diff options
Diffstat (limited to 'apps/plugins/sdl/src/main/qtopia/SDL_qtopia_main.cc')
-rw-r--r-- | apps/plugins/sdl/src/main/qtopia/SDL_qtopia_main.cc | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/apps/plugins/sdl/src/main/qtopia/SDL_qtopia_main.cc b/apps/plugins/sdl/src/main/qtopia/SDL_qtopia_main.cc new file mode 100644 index 0000000000..46fd518ff0 --- /dev/null +++ b/apps/plugins/sdl/src/main/qtopia/SDL_qtopia_main.cc | |||
@@ -0,0 +1,47 @@ | |||
1 | |||
2 | /* Include the SDL main definition header */ | ||
3 | #include "SDL_main.h" | ||
4 | #include <stdlib.h> | ||
5 | #include <unistd.h> | ||
6 | #ifdef main | ||
7 | #undef main | ||
8 | #endif | ||
9 | #ifdef QWS | ||
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; | ||
30 | #endif | ||
31 | |||
32 | extern int SDL_main(int argc, char *argv[]); | ||
33 | |||
34 | int main(int argc, char *argv[]) | ||
35 | { | ||
36 | #ifdef QWS | ||
37 | // This initializes the Qtopia application. It needs to be done here | ||
38 | // because it parses command line options. | ||
39 | app = new QPEApplication(argc, argv); | ||
40 | QWidget dummy; | ||
41 | app->showMainWidget(&dummy); | ||
42 | atexit(cleanupQCop); | ||
43 | #endif | ||
44 | // Exit here because if return is used, the application | ||
45 | // doesn't seem to quit correctly. | ||
46 | exit(SDL_main(argc, argv)); | ||
47 | } | ||