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

Wayland: Fix key repeat continuing when refocused

If a window lost input focus while a key was held down, the key repeat
mechanism would resume once the window regained focus.
Camilla Löwy преди 3 години
родител
ревизия
e24fe4b189
променени са 2 файла, в които са добавени 4 реда и са изтрити 0 реда
  1. 1 0
      README.md
  2. 3 0
      src/wl_init.c

+ 1 - 0
README.md

@@ -280,6 +280,7 @@ information on what to include when reporting a bug.
  - [Wayland] Bugfix: The `O_CLOEXEC` flag was not defined on FreeBSD
  - [Wayland] Bugfix: The `O_CLOEXEC` flag was not defined on FreeBSD
  - [Wayland] Bugfix: Key repeat could lead to a race condition (#1710)
  - [Wayland] Bugfix: Key repeat could lead to a race condition (#1710)
  - [Wayland] Bugfix: Activating a window would emit two input focus events
  - [Wayland] Bugfix: Activating a window would emit two input focus events
+ - [Wayland] Bugfix: Disable key repeat mechanism when window loses input focus
  - [POSIX] Removed use of deprecated function `gettimeofday`
  - [POSIX] Removed use of deprecated function `gettimeofday`
  - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled
  - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled
  - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072)
  - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072)

+ 3 - 0
src/wl_init.c

@@ -508,6 +508,9 @@ static void keyboardHandleLeave(void* data,
     _glfw.wl.serial = serial;
     _glfw.wl.serial = serial;
     _glfw.wl.keyboardFocus = NULL;
     _glfw.wl.keyboardFocus = NULL;
     _glfwInputWindowFocus(window, GLFW_FALSE);
     _glfwInputWindowFocus(window, GLFW_FALSE);
+
+    struct itimerspec timer = {};
+    timerfd_settime(_glfw.wl.timerfd, 0, &timer, NULL);
 }
 }
 
 
 static int toGLFWKeyCode(uint32_t key)
 static int toGLFWKeyCode(uint32_t key)