# HG changeset patch # User Ryan C. Gordon # Date 1040355448 0 # Node ID cb40b26523a5e385cab89990030e197ca5de0c7c # Parent 4bcf7dd06c47abfb28c1ab09dd374ed2bd2ba814 Added some code to toggle fullscreen and input grab for testing... --ryan. diff -r 4bcf7dd06c47 -r cb40b26523a5 test/threadwin.c --- a/test/threadwin.c Sun Dec 15 09:09:31 2002 +0000 +++ b/test/threadwin.c Fri Dec 20 03:37:28 2002 +0000 @@ -172,14 +172,37 @@ /* We want to toggle visibility on buttonpress */ case SDL_KEYDOWN: case SDL_KEYUP: + printf("Key '%c' has been %s\n", + events[i].key.keysym.unicode, + (events[i].key.state == SDL_PRESSED) ? + "pressed" : "released"); + /* Allow hitting to quit the app */ if ( events[i].key.keysym.sym == SDLK_ESCAPE ) { done = 1; } - printf("Key '%c' has been %s\n", - events[i].key.keysym.unicode, - (events[i].key.state == SDL_PRESSED) ? - "pressed" : "released"); + + /* skip events now that aren't KEYUPs... */ + if (events[i].key.state == SDL_PRESSED) + break; + + if ( events[i].key.keysym.sym == SDLK_f ) { + int rc = 0; + printf("attempting to toggle fullscreen...\n"); + rc = SDL_WM_ToggleFullScreen(SDL_GetVideoSurface()); + printf("SDL_WM_ToggleFullScreen returned %d.\n", rc); + } + + if ( events[i].key.keysym.sym == SDLK_g ) { + SDL_GrabMode m; + m = SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON ? + SDL_GRAB_OFF : SDL_GRAB_ON; + printf("attempting to toggle input grab to %s...\n", + m == SDL_GRAB_ON ? "ON" : "OFF"); + SDL_WM_GrabInput(m); + printf("attempt finished.\n"); + } + break; } }