Преглед на файлове

Linux: Ignore partial state after SYN_DROPPED

Related to #1005.
Camilla Löwy преди 8 години
родител
ревизия
6da26c8d6c
променени са 2 файла, в които са добавени 15 реда и са изтрити 2 реда
  1. 14 2
      src/linux_joystick.c
  2. 1 0
      src/linux_joystick.h

+ 14 - 2
src/linux_joystick.c

@@ -399,12 +399,24 @@ int _glfwPlatformPollJoystick(int jid, int mode)
             break;
             break;
         }
         }
 
 
+        if (e.type == EV_SYN)
+        {
+            if (e.code == SYN_DROPPED)
+                _glfw.linjs.dropped = GLFW_TRUE;
+            else if (e.code == SYN_REPORT)
+            {
+                _glfw.linjs.dropped = GLFW_FALSE;
+                pollAbsState(js);
+            }
+        }
+
+        if (_glfw.linjs.dropped)
+            continue;
+
         if (e.type == EV_KEY)
         if (e.type == EV_KEY)
             handleKeyEvent(js, e.code, e.value);
             handleKeyEvent(js, e.code, e.value);
         else if (e.type == EV_ABS)
         else if (e.type == EV_ABS)
             handleAbsEvent(js, e.code, e.value);
             handleAbsEvent(js, e.code, e.value);
-        else if (e.type == EV_SYN && e.code == SYN_DROPPED)
-            pollAbsState(js);
     }
     }
 
 
     return js->present;
     return js->present;

+ 1 - 0
src/linux_joystick.h

@@ -50,6 +50,7 @@ typedef struct _GLFWlibraryLinux
     int                     inotify;
     int                     inotify;
     int                     watch;
     int                     watch;
     regex_t                 regex;
     regex_t                 regex;
+    GLFWbool                dropped;
 } _GLFWlibraryLinux;
 } _GLFWlibraryLinux;