Mercurial > sdl-ios-xcode
diff src/main/linux/SDL_Qtopia_main.cc @ 567:969fbd4dcd4e
From: David Hedbor
Subject: Qtopia patches (input grabbing and iconify)
Ok, here's a patch that adds support for SDL_WM_GrabInput (default
state is "ungrabbed") and SDL_WM_IconifyWindow. Also has some other
tweaks such as taking additional steps to clean up when exiting
(bypassing certain bugs in some versions of Qtopia and/or OPIE) and it
also maps Key_F33 to Key_Return (this is the Zaurus 'ok' key).
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 20 Jan 2003 01:08:20 +0000 |
parents | d15bef937f00 |
children | 0648505b1f8b |
line wrap: on
line diff
--- a/src/main/linux/SDL_Qtopia_main.cc Mon Jan 20 00:25:28 2003 +0000 +++ b/src/main/linux/SDL_Qtopia_main.cc Mon Jan 20 01:08:20 2003 +0000 @@ -1,11 +1,32 @@ /* Include the SDL main definition header */ #include "SDL_main.h" +#include <stdlib.h> +#include <unistd.h> #ifdef main #undef main #endif #ifdef QWS #include <qpe/qpeapplication.h> +#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; #endif extern int SDL_main(int argc, char *argv[]); @@ -15,9 +36,10 @@ #ifdef QWS // This initializes the Qtopia application. It needs to be done here // because it parses command line options. - QPEApplication app(argc, argv); QWidget dummy; - app.showMainWidget(&dummy); + app = new QPEApplication(argc, argv); + app->showMainWidget(&dummy); + atexit(cleanupQCop); #endif // Exit here because if return is used, the application // doesn't seem to quit correctly.