Import SDL 1.2
[yari.git] / SDL-1.2 / src / main / qtopia / SDL_qtopia_main.cc
blob46fd518ff02649a50b41957d1e77fc2d2610df93
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>
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());
29 static QPEApplication *app;
30 #endif
32 extern int SDL_main(int argc, char *argv[]);
34 int main(int argc, char *argv[])
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));