From 7de298dbd360432c8d1cebd3093e36bf39fa7a7d Mon Sep 17 00:00:00 2001 From: AlmaLinux RelEng Bot Date: Mon, 24 Aug 2026 09:09:11 -0400 Subject: [PATCH] import CS gtk3-3.24.31-11.el9 --- ...ch-behavior-of-BTN_STYLUS-STYLUS2-as.patch | 38 +++++++++++ SOURCES/0004-menu-scrolling.patch | 47 +++++++++++++ SOURCES/0005-socket-sanity-check.patch | 27 ++++++++ SOURCES/0006-drag-finish-crash.patch | 66 +++++++++++++++++++ SOURCES/0007-drag-finish-crash2.patch | 12 ++++ SPECS/gtk3.spec | 20 +++++- 6 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 SOURCES/0001-gdk-wayland-Switch-behavior-of-BTN_STYLUS-STYLUS2-as.patch create mode 100644 SOURCES/0004-menu-scrolling.patch create mode 100644 SOURCES/0005-socket-sanity-check.patch create mode 100644 SOURCES/0006-drag-finish-crash.patch create mode 100644 SOURCES/0007-drag-finish-crash2.patch diff --git a/SOURCES/0001-gdk-wayland-Switch-behavior-of-BTN_STYLUS-STYLUS2-as.patch b/SOURCES/0001-gdk-wayland-Switch-behavior-of-BTN_STYLUS-STYLUS2-as.patch new file mode 100644 index 0000000..23481a6 --- /dev/null +++ b/SOURCES/0001-gdk-wayland-Switch-behavior-of-BTN_STYLUS-STYLUS2-as.patch @@ -0,0 +1,38 @@ +From e205bdaa89342bb1d47527be0cdfbc1bfb0f5f59 Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Wed, 5 Jul 2023 16:24:03 +0200 +Subject: [PATCH] gdk/wayland: Switch behavior of BTN_STYLUS/STYLUS2 as + middle/right click + +This mapping of stylus evdev input event codes into GDK button numbers +makes gdk/wayland inconsistent with gdk/x11, so depending on the backend +the same button middle-click pastes or right-click pops up menus. + +Make the wayland backend consistent with X11, so that a GNOME wayland +session gets these buttons consistently mapped across all kinds of +clients. + +(cherry-picked from commit e28ff79bec53ecd56885390ba4a66019cde598c6) +--- + gdk/wayland/gdkdevice-wayland.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c +index a1e4771a74..38c2e61efa 100644 +--- a/gdk/wayland/gdkdevice-wayland.c ++++ b/gdk/wayland/gdkdevice-wayland.c +@@ -3963,9 +3963,9 @@ tablet_tool_handle_button (void *data, + tablet->pointer_info.press_serial = serial; + + if (button == BTN_STYLUS) +- n_button = GDK_BUTTON_SECONDARY; +- else if (button == BTN_STYLUS2) + n_button = GDK_BUTTON_MIDDLE; ++ else if (button == BTN_STYLUS2) ++ n_button = GDK_BUTTON_SECONDARY; + else if (button == BTN_STYLUS3) + n_button = 8; /* Back */ + else +-- +2.53.0 + diff --git a/SOURCES/0004-menu-scrolling.patch b/SOURCES/0004-menu-scrolling.patch new file mode 100644 index 0000000..5c10301 --- /dev/null +++ b/SOURCES/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/SOURCES/0005-socket-sanity-check.patch b/SOURCES/0005-socket-sanity-check.patch new file mode 100644 index 0000000..2c06497 --- /dev/null +++ b/SOURCES/0005-socket-sanity-check.patch @@ -0,0 +1,27 @@ +From 1d29335cbfbd4a6d3c39664c68145a7966fdbd14 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ga=C3=ABl=20Bonithon?= +Date: Sat, 3 Feb 2024 22:33:57 +0100 +Subject: [PATCH] gtksocket: Fix wrong sanity check + +This avoids a critical warning from gtk_widget_get_parent() if +focus_widget == NULL. +--- + gtk/gtksocket.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gtk/gtksocket.c b/gtk/gtksocket.c +index ffdaf8bee4..7b87b4d806 100644 +--- a/gtk/gtksocket.c ++++ b/gtk/gtksocket.c +@@ -1260,7 +1260,7 @@ gtk_socket_advance_toplevel_focus (GtkSocket *socket, + } + + focus_widget = gtk_window_get_focus (window); +- if (window) ++ if (focus_widget) + { + /* Wrapped off the end, clear the focus setting for the toplevel */ + parent = gtk_widget_get_parent (focus_widget); +-- +2.53.0 + diff --git a/SOURCES/0006-drag-finish-crash.patch b/SOURCES/0006-drag-finish-crash.patch new file mode 100644 index 0000000..9efc3b9 --- /dev/null +++ b/SOURCES/0006-drag-finish-crash.patch @@ -0,0 +1,66 @@ +From 34c12e4885dcb712272c441941234187cb131bc3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ga=C3=ABl=20Bonithon?= +Date: Sun, 10 Dec 2023 10:17:00 +0100 +Subject: [PATCH] gtkdnd: Keep a reference on destination drag context + +If we don't keep a reference on it, it is released somewhere before +gtk_drag_abort_timeout is called. This can cause a crash e.g. when the +dnd takes place in the GtkSocket/GtkPlug framework. + +Fixes: #7128 +--- + gtk/gtkdnd.c | 18 +++++++++++++++--- + 1 file changed, 15 insertions(+), 3 deletions(-) + +diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c +index a660f4db21..d2bc74f26c 100644 +--- a/gtk/gtkdnd.c ++++ b/gtk/gtkdnd.c +@@ -2666,6 +2666,8 @@ gtk_drag_drop (GtkDragSourceInfo *info, + { + if (info->icon_window) + gtk_widget_hide (info->icon_window); ++ if (info->proxy_dest) ++ g_object_ref (info->proxy_dest->context); + + gdk_drag_drop (info->context, time); + info->drop_timeout = gdk_threads_add_timeout (DROP_ABORT_TIME, +@@ -2814,7 +2816,11 @@ gtk_drag_source_info_destroy (GtkDragSourceInfo *info) + gtk_target_list_unref (info->target_list); + + if (info->drop_timeout) +- g_source_remove (info->drop_timeout); ++ { ++ g_source_remove (info->drop_timeout); ++ if (info->proxy_dest) ++ g_object_unref (info->proxy_dest->context); ++ } + + if (info->update_idle) + g_source_remove (info->update_idle); +@@ -3260,14 +3266,20 @@ static gboolean + gtk_drag_abort_timeout (gpointer data) + { + GtkDragSourceInfo *info = data; ++ GdkDragContext *context = NULL; + guint32 time = GDK_CURRENT_TIME; + + if (info->proxy_dest) +- time = info->proxy_dest->proxy_drop_time; ++ { ++ time = info->proxy_dest->proxy_drop_time; ++ context = info->proxy_dest->context; ++ } + + info->drop_timeout = 0; + gtk_drag_drop_finished (info, GTK_DRAG_RESULT_TIMEOUT_EXPIRED, time); +- ++ ++ g_clear_object (&context); ++ + return FALSE; + } + +-- +2.53.0 + diff --git a/SOURCES/0007-drag-finish-crash2.patch b/SOURCES/0007-drag-finish-crash2.patch new file mode 100644 index 0000000..dd80607 --- /dev/null +++ b/SOURCES/0007-drag-finish-crash2.patch @@ -0,0 +1,12 @@ +diff -up gtk+-3.24.31/gtk/gtkdnd.c.orig gtk+-3.24.31/gtk/gtkdnd.c +--- gtk+-3.24.31/gtk/gtkdnd.c.orig 2026-08-10 10:23:57.895270407 -0400 ++++ gtk+-3.24.31/gtk/gtkdnd.c 2026-08-10 10:24:35.178049818 -0400 +@@ -2761,7 +2761,7 @@ static void + gtk_drag_source_info_free (GtkDragSourceInfo *info) + { + gtk_drag_remove_icon (info); +- gtk_widget_destroy (info->icon_window); ++ g_clear_pointer (&info->icon_window, gtk_widget_destroy); + g_free (info); + } + diff --git a/SPECS/gtk3.spec b/SPECS/gtk3.spec index f1b653f..39617b0 100644 --- a/SPECS/gtk3.spec +++ b/SPECS/gtk3.spec @@ -19,7 +19,7 @@ Name: gtk3 Version: 3.24.31 -Release: 8%{?dist} +Release: 11%{?dist} Summary: GTK+ graphical user interface library License: LGPLv2+ @@ -47,6 +47,13 @@ Patch7: remove-size-allocation-critical.patch 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 +# https://redhat.atlassian.net/browse/RHEL-151642 +Patch13: 0005-socket-sanity-check.patch +Patch14: 0006-drag-finish-crash.patch +Patch15: 0007-drag-finish-crash2.patch BuildRequires: pkgconfig(atk) >= %{atk_version} BuildRequires: pkgconfig(atk-bridge-2.0) @@ -314,6 +321,17 @@ gtk-query-immodules-3.0-%{__isa_bits} --update-cache &>/dev/null || : %{_datadir}/installed-tests/ %changelog +* Mon Aug 10 2026 Matthias Clasen - 3.24.31-11 +- Resolves: RHEL-151642 + +* Mon May 4 2026 Matthias Clasen - 3.24.31-10 +- Resolves: RHEL-85085 +- Resolves: RHEL-151642 + +* Mon Apr 20 2026 Carlos Garnacho - 3.24.31-9 +- Switch stylus button order to match compositor + Resolves: RHEL-146566 + * Tue Jul 2 2025 Matthias Clasen - 3.24.31-8 - Resolves: RHEL-4098