From b0ee5ddfce9a09236e9871882fad6497afcbfe1e Mon Sep 17 00:00:00 2001 From: balooii balooii Date: Thu, 5 Mar 2026 10:37:32 +0100 Subject: [PATCH] Issue #12491: Fix GimpUnitComboBox immediately closing on certain platforms I noticed that the issue of the combo box popup getting immeidately closed on Linux X11 (and probably macOS as well) only happens when using GimpUnitComboBox as used in gimppropwidgets.c and gimpsizeentry.c while there is no issue when used in gimpstatusbar.c The only noticable difference I saw was that in status bar was that the wrap width of combo box was set to 1 via gtk_combo_box_set_wrap_width. Which was added as a hack for another issue. I did the same for the other two uses of GimpUnitComboBox and the issue disappeared so I moved this hack to GimpUnitComboBox itself as it seems to be generally useful. The change doesn't make much sense to me and is a workaround for something that should probably be changed in GTK but well. As explored in !2654 I think we shouldn't use GtkComboBox but reimplement using a Popover. This would get rid of these workarounds as we wouldn't rely on internal behaviour of GtkComboBox. Couldn't test macOS or Windows but Linux X11 and Wayland work just fine. Tested by: GDK_BACKEND=x11 gimp and GDK_BACKEND=wayland gimp Fixes #12491 Superseedes !2654 --- app/display/gimpstatusbar.c | 3 --- libgimpwidgets/gimpunitcombobox.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/display/gimpstatusbar.c b/app/display/gimpstatusbar.c index 3b0fc860bf..8fce29d5b3 100644 --- a/app/display/gimpstatusbar.c +++ b/app/display/gimpstatusbar.c @@ -308,9 +308,6 @@ gimp_statusbar_init (GimpStatusbar *statusbar) statusbar->unit_combo = gimp_unit_combo_box_new_with_model (store); g_object_unref (store); - /* see issue #2642 */ - gtk_combo_box_set_wrap_width (GTK_COMBO_BOX (statusbar->unit_combo), 1); - gtk_widget_set_can_focus (statusbar->unit_combo, FALSE); g_object_set (statusbar->unit_combo, "focus-on-click", FALSE, NULL); gimp_statusbar_add_size_widget (statusbar, statusbar->unit_combo); diff --git a/libgimpwidgets/gimpunitcombobox.c b/libgimpwidgets/gimpunitcombobox.c index c8c0a27751..1f41e3ba10 100644 --- a/libgimpwidgets/gimpunitcombobox.c +++ b/libgimpwidgets/gimpunitcombobox.c @@ -77,6 +77,9 @@ gimp_unit_combo_box_constructed (GObject *object) G_OBJECT_CLASS (parent_class)->constructed (object); gimp_unit_combo_box_popup_shown (combo); + + /* Hack to fix issue #2642 and #12491 */ + gtk_combo_box_set_wrap_width (GTK_COMBO_BOX (combo), 1); } static void