After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 757269 - Allow to make ListBoxRows not grab focus when activated
Allow to make ListBoxRows not grab focus when activated
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 756323
 
 
Reported: 2015-10-28 21:35 UTC by Florian Müllner
Modified: 2015-11-03 12:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
widget: Add :focus-on-click property (5.25 KB, patch)
2015-10-28 21:35 UTC, Florian Müllner
committed Details | Review
Deprecate widget-specific :focus-on-click properties (14.42 KB, patch)
2015-10-28 21:35 UTC, Florian Müllner
committed Details | Review
Use gtk_widget_set_focus_on_click() instead of deprecated setters (6.03 KB, patch)
2015-10-28 21:35 UTC, Florian Müllner
committed Details | Review
listbox: Implement :focus-on-click (3.46 KB, patch)
2015-10-28 21:36 UTC, Florian Müllner
committed Details | Review

Description Florian Müllner 2015-10-28 21:35:33 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
Comment 1 Florian Müllner 2015-10-28 21:35:38 UTC
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.
Comment 2 Florian Müllner 2015-10-28 21:35:47 UTC
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.
Comment 3 Florian Müllner 2015-10-28 21:35:54 UTC
Created attachment 314345 [details] [review]
Use gtk_widget_set_focus_on_click() instead of deprecated setters
Comment 4 Florian Müllner 2015-10-28 21:36:02 UTC
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.
Comment 5 Matthias Clasen 2015-10-29 16:29:54 UTC
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...
Comment 6 Matthias Clasen 2015-10-29 18:27:04 UTC
Review of attachment 314344 [details] [review]:

Looks ok to me
Comment 7 Matthias Clasen 2015-10-29 18:27:49 UTC
Review of attachment 314345 [details] [review]:

ok
Comment 8 Matthias Clasen 2015-10-29 18:29:32 UTC
Review of attachment 314346 [details] [review]:

looks right
Comment 9 Matthias Clasen 2015-10-29 18:30:50 UTC
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.
Comment 10 Matthias Clasen 2015-11-03 12:45:08 UTC
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