Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
56 lines (50 loc) · 1.38 KB

SDL_qtopia_main.cc

File metadata and controls

56 lines (50 loc) · 1.38 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
#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.
May 28, 2006
May 28, 2006
19
static inline void
May 29, 2006
May 29, 2006
20
cleanupQCop()
May 28, 2006
May 28, 2006
21
{
May 29, 2006
May 29, 2006
22
23
QString appname(qApp->argv()[0]);
int slash = appname.findRev("/");
May 28, 2006
May 28, 2006
24
if (slash != -1) {
May 29, 2006
May 29, 2006
25
appname = appname.mid(slash + 1);
May 28, 2006
May 28, 2006
26
27
}
QString cmd =
May 29, 2006
May 29, 2006
28
QPEApplication::qpeDir() +
May 28, 2006
May 28, 2006
29
"bin/qcop QPE/System 'closing(QString)' '" + appname + "'";
May 29, 2006
May 29, 2006
30
system(cmd.latin1());
May 28, 2006
May 28, 2006
31
cmd = "/tmp/qcop-msg-" + appname;
May 29, 2006
May 29, 2006
32
unlink(cmd.latin1());
Jan 20, 2003
Jan 20, 2003
33
34
35
}
static QPEApplication *app;
May 19, 2002
May 19, 2002
36
37
#endif
May 29, 2006
May 29, 2006
38
extern int SDL_main(int argc, char *argv[]);
May 19, 2002
May 19, 2002
39
May 28, 2006
May 28, 2006
40
int
May 29, 2006
May 29, 2006
41
main(int argc, char *argv[])
May 19, 2002
May 19, 2002
42
43
{
#ifdef QWS
May 28, 2006
May 28, 2006
44
45
// This initializes the Qtopia application. It needs to be done here
// because it parses command line options.
May 29, 2006
May 29, 2006
46
app = new QPEApplication(argc, argv);
May 28, 2006
May 28, 2006
47
QWidget dummy;
May 29, 2006
May 29, 2006
48
49
app->showMainWidget(&dummy);
atexit(cleanupQCop);
May 19, 2002
May 19, 2002
50
#endif
May 28, 2006
May 28, 2006
51
52
// Exit here because if return is used, the application
// doesn't seem to quit correctly.
May 29, 2006
May 29, 2006
53
exit(SDL_main(argc, argv));
May 19, 2002
May 19, 2002
54
}
May 28, 2006
May 28, 2006
55
56
/* vi: set ts=4 sw=4 expandtab: */