Avoid sending regular mouse messages for touch input
parent
c760c02c6c
commit
0721931f5b
|
@ -75,6 +75,9 @@
|
||||||
#ifndef WM_MOUSEHWHEEL
|
#ifndef WM_MOUSEHWHEEL
|
||||||
#define WM_MOUSEHWHEEL 0x020E
|
#define WM_MOUSEHWHEEL 0x020E
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef WM_POINTERUPDATE
|
||||||
|
#define WM_POINTERUPDATE 0x0245
|
||||||
|
#endif
|
||||||
#ifndef WM_UNICHAR
|
#ifndef WM_UNICHAR
|
||||||
#define WM_UNICHAR 0x0109
|
#define WM_UNICHAR 0x0109
|
||||||
#endif
|
#endif
|
||||||
|
@ -523,12 +526,19 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
returnCode = 0;
|
returnCode = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WM_POINTERUPDATE:
|
||||||
|
{
|
||||||
|
data->last_pointer_update = lParam;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
{
|
{
|
||||||
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) {
|
||||||
/* Only generate mouse events for real mouse */
|
/* Only generate mouse events for real mouse */
|
||||||
if (GetMouseMessageSource() != SDL_MOUSE_EVENT_SOURCE_TOUCH) {
|
if (GetMouseMessageSource() != SDL_MOUSE_EVENT_SOURCE_TOUCH &&
|
||||||
|
lParam != data->last_pointer_update) {
|
||||||
SDL_SendMouseMotion(data->window, 0, 0, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
SDL_SendMouseMotion(data->window, 0, 0, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||||
if (isWin10FCUorNewer && mouse->relative_mode_warp) {
|
if (isWin10FCUorNewer && mouse->relative_mode_warp) {
|
||||||
/* To work around #3931, Win10 bug introduced in Fall Creators Update, where
|
/* To work around #3931, Win10 bug introduced in Fall Creators Update, where
|
||||||
|
@ -563,7 +573,8 @@ 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) {
|
||||||
if (GetMouseMessageSource() != SDL_MOUSE_EVENT_SOURCE_TOUCH) {
|
if (GetMouseMessageSource() != SDL_MOUSE_EVENT_SOURCE_TOUCH &&
|
||||||
|
lParam != data->last_pointer_update) {
|
||||||
WIN_CheckWParamMouseButtons(wParam, data, 0);
|
WIN_CheckWParamMouseButtons(wParam, data, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -589,7 +600,8 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
/* Mouse data (ignoring synthetic mouse events generated for touchscreens) */
|
/* Mouse data (ignoring synthetic mouse events generated for touchscreens) */
|
||||||
if (inp.header.dwType == RIM_TYPEMOUSE) {
|
if (inp.header.dwType == RIM_TYPEMOUSE) {
|
||||||
if (GetMouseMessageSource() == SDL_MOUSE_EVENT_SOURCE_TOUCH) {
|
if (GetMouseMessageSource() == SDL_MOUSE_EVENT_SOURCE_TOUCH ||
|
||||||
|
(GetMessageExtraInfo() & 0x82) == 0x82) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (isRelative) {
|
if (isRelative) {
|
||||||
|
|
|
@ -188,6 +188,7 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool cre
|
||||||
data->hinstance = (HINSTANCE) GetWindowLongPtr(hwnd, GWLP_HINSTANCE);
|
data->hinstance = (HINSTANCE) GetWindowLongPtr(hwnd, GWLP_HINSTANCE);
|
||||||
data->created = created;
|
data->created = created;
|
||||||
data->mouse_button_flags = 0;
|
data->mouse_button_flags = 0;
|
||||||
|
data->last_pointer_update = (LPARAM)-1;
|
||||||
data->videodata = videodata;
|
data->videodata = videodata;
|
||||||
data->initializing = SDL_TRUE;
|
data->initializing = SDL_TRUE;
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ typedef struct
|
||||||
WNDPROC wndproc;
|
WNDPROC wndproc;
|
||||||
SDL_bool created;
|
SDL_bool created;
|
||||||
WPARAM mouse_button_flags;
|
WPARAM mouse_button_flags;
|
||||||
|
LPARAM last_pointer_update;
|
||||||
SDL_bool initializing;
|
SDL_bool initializing;
|
||||||
SDL_bool expected_resize;
|
SDL_bool expected_resize;
|
||||||
SDL_bool in_border_change;
|
SDL_bool in_border_change;
|
||||||
|
|
Loading…
Reference in New Issue