From dd0e48b507fd24f948630ca3b6030ce488596284 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 4 May 2026 17:21:48 -0400 Subject: [PATCH] Fix a problem with menu scrolling Resolves: RHEL-85085 --- 0004-menu-scrolling.patch | 47 +++++++++++++++++++++++++++++++++++++++ gtk3.spec | 7 +++++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 0004-menu-scrolling.patch diff --git a/0004-menu-scrolling.patch b/0004-menu-scrolling.patch new file mode 100644 index 0000000..5c10301 --- /dev/null +++ b/0004-menu-scrolling.patch @@ -0,0 +1,47 @@ +From ea162a26c3ce4f8ce2c2c11b12164bd4f71445ac Mon Sep 17 00:00:00 2001 +From: Matthias Clasen +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 + diff --git a/gtk3.spec b/gtk3.spec index feac19c..4a3b22f 100644 --- a/gtk3.spec +++ b/gtk3.spec @@ -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 - 3.24.31-10 +- Resolves: RHEL-85085 + * Mon Apr 20 2026 Carlos Garnacho - 3.24.31-9 - Switch stylus button order to match compositor Resolves: RHEL-146566