Removed completely non-portable event thread hack.
authorSam Lantinga <slouken@libsdl.org>
Thu, 27 Jan 2011 22:44:08 -0800
changeset 5123dc0dfdd58f27
parent 5122 0ec550f04bbc
child 5124 d79ff339d1f2
Removed completely non-portable event thread hack.
Next I'll be working on generalizing the event sources and making the event queue lock-free. :)
include/SDL.h
include/SDL_video.h
src/SDL.c
src/events/SDL_events.c
src/events/SDL_events_c.h
src/events/SDL_keyboard.c
src/joystick/SDL_joystick.c
src/video/SDL_video.c
src/video/directfb/SDL_DirectFB_events.c
src/video/dummy/SDL_nullevents.c
src/video/nds/SDL_ndsevents.c
src/video/pandora/SDL_pandora_events.c
src/video/uikit/SDL_uikitevents.m
test/common.c
test/testshape.c
test/threadwin.c
     1.1 --- a/include/SDL.h	Thu Jan 27 20:51:54 2011 -0800
     1.2 +++ b/include/SDL.h	Thu Jan 27 22:44:08 2011 -0800
     1.3 @@ -116,7 +116,6 @@
     1.4  #define SDL_INIT_JOYSTICK       0x00000200
     1.5  #define SDL_INIT_HAPTIC         0x00001000
     1.6  #define SDL_INIT_NOPARACHUTE    0x00100000      /**< Don't catch fatal signals */
     1.7 -#define SDL_INIT_EVENTTHREAD    0x01000000      /**< Not supported on all OS's */
     1.8  #define SDL_INIT_EVERYTHING     0x0000FFFF
     1.9  /*@}*/
    1.10  
     2.1 --- a/include/SDL_video.h	Thu Jan 27 20:51:54 2011 -0800
     2.2 +++ b/include/SDL_video.h	Thu Jan 27 22:44:08 2011 -0800
     2.3 @@ -278,8 +278,6 @@
     2.4   *  \param driver_name Initialize a specific driver by name, or NULL for the 
     2.5   *                     default video driver.
     2.6   *  
     2.7 - *  \param flags FIXME: Still needed?
     2.8 - *  
     2.9   *  \return 0 on success, -1 on error
    2.10   *  
    2.11   *  This function initializes the video subsystem; setting up a connection
    2.12 @@ -288,8 +286,7 @@
    2.13   *  
    2.14   *  \sa SDL_VideoQuit()
    2.15   */
    2.16 -extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name,
    2.17 -                                          Uint32 flags);
    2.18 +extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name);
    2.19  
    2.20  /**
    2.21   *  \brief Shuts down the video subsystem.
     3.1 --- a/src/SDL.c	Thu Jan 27 20:51:54 2011 -0800
     3.2 +++ b/src/SDL.c	Thu Jan 27 22:44:08 2011 -0800
     3.3 @@ -59,7 +59,7 @@
     3.4  #if !SDL_VIDEO_DISABLED
     3.5      /* Initialize the video/event subsystem */
     3.6      if ((flags & SDL_INIT_VIDEO) && !(SDL_initialized & SDL_INIT_VIDEO)) {
     3.7 -        if (SDL_VideoInit(NULL, (flags & SDL_INIT_EVENTTHREAD)) < 0) {
     3.8 +        if (SDL_VideoInit(NULL) < 0) {
     3.9              return (-1);
    3.10          }
    3.11          SDL_initialized |= SDL_INIT_VIDEO;
     4.1 --- a/src/events/SDL_events.c	Thu Jan 27 20:51:54 2011 -0800
     4.2 +++ b/src/events/SDL_events.c	Thu Jan 27 22:44:08 2011 -0800
     4.3 @@ -27,12 +27,12 @@
     4.4  #include "SDL_events.h"
     4.5  #include "SDL_syswm.h"
     4.6  #include "SDL_thread.h"
     4.7 -#include "SDL_sysevents.h"
     4.8  #include "SDL_events_c.h"
     4.9  #include "../timer/SDL_timer_c.h"
    4.10  #if !SDL_JOYSTICK_DISABLED
    4.11  #include "../joystick/SDL_joystick_c.h"
    4.12  #endif
    4.13 +#include "../video/SDL_sysvideo.h"
    4.14  
    4.15  /* Public data -- the event filter */
    4.16  SDL_EventFilter SDL_EventOK = NULL;
    4.17 @@ -58,36 +58,6 @@
    4.18      struct SDL_SysWMmsg wmmsg[MAXEVENTS];
    4.19  } SDL_EventQ;
    4.20  
    4.21 -/* Private data -- event locking structure */
    4.22 -static struct
    4.23 -{
    4.24 -    SDL_mutex *lock;
    4.25 -    int safe;
    4.26 -} SDL_EventLock;
    4.27 -
    4.28 -/* Thread functions */
    4.29 -static SDL_Thread *SDL_EventThread = NULL;      /* Thread handle */
    4.30 -static SDL_threadID event_thread;     /* The event thread id */
    4.31 -
    4.32 -void
    4.33 -SDL_Lock_EventThread(void)
    4.34 -{
    4.35 -    if (SDL_EventThread && (SDL_ThreadID() != event_thread)) {
    4.36 -        /* Grab lock and spin until we're sure event thread stopped */
    4.37 -        SDL_mutexP(SDL_EventLock.lock);
    4.38 -        while (!SDL_EventLock.safe) {
    4.39 -            SDL_Delay(1);
    4.40 -        }
    4.41 -    }
    4.42 -}
    4.43 -
    4.44 -void
    4.45 -SDL_Unlock_EventThread(void)
    4.46 -{
    4.47 -    if (SDL_EventThread && (SDL_ThreadID() != event_thread)) {
    4.48 -        SDL_mutexV(SDL_EventLock.lock);
    4.49 -    }
    4.50 -}
    4.51  
    4.52  static __inline__ SDL_bool
    4.53  SDL_ShouldPollJoystick()
    4.54 @@ -102,106 +72,6 @@
    4.55      return SDL_FALSE;
    4.56  }
    4.57  
    4.58 -static int SDLCALL
    4.59 -SDL_GobbleEvents(void *unused)
    4.60 -{
    4.61 -    event_thread = SDL_ThreadID();
    4.62 -
    4.63 -    while (SDL_EventQ.active) {
    4.64 -        SDL_VideoDevice *_this = SDL_GetVideoDevice();
    4.65 -
    4.66 -        /* Get events from the video subsystem */
    4.67 -        if (_this) {
    4.68 -            _this->PumpEvents(_this);
    4.69 -        }
    4.70 -#if !SDL_JOYSTICK_DISABLED
    4.71 -        /* Check for joystick state change */
    4.72 -        if (SDL_ShouldPollJoystick()) {
    4.73 -            SDL_JoystickUpdate();
    4.74 -        }
    4.75 -#endif
    4.76 -
    4.77 -        /* Give up the CPU for the rest of our timeslice */
    4.78 -        SDL_EventLock.safe = 1;
    4.79 -        SDL_Delay(1);
    4.80 -
    4.81 -        /* Check for event locking.
    4.82 -           On the P of the lock mutex, if the lock is held, this thread
    4.83 -           will wait until the lock is released before continuing.  The
    4.84 -           safe flag will be set, meaning that the other thread can go
    4.85 -           about it's business.  The safe flag is reset before the V,
    4.86 -           so as soon as the mutex is free, other threads can see that
    4.87 -           it's not safe to interfere with the event thread.
    4.88 -         */
    4.89 -        SDL_mutexP(SDL_EventLock.lock);
    4.90 -        SDL_EventLock.safe = 0;
    4.91 -        SDL_mutexV(SDL_EventLock.lock);
    4.92 -    }
    4.93 -    event_thread = 0;
    4.94 -    return (0);
    4.95 -}
    4.96 -
    4.97 -static int
    4.98 -SDL_StartEventThread(Uint32 flags)
    4.99 -{
   4.100 -    /* Reset everything to zero */
   4.101 -    SDL_EventThread = NULL;
   4.102 -    SDL_memset(&SDL_EventLock, 0, sizeof(SDL_EventLock));
   4.103 -
   4.104 -    /* Create the lock and set ourselves active */
   4.105 -#if !SDL_THREADS_DISABLED
   4.106 -    SDL_EventQ.lock = SDL_CreateMutex();
   4.107 -    if (SDL_EventQ.lock == NULL) {
   4.108 -        return (-1);
   4.109 -    }
   4.110 -#endif /* !SDL_THREADS_DISABLED */
   4.111 -    SDL_EventQ.active = 1;
   4.112 -
   4.113 -    if ((flags & SDL_INIT_EVENTTHREAD) == SDL_INIT_EVENTTHREAD) {
   4.114 -        SDL_EventLock.lock = SDL_CreateMutex();
   4.115 -        if (SDL_EventLock.lock == NULL) {
   4.116 -            return (-1);
   4.117 -        }
   4.118 -        SDL_EventLock.safe = 0;
   4.119 -
   4.120 -#if (defined(__WIN32__) && !defined(_WIN32_WCE)) && !defined(HAVE_LIBC)
   4.121 -#undef SDL_CreateThread
   4.122 -        SDL_EventThread =
   4.123 -            SDL_CreateThread(SDL_GobbleEvents, NULL, NULL, NULL);
   4.124 -#else
   4.125 -        SDL_EventThread = SDL_CreateThread(SDL_GobbleEvents, NULL);
   4.126 -#endif
   4.127 -        if (SDL_EventThread == NULL) {
   4.128 -            return (-1);
   4.129 -        }
   4.130 -    } else {
   4.131 -        event_thread = 0;
   4.132 -    }
   4.133 -    return (0);
   4.134 -}
   4.135 -
   4.136 -static void
   4.137 -SDL_StopEventThread(void)
   4.138 -{
   4.139 -    SDL_EventQ.active = 0;
   4.140 -    if (SDL_EventThread) {
   4.141 -        SDL_WaitThread(SDL_EventThread, NULL);
   4.142 -        SDL_EventThread = NULL;
   4.143 -        SDL_DestroyMutex(SDL_EventLock.lock);
   4.144 -        SDL_EventLock.lock = NULL;
   4.145 -    }
   4.146 -    if (SDL_EventQ.lock) {
   4.147 -        SDL_DestroyMutex(SDL_EventQ.lock);
   4.148 -        SDL_EventQ.lock = NULL;
   4.149 -    }
   4.150 -}
   4.151 -
   4.152 -SDL_threadID
   4.153 -SDL_EventThreadID(void)
   4.154 -{
   4.155 -    return (event_thread);
   4.156 -}
   4.157 -
   4.158  /* Public functions */
   4.159  
   4.160  void
   4.161 @@ -209,13 +79,10 @@
   4.162  {
   4.163      int i;
   4.164  
   4.165 -    /* Halt the event thread, if running */
   4.166 -    SDL_StopEventThread();
   4.167 -
   4.168 -    /* Shutdown event handlers */
   4.169 -    SDL_KeyboardQuit();
   4.170 -    SDL_MouseQuit();
   4.171 -    SDL_QuitQuit();
   4.172 +    if (SDL_EventQ.lock) {
   4.173 +        SDL_DestroyMutex(SDL_EventQ.lock);
   4.174 +        SDL_EventQ.lock = NULL;
   4.175 +    }
   4.176  
   4.177      /* Clean out EventQ */
   4.178      SDL_EventQ.head = 0;
   4.179 @@ -233,12 +100,11 @@
   4.180  
   4.181  /* This function (and associated calls) may be called more than once */
   4.182  int
   4.183 -SDL_StartEventLoop(Uint32 flags)
   4.184 +SDL_StartEventLoop(void)
   4.185  {
   4.186      int retcode;
   4.187  
   4.188      /* Clean out the event queue */
   4.189 -    SDL_EventThread = NULL;
   4.190      SDL_EventQ.lock = NULL;
   4.191      SDL_StopEventLoop();
   4.192  
   4.193 @@ -246,22 +112,15 @@
   4.194      SDL_EventOK = NULL;
   4.195      SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE);
   4.196  
   4.197 -    /* Initialize event handlers */
   4.198 -    retcode = 0;
   4.199 -    retcode += SDL_KeyboardInit();
   4.200 -    retcode += SDL_MouseInit();
   4.201 -    retcode += SDL_TouchInit();
   4.202 -    retcode += SDL_QuitInit();
   4.203 -    if (retcode < 0) {
   4.204 -        /* We don't expect them to fail, but... */
   4.205 +    /* Create the lock and set ourselves active */
   4.206 +#if !SDL_THREADS_DISABLED
   4.207 +    SDL_EventQ.lock = SDL_CreateMutex();
   4.208 +    if (SDL_EventQ.lock == NULL) {
   4.209          return (-1);
   4.210      }
   4.211 +#endif /* !SDL_THREADS_DISABLED */
   4.212 +    SDL_EventQ.active = 1;
   4.213  
   4.214 -    /* Create the lock and event thread */
   4.215 -    if (SDL_StartEventThread(flags) < 0) {
   4.216 -        SDL_StopEventLoop();
   4.217 -        return (-1);
   4.218 -    }
   4.219      return (0);
   4.220  }
   4.221  
   4.222 @@ -420,20 +279,18 @@
   4.223  void
   4.224  SDL_PumpEvents(void)
   4.225  {
   4.226 -    if (!SDL_EventThread) {
   4.227 -        SDL_VideoDevice *_this = SDL_GetVideoDevice();
   4.228 +    SDL_VideoDevice *_this = SDL_GetVideoDevice();
   4.229  
   4.230 -        /* Get events from the video subsystem */
   4.231 -        if (_this) {
   4.232 -            _this->PumpEvents(_this);
   4.233 -        }
   4.234 +    /* Get events from the video subsystem */
   4.235 +    if (_this) {
   4.236 +        _this->PumpEvents(_this);
   4.237 +    }
   4.238  #if !SDL_JOYSTICK_DISABLED
   4.239 -        /* Check for joystick state change */
   4.240 -        if (SDL_ShouldPollJoystick()) {
   4.241 -            SDL_JoystickUpdate();
   4.242 -        }
   4.243 +    /* Check for joystick state change */
   4.244 +    if (SDL_ShouldPollJoystick()) {
   4.245 +        SDL_JoystickUpdate();
   4.246 +    }
   4.247  #endif
   4.248 -    }
   4.249  }
   4.250  
   4.251  /* Public functions */
     5.1 --- a/src/events/SDL_events_c.h	Thu Jan 27 20:51:54 2011 -0800
     5.2 +++ b/src/events/SDL_events_c.h	Thu Jan 27 22:44:08 2011 -0800
     5.3 @@ -29,15 +29,12 @@
     5.4  #include "SDL_touch_c.h"
     5.5  #include "SDL_windowevents_c.h"
     5.6  #include "SDL_gesture_c.h"
     5.7 +
     5.8  /* Start and stop the event processing loop */
     5.9 -extern int SDL_StartEventLoop(Uint32 flags);
    5.10 +extern int SDL_StartEventLoop(void);
    5.11  extern void SDL_StopEventLoop(void);
    5.12  extern void SDL_QuitInterrupt(void);
    5.13  
    5.14 -extern void SDL_Lock_EventThread(void);
    5.15 -extern void SDL_Unlock_EventThread(void);
    5.16 -extern SDL_threadID SDL_EventThreadID(void);
    5.17 -
    5.18  extern int SDL_SendSysWMEvent(SDL_SysWMmsg * message);
    5.19  
    5.20  extern int SDL_QuitInit(void);
     6.1 --- a/src/events/SDL_keyboard.c	Thu Jan 27 20:51:54 2011 -0800
     6.2 +++ b/src/events/SDL_keyboard.c	Thu Jan 27 22:44:08 2011 -0800
     6.3 @@ -26,7 +26,7 @@
     6.4  #include "SDL_timer.h"
     6.5  #include "SDL_events.h"
     6.6  #include "SDL_events_c.h"
     6.7 -#include "SDL_sysevents.h"
     6.8 +#include "../video/SDL_sysvideo.h"
     6.9  
    6.10  
    6.11  /* Global keyboard information */
     7.1 --- a/src/joystick/SDL_joystick.c	Thu Jan 27 20:51:54 2011 -0800
     7.2 +++ b/src/joystick/SDL_joystick.c	Thu Jan 27 22:44:08 2011 -0800
     7.3 @@ -30,12 +30,6 @@
     7.4  #include "../events/SDL_events_c.h"
     7.5  #endif
     7.6  
     7.7 -/* This is used for Quake III Arena */
     7.8 -#if SDL_EVENTS_DISABLED
     7.9 -#define SDL_Lock_EventThread()
    7.10 -#define SDL_Unlock_EventThread()
    7.11 -#endif
    7.12 -
    7.13  Uint8 SDL_numjoysticks = 0;
    7.14  SDL_Joystick **SDL_joysticks = NULL;
    7.15  static SDL_Joystick *default_joystick = NULL;
    7.16 @@ -165,11 +159,9 @@
    7.17  
    7.18      /* Add joystick to list */
    7.19      ++joystick->ref_count;
    7.20 -    SDL_Lock_EventThread();
    7.21      for (i = 0; SDL_joysticks[i]; ++i)
    7.22          /* Skip to next joystick */ ;
    7.23      SDL_joysticks[i] = joystick;
    7.24 -    SDL_Unlock_EventThread();
    7.25  
    7.26      return (joystick);
    7.27  }
    7.28 @@ -379,9 +371,6 @@
    7.29          return;
    7.30      }
    7.31  
    7.32 -    /* Lock the event queue - prevent joystick polling */
    7.33 -    SDL_Lock_EventThread();
    7.34 -
    7.35      if (joystick == default_joystick) {
    7.36          default_joystick = NULL;
    7.37      }
    7.38 @@ -396,9 +385,6 @@
    7.39          }
    7.40      }
    7.41  
    7.42 -    /* Let the event thread keep running */
    7.43 -    SDL_Unlock_EventThread();
    7.44 -
    7.45      /* Free the data associated with this joystick */
    7.46      if (joystick->axes) {
    7.47          SDL_free(joystick->axes);
    7.48 @@ -419,9 +405,7 @@
    7.49  SDL_JoystickQuit(void)
    7.50  {
    7.51      /* Stop the event polling */
    7.52 -    SDL_Lock_EventThread();
    7.53      SDL_numjoysticks = 0;
    7.54 -    SDL_Unlock_EventThread();
    7.55  
    7.56      /* Quit the joystick setup */
    7.57      SDL_SYS_JoystickQuit();
     8.1 --- a/src/video/SDL_video.c	Thu Jan 27 20:51:54 2011 -0800
     8.2 +++ b/src/video/SDL_video.c	Thu Jan 27 22:44:08 2011 -0800
     8.3 @@ -31,7 +31,6 @@
     8.4  #include "SDL_renderer_gl.h"
     8.5  #include "SDL_renderer_gles.h"
     8.6  #include "SDL_renderer_sw.h"
     8.7 -#include "../events/SDL_sysevents.h"
     8.8  #include "../events/SDL_events_c.h"
     8.9  
    8.10  #if SDL_VIDEO_DRIVER_WINDOWS
    8.11 @@ -172,7 +171,7 @@
    8.12   * Initialize the video and event subsystems -- determine native pixel format
    8.13   */
    8.14  int
    8.15 -SDL_VideoInit(const char *driver_name, Uint32 flags)
    8.16 +SDL_VideoInit(const char *driver_name)
    8.17  {
    8.18      SDL_VideoDevice *video;
    8.19      int index;
    8.20 @@ -183,18 +182,12 @@
    8.21          SDL_VideoQuit();
    8.22      }
    8.23  
    8.24 -    /* Toggle the event thread flags, based on OS requirements */
    8.25 -#if defined(MUST_THREAD_EVENTS)
    8.26 -    flags |= SDL_INIT_EVENTTHREAD;
    8.27 -#elif defined(CANT_THREAD_EVENTS)
    8.28 -    if ((flags & SDL_INIT_EVENTTHREAD) == SDL_INIT_EVENTTHREAD) {
    8.29 -        SDL_SetError("OS doesn't support threaded events");
    8.30 -        return -1;
    8.31 -    }
    8.32 -#endif
    8.33 -
    8.34      /* Start the event loop */
    8.35 -    if (SDL_StartEventLoop(flags) < 0) {
    8.36 +    if (SDL_StartEventLoop() < 0 ||
    8.37 +        SDL_KeyboardInit() < 0 ||
    8.38 +        SDL_MouseInit() < 0 ||
    8.39 +        SDL_TouchInit() < 0 ||
    8.40 +        SDL_QuitInit() < 0) {
    8.41          return -1;
    8.42      }
    8.43  
    8.44 @@ -887,7 +880,7 @@
    8.45  
    8.46      if (!_this) {
    8.47          /* Initialize the video system if needed */
    8.48 -        if (SDL_VideoInit(NULL, 0) < 0) {
    8.49 +        if (SDL_VideoInit(NULL) < 0) {
    8.50              return NULL;
    8.51          }
    8.52      }
    8.53 @@ -2807,8 +2800,13 @@
    8.54      if (!_this) {
    8.55          return;
    8.56      }
    8.57 +
    8.58      /* Halt event processing before doing anything else */
    8.59 +    SDL_QuitQuit();
    8.60 +    SDL_MouseQuit();
    8.61 +    SDL_KeyboardQuit();
    8.62      SDL_StopEventLoop();
    8.63 +
    8.64      SDL_EnableScreenSaver();
    8.65  
    8.66      /* Clean up the system video */
     9.1 --- a/src/video/directfb/SDL_DirectFB_events.c	Thu Jan 27 20:51:54 2011 -0800
     9.2 +++ b/src/video/directfb/SDL_DirectFB_events.c	Thu Jan 27 22:44:08 2011 -0800
     9.3 @@ -26,7 +26,6 @@
     9.4  #include <directfb.h>
     9.5  
     9.6  #include "../SDL_sysvideo.h"
     9.7 -#include "../../events/SDL_sysevents.h"
     9.8  #include "../../events/SDL_events_c.h"
     9.9  #include "../../events/SDL_keyboard_c.h"
    9.10  #include "../../events/scancodes_linux.h"
    10.1 --- a/src/video/dummy/SDL_nullevents.c	Thu Jan 27 20:51:54 2011 -0800
    10.2 +++ b/src/video/dummy/SDL_nullevents.c	Thu Jan 27 22:44:08 2011 -0800
    10.3 @@ -24,7 +24,6 @@
    10.4  /* Being a null driver, there's no event stream. We just define stubs for
    10.5     most of the API. */
    10.6  
    10.7 -#include "../../events/SDL_sysevents.h"
    10.8  #include "../../events/SDL_events_c.h"
    10.9  
   10.10  #include "SDL_nullvideo.h"
    11.1 --- a/src/video/nds/SDL_ndsevents.c	Thu Jan 27 20:51:54 2011 -0800
    11.2 +++ b/src/video/nds/SDL_ndsevents.c	Thu Jan 27 22:44:08 2011 -0800
    11.3 @@ -28,7 +28,6 @@
    11.4  #include <stdlib.h>
    11.5  #include <nds.h>
    11.6  
    11.7 -#include "../../events/SDL_sysevents.h"
    11.8  #include "../../events/SDL_events_c.h"
    11.9  
   11.10  #include "SDL_ndsvideo.h"
    12.1 --- a/src/video/pandora/SDL_pandora_events.c	Thu Jan 27 20:51:54 2011 -0800
    12.2 +++ b/src/video/pandora/SDL_pandora_events.c	Thu Jan 27 22:44:08 2011 -0800
    12.3 @@ -24,7 +24,6 @@
    12.4  /* Being a null driver, there's no event stream. We just define stubs for
    12.5     most of the API. */
    12.6  
    12.7 -#include "../../events/SDL_sysevents.h"
    12.8  #include "../../events/SDL_events_c.h"
    12.9  
   12.10  void
    13.1 --- a/src/video/uikit/SDL_uikitevents.m	Thu Jan 27 20:51:54 2011 -0800
    13.2 +++ b/src/video/uikit/SDL_uikitevents.m	Thu Jan 27 22:44:08 2011 -0800
    13.3 @@ -21,7 +21,6 @@
    13.4  */
    13.5  #include "SDL_config.h"
    13.6  
    13.7 -#include "../../events/SDL_sysevents.h"
    13.8  #include "../../events/SDL_events_c.h"
    13.9  
   13.10  #include "SDL_uikitvideo.h"
    14.1 --- a/test/common.c	Thu Jan 27 20:51:54 2011 -0800
    14.2 +++ b/test/common.c	Thu Jan 27 22:44:08 2011 -0800
    14.3 @@ -616,7 +616,7 @@
    14.4                  fprintf(stderr, "\n");
    14.5              }
    14.6          }
    14.7 -        if (SDL_VideoInit(state->videodriver, 0) < 0) {
    14.8 +        if (SDL_VideoInit(state->videodriver) < 0) {
    14.9              fprintf(stderr, "Couldn't initialize video driver: %s\n",
   14.10                      SDL_GetError());
   14.11              return SDL_FALSE;
    15.1 --- a/test/testshape.c	Thu Jan 27 20:51:54 2011 -0800
    15.2 +++ b/test/testshape.c	Thu Jan 27 22:44:08 2011 -0800
    15.3 @@ -60,7 +60,7 @@
    15.4      	exit(-1);
    15.5      }
    15.6  	
    15.7 -	if(SDL_VideoInit(NULL,0) == -1) {
    15.8 +	if(SDL_VideoInit(NULL) == -1) {
    15.9  		printf("Could not initialize SDL video.\n");
   15.10  		exit(-2);
   15.11  	}
    16.1 --- a/test/threadwin.c	Thu Jan 27 20:51:54 2011 -0800
    16.2 +++ b/test/threadwin.c	Thu Jan 27 22:44:08 2011 -0800
    16.3 @@ -241,16 +241,7 @@
    16.4      video_flags = SDL_SWSURFACE;
    16.5      parsed = 1;
    16.6      while (parsed) {
    16.7 -        /* If the threaded option is enabled, and the SDL library hasn't
    16.8 -           been compiled with threaded events enabled, then the mouse and
    16.9 -           keyboard won't respond.
   16.10 -         */
   16.11 -        if ((argc >= 2) && (strcmp(argv[1], "-threaded") == 0)) {
   16.12 -            init_flags |= SDL_INIT_EVENTTHREAD;
   16.13 -            argc -= 1;
   16.14 -            argv += 1;
   16.15 -            printf("Running with threaded events\n");
   16.16 -        } else if ((argc >= 2) && (strcmp(argv[1], "-fullscreen") == 0)) {
   16.17 +        if ((argc >= 2) && (strcmp(argv[1], "-fullscreen") == 0)) {
   16.18              video_flags |= SDL_FULLSCREEN;
   16.19              argc -= 1;
   16.20              argv += 1;
   16.21 @@ -320,9 +311,8 @@
   16.22  
   16.23      /* Loop, waiting for QUIT */
   16.24      while (!done) {
   16.25 -        if (!(init_flags & SDL_INIT_EVENTTHREAD)) {
   16.26 -            SDL_PumpEvents();   /* Needed when event thread is off */
   16.27 -        }
   16.28 +        SDL_PumpEvents();
   16.29 +
   16.30          if (SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, SDL_QUIT, SDL_QUIT)) {
   16.31              done = 1;
   16.32          }