GNOME Bugzilla – Bug 708320
listbox: Update the cursor row when the row's child gets focus
Last modified: 2015-02-12 09:05:39 UTC
See https://bugzilla.redhat.com/show_bug.cgi?id=1009452 for a bug report with a backtrace.
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.
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.
Created attachment 255346 [details] [review] listbox: Don't crash if cursor_row is NULL in real_focus
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
*** Bug 743595 has been marked as a duplicate of this bug. ***
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?
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().
Created attachment 296535 [details] [review] GtkListBoxRow: Update the listbox's cursor row when focusing
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.
Created attachment 296607 [details] [review] GtkListBoxRow: Update the listbox's cursor row when focusing
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.
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.