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 762236 - Port atk_focus_tracker_ to the new atk notify system
Port atk_focus_tracker_ to the new atk notify system
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-02-18 08:33 UTC by Carlos Soriano
Modified: 2016-05-03 11:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH 1/2] canvas-item: don't use atk_focus_tracker_notify() (1.14 KB, patch)
2016-04-18 07:03 UTC, Ernestas Kulik
needs-work Details | Review
[PATCH 2/2] canvas-container: don't use atk_focus_tracker_notify() (2.12 KB, patch)
2016-04-18 07:03 UTC, Ernestas Kulik
needs-work Details | Review
canvas-item: use atk_object_notify_state_change() (1.21 KB, patch)
2016-04-25 10:54 UTC, Ernestas Kulik
none Details | Review
canvas-item: use atk_component_get_extents() (1.49 KB, patch)
2016-04-25 10:54 UTC, Ernestas Kulik
committed Details | Review
canvas-container: don't fire state-changed:focused on mouse clicks (1.66 KB, patch)
2016-04-25 10:54 UTC, Ernestas Kulik
none Details | Review
canvas-container: stop using atk_focus_tracker_notify() (1.64 KB, patch)
2016-04-25 10:54 UTC, Ernestas Kulik
none Details | Review
canvas-container: use clear_keyboard_rubberband_start() (1.17 KB, patch)
2016-04-25 10:54 UTC, Ernestas Kulik
none Details | Review
eel-canvas: don't override deprecated functions (2.66 KB, patch)
2016-04-25 10:54 UTC, Ernestas Kulik
committed Details | Review
canvas-item: use atk_object_notify_state_change() (1.13 KB, patch)
2016-04-28 19:18 UTC, Ernestas Kulik
committed Details | Review
canvas-container: rework canvas item focusing (10.14 KB, patch)
2016-04-28 20:03 UTC, Ernestas Kulik
none Details | Review
canvas-container: rework canvas item focusing (10.19 KB, patch)
2016-04-29 11:59 UTC, Ernestas Kulik
committed Details | Review

Description Carlos Soriano 2016-02-18 08:33:23 UTC
The former is deprecated, would be better to port those.
Comment 1 Ernestas Kulik 2016-04-18 07:03:21 UTC
Created attachment 326220 [details] [review]
[PATCH 1/2] canvas-item: don't use atk_focus_tracker_notify()
Comment 2 Ernestas Kulik 2016-04-18 07:03:51 UTC
Created attachment 326221 [details] [review]
[PATCH 2/2] canvas-container: don't use atk_focus_tracker_notify()
Comment 3 Carlos Soriano 2016-04-18 21:44:35 UTC
Review of attachment 326220 [details] [review]:

::: libnautilus-private/nautilus-canvas-item.c
@@ +341,2 @@
 		if (details->is_highlighted_as_keyboard_focus) {
+			atk_object_notify_state_change (accessible, ATK_STATE_FOCUSED, TRUE);

I don't think this is equivalent. You now want to specify the state directly... but you are doing it only for the TRUE state.
Look how is done for PROP_HIGHLIGHTED_FOR_SELECTION
Comment 4 Carlos Soriano 2016-04-18 21:47:37 UTC
Review of attachment 326221 [details] [review]:

I thinks this one looks good, thanks!
Comment 5 Carlos Soriano 2016-04-18 21:48:39 UTC
In any case worth to check with people from accessibility. Could you join their channel #a11y on irc.gnome.org and ask them?
Comment 6 Ernestas Kulik 2016-04-21 12:18:36 UTC
Okay, so the deprecated stuff runs a little deeper, namely, the overriding of add_focus_handler() and remove_focus_handler() (https://git.gnome.org/browse/nautilus/tree/eel/eel-canvas.c#n3637).
Connecting to the “state-change” signal is recommended for tracking, instead of using atk_component_{add,remove}_focus_handler().

Not entirely sure what to make of this.
Comment 7 Ernestas Kulik 2016-04-25 10:54:25 UTC
Created attachment 326673 [details] [review]
canvas-item: use atk_object_notify_state_change()

atk_focus_tracker_notify() has been deprecated since ATK 2.9.4 and using
atk_object_notify_state_change() is recommended.

This commit replaces the call to the deprecated function.
Comment 8 Ernestas Kulik 2016-04-25 10:54:29 UTC
Created attachment 326674 [details] [review]
canvas-item: use atk_component_get_extents()

atk_component_get_position() has been deprecated since ATK 2.12 and
using atk_component_get_extents() is recommended.

This commit replaces calls to the deprecated function.
Comment 9 Ernestas Kulik 2016-04-25 10:54:34 UTC
Created attachment 326675 [details] [review]
canvas-container: don't fire state-changed:focused on mouse clicks

ATK_STATE_FOCUSED indicates keyboard focus and is set erroneously on
mouse clicks. In some cases it is done twice and, since
set_keyboard_focus() already indirectly sets the state, doing so is
redundant.

This commit removes calls to emit_atk_focus_tracker_notify() in
inappropriate places.
Comment 10 Ernestas Kulik 2016-04-25 10:54:38 UTC
Created attachment 326676 [details] [review]
canvas-container: stop using atk_focus_tracker_notify()

atk_focus_tracker_notify() has been deprecated since ATK 2.9.4 and using
atk_object_notify_state_change() is recommended.

This commit replaces the deprecated function call.
Comment 11 Ernestas Kulik 2016-04-25 10:54:42 UTC
Created attachment 326677 [details] [review]
canvas-container: use clear_keyboard_rubberband_start()

The keyboard rubberband start variable is cleared inconsistently.

This commit replaces the occurence of direct manipulation with a
function call.
Comment 12 Ernestas Kulik 2016-04-25 10:54:47 UTC
Created attachment 326678 [details] [review]
eel-canvas: don't override deprecated functions

AtkComponentIface's {add,remove}_focus_handler should not be overridden,
since ATK 2.9.4, as atk_component_{add,remove}_focus_handler() are
deprecated.

This commit removes deprecated virtual function overrides.
Comment 13 Carlos Soriano 2016-04-28 10:42:41 UTC
Review of attachment 326673 [details] [review]:

Makes sense
Comment 14 Carlos Soriano 2016-04-28 10:47:58 UTC
Review of attachment 326674 [details] [review]:

A different approach would be to implement something similar as atk, and merge the position and size handling together.
But seems we do something really specific towards size, so I think this patch is good to go as it is and further improvement doesn't worth the effort given that this will only be use by the desktop soon.
so LGTM
Comment 15 Carlos Soriano 2016-04-28 11:11:25 UTC
Review of attachment 326675 [details] [review]:

I'm not sure why is wrong to set it on mouse clicks, the items get selected no and that means focus for atk right?
Comment 16 Carlos Soriano 2016-04-28 11:12:51 UTC
Review of attachment 326676 [details] [review]:

::: libnautilus-private/nautilus-canvas-container.c
@@ +3338,3 @@
 		
+		emit_atk_object_notify_focused (icon);
+

why is this necessary here now but didn't before? Is because of the previous patch that removed a needed atk_notify?
Comment 17 Carlos Soriano 2016-04-28 11:15:28 UTC
Review of attachment 326677 [details] [review]:

looks good thanks!
Comment 18 Carlos Soriano 2016-04-28 11:17:34 UTC
Review of attachment 326678 [details] [review]:

This one only is fine if the previous ones are also committed right? In any case, looks good once that's the case. Marking as accepted commit now, but only commit when the others are.
Comment 19 Ernestas Kulik 2016-04-28 11:37:21 UTC
(In reply to Carlos Soriano from comment #15)
> Review of attachment 326675 [details] [review] [review]:
> 
> I'm not sure why is wrong to set it on mouse clicks, the items get selected
> no and that means focus for atk right?

state-changed:selected and selection-changed are fired on mouse selection (as with keyboard navigation). The items are still read when clicked, just not when clicked with a modifier (didn’t work with ctrl anyway and without the deprecated atk_focus_tracker_notify(), shift-selection reading stops working properly). The emphasis is put on the keyboard with ATK_STATE_FOCUSED, so I decided to focus (pardon the pun) on the keyboard.

There’s nothing wrong with it per se.

I can consult with #a11y on this one.
Comment 20 Ernestas Kulik 2016-04-28 11:43:47 UTC
(In reply to Carlos Soriano from comment #16)
> Review of attachment 326676 [details] [review] [review]:
> 
> ::: libnautilus-private/nautilus-canvas-container.c
> @@ +3338,3 @@
>  		
> +		emit_atk_object_notify_focused (icon);
> +
> 
> why is this necessary here now but didn't before? Is because of the previous
> patch that removed a needed atk_notify?

Oops, my bad.
Yeah, it’s because I removed the calls in a previous patch.

The purpose of it is so the signal gets emitted, but the focus isn’t drawn.
That’s the way it has been for a while, so I didn’t change the behavior.
Comment 21 Carlos Soriano 2016-04-28 12:19:22 UTC
(In reply to Ernestas Kulik from comment #19)
> (In reply to Carlos Soriano from comment #15)
> > Review of attachment 326675 [details] [review] [review] [review]:
> > 
> > I'm not sure why is wrong to set it on mouse clicks, the items get selected
> > no and that means focus for atk right?
> 
> state-changed:selected and selection-changed are fired on mouse selection
> (as with keyboard navigation). The items are still read when clicked, just

Why is relevant that those signals are emitted? Also, what do you mean with "still read"?

> not when clicked with a modifier (didn’t work with ctrl anyway and without
> the deprecated atk_focus_tracker_notify(), shift-selection reading stops
> working properly). The emphasis is put on the keyboard with
> ATK_STATE_FOCUSED, so I decided to focus (pardon the pun) on the keyboard.

You mean with the patch the shift modifier stop working to select the items?

> 
> There’s nothing wrong with it per se.
> 
> I can consult with #a11y on this one.

I think the problem is me not understanding it more than the patch being not correct or so :)
Comment 22 Carlos Soriano 2016-04-28 12:20:00 UTC
(In reply to Ernestas Kulik from comment #20)
> (In reply to Carlos Soriano from comment #16)
> > Review of attachment 326676 [details] [review] [review] [review]:
> > 
> > ::: libnautilus-private/nautilus-canvas-container.c
> > @@ +3338,3 @@
> >  		
> > +		emit_atk_object_notify_focused (icon);
> > +
> > 
> > why is this necessary here now but didn't before? Is because of the previous
> > patch that removed a needed atk_notify?
> 
> Oops, my bad.
> Yeah, it’s because I removed the calls in a previous patch.
> 
> The purpose of it is so the signal gets emitted, but the focus isn’t drawn.
> That’s the way it has been for a while, so I didn’t change the behavior.

Ah ok, move the code to the patch it belongs and I think it will be fine.
Comment 23 Ernestas Kulik 2016-04-28 12:55:01 UTC
(In reply to Carlos Soriano from comment #21)
> (In reply to Ernestas Kulik from comment #19)
> > (In reply to Carlos Soriano from comment #15)
> > > Review of attachment 326675 [details] [review] [review] [review] [review]:
> > > 
> > > I'm not sure why is wrong to set it on mouse clicks, the items get selected
> > > no and that means focus for atk right?
> > 
> > state-changed:selected and selection-changed are fired on mouse selection
> > (as with keyboard navigation). The items are still read when clicked, just
> 
> Why is relevant that those signals are emitted? Also, what do you mean with
> "still read"?
> 

Ah, yes, I’m talking about Orca.

> > not when clicked with a modifier (didn’t work with ctrl anyway and without
> > the deprecated atk_focus_tracker_notify(), shift-selection reading stops
> > working properly). The emphasis is put on the keyboard with
> > ATK_STATE_FOCUSED, so I decided to focus (pardon the pun) on the keyboard.
> 
> You mean with the patch the shift modifier stop working to select the items?
> 

No, the selection itself is fine. With Orca, if you click an item with the mouse, it’s read fine, but problems arise with modifier keys pressed. Ctrl-clicked items weren’t being focused at all (not as a consequence of a bug), but shift-clicked items are only read sometimes when not using atk_focus_tracker_notify(). The signals are emitted as they should be, so that had me quite confused.

My solution was to simply remove ATK focusing on mouse clicks.

This could be talked over with #a11y.
> > 
> > There’s nothing wrong with it per se.
> > 
> > I can consult with #a11y on this one.
> 
> I think the problem is me not understanding it more than the patch being not
> correct or so :)
Comment 24 Ernestas Kulik 2016-04-28 15:08:47 UTC
Okay, disregard everything. My changes were based on a false premise, so I’ll redo it once more.

Feel free to not commit anything, haha.
Comment 25 Ernestas Kulik 2016-04-28 19:18:29 UTC
Created attachment 326962 [details] [review]
canvas-item: use atk_object_notify_state_change()

Updated for the libnautilus-private merge.
Comment 26 Ernestas Kulik 2016-04-28 20:03:33 UTC
Created attachment 326965 [details] [review]
canvas-container: rework canvas item focusing

So this one does the exact opposite: “fixes“ the mouse focusing.

Previously, only keyboard focus was being tracked. Now, keyboard /and/ mouse focus is being tracked. I added a flag, which indicates whether the focused icon was focused using the keyboard (so it either sets/unsets the “highlighted_as_keyboard_focus” property or the ATK_STATE_FOCUSED state).

I plastered the input handler functions with calls to set_focus(), because it’s somewhat cleaner than extending the selection functions.
Comment 27 Carlos Soriano 2016-04-29 07:25:08 UTC
/me removes newcomers keyword and hides
Comment 28 Carlos Soriano 2016-04-29 07:27:22 UTC
Thanks for taking a deeper look into it. Now I'm even more confused heh.
Let's talk about it on IRC, what do you think?
Comment 29 Ernestas Kulik 2016-04-29 11:59:57 UTC
Created attachment 327012 [details] [review]
canvas-container: rework canvas item focusing
Comment 30 Carlos Soriano 2016-04-29 12:04:12 UTC
Review of attachment 327012 [details] [review]:

LGTM thanks!
Comment 31 Carlos Soriano 2016-04-29 12:05:09 UTC
Review of attachment 326962 [details] [review]:

sure
Comment 32 Carlos Soriano 2016-04-29 12:05:40 UTC
Review of attachment 326962 [details] [review]:

sure
Comment 33 Ernestas Kulik 2016-05-03 10:22:27 UTC
Attachment 326674 [details] pushed as bd73a8e - canvas-item: use atk_component_get_extents()
Attachment 326678 [details] pushed as f3aabd3 - eel-canvas: don't override deprecated functions
Attachment 326962 [details] pushed as 3e498fc - canvas-item: use atk_object_notify_state_change()
Attachment 327012 [details] pushed as dea1979 - canvas-container: rework canvas item focusing