Ignore synthetic mouse events generated for touchscreens
authorCameron Gutman <aicommander@gmail.com>
Sun, 07 Jul 2019 11:23:16 -0700
changeset 1293092e72926b7f5
parent 12929 d6c5eb7a0afb
child 12931 881705583f45
Ignore synthetic mouse events generated for touchscreens

Windows generates fake raw mouse events for touchscreens for compatibility
with legacy apps that predate touch support in Windows. We already handle
touch events explicitly, so drop the synthetic events to avoid duplicates.
src/video/windows/SDL_windowsevents.c
     1.1 --- a/src/video/windows/SDL_windowsevents.c	Mon Jul 08 13:41:01 2019 -0400
     1.2 +++ b/src/video/windows/SDL_windowsevents.c	Sun Jul 07 11:23:16 2019 -0700
     1.3 @@ -552,8 +552,8 @@
     1.4  
     1.5              GetRawInputData(hRawInput, RID_INPUT, &inp, &size, sizeof(RAWINPUTHEADER));
     1.6  
     1.7 -            /* Mouse data */
     1.8 -            if (inp.header.dwType == RIM_TYPEMOUSE) {
     1.9 +            /* Mouse data (ignoring synthetic mouse events generated for touchscreens) */
    1.10 +            if (inp.header.dwType == RIM_TYPEMOUSE && (GetMessageExtraInfo() & 0x80) == 0) {
    1.11                  if (isRelative) {
    1.12                      RAWMOUSE* rawmouse = &inp.data.mouse;
    1.13