Compare commits

...

3 Commits

Author SHA1 Message Date
Rémi Bernon
e56ca0c75c
Merge 54ecc8a9f5 into feb2a6b728 2025-07-18 15:43:36 +08:00
Doug Binks
feb2a6b728 Wayland: Reset key repeat timer on window destruction
Windows with keyboard focus may have an active key repeat timer.
This should be reset when the window is closed, or key repeat events
could be sent to a NULL window were it not for the quickfix in PR #2732.

Fixes #2741
Probably the source of #2727
2025-07-17 17:24:19 +02:00
Rémi Bernon
54ecc8a9f5
Explicitly unmap iconified windows before restoring them.
Closes: #2077
2025-02-17 10:55:29 +01:00
4 changed files with 16 additions and 1 deletions

View File

@ -132,6 +132,7 @@ information on what to include when reporting a bug.
- [Wayland] Bugfix: `glfwInit` would segfault on compositor with no seat (#2517)
- [Wayland] Bugfix: A drag entering a non-GLFW surface could cause a segfault
- [Wayland] Bugfix: Ignore key repeat events when no window has keyboard focus (#2727)
- [Wayland] Bugfix: Reset key repeat timer when window destroyed (#2741,#2727)
- [X11] Bugfix: Running without a WM could trigger an assert (#2593,#2601,#2631)
- [Null] Added Vulkan 'window' surface creation via `VK_EXT_headless_surface`
- [Null] Added EGL context creation on Mesa via `EGL_MESA_platform_surfaceless`

View File

@ -2187,7 +2187,12 @@ void _glfwDestroyWindowWayland(_GLFWwindow* window)
_glfw.wl.pointerFocus = NULL;
if (window == _glfw.wl.keyboardFocus)
{
struct itimerspec timer = {0};
timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL);
_glfw.wl.keyboardFocus = NULL;
}
if (window->wl.fractionalScale)
wp_fractional_scale_v1_destroy(window->wl.fractionalScale);

View File

@ -2339,6 +2339,9 @@ void _glfwRestoreWindowX11(_GLFWwindow* window)
if (_glfwWindowIconifiedX11(window))
{
// Some window managers do not unmap iconified windows, and XMapWindow is
// then no-op. Explicitly unmap the window to make sure it gets restored.
XUnmapWindow(_glfw.x11.display, window->x11.handle);
XMapWindow(_glfw.x11.display, window->x11.handle);
waitForVisibilityNotify(window);
}

View File

@ -56,6 +56,8 @@ static void error_callback(int error, const char* description)
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
static GLFWwindow *iconified;
printf("%0.2f Key %s\n",
glfwGetTime(),
action == GLFW_PRESS ? "pressed" : "released");
@ -67,12 +69,15 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
{
case GLFW_KEY_I:
glfwIconifyWindow(window);
iconified = window;
break;
case GLFW_KEY_M:
glfwMaximizeWindow(window);
break;
case GLFW_KEY_R:
if (iconified) window = iconified;
glfwRestoreWindow(window);
iconified = NULL;
break;
case GLFW_KEY_ESCAPE:
glfwSetWindowShouldClose(window, GLFW_TRUE);
@ -253,9 +258,10 @@ int main(int argc, char** argv)
if (fullscreen)
monitor = glfwGetPrimaryMonitor();
window_count = 1;
window_count = 2;
windows = calloc(window_count, sizeof(GLFWwindow*));
windows[0] = create_window(monitor);
windows[1] = create_window(monitor);
}
for (i = 0; i < window_count; i++)