Issue #11998: do not steal focus from spin widget when double clicking

This commit is contained in:
Lukas Oberhuber 2026-02-21 13:48:03 +00:00
parent 06fafe6f71
commit cb730621e6
2 changed files with 14 additions and 4 deletions

View file

@ -445,10 +445,16 @@ gimp_toolbox_button_press_event (GtkWidget *widget,
} }
else if ((display = gimp_context_get_display (toolbox->p->context))) else if ((display = gimp_context_get_display (toolbox->p->context)))
{ {
/* Any button event in empty spaces or the Wilber area gives focus GtkWidget *event_widget = gtk_get_event_widget ((GdkEvent *) event);
* to the top image.
/* Give focus to the top image for clicks on non-editable areas
* (Issue #6869), but not when the click is on an editable input
* widget like a spin scale stealing focus from those prevents
* text editing (Issue #11998).
*/ */
gimp_display_grab_focus (display); if (! GTK_IS_EDITABLE (event_widget) &&
! gtk_widget_get_ancestor (event_widget, GTK_TYPE_EDITABLE))
gimp_display_grab_focus (display);
} }
return stop_event; return stop_event;

View file

@ -844,7 +844,11 @@ gimp_spin_scale_button_press (GtkWidget *widget,
case TARGET_NUMBER: case TARGET_NUMBER:
gtk_widget_grab_focus (widget); gtk_widget_grab_focus (widget);
return TRUE; /* Fall through to the parent handler so that GtkEntry processes
* the click event for cursor placement, double-click word
* selection, etc.
*/
break;
default: default:
break; break;