mirror of
https://github.com/yawut/SDL.git
synced 2026-10-02 05:06:46 -05:00
Fixed bug #611
Comment #22 From Tim Angus 2009-04-02 08:45:52 (-) [reply] ------- First of all, thanks for committing this. Unfortunately it seems the patch has only partially applied to wincommon/SDL_sysevents.c and currently a clean SDL 1.2 checkout doesn't build. The new patch here (http://bugzilla.libsdl.org/attachment.cgi?id=316) fixes this. --HG-- branch : SDL-1.2
This commit is contained in:
@@ -438,62 +438,41 @@ LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
|
||||
case WM_MOUSEMOVE: {
|
||||
|
||||
/* Mouse is handled by DirectInput when fullscreen */
|
||||
if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
|
||||
Sint16 x, y;
|
||||
|
||||
/* mouse has entered the window */
|
||||
if ( ! in_window ) {
|
||||
#ifdef WM_MOUSELEAVE
|
||||
/* No need to handle SDL_APPMOUSEFOCUS when fullscreen */
|
||||
if ( SDL_VideoSurface && !FULLSCREEN() ) {
|
||||
/* mouse has entered the window */
|
||||
|
||||
if ( !(SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) {
|
||||
TRACKMOUSEEVENT tme;
|
||||
|
||||
tme.cbSize = sizeof(tme);
|
||||
tme.dwFlags = TME_LEAVE;
|
||||
tme.hwndTrack = SDL_Window;
|
||||
_TrackMouseEvent(&tme);
|
||||
#endif /* WM_MOUSELEAVE */
|
||||
in_window = TRUE;
|
||||
|
||||
posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
|
||||
}
|
||||
|
||||
/* mouse has moved within the window */
|
||||
x = LOWORD(lParam);
|
||||
y = HIWORD(lParam);
|
||||
if ( mouse_relative ) {
|
||||
POINT center;
|
||||
center.x = (SDL_VideoSurface->w/2);
|
||||
center.y = (SDL_VideoSurface->h/2);
|
||||
x -= (Sint16)center.x;
|
||||
y -= (Sint16)center.y;
|
||||
if ( x || y ) {
|
||||
ClientToScreen(SDL_Window, ¢er);
|
||||
SetCursorPos(center.x, center.y);
|
||||
posted = SDL_PrivateMouseMotion(0, 1, x, y);
|
||||
}
|
||||
} else {
|
||||
#ifdef SDL_VIDEO_DRIVER_GAPI
|
||||
if (SDL_VideoSurface && this->hidden->gapiInfo)
|
||||
GapiTransform(this->hidden->gapiInfo->coordinateTransform, this->hidden->gapiInfo->hiresFix, &x, &y);
|
||||
#endif
|
||||
posted = SDL_PrivateMouseMotion(0, 0, x, y);
|
||||
}
|
||||
}
|
||||
#endif /* WM_MOUSELEAVE */
|
||||
|
||||
/* Mouse motion is handled in DIB_PumpEvents or
|
||||
* DX5_PumpEvents, depending on the video driver
|
||||
* in use */
|
||||
|
||||
posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
|
||||
}
|
||||
return(0);
|
||||
|
||||
#ifdef WM_MOUSELEAVE
|
||||
case WM_MOUSELEAVE: {
|
||||
|
||||
/* Mouse is handled by DirectInput when fullscreen */
|
||||
if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
|
||||
/* No need to handle SDL_APPMOUSEFOCUS when fullscreen */
|
||||
if ( SDL_VideoSurface && !FULLSCREEN() ) {
|
||||
/* mouse has left the window */
|
||||
/* or */
|
||||
/* Elvis has left the building! */
|
||||
posted = SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
|
||||
}
|
||||
in_window = FALSE;
|
||||
}
|
||||
return(0);
|
||||
#endif /* WM_MOUSELEAVE */
|
||||
@@ -571,20 +550,8 @@ LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
mouse_pressed = 0;
|
||||
}
|
||||
}
|
||||
if ( mouse_relative ) {
|
||||
/* RJR: March 28, 2000
|
||||
report internal mouse position if in relative mode */
|
||||
x = 0; y = 0;
|
||||
} else {
|
||||
x = (Sint16)LOWORD(lParam);
|
||||
y = (Sint16)HIWORD(lParam);
|
||||
#ifdef SDL_VIDEO_DRIVER_GAPI
|
||||
if (SDL_VideoSurface && this->hidden->gapiInfo)
|
||||
GapiTransform(this->hidden->gapiInfo->coordinateTransform, this->hidden->gapiInfo->hiresFix, &x, &y);
|
||||
#endif
|
||||
}
|
||||
posted = SDL_PrivateMouseButton(
|
||||
state, button, x, y);
|
||||
state, button, 0, 0);
|
||||
|
||||
/*
|
||||
* MSDN says:
|
||||
|
||||
Reference in New Issue
Block a user