This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
/
SDL_qtopia_main.cc
56 lines (50 loc) · 1.38 KB
1
2
3
/* Include the SDL main definition header */
#include "SDL_main.h"
4
5
#include <stdlib.h>
#include <unistd.h>
6
7
8
9
10
#ifdef main
#undef main
#endif
#ifdef QWS
#include <qpe/qpeapplication.h>
11
12
13
14
15
16
17
18
#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.
19
static inline void
20
cleanupQCop()
21
{
22
23
QString appname(qApp->argv()[0]);
int slash = appname.findRev("/");
24
if (slash != -1) {
25
appname = appname.mid(slash + 1);
26
27
}
QString cmd =
28
QPEApplication::qpeDir() +
29
"bin/qcop QPE/System 'closing(QString)' '" + appname + "'";
30
system(cmd.latin1());
31
cmd = "/tmp/qcop-msg-" + appname;
32
unlink(cmd.latin1());
33
34
35
}
static QPEApplication *app;
36
37
#endif
38
extern int SDL_main(int argc, char *argv[]);
39
40
int
41
main(int argc, char *argv[])
42
43
{
#ifdef QWS
44
45
// This initializes the Qtopia application. It needs to be done here
// because it parses command line options.
46
app = new QPEApplication(argc, argv);
47
QWidget dummy;
48
49
app->showMainWidget(&dummy);
atexit(cleanupQCop);
50
#endif
51
52
// Exit here because if return is used, the application
// doesn't seem to quit correctly.
53
exit(SDL_main(argc, argv));
54
}
55
56
/* vi: set ts=4 sw=4 expandtab: */