src/main/linux/SDL_Qtopia_main.cc
author Sam Lantinga
Sun, 21 Sep 2003 18:32:04 +0000
changeset 720 f90d80d68071
parent 612 0648505b1f8b
permissions -rw-r--r--
N Sep 17 8791 Sam Lantinga Re: tks source released
Date: Sun, 07 Sep 2003 02:51:58 +0200
From: Stephane Marchesin
Subject: [SDL] Two little patches

Compiling SDL with a recent gcc (gcc 3.3.1, 3.3 doesn't have this
behaviour) gives some nasty warnings :

SDL_blit_A.c: In function `BlitRGBtoRGBSurfaceAlpha128MMX':
SDL_blit_A.c:223: warning: integer constant is too large for "long" type
SDL_blit_A.c:225: warning: integer constant is too large for "long" type
SDL_blit_A.c:227: warning: integer constant is too large for "long" type
[...]

The first attached patch (longlongfix.patch) tells gcc to really treat
those constants as unsigned long long and not long.

The second patch (nasinclude.patch) fixes an include problem I had while
compiling nas audio : when the <audio/audiolib.h> file lies in
/usr/X11R6/include, a -I/usr/X11R6/include option is needed or the file
isn't found.
slouken@371
     1
slouken@371
     2
/* Include the SDL main definition header */
slouken@371
     3
#include "SDL_main.h"
slouken@567
     4
#include <stdlib.h>
slouken@567
     5
#include <unistd.h>
slouken@371
     6
#ifdef main
slouken@371
     7
#undef main
slouken@371
     8
#endif
slouken@371
     9
#ifdef QWS
slouken@371
    10
#include <qpe/qpeapplication.h>
slouken@567
    11
#include <qapplication.h>
slouken@567
    12
#include <qpe/qpeapplication.h>
slouken@567
    13
#include <stdlib.h>
slouken@567
    14
slouken@567
    15
// Workaround for OPIE to remove taskbar icon. Also fixes
slouken@567
    16
// some issues in Qtopia where there are left-over qcop files in /tmp/.
slouken@567
    17
// I'm guessing this will also clean up the taskbar in the Sharp version
slouken@567
    18
// of Qtopia.
slouken@567
    19
static inline void cleanupQCop() {
slouken@567
    20
  QString appname(qApp->argv()[0]);
slouken@567
    21
  int slash = appname.findRev("/");
slouken@567
    22
  if(slash != -1) {  appname = appname.mid(slash+1); }
slouken@567
    23
  QString cmd = QPEApplication::qpeDir() + "bin/qcop QPE/System 'closing(QString)' '"+appname+"'";
slouken@567
    24
  system(cmd.latin1());
slouken@567
    25
  cmd = "/tmp/qcop-msg-"+appname;
slouken@567
    26
  unlink(cmd.latin1());
slouken@567
    27
}
slouken@567
    28
slouken@567
    29
static QPEApplication *app;
slouken@371
    30
#endif
slouken@371
    31
slouken@371
    32
extern int SDL_main(int argc, char *argv[]);
slouken@371
    33
slouken@371
    34
int main(int argc, char *argv[])
slouken@371
    35
{
slouken@371
    36
#ifdef QWS
slouken@371
    37
  // This initializes the Qtopia application. It needs to be done here
slouken@371
    38
  // because it parses command line options.
slouken@612
    39
  app = new QPEApplication(argc, argv);
slouken@371
    40
  QWidget dummy;
slouken@567
    41
  app->showMainWidget(&dummy);
slouken@567
    42
  atexit(cleanupQCop);
slouken@371
    43
#endif
slouken@394
    44
  // Exit here because if return is used, the application
slouken@394
    45
  // doesn't seem to quit correctly.
slouken@394
    46
  exit(SDL_main(argc, argv));
slouken@371
    47
}