GNOME Bugzilla – Bug 757269
Allow to make ListBoxRows not grab focus when activated
Last modified: 2015-11-03 12:45:26 UTC
This is just like the existing GtkButton:focus-on-click behavior, except for GtkListBoxRow; instead of adding the property there however, add it to GtkWidget directly following Matthias' suggestion in https://bugzilla.gnome.org/show_bug.cgi?id=756323#c10
Created attachment 314343 [details] [review] widget: Add :focus-on-click property There are currently three widget that implement such a property, and there are other widgets for which the behavior can make sense. It seems like a good time to add the property to GtkWidget itself so subclasses can choose to respect it without adding their own property.
Created attachment 314344 [details] [review] Deprecate widget-specific :focus-on-click properties The differences between the existing properties and the newly added GtkWidget:focus-on-click property are minimal (different owner_type in GParamSpec), so it is extremely unlikely that dropping the former would break anything.
Created attachment 314345 [details] [review] Use gtk_widget_set_focus_on_click() instead of deprecated setters
Created attachment 314346 [details] [review] listbox: Implement :focus-on-click Similar to buttons-in-toolbars, it can make sense for listbox rows to not take away the focus from the main application view, for instance when used for navigation. Support this by taking the newly added GtkWidget:focus-on-click property into account.
Review of attachment 314343 [details] [review]: ::: gtk/gtkwidget.c @@ +1202,3 @@ + * + * Whether the widget should grab focus when it is clicked with the mouse. + * Might want to mention that this property is only relevant for widgets that have can-focus set ? Plus maybe that it is a reincarnation of earlier properties on other widgets, otherwise people might get the wrong message - using g_object_set (button, "focus-on-click", FALSE, NULL) works fine in gtk 2.0, after all...
Review of attachment 314344 [details] [review]: Looks ok to me
Review of attachment 314345 [details] [review]: ok
Review of attachment 314346 [details] [review]: looks right
Review of attachment 314343 [details] [review]: ::: gtk/gtkwidget.c @@ +1211,3 @@ + TRUE, + GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY); + Given that the default is TRUE, this patch is probably missing a hunk to initialize priv->focus_on_click to the initial value.
Pushed with the outlined fixes. Attachment 314343 [details] pushed as ebdf5f5 - widget: Add :focus-on-click property Attachment 314344 [details] pushed as 9a29a27 - Deprecate widget-specific :focus-on-click properties Attachment 314345 [details] pushed as e364ae3 - Use gtk_widget_set_focus_on_click() instead of deprecated setters Attachment 314346 [details] pushed as de50012 - listbox: Implement :focus-on-click