From e5d39aca316acecc23af6a1aed709c0e4c755777 Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Sun, 13 Apr 2025 12:57:07 +0000 Subject: [PATCH] libgimpwidgets: Use arrows for GimpSpinScale cursors The "grabbing" cursor currently used is quite large on newer versions of GTK3, and makes it difficult for users to see where they're grabbing. This patch switches to using "pointer" cursor for hovering over the slider area, and "col-resize" when actually moving the slider. It also reverts padding changes in CSS so that the progress bar aligns with the place the user clicks. Padding is added in Cairo for the label, though the number entry is now flush against the input buttons. (cherry picked from commit 9a1984a7078746b38787d20eac2e26e29a268d61) --- libgimpwidgets/gimpspinscale.c | 11 ++++------- themes/Default/common.css | 4 ++-- themes/System/gimp.css | 4 ++-- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/libgimpwidgets/gimpspinscale.c b/libgimpwidgets/gimpspinscale.c index 3404625ad8..2c127a5db8 100644 --- a/libgimpwidgets/gimpspinscale.c +++ b/libgimpwidgets/gimpspinscale.c @@ -425,9 +425,9 @@ gimp_spin_scale_draw (GtkWidget *widget, gtk_entry_get_layout_offsets (GTK_ENTRY (widget), NULL, &layout_offset_y); if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) - layout_offset_x = text_area.x + text_area.width - ink.width - 2; + layout_offset_x = text_area.x + text_area.width - ink.width - 6; else - layout_offset_x = text_area.x + 2; + layout_offset_x = text_area.x + 6; layout_offset_x -= ink.x; @@ -632,7 +632,7 @@ static void gimp_spin_scale_update_cursor (GtkWidget *widget, GdkWindow *window) { - GimpSpinScale *scale = GIMP_SPIN_SCALE (widget); + GimpSpinScale *scale = GIMP_SPIN_SCALE (widget); GdkDisplay *display = gtk_widget_get_display (widget); GdkCursor *cursor = NULL; @@ -643,13 +643,10 @@ gimp_spin_scale_update_cursor (GtkWidget *widget, break; case TARGET_GRAB: - cursor = gdk_cursor_new_from_name (display, "grab"); + cursor = gdk_cursor_new_from_name (display, "pointer"); break; case TARGET_GRABBING: - cursor = gdk_cursor_new_from_name (display, "grabbing"); - break; - case TARGET_RELATIVE: cursor = gdk_cursor_new_from_name (display, "col-resize"); break; diff --git a/themes/Default/common.css b/themes/Default/common.css index b07af2ca46..ba30e2931e 100644 --- a/themes/Default/common.css +++ b/themes/Default/common.css @@ -561,7 +561,7 @@ GimpSpinScale entry { border-radius: 5px 0px 0px 5px; border-right-width: 0px; box-shadow: none; - padding: 0px 8px 0px 5px; + padding: 0px; } GimpSpinScale entry progress { @@ -569,7 +569,7 @@ GimpSpinScale entry progress { background-image: none; border-width: 0px; border-radius: 3px 0px 0px 3px; - margin: 0px -8px 0px -5px; + margin: 0px; } GimpSpinScale button { diff --git a/themes/System/gimp.css b/themes/System/gimp.css index 98a2cfb118..6324c12201 100644 --- a/themes/System/gimp.css +++ b/themes/System/gimp.css @@ -111,14 +111,14 @@ spinbutton entry { GimpSpinScale entry { /* Important: prevent overhigh spin scale */ min-height: 16px; - padding: 0px 8px 0px 5px; + padding: 0px; } GimpSpinScale entry progress { background-color: @theme_selected_bg_color; border-width: 0px; border-radius: 3px; - margin: 0px -8px 0px -5px; + margin: 0px; } GimpSpinScale button {