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 689907 - Problems with the management of ATK_STATE_SELECTABLE/ATK_STATE_SELECTED states at AtkObject
Problems with the management of ATK_STATE_SELECTABLE/ATK_STATE_SELECTED state...
Status: RESOLVED FIXED
Product: atk
Classification: Platform
Component: atk
unspecified
Other Linux
: Normal normal
: ---
Assigned To: ATK maintainer(s)
ATK maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-12-08 19:45 UTC by Alejandro Piñeiro Iglesias (IRC: infapi00)
Modified: 2012-12-09 12:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fixes the bug (1.26 KB, patch)
2012-12-09 10:59 UTC, Alejandro Piñeiro Iglesias (IRC: infapi00)
none Details | Review

Description Alejandro Piñeiro Iglesias (IRC: infapi00) 2012-12-08 19:45:53 UTC
At this moment the default implementation of ref_state_set is adding some states. As the summary says, some of them are ATK_STATE_SELECTABLE/ATK_STATE_SELECTED:

 * For any object checks if the parent is an ATK_SELECTION. This interface is implemented by objects like lists.
 * If it is an ATK_SELECTION it add the state ATK_STATE_SELECTABLE *always*
 * Additionally it asks through the atk_selection interface which is the element selected in order to add ATK_STATE_SELECTED if applies

So the implementation assumes that if an object is a list, their children will be always selectable. But this is not always the case. In some cases you could have a list of items enabled, with some of the items enabled and the others not. If some of the list items are not enabled, obviously, you can't select it. One example here [1]. And I really doubt that you couldn't do the same with others.

So I see two options:
a) Remove that code from AtkObject. Assume that at the AtkObject level you can't know a so specific thing, and that should be decided by the specific subclass. This has the problem that although some of the current toolkit implementations are already managing the SELECTABLE/SELECTED thing, some not, so just removing the code could lead to several regressions.

b) Add a new method on atk_selection. In the same way that we have this:
    gboolean atk_selection_is_child_selected (AtkSelection selection, gint i);
Add this one:
    gboolean atk_selection_is_child_selectable (AtkSelection selection, gint i);
So on AtkObject they would use that method to decide if add that state or not. One option to avoid the initial regressions until that method is implemented by all the toolkits would be add a default implementation where child_selectable==TRUE. In the case of [1], they would only need to reimplement atk_selection_is_child_selectable.


Right now I'm not sure whats the best option. b) is less intrusive and regression-prone. a) seems more natural, as AtkObject are supposed to be a abstract/general class, so managing state sets seems somewhat out of scope at that level.

[1] https://bugs.webkit.org/show_bug.cgi?id=98376#c3
Comment 1 Alejandro Piñeiro Iglesias (IRC: infapi00) 2012-12-09 10:00:11 UTC
(In reply to comment #0)

> Right now I'm not sure whats the best option. b) is less intrusive and
> regression-prone. a) seems more natural, as AtkObject are supposed to be a
> abstract/general class, so managing state sets seems somewhat out of scope at
> that level.

After a quick talk with Joanie and after sleeping on this issue, I think that a) is the best solution, and I will work first on this solution. Probably I will ping toolkit developers (mainly gtk) to mention them that some regressions could appear.
Comment 2 Alejandro Piñeiro Iglesias (IRC: infapi00) 2012-12-09 10:59:23 UTC
Created attachment 231060 [details] [review]
Fixes the bug

Trivial patch that implements solution b) mentioned at comment 0
Comment 3 Alejandro Piñeiro Iglesias (IRC: infapi00) 2012-12-09 10:59:52 UTC
(In reply to comment #2)
> Created an attachment (id=231060) [details] [review]
> Fixes the bug
> 
> Trivial patch that implements solution b) mentioned at comment 0

Typo: solution a)
Comment 4 Benjamin Otte (Company) 2012-12-09 11:32:28 UTC
I'm all for it.
I should go through all the GTK accessibles that are affected by this to see if they properly set SELECTABLE/SELECTED.

From a quick grep the SELECTION interface seems to be implemented by menus, notebooks, iconview, treeview and combobox.
Comment 5 Alejandro Piñeiro Iglesias (IRC: infapi00) 2012-12-09 12:51:07 UTC
(In reply to comment #4)
> I'm all for it.

Everybody agrees. So just comitted. Closing bug.

Thanks.