diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index ff63e99e3..24a499b5f 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -573,6 +573,10 @@ static void SDL_CreateShadowSurface(int depth) #include #endif /* __QNXNTO__ */ +#ifdef WIN32 + extern int sysevents_mouse_pressed; +#endif + /* * Set the requested video mode, allocating a shadow buffer if necessary. */ @@ -586,6 +590,10 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags) int is_opengl; SDL_GrabMode saved_grab; + #ifdef WIN32 + sysevents_mouse_pressed = 0; + #endif + /* Start up the video driver, if necessary.. WARNING: This is the only function protected this way! */ diff --git a/src/video/wincommon/SDL_sysevents.c b/src/video/wincommon/SDL_sysevents.c index cd45f189e..5ce562bed 100644 --- a/src/video/wincommon/SDL_sysevents.c +++ b/src/video/wincommon/SDL_sysevents.c @@ -243,13 +243,14 @@ static BOOL WINAPI WIN_TrackMouseEvent(TRACKMOUSEEVENT *ptme) } #endif /* WM_MOUSELEAVE */ +int sysevents_mouse_pressed = 0; + /* The main Win32 event handler DJM: This is no longer static as (DX5/DIB)_CreateWindow needs it */ LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - SDL_VideoDevice *this = current_video; - static int mouse_pressed = 0; + SDL_VideoDevice *this = current_video; #ifdef WMMSG_DEBUG fprintf(stderr, "Received windows message: "); if ( msg > MAX_WMMSG ) { @@ -426,14 +427,14 @@ LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } if ( state == SDL_PRESSED ) { /* Grab mouse so we get up events */ - if ( ++mouse_pressed > 0 ) { + if ( ++sysevents_mouse_pressed > 0 ) { SetCapture(hwnd); } } else { /* Release mouse after all up events */ - if ( --mouse_pressed <= 0 ) { + if ( --sysevents_mouse_pressed <= 0 ) { ReleaseCapture(); - mouse_pressed = 0; + sysevents_mouse_pressed = 0; } } if ( mouse_relative ) {