2 Copyright 1999, Be Incorporated. All Rights Reserved.
3 This file may be used under the terms of the Be Sample Code License.
7 Rudolf Cornelissen 4/2003-9/2005
10 #define MODULE_BIT 0x20000000
14 status_t
SET_CURSOR_SHAPE(uint16 width
, uint16 height
, uint16 hot_x
, uint16 hot_y
, uint8
*andMask
, uint8
*xorMask
)
16 LOG(4,("SET_CURSOR_SHAPE: width %d, height %d, hot_x %d, hot_y %d\n",
17 width
, height
, hot_x
, hot_y
));
19 if ((width
!= 16) || (height
!= 16))
23 else if ((hot_x
>= width
) || (hot_y
>= height
))
29 head1_cursor_define(andMask
,xorMask
);
30 if ((si
->dm
.flags
& DUALHEAD_BITS
) != DUALHEAD_OFF
)
31 head2_cursor_define(andMask
,xorMask
);
33 /* Update cursor variables appropriately. */
34 si
->cursor
.width
= width
;
35 si
->cursor
.height
= height
;
36 si
->cursor
.hot_x
= hot_x
;
37 si
->cursor
.hot_y
= hot_y
;
43 /* Move the cursor to the specified position on the desktop, taking account of virtual/dual issues */
44 void MOVE_CURSOR(uint16 x
, uint16 y
)
46 uint16 hds
= si
->dm
.h_display_start
; /* the current horizontal starting pixel */
47 uint16 vds
= si
->dm
.v_display_start
; /* the current vertical starting line */
50 /* clamp cursor to display */
51 if (x
>= si
->dm
.virtual_width
) x
= si
->dm
.virtual_width
- 1;
52 if (y
>= si
->dm
.virtual_height
) y
= si
->dm
.virtual_height
- 1;
54 /* store, for our info */
58 /* set up minimum amount to scroll */
59 if (si
->dm
.flags
& DUALHEAD_BITS
)
82 case B_RGB15_LITTLE
:case B_RGB16_LITTLE
:
94 /* adjust h/v_display_start to move cursor onto screen */
95 switch (si
->dm
.flags
& DUALHEAD_BITS
)
99 if (x
>= ((si
->dm
.timing
.h_display
* 2) + hds
))
101 hds
= ((x
- (si
->dm
.timing
.h_display
* 2)) + 1 + h_adjust
) & ~h_adjust
;
102 /* make sure we stay within the display! */
103 if ((hds
+ (si
->dm
.timing
.h_display
* 2)) > si
->dm
.virtual_width
)
104 hds
-= (h_adjust
+ 1);
110 if (x
>= (si
->dm
.timing
.h_display
+ hds
))
112 hds
= ((x
- si
->dm
.timing
.h_display
) + 1 + h_adjust
) & ~h_adjust
;
113 /* make sure we stay within the display! */
114 if ((hds
+ si
->dm
.timing
.h_display
) > si
->dm
.virtual_width
)
115 hds
-= (h_adjust
+ 1);
122 if (y
>= (si
->dm
.timing
.v_display
+ vds
))
123 vds
= y
- si
->dm
.timing
.v_display
+ 1;
127 /* reposition the desktop _and_ the overlay on the display if required */
128 if ((hds
!=si
->dm
.h_display_start
) || (vds
!=si
->dm
.v_display_start
))
130 MOVE_DISPLAY(hds
,vds
);
131 eng_bes_move_overlay();
134 /* put cursor in correct physical position, so stay onscreen (rel. to CRTC) */
135 if (x
> (hds
+ si
->cursor
.hot_x
)) x
-= (hds
+ si
->cursor
.hot_x
);
137 if (y
> (vds
+ si
->cursor
.hot_y
)) y
-= (vds
+ si
->cursor
.hot_y
);
140 /* position the cursor on the display */
141 switch (si
->dm
.flags
& DUALHEAD_BITS
)
144 head1_cursor_position(x
,y
);
145 head2_cursor_position(x
,y
);
148 case DUALHEAD_SWITCH
:
149 if (x
< si
->dm
.timing
.h_display
)
151 if (si
->cursor
.dh_right
)
153 LOG(4,("MOVE_CURSOR: now on left side\n"));
156 si
->cursor
.dh_right
= false;
158 head1_cursor_position(x
, y
);
162 if (!si
->cursor
.dh_right
)
164 LOG(4,("MOVE_CURSOR: now on right side\n"));
167 si
->cursor
.dh_right
= true;
169 head2_cursor_position((x
- si
->dm
.timing
.h_display
), y
);
172 default: /* singlehead mode */
173 head1_cursor_position(x
,y
);
178 void SHOW_CURSOR(bool is_visible
)
180 /* record for our info */
181 si
->cursor
.is_visible
= is_visible
;
183 switch (si
->dm
.flags
& DUALHEAD_BITS
)
198 case DUALHEAD_SWITCH
:
201 if (!si
->cursor
.dh_right
)
216 default: /* singlehead mode */