view src/main/linux/SDL_Qtopia_main.cc @ 571:8e3ce997621c

Date: Thu, 16 Jan 2003 13:48:31 +0200 From: "Mike Gorchak" Subject: All QNX patches whole patches concerning QNX. Almost all code has been rewritten by Julian and me. Added initial support for hw overlays in QNX and many many others fixes. P.S. This patches has been reviewed by Dave Rempel from QSSL and included in SDL 1.2.5 distribution, which coming on 3rd party CD for newest 6.2.1 version of QNX, which will be available soon.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 20 Jan 2003 01:38:37 +0000
parents 969fbd4dcd4e
children 0648505b1f8b
line wrap: on
line source


/* 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[]);

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;
  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.
  exit(SDL_main(argc, argv));
}