mirror of https://github.com/encounter/SDL.git
Bug 4576: remove touch/mouse duplication for Windows
This commit is contained in:
parent
a3f2c446ef
commit
1a4c3b57b7
src/video/windows
|
@ -494,18 +494,20 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
if (!mouse->relative_mode || mouse->relative_mode_warp) {
|
if (!mouse->relative_mode || mouse->relative_mode_warp) {
|
||||||
SDL_MouseID mouseID = (((GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH) ? SDL_TOUCH_MOUSEID : 0);
|
/* Only generate mouse events for real mouse */
|
||||||
SDL_SendMouseMotion(data->window, mouseID, 0, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
if ((GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) != MOUSEEVENTF_FROMTOUCH) {
|
||||||
if (isWin10FCUorNewer && mouseID != SDL_TOUCH_MOUSEID && mouse->relative_mode_warp) {
|
SDL_SendMouseMotion(data->window, 0, 0, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||||
/* To work around #3931, Win10 bug introduced in Fall Creators Update, where
|
if (isWin10FCUorNewer && mouse->relative_mode_warp) {
|
||||||
SetCursorPos() (SDL_WarpMouseInWindow()) doesn't reliably generate mouse events anymore,
|
/* To work around #3931, Win10 bug introduced in Fall Creators Update, where
|
||||||
after each windows mouse event generate a fake event for the middle of the window
|
SetCursorPos() (SDL_WarpMouseInWindow()) doesn't reliably generate mouse events anymore,
|
||||||
if relative_mode_warp is used */
|
after each windows mouse event generate a fake event for the middle of the window
|
||||||
int center_x = 0, center_y = 0;
|
if relative_mode_warp is used */
|
||||||
SDL_GetWindowSize(data->window, ¢er_x, ¢er_y);
|
int center_x = 0, center_y = 0;
|
||||||
center_x /= 2;
|
SDL_GetWindowSize(data->window, ¢er_x, ¢er_y);
|
||||||
center_y /= 2;
|
center_x /= 2;
|
||||||
SDL_SendMouseMotion(data->window, mouseID, 0, center_x, center_y);
|
center_y /= 2;
|
||||||
|
SDL_SendMouseMotion(data->window, 0, 0, center_x, center_y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -525,8 +527,9 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
if (!mouse->relative_mode || mouse->relative_mode_warp) {
|
if (!mouse->relative_mode || mouse->relative_mode_warp) {
|
||||||
SDL_MouseID mouseID = (((GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH) ? SDL_TOUCH_MOUSEID : 0);
|
if ((GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) != MOUSEEVENTF_FROMTOUCH) {
|
||||||
WIN_CheckWParamMouseButtons(wParam, data, mouseID);
|
WIN_CheckWParamMouseButtons(wParam, data, mouseID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue