Mercurial > sdl-ios-xcode
comparison 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 |
comparison
equal
deleted
inserted
replaced
566:d6e7d7006062 | 567:969fbd4dcd4e |
---|---|
51 #include "SDL_lowvideo.h" | 51 #include "SDL_lowvideo.h" |
52 | 52 |
53 //#define QTOPIA_DEBUG | 53 //#define QTOPIA_DEBUG |
54 #define QT_HIDDEN_SIZE 32 /* starting hidden window size */ | 54 #define QT_HIDDEN_SIZE 32 /* starting hidden window size */ |
55 | 55 |
56 /* Name of the environment variable used to invert the screen rotation or not: | 56 /* Name of the environment variable used to invert the screen rotation or not: |
57 Possible values: | 57 Possible values: |
58 !=0 : Screen is 270° rotated | 58 !=0 : Screen is 270° rotated |
59 0: Screen is 90° rotated*/ | 59 0: Screen is 90° rotated*/ |
60 #define SDL_QT_ROTATION_ENV_NAME "SDL_QT_INVERT_ROTATION" | 60 #define SDL_QT_ROTATION_ENV_NAME "SDL_QT_INVERT_ROTATION" |
61 | 61 |
62 /* Initialization/Query functions */ | 62 /* Initialization/Query functions */ |
63 static int QT_VideoInit(_THIS, SDL_PixelFormat *vformat); | 63 static int QT_VideoInit(_THIS, SDL_PixelFormat *vformat); |
64 static SDL_Rect **QT_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags); | 64 static SDL_Rect **QT_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags); |
65 static SDL_Surface *QT_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); | 65 static SDL_Surface *QT_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); |
66 static void QT_UpdateMouse(_THIS); | 66 static void QT_UpdateMouse(_THIS); |
73 static void QT_UnlockHWSurface(_THIS, SDL_Surface *surface); | 73 static void QT_UnlockHWSurface(_THIS, SDL_Surface *surface); |
74 static void QT_FreeHWSurface(_THIS, SDL_Surface *surface); | 74 static void QT_FreeHWSurface(_THIS, SDL_Surface *surface); |
75 | 75 |
76 static int QT_ToggleFullScreen(_THIS, int fullscreen); | 76 static int QT_ToggleFullScreen(_THIS, int fullscreen); |
77 | 77 |
78 static int QT_IconifyWindow(_THIS); | |
79 static SDL_GrabMode QT_GrabInput(_THIS, SDL_GrabMode mode); | |
78 | 80 |
79 /* FB driver bootstrap functions */ | 81 /* FB driver bootstrap functions */ |
80 | 82 |
81 static int QT_Available(void) | 83 static int QT_Available(void) |
82 { | 84 { |
126 device->UnlockHWSurface = QT_UnlockHWSurface; | 128 device->UnlockHWSurface = QT_UnlockHWSurface; |
127 device->FlipHWSurface = NULL; | 129 device->FlipHWSurface = NULL; |
128 device->FreeHWSurface = QT_FreeHWSurface; | 130 device->FreeHWSurface = QT_FreeHWSurface; |
129 device->SetIcon = NULL; | 131 device->SetIcon = NULL; |
130 device->SetCaption = QT_SetWMCaption; | 132 device->SetCaption = QT_SetWMCaption; |
133 device->IconifyWindow = QT_IconifyWindow; | |
134 device->GrabInput = QT_GrabInput; | |
131 device->GetWMInfo = NULL; | 135 device->GetWMInfo = NULL; |
132 device->FreeWMCursor = QT_FreeWMCursor; | 136 device->FreeWMCursor = QT_FreeWMCursor; |
133 device->CreateWMCursor = QT_CreateWMCursor; | 137 device->CreateWMCursor = QT_CreateWMCursor; |
134 device->ShowWMCursor = QT_ShowWMCursor; | 138 device->ShowWMCursor = QT_ShowWMCursor; |
135 device->WarpWMCursor = QT_WarpWMCursor; | 139 device->WarpWMCursor = QT_WarpWMCursor; |
279 | 283 |
280 QImage *qimage; | 284 QImage *qimage; |
281 QSize desktop_size = qApp->desktop()->size(); | 285 QSize desktop_size = qApp->desktop()->size(); |
282 | 286 |
283 | 287 |
284 current->flags = SDL_FULLSCREEN; // We always run fullscreen. | 288 current->flags = 0; //SDL_FULLSCREEN; // We always run fullscreen. |
285 | 289 |
286 if(width <= desktop_size.width() | 290 if(width <= desktop_size.width() |
287 && height <= desktop_size.height()) { | 291 && height <= desktop_size.height()) { |
288 current->w = desktop_size.width(); | 292 current->w = desktop_size.width(); |
289 current->h = desktop_size.height(); | 293 current->h = desktop_size.height(); |
353 return; | 357 return; |
354 } | 358 } |
355 | 359 |
356 static void QT_NormalUpdate(_THIS, int numrects, SDL_Rect *rects) | 360 static void QT_NormalUpdate(_THIS, int numrects, SDL_Rect *rects) |
357 { | 361 { |
358 int i; | 362 if(SDL_Win->lockScreen()) { |
359 SDL_Win->lockScreen(); | 363 for(int i=0; i<numrects; ++i ) { |
360 for ( i=0; i<numrects; ++i ) { | 364 QRect rect(rects[i].x, rects[i].y, |
361 QRect rect(rects[i].x, rects[i].y, | 365 rects[i].w, rects[i].h); |
362 rects[i].w, rects[i].h); | 366 SDL_Win->repaintRect(rect); |
363 SDL_Win->repaintRect(rect); | 367 } |
364 } | 368 SDL_Win->unlockScreen(); |
365 SDL_Win->unlockScreen(); | 369 } |
366 } | 370 } |
367 /* Is the system palette settable? */ | 371 /* Is the system palette settable? */ |
368 int QT_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) | 372 int QT_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) |
369 { | 373 { |
370 return -1; | 374 return -1; |
378 | 382 |
379 // -- David Hedbor | 383 // -- David Hedbor |
380 // delete SDL_Win; | 384 // delete SDL_Win; |
381 // SDL_Win = 0; | 385 // SDL_Win = 0; |
382 _this->screen->pixels = NULL; | 386 _this->screen->pixels = NULL; |
383 } | 387 QT_GrabInput(_this, SDL_GRAB_OFF); |
384 | 388 } |
389 | |
390 static int QT_IconifyWindow(_THIS) { | |
391 SDL_Win->hide(); | |
392 | |
393 return true; | |
394 } | |
395 | |
396 static SDL_GrabMode QT_GrabInput(_THIS, SDL_GrabMode mode) { | |
397 if(mode == SDL_GRAB_OFF) { | |
398 QPEApplication::grabKeyboard(); | |
399 qApp->processEvents(); | |
400 QPEApplication::ungrabKeyboard(); | |
401 } else { | |
402 QPEApplication::grabKeyboard(); | |
403 } | |
404 qApp->processEvents(); | |
405 return mode; | |
406 } | |
407 | |
385 }; /* Extern C */ | 408 }; /* Extern C */ |