comparison src/video/x11/SDL_x11wm.c @ 98:8a5aff5c1294

Fixed some problems with the fullscreen code. Wooo. :)
author Sam Lantinga <slouken@lokigames.com>
date Mon, 09 Jul 2001 22:36:16 +0000
parents 71774090f286
children 1b387dc653d0
comparison
equal deleted inserted replaced
97:c7bcdece4845 98:8a5aff5c1294
248 } 248 }
249 if ( ! SDL_Window ) { 249 if ( ! SDL_Window ) {
250 return(mode); /* Will be set later on mode switch */ 250 return(mode); /* Will be set later on mode switch */
251 } 251 }
252 if ( mode == SDL_GRAB_OFF ) { 252 if ( mode == SDL_GRAB_OFF ) {
253 printf("SDL grab OFF\n");
253 XUngrabPointer(SDL_Display, CurrentTime); 254 XUngrabPointer(SDL_Display, CurrentTime);
254 if ( this->screen->flags & SDL_FULLSCREEN ) { 255 XUngrabKeyboard(SDL_Display, CurrentTime);
255 /* Rebind the mouse to the fullscreen window */
256 for ( numtries = 0; numtries < 10; ++numtries ) {
257 result = XGrabPointer(SDL_Display, FSwindow,
258 True, 0,
259 GrabModeAsync, GrabModeAsync,
260 FSwindow, None, CurrentTime);
261 if ( result == GrabSuccess ) {
262 break;
263 }
264 SDL_Delay(100);
265 }
266 if ( result != GrabSuccess ) {
267 /* Uh, oh, what do we do here? */ ;
268 }
269 }
270 if ( !(this->screen->flags & SDL_FULLSCREEN) )
271 XUngrabKeyboard(SDL_Display, CurrentTime);
272 } else { 256 } else {
257 printf("SDL grab ON\n");
273 if ( this->screen->flags & SDL_FULLSCREEN ) { 258 if ( this->screen->flags & SDL_FULLSCREEN ) {
274 /* Unbind the mouse from the fullscreen window */ 259 /* Unbind the mouse from the fullscreen window */
275 XUngrabPointer(SDL_Display, CurrentTime); 260 XUngrabPointer(SDL_Display, CurrentTime);
276 } 261 }
277 /* Try to grab the mouse */ 262 /* Try to grab the mouse */
263 #if 0 /* We'll wait here until we actually grab, otherwise behavior undefined */
278 for ( numtries = 0; numtries < 10; ++numtries ) { 264 for ( numtries = 0; numtries < 10; ++numtries ) {
265 #else
266 while ( 1 ) {
267 #endif
279 result = XGrabPointer(SDL_Display, SDL_Window, True, 0, 268 result = XGrabPointer(SDL_Display, SDL_Window, True, 0,
280 GrabModeAsync, GrabModeAsync, 269 GrabModeAsync, GrabModeAsync,
281 SDL_Window, None, CurrentTime); 270 SDL_Window, None, CurrentTime);
282 if ( result == GrabSuccess ) { 271 if ( result == GrabSuccess ) {
283 break; 272 break;
285 SDL_Delay(100); 274 SDL_Delay(100);
286 } 275 }
287 if ( result != GrabSuccess ) { 276 if ( result != GrabSuccess ) {
288 /* Uh, oh, what do we do here? */ ; 277 /* Uh, oh, what do we do here? */ ;
289 } 278 }
290 /* Grab the keyboard if we're in fullscreen mode */ 279 /* Now grab the keyboard */
291 if ( !(this->screen->flags & SDL_FULLSCREEN) ) { 280 XGrabKeyboard(SDL_Display, WMwindow, True,
292 XGrabKeyboard(SDL_Display, WMwindow, True,
293 GrabModeAsync, GrabModeAsync, CurrentTime); 281 GrabModeAsync, GrabModeAsync, CurrentTime);
294 SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
295 }
296 282
297 /* Raise the window if we grab the mouse */ 283 /* Raise the window if we grab the mouse */
298 if ( !(this->screen->flags & SDL_FULLSCREEN) ) 284 if ( !(this->screen->flags & SDL_FULLSCREEN) )
299 XRaiseWindow(SDL_Display, WMwindow); 285 XRaiseWindow(SDL_Display, WMwindow);
286
287 /* Make sure we register input focus */
288 SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
300 } 289 }
301 XSync(SDL_Display, False); 290 XSync(SDL_Display, False);
302 291
303 return(mode); 292 return(mode);
304 } 293 }