Commit 0329e5fd authored by Sam Lantinga's avatar Sam Lantinga

Fixed double-mouse event bug on Windows using OpenGL

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%4014
parent a42b4fe1
...@@ -16,6 +16,7 @@ be found at the <A HREF="http://www.libsdl.org/"> main SDL page</A>. ...@@ -16,6 +16,7 @@ be found at the <A HREF="http://www.libsdl.org/"> main SDL page</A>.
Major changes since SDL 1.0.0: Major changes since SDL 1.0.0:
</H2> </H2>
<UL> <UL>
<LI> 1.2.1: Fixed double-mouse event bug on Windows using OpenGL
<LI> 1.2.1: Fixed 320x200 video mode on framebuffer console <LI> 1.2.1: Fixed 320x200 video mode on framebuffer console
<LI> 1.2.1: Improved robustness for the ELO touchpad (thanks Alex!) <LI> 1.2.1: Improved robustness for the ELO touchpad (thanks Alex!)
<LI> 1.2.1: Added support for building under Cygwin on Windows <LI> 1.2.1: Added support for building under Cygwin on Windows
......
...@@ -35,13 +35,19 @@ static char rcsid = ...@@ -35,13 +35,19 @@ static char rcsid =
/* Hidden "this" pointer for the video functions */ /* Hidden "this" pointer for the video functions */
#define _THIS SDL_VideoDevice *this #define _THIS SDL_VideoDevice *this
#define DIRECTX_FULLSCREEN() \ #define DDRAW_FULLSCREEN() \
( \ ( \
((SDL_VideoSurface->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) && \ ((SDL_VideoSurface->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) && \
((SDL_VideoSurface->flags & SDL_OPENGL ) != SDL_OPENGL ) && \ ((SDL_VideoSurface->flags & SDL_OPENGL ) != SDL_OPENGL ) && \
(strcmp(this->name, "directx") == 0) \ (strcmp(this->name, "directx") == 0) \
) )
#define DINPUT_FULLSCREEN() \
( \
((SDL_VideoSurface->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) && \
(strcmp(this->name, "directx") == 0) \
)
/* The main window -- and a function to set it for the audio */ /* The main window -- and a function to set it for the audio */
extern const char *SDL_Appname; extern const char *SDL_Appname;
extern HINSTANCE SDL_Instance; extern HINSTANCE SDL_Instance;
......
...@@ -200,7 +200,7 @@ static LONG CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara ...@@ -200,7 +200,7 @@ static LONG CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
case WM_MOUSEMOVE: { case WM_MOUSEMOVE: {
/* Mouse is handled by DirectInput when fullscreen */ /* Mouse is handled by DirectInput when fullscreen */
if ( SDL_VideoSurface && ! DIRECTX_FULLSCREEN() ) { if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
Sint16 x, y; Sint16 x, y;
/* mouse has entered the window */ /* mouse has entered the window */
...@@ -243,7 +243,7 @@ static LONG CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara ...@@ -243,7 +243,7 @@ static LONG CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
case WM_MOUSELEAVE: { case WM_MOUSELEAVE: {
/* Mouse is handled by DirectInput when fullscreen */ /* Mouse is handled by DirectInput when fullscreen */
if ( SDL_VideoSurface && ! DIRECTX_FULLSCREEN() ) { if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
/* mouse has left the window */ /* mouse has left the window */
/* or */ /* or */
/* Elvis has left the building! */ /* Elvis has left the building! */
...@@ -261,7 +261,7 @@ static LONG CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara ...@@ -261,7 +261,7 @@ static LONG CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
case WM_RBUTTONUP: { case WM_RBUTTONUP: {
/* Mouse is handled by DirectInput when fullscreen */ /* Mouse is handled by DirectInput when fullscreen */
if ( SDL_VideoSurface && ! DIRECTX_FULLSCREEN() ) { if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
Sint16 x, y; Sint16 x, y;
Uint8 button, state; Uint8 button, state;
......
...@@ -192,7 +192,7 @@ int WIN_ShowWMCursor(_THIS, WMcursor *cursor) ...@@ -192,7 +192,7 @@ int WIN_ShowWMCursor(_THIS, WMcursor *cursor)
POINT mouse_pos; POINT mouse_pos;
/* The fullscreen cursor must be done in software with DirectInput */ /* The fullscreen cursor must be done in software with DirectInput */
if ( !this->screen || DIRECTX_FULLSCREEN() ) { if ( !this->screen || DDRAW_FULLSCREEN() ) {
return(0); return(0);
} }
...@@ -213,7 +213,7 @@ void WIN_WarpWMCursor(_THIS, Uint16 x, Uint16 y) ...@@ -213,7 +213,7 @@ void WIN_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
{ {
POINT pt; POINT pt;
if ( DIRECTX_FULLSCREEN() ) { if ( DDRAW_FULLSCREEN() ) {
x += (this->screen->offset % this->screen->pitch) / x += (this->screen->offset % this->screen->pitch) /
this->screen->format->BytesPerPixel; this->screen->format->BytesPerPixel;
y += (this->screen->offset / this->screen->pitch); y += (this->screen->offset / this->screen->pitch);
...@@ -237,7 +237,7 @@ void WIN_UpdateMouse(_THIS) ...@@ -237,7 +237,7 @@ void WIN_UpdateMouse(_THIS)
RECT rect; RECT rect;
POINT pt; POINT pt;
if ( ! DIRECTX_FULLSCREEN() ) { if ( ! DDRAW_FULLSCREEN() ) {
GetClientRect(SDL_Window, &rect); GetClientRect(SDL_Window, &rect);
GetCursorPos(&pt); GetCursorPos(&pt);
MapWindowPoints(NULL, SDL_Window, &pt, 1); MapWindowPoints(NULL, SDL_Window, &pt, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment