comparison src/video/gem/SDL_gemevents.c @ 4060:0b4ebec67cad SDL-1.2

Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
author Patrice Mandin <patmandin@gmail.com>
date Fri, 13 Jul 2007 18:44:43 +0000
parents 57b017e6aebf
children a1b03ba2fcd0
comparison
equal deleted inserted replaced
4059:57b017e6aebf 4060:0b4ebec67cad
87 87
88 event_mask = MU_MESAG|MU_TIMER|MU_KEYBD; 88 event_mask = MU_MESAG|MU_TIMER|MU_KEYBD;
89 if (!GEM_fullscreen && (GEM_handle>=0)) { 89 if (!GEM_fullscreen && (GEM_handle>=0)) {
90 wind_get (GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2); 90 wind_get (GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2);
91 event_mask |= MU_M1; 91 event_mask |= MU_M1;
92 if ( (SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) { 92 mouse_event = ( (SDL_GetAppState() & SDL_APPMOUSEFOCUS)
93 mouse_event = MO_LEAVE; 93 == SDL_APPMOUSEFOCUS) ? MO_LEAVE : MO_ENTER;
94 } else {
95 mouse_event = MO_ENTER;
96 }
97 } 94 }
98 95
99 resultat = evnt_multi( 96 resultat = evnt_multi(
100 event_mask, 97 event_mask,
101 0,0,0, 98 0,0,0,
121 } 118 }
122 119
123 /* Mouse entering/leaving window */ 120 /* Mouse entering/leaving window */
124 if (resultat & MU_M1) { 121 if (resultat & MU_M1) {
125 if (this->input_grab == SDL_GRAB_OFF) { 122 if (this->input_grab == SDL_GRAB_OFF) {
126 if (SDL_GetAppState() & SDL_APPMOUSEFOCUS) { 123 /* Switch mouse focus state */
127 SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS); 124 SDL_PrivateAppActive((mouse_event == MO_ENTER),
128 if (SDL_GetAppState() & SDL_APPINPUTFOCUS) { 125 SDL_APPMOUSEFOCUS);
129 graf_mouse(ARROW, NULL); 126 }
130 } 127 GEM_CheckMouseMode(this);
131 } else {
132 SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
133 if (SDL_GetAppState() & SDL_APPINPUTFOCUS) {
134 if (GEM_cursor == (void *) -1) {
135 graf_mouse(M_OFF, NULL);
136 } else if (GEM_cursor) {
137 graf_mouse(USER_DEF, GEM_cursor->mform_p);
138 }
139 }
140 }
141 }
142 } 128 }
143 129
144 /* Timer event ? */ 130 /* Timer event ? */
145 if ((resultat & MU_TIMER) || quit) 131 if ((resultat & MU_TIMER) || quit)
146 break; 132 break;
180 } 166 }
181 } 167 }
182 168
183 static int do_messages(_THIS, short *message) 169 static int do_messages(_THIS, short *message)
184 { 170 {
185 int quit, posted; 171 int quit, posted, check_mouse_mode;
186 short x2,y2,w2,h2; 172 short x2,y2,w2,h2;
187 173
188 quit=0; 174 quit = check_mouse_mode = 0;
189 switch (message[0]) { 175 switch (message[0]) {
190 case WM_CLOSED: 176 case WM_CLOSED:
191 case AP_TERM: 177 case AP_TERM:
192 posted = SDL_PrivateQuit(); 178 posted = SDL_PrivateQuit();
193 quit=1; 179 quit=1;
201 case WM_ONTOP: 187 case WM_ONTOP:
202 SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS); 188 SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
203 if (VDI_setpalette) { 189 if (VDI_setpalette) {
204 VDI_setpalette(this, VDI_curpalette); 190 VDI_setpalette(this, VDI_curpalette);
205 } 191 }
192 check_mouse_mode = 1;
206 break; 193 break;
207 case WM_REDRAW: 194 case WM_REDRAW:
208 if (!GEM_lock_redraw) { 195 if (!GEM_lock_redraw) {
209 GEM_wind_redraw(this, message[3],&message[4]); 196 GEM_wind_redraw(this, message[3],&message[4]);
210 } 197 }
220 /* Update window title */ 207 /* Update window title */
221 if (GEM_refresh_name && GEM_icon_name) { 208 if (GEM_refresh_name && GEM_icon_name) {
222 wind_set(GEM_handle,WF_NAME,(short)(((unsigned long)GEM_icon_name)>>16),(short)(((unsigned long)GEM_icon_name) & 0xffff),0,0); 209 wind_set(GEM_handle,WF_NAME,(short)(((unsigned long)GEM_icon_name)>>16),(short)(((unsigned long)GEM_icon_name) & 0xffff),0,0);
223 GEM_refresh_name = SDL_FALSE; 210 GEM_refresh_name = SDL_FALSE;
224 } 211 }
212 check_mouse_mode = 1;
225 break; 213 break;
226 case WM_UNICONIFY: 214 case WM_UNICONIFY:
227 wind_set(message[3],WF_UNICONIFY,message[4],message[5],message[6],message[7]); 215 wind_set(message[3],WF_UNICONIFY,message[4],message[5],message[6],message[7]);
228 /* If we're not active, make ourselves active */ 216 /* If we're not active, make ourselves active */
229 if ( !(SDL_GetAppState() & SDL_APPACTIVE) ) { 217 if ( !(SDL_GetAppState() & SDL_APPACTIVE) ) {
232 } 220 }
233 if (GEM_refresh_name && GEM_title_name) { 221 if (GEM_refresh_name && GEM_title_name) {
234 wind_set(GEM_handle,WF_NAME,(short)(((unsigned long)GEM_title_name)>>16),(short)(((unsigned long)GEM_title_name) & 0xffff),0,0); 222 wind_set(GEM_handle,WF_NAME,(short)(((unsigned long)GEM_title_name)>>16),(short)(((unsigned long)GEM_title_name) & 0xffff),0,0);
235 GEM_refresh_name = SDL_FALSE; 223 GEM_refresh_name = SDL_FALSE;
236 } 224 }
225 check_mouse_mode = 1;
237 break; 226 break;
238 case WM_SIZED: 227 case WM_SIZED:
239 wind_set (message[3], WF_CURRXYWH, message[4], message[5], message[6], message[7]); 228 wind_set (message[3], WF_CURRXYWH, message[4], message[5], message[6], message[7]);
240 wind_get (message[3], WF_WORKXYWH, &x2, &y2, &w2, &h2); 229 wind_get (message[3], WF_WORKXYWH, &x2, &y2, &w2, &h2);
241 GEM_win_fulled = SDL_FALSE; /* Cancel maximized flag */ 230 GEM_win_fulled = SDL_FALSE; /* Cancel maximized flag */
268 case WM_UNTOPPED: 257 case WM_UNTOPPED:
269 SDL_PrivateAppActive(0, SDL_APPINPUTFOCUS); 258 SDL_PrivateAppActive(0, SDL_APPINPUTFOCUS);
270 if (VDI_setpalette) { 259 if (VDI_setpalette) {
271 VDI_setpalette(this, VDI_oldpalette); 260 VDI_setpalette(this, VDI_oldpalette);
272 } 261 }
273 break; 262 check_mouse_mode = 1;
263 break;
264 }
265
266 if (check_mouse_mode) {
267 GEM_CheckMouseMode(this);
274 } 268 }
275 269
276 return quit; 270 return quit;
277 } 271 }
278 272