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