Skip to content

Commit 2ffd1b0

Browse files
committed
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.
1 parent 21bebd8 commit 2ffd1b0

File tree

1 file changed

+14
-47
lines changed

1 file changed

+14
-47
lines changed

src/video/wincommon/SDL_sysevents.c

Lines changed: 14 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -438,62 +438,41 @@ LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
438438
break;
439439

440440
case WM_MOUSEMOVE: {
441-
442-
/* Mouse is handled by DirectInput when fullscreen */
443-
if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
444-
Sint16 x, y;
445441

446-
/* mouse has entered the window */
447-
if ( ! in_window ) {
448442
#ifdef WM_MOUSELEAVE
443+
/* No need to handle SDL_APPMOUSEFOCUS when fullscreen */
444+
if ( SDL_VideoSurface && !FULLSCREEN() ) {
445+
/* mouse has entered the window */
446+
447+
if ( !(SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) {
449448
TRACKMOUSEEVENT tme;
450449

451450
tme.cbSize = sizeof(tme);
452451
tme.dwFlags = TME_LEAVE;
453452
tme.hwndTrack = SDL_Window;
454453
_TrackMouseEvent(&tme);
454+
}
455+
}
455456
#endif /* WM_MOUSELEAVE */
456-
in_window = TRUE;
457457

458-
posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
459-
}
458+
/* Mouse motion is handled in DIB_PumpEvents or
459+
* DX5_PumpEvents, depending on the video driver
460+
* in use */
460461

461-
/* mouse has moved within the window */
462-
x = LOWORD(lParam);
463-
y = HIWORD(lParam);
464-
if ( mouse_relative ) {
465-
POINT center;
466-
center.x = (SDL_VideoSurface->w/2);
467-
center.y = (SDL_VideoSurface->h/2);
468-
x -= (Sint16)center.x;
469-
y -= (Sint16)center.y;
470-
if ( x || y ) {
471-
ClientToScreen(SDL_Window, &center);
472-
SetCursorPos(center.x, center.y);
473-
posted = SDL_PrivateMouseMotion(0, 1, x, y);
474-
}
475-
} else {
476-
#ifdef SDL_VIDEO_DRIVER_GAPI
477-
if (SDL_VideoSurface && this->hidden->gapiInfo)
478-
GapiTransform(this->hidden->gapiInfo->coordinateTransform, this->hidden->gapiInfo->hiresFix, &x, &y);
479-
#endif
480-
posted = SDL_PrivateMouseMotion(0, 0, x, y);
481-
}
482-
}
462+
posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
483463
}
484464
return(0);
485465

486466
#ifdef WM_MOUSELEAVE
487467
case WM_MOUSELEAVE: {
488468

489-
/* Mouse is handled by DirectInput when fullscreen */
490-
if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
469+
/* No need to handle SDL_APPMOUSEFOCUS when fullscreen */
470+
if ( SDL_VideoSurface && !FULLSCREEN() ) {
491471
/* mouse has left the window */
492472
/* or */
493473
/* Elvis has left the building! */
494474
posted = SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
495475
}
496-
in_window = FALSE;
497476
}
498477
return(0);
499478
#endif /* WM_MOUSELEAVE */
@@ -571,20 +550,8 @@ LRESULT CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
571550
mouse_pressed = 0;
572551
}
573552
}
574-
if ( mouse_relative ) {
575-
/* RJR: March 28, 2000
576-
report internal mouse position if in relative mode */
577-
x = 0; y = 0;
578-
} else {
579-
x = (Sint16)LOWORD(lParam);
580-
y = (Sint16)HIWORD(lParam);
581-
#ifdef SDL_VIDEO_DRIVER_GAPI
582-
if (SDL_VideoSurface && this->hidden->gapiInfo)
583-
GapiTransform(this->hidden->gapiInfo->coordinateTransform, this->hidden->gapiInfo->hiresFix, &x, &y);
584-
#endif
585-
}
586553
posted = SDL_PrivateMouseButton(
587-
state, button, x, y);
554+
state, button, 0, 0);
588555

589556
/*
590557
* MSDN says:

0 commit comments

Comments
 (0)