From 161fb1b6f6adaf92a88a922bb2d974fb62e911d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 18 Jul 2025 16:35:57 +0200 Subject: [PATCH] Wayland: Fix fallback decoration scroll events The fallback decorations would emit scroll events as if scrolling had occurred over the content area of the window. --- README.md | 1 + src/wl_window.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a3fd32b2..d1be3141 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,7 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: Keyboard leave event handler now processes key repeats (#2736) - [Wayland] Bugfix: Retrieved cursor position would be incorrect when hovering over fallback decorations + - [Wayland] Bugfix: Fallback decorations would report scroll events - [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` diff --git a/src/wl_window.c b/src/wl_window.c index 134ef6d1..0a6a8543 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1636,11 +1636,14 @@ static void pointerHandleAxis(void* userData, if (!window) return; - // NOTE: 10 units of motion per mouse wheel step seems to be a common ratio - if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) - _glfwInputScroll(window, -wl_fixed_to_double(value) / 10.0, 0.0); - else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL) - _glfwInputScroll(window, 0.0, -wl_fixed_to_double(value) / 10.0); + if (window->wl.hovered) + { + // NOTE: 10 units of motion per mouse wheel step seems to be a common ratio + if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) + _glfwInputScroll(window, -wl_fixed_to_double(value) / 10.0, 0.0); + else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL) + _glfwInputScroll(window, 0.0, -wl_fixed_to_double(value) / 10.0); + } } static const struct wl_pointer_listener pointerListener =