Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11events.c @ 4558:4d95152d9e39
Applied the same logic as the fix for bug 894.
Anytime we enter the window, we gain the mouse focus. If we leave the window because of a normal LeaveNotify, then we lose mouse focus.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 20 Jul 2010 00:05:32 -0700 |
parents | cc06f306c053 |
children | 95352c671a6e |
comparison
equal
deleted
inserted
replaced
4556:cc06f306c053 | 4558:4d95152d9e39 |
---|---|
23 | 23 |
24 #include <sys/types.h> | 24 #include <sys/types.h> |
25 #include <sys/time.h> | 25 #include <sys/time.h> |
26 #include <signal.h> | 26 #include <signal.h> |
27 #include <unistd.h> | 27 #include <unistd.h> |
28 #include <limits.h> /* For INT_MAX */ | 28 #include <limits.h> /* For INT_MAX */ |
29 | 29 |
30 #include "SDL_x11video.h" | 30 #include "SDL_x11video.h" |
31 #include "../../events/SDL_events_c.h" | 31 #include "../../events/SDL_events_c.h" |
32 #include "../../events/SDL_mouse_c.h" | 32 #include "../../events/SDL_mouse_c.h" |
33 | 33 |
90 | 90 |
91 /* Gaining mouse coverage? */ | 91 /* Gaining mouse coverage? */ |
92 case EnterNotify:{ | 92 case EnterNotify:{ |
93 #ifdef DEBUG_XEVENTS | 93 #ifdef DEBUG_XEVENTS |
94 printf("EnterNotify! (%d,%d,%d)\n", | 94 printf("EnterNotify! (%d,%d,%d)\n", |
95 xevent.xcrossing.x, | 95 xevent.xcrossing.x, |
96 xevent.xcrossing.y, | 96 xevent.xcrossing.y, |
97 xevent.xcrossing.mode); | 97 xevent.xcrossing.mode); |
98 if (xevent.xcrossing.mode == NotifyGrab) | 98 if (xevent.xcrossing.mode == NotifyGrab) |
99 printf("Mode: NotifyGrab\n"); | 99 printf("Mode: NotifyGrab\n"); |
100 if (xevent.xcrossing.mode == NotifyUngrab) | 100 if (xevent.xcrossing.mode == NotifyUngrab) |
101 printf("Mode: NotifyUngrab\n"); | 101 printf("Mode: NotifyUngrab\n"); |
106 | 106 |
107 /* Losing mouse coverage? */ | 107 /* Losing mouse coverage? */ |
108 case LeaveNotify:{ | 108 case LeaveNotify:{ |
109 #ifdef DEBUG_XEVENTS | 109 #ifdef DEBUG_XEVENTS |
110 printf("LeaveNotify! (%d,%d,%d)\n", | 110 printf("LeaveNotify! (%d,%d,%d)\n", |
111 xevent.xcrossing.x, | 111 xevent.xcrossing.x, |
112 xevent.xcrossing.y, | 112 xevent.xcrossing.y, |
113 xevent.xcrossing.mode); | 113 xevent.xcrossing.mode); |
114 if (xevent.xcrossing.mode == NotifyGrab) | 114 if (xevent.xcrossing.mode == NotifyGrab) |
115 printf("Mode: NotifyGrab\n"); | 115 printf("Mode: NotifyGrab\n"); |
116 if (xevent.xcrossing.mode == NotifyUngrab) | 116 if (xevent.xcrossing.mode == NotifyUngrab) |
117 printf("Mode: NotifyUngrab\n"); | 117 printf("Mode: NotifyUngrab\n"); |
118 #endif | 118 #endif |
119 if (xevent.xcrossing.detail != NotifyInferior) { | 119 if (xevent.xcrossing.mode != NotifyGrab && |
120 xevent.xcrossing.mode != NotifyUngrab && | |
121 xevent.xcrossing.detail != NotifyInferior) { | |
120 SDL_SetMouseFocus(NULL); | 122 SDL_SetMouseFocus(NULL); |
121 } | 123 } |
122 } | 124 } |
123 break; | 125 break; |
124 | 126 |