2 Copyright 1999, Be Incorporated. All Rights Reserved.
3 This file may be used under the terms of the Be Sample Code License.
6 Rudolf Cornelissen 4/2003-11/2004
9 #define MODULE_BIT 0x20000000
13 status_t
SET_CURSOR_SHAPE(uint16 width
, uint16 height
, uint16 hot_x
, uint16 hot_y
, uint8
*andMask
, uint8
*xorMask
)
15 LOG(4,("SET_CURSOR_SHAPE: width %d, height %d, hot_x %d, hot_y %d\n",
16 width
, height
, hot_x
, hot_y
));
18 if ((width
!= 16) || (height
!= 16))
22 else if ((hot_x
>= width
) || (hot_y
>= height
))
28 nm_crtc_cursor_define(andMask
,xorMask
);
30 /* Update cursor variables appropriately. */
31 si
->cursor
.width
= width
;
32 si
->cursor
.height
= height
;
33 si
->cursor
.hot_x
= hot_x
;
34 si
->cursor
.hot_y
= hot_y
;
40 /* Move the cursor to the specified position on the desktop, taking account of virtual/dual issues */
41 void MOVE_CURSOR(uint16 x
, uint16 y
)
43 uint16 hds
= si
->dm
.h_display_start
; /* the current horizontal starting pixel */
44 uint16 vds
= si
->dm
.v_display_start
; /* the current vertical starting line */
46 uint16 h_display
= si
->dm
.timing
.h_display
; /* local copy needed for flatpanel */
47 uint16 v_display
= si
->dm
.timing
.v_display
; /* local copy needed for flatpanel */
49 /* clamp cursor to display */
50 if (x
>= si
->dm
.virtual_width
) x
= si
->dm
.virtual_width
- 1;
51 if (y
>= si
->dm
.virtual_height
) y
= si
->dm
.virtual_height
- 1;
53 /* store, for our info */
57 /* setting up minimum amount to scroll not needed:
58 * Neomagic cards can always do pixelprecise panning */
61 /* if internal panel is active correct visible screensize! */
62 if (nm_general_output_read() & 0x02)
64 if (h_display
> si
->ps
.panel_width
) h_display
= si
->ps
.panel_width
;
65 if (v_display
> si
->ps
.panel_height
) v_display
= si
->ps
.panel_height
;
68 /* adjust h/v_display_start to move cursor onto screen */
69 if (x
>= (h_display
+ hds
))
71 hds
= ((x
- h_display
) + 1 + h_adjust
) & ~h_adjust
;
72 /* make sure we stay within the display! */
73 if ((hds
+ h_display
) > si
->dm
.virtual_width
)
74 hds
-= (h_adjust
+ 1);
79 if (y
>= (v_display
+ vds
))
80 vds
= y
- v_display
+ 1;
84 /* reposition the desktop _and_ the overlay on the display if required */
85 if ((hds
!=si
->dm
.h_display_start
) || (vds
!=si
->dm
.v_display_start
))
87 MOVE_DISPLAY(hds
,vds
);
88 nm_bes_move_overlay();
91 /* put cursor in correct physical position */
92 if (x
> (hds
+ si
->cursor
.hot_x
)) x
-= hds
+ si
->cursor
.hot_x
;
94 if (y
> (vds
+ si
->cursor
.hot_y
)) y
-= vds
+ si
->cursor
.hot_y
;
97 /* position the cursor on the display */
98 nm_crtc_cursor_position(x
,y
);
101 void SHOW_CURSOR(bool is_visible
)
103 /* record for our info */
104 si
->cursor
.is_visible
= is_visible
;
107 nm_crtc_cursor_show();
109 nm_crtc_cursor_hide();