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 708320 - listbox: Update the cursor row when the row's child gets focus
listbox: Update the cursor row when the row's child gets focus
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 743595 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-09-18 17:56 UTC by Rui Matos
Modified: 2015-02-12 09:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
listbox: Update the cursor row when the row's child gets focus (1.95 KB, patch)
2013-09-18 17:56 UTC, Rui Matos
none Details | Review
listbox: Don't crash if cursor_row is NULL in real_focus (1.43 KB, patch)
2013-09-19 20:37 UTC, Alexander Larsson
committed Details | Review
GtkListBoxRow: Update the listbox's cursor row when focusing (1.54 KB, patch)
2015-01-31 16:08 UTC, Timm Bäder
none Details | Review
GtkListBoxRow: Update the listbox's cursor row when focusing (1.73 KB, patch)
2015-02-10 19:12 UTC, Timm Bäder
none Details | Review
GtkListBoxRow: Update the listbox's cursor row when focusing (1.83 KB, patch)
2015-02-11 14:52 UTC, Timm Bäder
none Details | Review

Description Rui Matos 2013-09-18 17:56:38 UTC
See https://bugzilla.redhat.com/show_bug.cgi?id=1009452 for a bug
report with a backtrace.
Comment 1 Rui Matos 2013-09-18 17:56:40 UTC
Created attachment 255239 [details] [review]
listbox: Update the cursor row when the row's child gets focus

This avoids a crash on key navigation in gtk_list_box_real_focus()
due to an uninitialized cursor row.
Comment 2 Alexander Larsson 2013-09-19 20:22:40 UTC
I don't think that is quite right. It intercepts 3rd party focus grabs for child or rows only, not for the row itself. Plus it needs to update the a11y state. I'm checking in a patch that will fix the crash reported, but yeah i think something like this will also be necessary.
Comment 3 Alexander Larsson 2013-09-19 20:37:46 UTC
Created attachment 255346 [details] [review]
listbox: Don't crash if cursor_row is NULL in real_focus
Comment 4 Alexander Larsson 2013-09-19 20:38:12 UTC
Comment on attachment 255346 [details] [review]
listbox: Don't crash if cursor_row is NULL in real_focus

Attachment 255346 [details] pushed as 7b7b8ea - listbox: Don't crash if cursor_row is NULL in real_focus
Comment 5 Matthias Clasen 2015-01-31 04:55:08 UTC
*** Bug 743595 has been marked as a duplicate of this bug. ***
Comment 6 Timm Bäder 2015-01-31 16:08:30 UTC
Created attachment 295856 [details] [review]
GtkListBoxRow: Update the listbox's cursor row when focusing

Would this be sufficient for updating the GtkListBox's cursor_row when gtk_widget_grab_focus is called on one of its rows?
Comment 7 Alexander Larsson 2015-02-10 13:09:42 UTC
Its a bit weird to do it twice when you call gtk_list_box_update_cursor().

I think instead we should *move* these calls:
  BOX_PRIV (box)->cursor_row = row;
  gtk_widget_queue_draw (GTK_WIDGET (row));
  _gtk_list_box_accessible_update_cursor (box, row);

into grab_focus.

Then keep the ensure_row_visible () in gtk_list_box_update_cursor(), because I don't think we scrolling is meant to be affected by grab_focus().
Comment 8 Timm Bäder 2015-02-10 19:12:23 UTC
Created attachment 296535 [details] [review]
GtkListBoxRow: Update the listbox's cursor row when focusing
Comment 9 Alexander Larsson 2015-02-11 09:44:59 UTC
You want to also remove the:
  BOX_PRIV (box)->cursor_row = row;
from update_cursor.

Also, you should call the parent implementation before calling the accessible to get the same behaviour as before.
Comment 10 Timm Bäder 2015-02-11 14:52:21 UTC
Created attachment 296607 [details] [review]
GtkListBoxRow: Update the listbox's cursor row when focusing
Comment 11 Alexander Larsson 2015-02-12 08:50:22 UTC
Hmm, actually this is a bit problematic. The gtk_widget_grab_focus() returns early if the row is insensitive, which means with the above patch that we can't key navigate over an insenstive row.
Comment 12 Alexander Larsson 2015-02-12 09:05:39 UTC
git-bz is broken, but i pushed a different fix that solves the insensitive issue here:

https://git.gnome.org/browse/gtk+/commit/?id=9141eeb60e29082d58036f9dd4bafdb052afcd69

It actually makes grab_focus() always make the focused widget visible, but I think thats probably what you want really (and what we always did previously when managing focus with keynav). And additionally, this makes sure the header is visible too which is hard to do otherwise.