Mercurial > sdl-ios-xcode
diff src/video/qtopia/SDL_sysvideo.cc @ 567:969fbd4dcd4e
From: David Hedbor
Subject: Qtopia patches (input grabbing and iconify)
Ok, here's a patch that adds support for SDL_WM_GrabInput (default
state is "ungrabbed") and SDL_WM_IconifyWindow. Also has some other
tweaks such as taking additional steps to clean up when exiting
(bypassing certain bugs in some versions of Qtopia and/or OPIE) and it
also maps Key_F33 to Key_Return (this is the Zaurus 'ok' key).
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 20 Jan 2003 01:08:20 +0000 |
parents | c96e2137f9eb |
children | b8d311d90021 |
line wrap: on
line diff
--- a/src/video/qtopia/SDL_sysvideo.cc Mon Jan 20 00:25:28 2003 +0000 +++ b/src/video/qtopia/SDL_sysvideo.cc Mon Jan 20 01:08:20 2003 +0000 @@ -53,12 +53,12 @@ //#define QTOPIA_DEBUG #define QT_HIDDEN_SIZE 32 /* starting hidden window size */ -/* Name of the environment variable used to invert the screen rotation or not: - Possible values: - !=0 : Screen is 270° rotated - 0: Screen is 90° rotated*/ + /* Name of the environment variable used to invert the screen rotation or not: + Possible values: + !=0 : Screen is 270° rotated + 0: Screen is 90° rotated*/ #define SDL_QT_ROTATION_ENV_NAME "SDL_QT_INVERT_ROTATION" - + /* Initialization/Query functions */ static int QT_VideoInit(_THIS, SDL_PixelFormat *vformat); static SDL_Rect **QT_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags); @@ -75,6 +75,8 @@ static int QT_ToggleFullScreen(_THIS, int fullscreen); + static int QT_IconifyWindow(_THIS); + static SDL_GrabMode QT_GrabInput(_THIS, SDL_GrabMode mode); /* FB driver bootstrap functions */ @@ -128,6 +130,8 @@ device->FreeHWSurface = QT_FreeHWSurface; device->SetIcon = NULL; device->SetCaption = QT_SetWMCaption; + device->IconifyWindow = QT_IconifyWindow; + device->GrabInput = QT_GrabInput; device->GetWMInfo = NULL; device->FreeWMCursor = QT_FreeWMCursor; device->CreateWMCursor = QT_CreateWMCursor; @@ -281,7 +285,7 @@ QSize desktop_size = qApp->desktop()->size(); - current->flags = SDL_FULLSCREEN; // We always run fullscreen. + current->flags = 0; //SDL_FULLSCREEN; // We always run fullscreen. if(width <= desktop_size.width() && height <= desktop_size.height()) { @@ -355,14 +359,14 @@ static void QT_NormalUpdate(_THIS, int numrects, SDL_Rect *rects) { - int i; - SDL_Win->lockScreen(); - for ( i=0; i<numrects; ++i ) { - QRect rect(rects[i].x, rects[i].y, - rects[i].w, rects[i].h); - SDL_Win->repaintRect(rect); + if(SDL_Win->lockScreen()) { + for(int i=0; i<numrects; ++i ) { + QRect rect(rects[i].x, rects[i].y, + rects[i].w, rects[i].h); + SDL_Win->repaintRect(rect); + } + SDL_Win->unlockScreen(); } - SDL_Win->unlockScreen(); } /* Is the system palette settable? */ int QT_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) @@ -380,6 +384,25 @@ // delete SDL_Win; // SDL_Win = 0; _this->screen->pixels = NULL; + QT_GrabInput(_this, SDL_GRAB_OFF); + } + + static int QT_IconifyWindow(_THIS) { + SDL_Win->hide(); + + return true; } + static SDL_GrabMode QT_GrabInput(_THIS, SDL_GrabMode mode) { + if(mode == SDL_GRAB_OFF) { + QPEApplication::grabKeyboard(); + qApp->processEvents(); + QPEApplication::ungrabKeyboard(); + } else { + QPEApplication::grabKeyboard(); + } + qApp->processEvents(); + return mode; + } + }; /* Extern C */