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 756323 - Hide focus-indication when interacting with room list using the pointer
Hide focus-indication when interacting with room list using the pointer
Status: RESOLVED FIXED
Product: polari
Classification: Applications
Component: general
3.18.x
Other Linux
: Normal enhancement
: ---
Assigned To: Polari maintainers
Polari maintainers
Depends on: 757269
Blocks:
 
 
Reported: 2015-10-09 22:23 UTC by Bastian Ilsø
Modified: 2015-11-04 00:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screenshot of the polari room having focus indication. (10.80 KB, image/png)
2015-10-09 22:23 UTC, Bastian Ilsø
  Details
roomList: Don't focus room rows when clicked (1.13 KB, patch)
2015-10-28 22:14 UTC, Florian Müllner
committed Details | Review

Description Bastian Ilsø 2015-10-09 22:23:20 UTC
Created attachment 312991 [details]
screenshot of the polari room having focus indication.

If I click on a room in the the roomlist sidebar, then the GTK+'s focus-indication appears (the dashed pattern around the label). We already mark the chosen room blue when clicking on it, so there is no need to also show focus-indication.

In Nautilus the dashes are not visible until you begin to press tab or use arrow keys which makes a lot of sense.
Comment 1 Cody Welsh 2015-10-14 04:18:34 UTC
I played around with reproducing this bug, and it seems to only occur if you interact with the menus using keys first. For example, starting up Polari, I can't produce any dashes with my cursor if I click on rooms. However, if I hit tab to cycle through something, then both the keys and the cursor will invoke focus-indication for the rest of the time Polari is open.
Comment 2 Cody Welsh 2015-10-16 02:24:22 UTC
After chatting in IRC, I built the latest version of Nautilus (which, as Florian pointed out, uses GtkListBox now). It actually exhibits the same behavior in 3.18. Not sure if it's something that should be looked at more generally.
Comment 3 Florian Müllner 2015-10-16 21:17:50 UTC
(In reply to Cody Welsh from comment #2)
> It actually exhibits the same behavior in 3.18.

Mmh, I haven't seen it in nautilus, nor have I looked at its code (yet). However I suspect that it's moving the key focus when displaying a folder.


> Not sure if it's something that should be looked at more
> generally.

Maybe. There are precedents for GtkWidgets to have a :focus-on-click property, maybe it's worth adding something similar to GtkListBox/GtkListBoxRow.
Comment 4 Cody Welsh 2015-10-17 23:48:13 UTC
Yeah, I've been trying to inspect the code a bit; my C is rusty, though ;)

> There are precedents for GtkWidgets to have a :focus-on-click property, maybe > it's worth adding something similar to GtkListBox/GtkListBoxRow.

Is it worth adding custom functionality for this bug, if we're considering putting a :focus-on-click property in the parent row element?
Comment 5 Cody Welsh 2015-10-20 20:44:27 UTC
Actually, I think it's probably worth just comparing the functionality of GtkTreeView versus GtkListBox. I'm not entirely clear as to what the difference is, yet, with regards to keyboard and cursor interaction, however.
Comment 6 Cody Welsh 2015-10-22 08:33:25 UTC
Looking in GtkWidget docs, you can see that the useful properties one might use are read-only:

https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget.style-properties

However, if we want to, we can apply a different CSS style (as is suggested there) - E.G., outline-style: hidden - when we focus from the mouse instead. That would still need for us to listen for keycodes, which we already seem to do as well in the RoomRow definition (although, it seems unrelated):

 92     _onKeyPress: function(w, event) {
 93         let [, keyval] = event.get_keyval();
 94         let [, mods] = event.get_state();
 95         if (keyval != Gdk.KEY_Menu &&
 96             !(keyval == Gdk.KEY_F10 &&
 97               mods & Gdk.ModifierType.SHIFT_MASK))
 98             return Gdk.EVENT_PROPAGATE;
 99  
100         this._popover.show();
101  
102         return Gdk.EVENT_STOP;
103     },

So, I guess the question is, "Do we want to add functionality right now that has a non-zero chance of being deprecated soon?"
Comment 7 Matthias Clasen 2015-10-22 10:50:13 UTC
This is not something that applications are expected to manage manually.
GTK+ should do this for you automatically.
Comment 8 Florian Müllner 2015-10-22 11:18:33 UTC
(In reply to Cody Welsh from comment #6)
> Looking in GtkWidget docs, you can see that the useful properties one might
> use are read-only ...

No. The only acceptable way (IMHO) to implement a focus-on-click == false policy in the app itself is to move the key focus elsewhere, not to mess with GTK+'s focus indication. Well, apart from an actual GtkListBoxRow:focus-on-click property of course. Not sure this is really important enough to be honest, so I think we should make this bug dependent on getting this functionality in GTK+ and just close as WONTFIX if we don't.

Matthias, how do you feel about such a property? Worth writing a patch for that or are the existing property a relict pattern we don't want spreading to newer widgets?
Comment 9 Cody Welsh 2015-10-22 22:13:59 UTC
Oh, now I see what you meant by moving the key focus. If that's the only option, it does seem a little "hacky" for this (in my uneducated opinion), especially if we're going to change it later.
Comment 10 Matthias Clasen 2015-10-23 12:53:39 UTC
(In reply to Florian Müllner from comment #8)
 
> Matthias, how do you feel about such a property? Worth writing a patch for
> that or are the existing property a relict pattern we don't want spreading
> to newer widgets?

We have this property duplicated in 3 widgets already, maybe it is time to move it to GtkWidget and make it generally available.
Comment 11 Florian Müllner 2015-10-28 22:14:22 UTC
Created attachment 314347 [details] [review]
roomList: Don't focus room rows when clicked

When switching to a room by clicking the corresponding row, it is
much more likely that the user wants to take part in the room's
conversation than using keynav to navigate the room list. So don't
steal focus from the entry by setting GtkWidget:focus-on-click
appropriately.
Comment 12 Bastian Ilsø 2015-10-29 07:38:57 UTC
Review of attachment 314347 [details] [review]:

Tried to test it by applying the patches in bug 757269 and this patch and it seems to work nicely.

I do see this output in the terminal though:

[bastian@archxps gtk+]$ jhbuild run polari
Gtk-Message: Failed to load module "canberra-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"

(org.gnome.Polari:30665): Gtk-WARNING **: Allocating size to GtkHeaderBar 0x82c350 without calling gtk_widget_get_preferred_width/height(). How does the code know the size to allocate?

(org.gnome.Polari:30665): tp-logger-CRITICAL **: log_store_pidgin_set_basedir: assertion 'self->priv->basedir == NULL' failed

(org.gnome.Polari:30665): Gtk-CRITICAL **: gtk_widget_draw: assertion '!widget->priv->alloc_needed' failed

(org.gnome.Polari:30665): Gtk-CRITICAL **: gtk_widget_draw: assertion '!widget->priv->alloc_needed' failed

(org.gnome.Polari:30665): Gtk-CRITICAL **: gtk_widget_draw: assertion '!widget->priv->alloc_needed' failed

(org.gnome.Polari:30665): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width 0 and height -4

(org.gnome.Polari:30665): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width -15 and height -3
Comment 13 Florian Müllner 2015-10-29 08:25:26 UTC
(In reply to Bastian Ilsø from comment #12)
> I do see this output in the terminal though

There have been various allocation-related changes on gtk master (https://git.gnome.org/browse/gtk+/commit?id=6866d1c06e338 for instance). It's something we need to look into of course, but unrelated to the patches here and the corresponding gtk+ bug.
Comment 14 Florian Müllner 2015-11-04 00:49:09 UTC
Attachment 314347 [details] pushed as 56f0f9a - roomList: Don't focus room rows when clicked