From 2bce91de0bf92e6332252eea748b4a4c1389d62f Mon Sep 17 00:00:00 2001 From: deepend Date: Fri, 30 Jan 2026 16:21:41 -0700 Subject: [PATCH] =?UTF-8?q?Updated=20GTK3=20handling=20in=20setup=5Fcreate?= =?UTF-8?q?=5Fcolor=5Fbutton=20to=20align=20the=20color=20button=E2=80=99s?= =?UTF-8?q?=20child=20widget=20without=20using=20GtkAlignment,=20while=20k?= =?UTF-8?q?eeping=20the=20GTK2=20alignment=20path=20intact.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fe-gtk/setup.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 18163d2f..23bb1259 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -1812,7 +1812,9 @@ setup_create_color_button (GtkWidget *table, int num, int row, int col) GtkWidget *but; GtkWidget *label; GtkWidget *box; +#if !HAVE_GTK3 GtkWidget *alignment; +#endif char buf[64]; if (num > 31) @@ -1829,17 +1831,17 @@ setup_create_color_button (GtkWidget *table, int num, int row, int col) gtk_event_box_set_visible_window (GTK_EVENT_BOX (box), TRUE); gtk_container_add (GTK_CONTAINER (box), label); gtk_container_add (GTK_CONTAINER (but), box); +#if HAVE_GTK3 + gtk_widget_set_halign (box, GTK_ALIGN_CENTER); + gtk_widget_set_valign (box, GTK_ALIGN_CENTER); +#else alignment = gtk_bin_get_child (GTK_BIN (but)); if (GTK_IS_ALIGNMENT (alignment)) { -#if HAVE_GTK3 - gtk_widget_set_halign (alignment, GTK_ALIGN_CENTER); - gtk_widget_set_valign (alignment, GTK_ALIGN_CENTER); -#elif !HAVE_GTK3 gtk_alignment_set (GTK_ALIGNMENT (alignment), 0.5, 0.5, 1.0, 1.0); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 0, 0); -#endif } +#endif gtk_widget_show (label); gtk_widget_show (box); /* win32 build uses this to turn off themeing */