Fix a problem with menu scrolling

Resolves: RHEL-85085
This commit is contained in:
Matthias Clasen 2026-05-04 17:21:48 -04:00 committed by Tomas Popela
parent 2566a9467e
commit dd0e48b507
2 changed files with 53 additions and 1 deletions

47
0004-menu-scrolling.patch Normal file
View File

@ -0,0 +1,47 @@
From ea162a26c3ce4f8ce2c2c11b12164bd4f71445ac Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Fri, 12 Dec 2025 12:21:44 -0500
Subject: [PATCH] menu: Avoid scrolling too far
gtk_menu_scroll_by tries to clamp the offset value to avoid
scrolling too far (unless we are already 'too far').
Unfortunately, the check for whether we are already too far
isn't 100% fool-proof. For example, if the requested height
shrinks, our existing scroll offset may suddenly be 'too far',
and then we let the user scroll the menu content all the
way off screen, which is confusing and disorienting.
The fix in this commit was proposed by Simeon Andreev
of the Eclipse team.
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=564910
---
gtk/gtkmenu.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 500194929b..09e1ee445d 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -4193,12 +4193,13 @@ gtk_menu_scroll_by (GtkMenu *menu,
/* Since arrows are shown, reduce view height even more */
view_height -= arrow_border.bottom;
- if ((priv->scroll_offset + view_height <= priv->requested_height) &&
- (offset + view_height > priv->requested_height))
- offset = priv->requested_height - view_height;
-
if (offset != priv->scroll_offset)
- gtk_menu_scroll_to (menu, offset, GTK_MENU_SCROLL_FLAG_NONE);
+ {
+ offset = CLAMP (offset,
+ MIN (priv->scroll_offset, 0),
+ MAX (priv->scroll_offset, priv->requested_height - view_height));
+ gtk_menu_scroll_to (menu, offset, GTK_MENU_SCROLL_FLAG_NONE);
+ }
}
static gboolean
--
2.53.0

View File

@ -19,7 +19,7 @@
Name: gtk3
Version: 3.24.31
Release: 9%{?dist}
Release: 10%{?dist}
Summary: GTK+ graphical user interface library
License: LGPLv2+
@ -48,6 +48,8 @@ Patch8: 0001-Differentiate-keypad-keysyms-in-accelerators.patch
Patch9: 0002-accellabel-Differentiate-keypad-better.patch
Patch10: 0003-shortcutwindow-Differentiate-keypad-better.patch
Patch11: 0001-gdk-wayland-Switch-behavior-of-BTN_STYLUS-STYLUS2-as.patch
# https://redhat.atlassian.net/browse/RHEL-85085
Patch12: 0004-menu-scrolling.patch
BuildRequires: pkgconfig(atk) >= %{atk_version}
BuildRequires: pkgconfig(atk-bridge-2.0)
@ -315,6 +317,9 @@ gtk-query-immodules-3.0-%{__isa_bits} --update-cache &>/dev/null || :
%{_datadir}/installed-tests/
%changelog
* Mon May 4 2026 Matthias Clasen <mclasen@redhat.com> - 3.24.31-10
- Resolves: RHEL-85085
* Mon Apr 20 2026 Carlos Garnacho <cgarnach@redhat.com> - 3.24.31-9
- Switch stylus button order to match compositor
Resolves: RHEL-146566