From 56edadee66a93d5f5fc4d9b52042afd41c4f6b1c Mon Sep 17 00:00:00 2001 From: Ryan Zhang Date: Fri, 17 Apr 2026 17:35:52 +0800 Subject: [PATCH] fix(wayland): restore focus during window resize On Wayland, when the user resizes a window, the compositor takes over input handling. This causes GLFW to receive a keyboardHandleLeave event, which it incorrectly interprets as the window losing focus. This will result in Platform::update() no longer executed, then the render result is incorrect. This patch forces focus to be restored in the window size callback on Wayland, ensuring that rendering continues during resize operations. Signed-off-by: Ryan Zhang --- framework/platform/glfw_window.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/framework/platform/glfw_window.cpp b/framework/platform/glfw_window.cpp index a3d08eb75b..f183f2d254 100644 --- a/framework/platform/glfw_window.cpp +++ b/framework/platform/glfw_window.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2019-2025, Arm Limited and Contributors +/* Copyright (c) 2019-2026, Arm Limited and Contributors * * SPDX-License-Identifier: Apache-2.0 * @@ -49,6 +49,11 @@ void window_size_callback(GLFWwindow *window, int width, int height) if (auto platform = reinterpret_cast(glfwGetWindowUserPointer(window))) { platform->resize(width, height); + +#if defined(VK_USE_PLATFORM_WAYLAND_KHR) + // On Wayland, window may lose focus during resize. Force focus to ensure rendering continues. + platform->set_focus(true); +#endif } }