comparison src/main/linux/SDL_Qtopia_main.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 d15bef937f00
children 0648505b1f8b
comparison
equal deleted inserted replaced
566:d6e7d7006062 567:969fbd4dcd4e
1 1
2 /* Include the SDL main definition header */ 2 /* Include the SDL main definition header */
3 #include "SDL_main.h" 3 #include "SDL_main.h"
4 #include <stdlib.h>
5 #include <unistd.h>
4 #ifdef main 6 #ifdef main
5 #undef main 7 #undef main
6 #endif 8 #endif
7 #ifdef QWS 9 #ifdef QWS
8 #include <qpe/qpeapplication.h> 10 #include <qpe/qpeapplication.h>
11 #include <qapplication.h>
12 #include <qpe/qpeapplication.h>
13 #include <stdlib.h>
14
15 // Workaround for OPIE to remove taskbar icon. Also fixes
16 // some issues in Qtopia where there are left-over qcop files in /tmp/.
17 // I'm guessing this will also clean up the taskbar in the Sharp version
18 // of Qtopia.
19 static inline void cleanupQCop() {
20 QString appname(qApp->argv()[0]);
21 int slash = appname.findRev("/");
22 if(slash != -1) { appname = appname.mid(slash+1); }
23 QString cmd = QPEApplication::qpeDir() + "bin/qcop QPE/System 'closing(QString)' '"+appname+"'";
24 system(cmd.latin1());
25 cmd = "/tmp/qcop-msg-"+appname;
26 unlink(cmd.latin1());
27 }
28
29 static QPEApplication *app;
9 #endif 30 #endif
10 31
11 extern int SDL_main(int argc, char *argv[]); 32 extern int SDL_main(int argc, char *argv[]);
12 33
13 int main(int argc, char *argv[]) 34 int main(int argc, char *argv[])
14 { 35 {
15 #ifdef QWS 36 #ifdef QWS
16 // This initializes the Qtopia application. It needs to be done here 37 // This initializes the Qtopia application. It needs to be done here
17 // because it parses command line options. 38 // because it parses command line options.
18 QPEApplication app(argc, argv);
19 QWidget dummy; 39 QWidget dummy;
20 app.showMainWidget(&dummy); 40 app = new QPEApplication(argc, argv);
41 app->showMainWidget(&dummy);
42 atexit(cleanupQCop);
21 #endif 43 #endif
22 // Exit here because if return is used, the application 44 // Exit here because if return is used, the application
23 // doesn't seem to quit correctly. 45 // doesn't seem to quit correctly.
24 exit(SDL_main(argc, argv)); 46 exit(SDL_main(argc, argv));
25 } 47 }