21 #include "../SDL_internal.h"
30 #include "../video/SDL_sysvideo.h"
97 if (hint && (*hint ==
'0' ||
SDL_strcasecmp(hint,
"false") == 0)) {
165 printf(
"Resetting mouse\n");
181 if (mouse->
focus == window) {
191 if (mouse->
focus && !window) {
237 #ifdef SUPPORT_DRAG_OUTSIDE_WINDOW
238 if (!inWindow && !buttonstate) {
242 if (window == mouse->
focus) {
244 printf(
"Mouse left window, synthesizing move & focus lost event\n");
252 if (window != mouse->
focus) {
254 printf(
"Mouse entered window, synthesizing focus gain & move event\n");
265 if (window && !relative) {
279 *accum += scale *
value;
280 if (*accum >= 0.0
f) {
303 int center_x = 0, center_y = 0;
307 if (x == center_x && y == center_y) {
325 x = (mouse->
last_x + xrel);
326 y = (mouse->
last_y + yrel);
333 if (!xrel && !yrel) {
335 printf(
"Mouse event didn't change state - dropped!\n");
365 int x_max = 0, y_max = 0;
372 if (mouse->
x > x_max) {
379 if (mouse->
y > y_max) {
401 event.motion.windowID = mouse->
focus ? mouse->
focus->
id : 0;
402 event.motion.which = mouseID;
404 event.motion.x = mouse->
x;
405 event.motion.y = mouse->
y;
406 event.motion.xrel = xrel;
407 event.motion.yrel = yrel;
424 int i,
count = button + 1;
506 event.button.windowID = mouse->
focus ? mouse->
focus->
id : 0;
507 event.button.which = mouseID;
508 event.button.state =
state;
509 event.button.button =
button;
511 event.button.x = mouse->
x;
512 event.button.y = mouse->
y;
542 int integral_x, integral_y;
577 event.wheel.windowID = mouse->
focus ? mouse->
focus->
id : 0;
578 event.wheel.which = mouseID;
580 event.wheel.preciseX =
x;
581 event.wheel.preciseY =
y;
583 event.wheel.x = integral_x;
584 event.wheel.y = integral_y;
585 event.wheel.direction = (
Uint32)direction;
686 if (window ==
NULL) {
687 window = mouse->
focus;
690 if (window ==
NULL) {
734 if (enabled && focusWindow) {
751 return SDL_SetError(
"No relative mode implementation available");
800 if (isCaptured == enabled) {
823 int w,
int h,
int hot_x,
int hot_y)
829 Uint8 datab = 0, maskb = 0;
830 const Uint32 black = 0xFF000000;
831 const Uint32 white = 0xFFFFFFFF;
832 const Uint32 transparent = 0x00000000;
846 for (y = 0; y <
h; ++
y) {
848 for (x = 0; x <
w; ++
x) {
854 *pixel++ = (datab & 0x80) ? black : white;
856 *pixel++ = (datab & 0x80) ? black : transparent;
888 if ((hot_x < 0) || (hot_y < 0) ||
889 (hot_x >= surface->
w) || (hot_y >= surface->
h)) {
890 SDL_SetError(
"Cursor hot spot doesn't lie within cursor");
920 SDL_SetError(
"CreateSystemCursor is not currently supported");
947 for (found = mouse->
cursors; found; found = found->
next) {
948 if (found == cursor) {
953 SDL_SetError(
"Cursor not associated with the current mouse");
1017 prev = curr, curr = curr->
next) {
1018 if (curr == cursor) {