comparison src/video/qtopia/SDL_QPEApp.cc @ 371:db0cc6034336

Added David Hedbor's Qtopia patches
author Sam Lantinga <slouken@libsdl.org>
date Sun, 19 May 2002 20:06:01 +0000
parents
children b8d311d90021
comparison
equal deleted inserted replaced
370:ba72f259bc88 371:db0cc6034336
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21 */
22
23 #include <qpe/qpeapplication.h>
24 #include <qapplication.h>
25 #include <qevent.h>
26
27 #include "SDL_thread.h"
28 #include "SDL_timer.h"
29 #include "SDL_error.h"
30
31 /* Flag to tell whether or not the Be application is active or not */
32 int SDL_QPEAppActive = 0;
33 static QPEApplication *app;
34
35 int SDL_InitQPEApp() {
36 if(SDL_QPEAppActive <= 0) {
37 if(!qApp) {
38 int argc = 1;
39 char *argv[] = { { "SDLApp" } };
40 app = new QPEApplication(argc, argv);
41 QWidget dummy;
42 app->showMainWidget(&dummy);
43 } else {
44 app = (QPEApplication*)qApp;
45 }
46 SDL_QPEAppActive++;
47 }
48 return 0;
49 }
50
51 /* Quit the QPE Application, if there's nothing left to do */
52 void SDL_QuitQPEApp(void)
53 {
54 /* Decrement the application reference count */
55 SDL_QPEAppActive--;
56 /* If the reference count reached zero, clean up the app */
57 if ( SDL_QPEAppActive == 0 && app) {
58 delete app;
59 app = 0;
60 qApp = 0;
61 }
62 }