1 Index: SDL-1.2.7/src/main/qtopia/SDL_qtopia_main.cc
2 ===================================================================
3 --- SDL-1.2.7.orig/src/main/qtopia/SDL_qtopia_main.cc 2003-12-14 07:25:53.000000000 +0100
4 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000
7 -/* Include the SDL main definition header */
15 -#include <qpe/qpeapplication.h>
16 -#include <qapplication.h>
17 -#include <qpe/qpeapplication.h>
20 -// Workaround for OPIE to remove taskbar icon. Also fixes
21 -// some issues in Qtopia where there are left-over qcop files in /tmp/.
22 -// I'm guessing this will also clean up the taskbar in the Sharp version
24 -static inline void cleanupQCop() {
25 - QString appname(qApp->argv()[0]);
26 - int slash = appname.findRev("/");
27 - if(slash != -1) { appname = appname.mid(slash+1); }
28 - QString cmd = QPEApplication::qpeDir() + "bin/qcop QPE/System 'closing(QString)' '"+appname+"'";
29 - system(cmd.latin1());
30 - cmd = "/tmp/qcop-msg-"+appname;
31 - unlink(cmd.latin1());
34 -static QPEApplication *app;
37 -extern int SDL_main(int argc, char *argv[]);
39 -int main(int argc, char *argv[])
42 - // This initializes the Qtopia application. It needs to be done here
43 - // because it parses command line options.
44 - app = new QPEApplication(argc, argv);
46 - app->showMainWidget(&dummy);
47 - atexit(cleanupQCop);
49 - // Exit here because if return is used, the application
50 - // doesn't seem to quit correctly.
51 - exit(SDL_main(argc, argv));
53 Index: SDL-1.2.7/src/video/qtopia/SDL_qmain.cc
54 ===================================================================
55 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
56 +++ SDL-1.2.7/src/video/qtopia/SDL_qmain.cc 2005-09-24 19:55:14.000000000 +0200
58 +/* Include the SDL main definition header */
59 +#include "SDL_main.h"
62 +#include <sys/types.h>
68 +#include <qpe/qpeapplication.h>
74 +static QWidget *dummyW = 0;
75 +static QPEApplication *theApp = 0;
76 +static char **cmdline= 0;
79 +static void parse_cmd_line() {
85 + char *string_start = 0;
86 + int fd = ::open( "/proc/self/cmdline", O_RDONLY );
88 + qWarning( "Error getting the cmdline, can't be" );
92 + available = ::read( fd, &buf, sizeof(buf) );
93 + if ( available <= 0 )
97 + * find out the number of arguments
100 + for (int i = 0; i < available; ++i )
101 + if ( buf[i] == '\0' )
104 + /* now create a the cmdline */
105 + cmdline = new char*[size+1];
106 + cmdline[size] = '\0'; // parnoid...
108 + string_start = &buf[0];
109 + for ( int i = 0; i < size; ++i ) {
111 + * find the end of the string
113 + size_t sz = ::strlen(string_start);
114 + cmdline[i] = new char[sz+1];
115 + memcpy( cmdline[i], string_start, sz+1 );
116 + string_start += (sz+1); // +1 for '\0' +1 to set it beyond
125 + cmdline = new char*[2];
126 + cmdline[0] = "unknown_app";
131 +static void free_cmd_line() {
133 + * free each string and then free the array
135 + for ( int i = 0; i < size; ++i )
136 + delete [] cmdline[i];
141 +static void __attribute__((constructor)) initialize_qpe_app() {
144 + theApp = new QPEApplication( size, cmdline );
145 + dummyW = new QWidget;
146 + theApp->showMainWidget(dummyW);
149 +static void __attribute__((destructor)) deinitialize_qpe_app() {
157 Index: SDL-1.2.7/src/main/Makefile.am
158 ===================================================================
159 --- SDL-1.2.7.orig/src/main/Makefile.am 2004-02-18 18:22:01.000000000 +0100
160 +++ SDL-1.2.7/src/main/Makefile.am 2005-09-24 19:56:40.000000000 +0200
163 MAINLIB_ARCH_SRCS = macosx/SDLMain.m macosx/SDLMain.h
166 -MAINLIB_ARCH_SRCS = qtopia/SDL_qtopia_main.cc
168 MAINLIB_ARCH_SRCS = dummy/SDL_dummy_main.c
169 -endif # !TARGET_QTOPIA
170 endif # !TARGET_MACOSX
171 endif # !TARGET_WIN32
172 libSDLmain_a_SOURCES = $(MAINLIB_ARCH_SRCS)
173 Index: SDL-1.2.7/src/video/qtopia/Makefile.am
174 ===================================================================
175 --- SDL-1.2.7.orig/src/video/qtopia/Makefile.am 2002-05-28 21:24:11.000000000 +0200
176 +++ SDL-1.2.7/src/video/qtopia/Makefile.am 2005-09-24 19:56:40.000000000 +0200
182 + SDL_sysevents_c.h \
184 Index: SDL-1.2.7/configure.in
185 ===================================================================
186 --- SDL-1.2.7.orig/configure.in 2004-02-22 22:31:47.000000000 +0100
187 +++ SDL-1.2.7/configure.in 2005-09-24 19:58:30.000000000 +0200
188 @@ -1806,7 +1806,7 @@
189 # Set up files for the main() stub
190 if test "x$video_qtopia" = "xyes"; then
191 SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
192 - SDL_LIBS="-lSDLmain $SDL_LIBS"
195 # Set up files for the audio library
196 # We use the OSS and ALSA API's, not the Sun audio API