Skip to content

Latest commit

 

History

History
47 lines (42 loc) · 1.28 KB

SDL_Qtopia_main.cc

File metadata and controls

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