Mercurial > sdl-ios-xcode
comparison src/video/qtopia/SDL_sysvideo.cc @ 379:11c8a7684f74
Date: Fri, 24 May 2002 10:32:00 -0700
From: David Hedbor <david@hedbor.org>
Subject: more patches
Ok, another thing I discovered when porting prboom to the Zaurus -
mouse events weren't rotated when the screen was (i.e you got
incorrect events there).
This is now fixed. Also noticed that SDL_WarpMouse isn't handled
correctly, but I haven't looked at fixing that yes.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 28 May 2002 19:24:11 +0000 |
parents | db0cc6034336 |
children | c96e2137f9eb |
comparison
equal
deleted
inserted
replaced
378:6089cd59e3ca | 379:11c8a7684f74 |
---|---|
32 | 32 |
33 #include <stdio.h> | 33 #include <stdio.h> |
34 #include <unistd.h> | 34 #include <unistd.h> |
35 | 35 |
36 #include <qapplication.h> | 36 #include <qapplication.h> |
37 #include <qpe/qpeapplication.h> | |
37 | 38 |
38 #include "SDL.h" | 39 #include "SDL.h" |
39 #include "SDL_timer.h" | 40 #include "SDL_timer.h" |
40 | 41 |
41 #include "SDL_QWin.h" | 42 #include "SDL_QWin.h" |
42 #include "SDL_QPEApp.h" | |
43 | 43 |
44 extern "C" { | 44 extern "C" { |
45 | 45 |
46 #include "SDL_sysvideo.h" | 46 #include "SDL_sysvideo.h" |
47 #include "SDL_sysmouse_c.h" | 47 #include "SDL_sysmouse_c.h" |
211 } | 211 } |
212 | 212 |
213 int QT_VideoInit(_THIS, SDL_PixelFormat *vformat) | 213 int QT_VideoInit(_THIS, SDL_PixelFormat *vformat) |
214 { | 214 { |
215 /* Initialize the QPE Application */ | 215 /* Initialize the QPE Application */ |
216 if(SDL_InitQPEApp() == -1) { | |
217 return -1; | |
218 } | |
219 | |
220 /* Determine the screen depth */ | 216 /* Determine the screen depth */ |
221 vformat->BitsPerPixel = QPixmap::defaultDepth(); | 217 vformat->BitsPerPixel = QPixmap::defaultDepth(); |
222 | 218 |
223 // For now we hardcode the current depth because anything else | 219 // For now we hardcode the current depth because anything else |
224 // might as well be emulated by SDL rather than by Qtopia. | 220 // might as well be emulated by SDL rather than by Qtopia. |
229 QT_AddMode(_this, ((vformat->BitsPerPixel+7)/8)-1, | 225 QT_AddMode(_this, ((vformat->BitsPerPixel+7)/8)-1, |
230 desktop_size.height(), desktop_size.width()); | 226 desktop_size.height(), desktop_size.width()); |
231 | 227 |
232 /* Create the window / widget */ | 228 /* Create the window / widget */ |
233 SDL_Win = new SDL_QWin(QSize(QT_HIDDEN_SIZE, QT_HIDDEN_SIZE)); | 229 SDL_Win = new SDL_QWin(QSize(QT_HIDDEN_SIZE, QT_HIDDEN_SIZE)); |
234 qApp->setMainWidget(SDL_Win); | 230 ((QPEApplication*)qApp)->showMainWidget(SDL_Win); |
235 /* Fill in some window manager capabilities */ | 231 /* Fill in some window manager capabilities */ |
236 _this->info.wm_available = 0; | 232 _this->info.wm_available = 0; |
237 | 233 |
238 /* We're done! */ | 234 /* We're done! */ |
239 return(0); | 235 return(0); |
272 | 268 |
273 /* FIXME: check return values and cleanup here */ | 269 /* FIXME: check return values and cleanup here */ |
274 SDL_Surface *QT_SetVideoMode(_THIS, SDL_Surface *current, | 270 SDL_Surface *QT_SetVideoMode(_THIS, SDL_Surface *current, |
275 int width, int height, int bpp, Uint32 flags) | 271 int width, int height, int bpp, Uint32 flags) |
276 { | 272 { |
277 Qt::WFlags wflags = Qt::WType_TopLevel|Qt::WStyle_Customize; | 273 |
278 QImage *qimage; | 274 QImage *qimage; |
279 QSize desktop_size = qApp->desktop()->size(); | 275 QSize desktop_size = qApp->desktop()->size(); |
280 | 276 |
281 | 277 |
282 current->flags = SDL_FULLSCREEN; // We always run fullscreen. | 278 current->flags = SDL_FULLSCREEN; // We always run fullscreen. |
365 return -1; | 361 return -1; |
366 } | 362 } |
367 | 363 |
368 void QT_VideoQuit(_THIS) | 364 void QT_VideoQuit(_THIS) |
369 { | 365 { |
370 qApp->setMainWidget(0); | 366 // This is dumb, but if I free this, the app doesn't exit correctly. |
371 delete SDL_Win; | 367 // Of course, this will leak memory if init video is done more than once. |
372 SDL_QuitQPEApp(); | 368 // Sucks but such is life. |
369 | |
370 // -- David Hedbor | |
371 // delete SDL_Win; | |
372 // SDL_Win = 0; | |
373 _this->screen->pixels = NULL; | 373 _this->screen->pixels = NULL; |
374 } | 374 } |
375 | 375 |
376 }; /* Extern C */ | 376 }; /* Extern C */ |