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 657578 - Toggling the state of a GtkCheckButton causes accessible window activate and deactivate signals to be emitted
Toggling the state of a GtkCheckButton causes accessible window activate and ...
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
3.1.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2011-08-29 00:34 UTC by Joanmarie Diggs (IRC: joanie)
Modified: 2012-03-07 14:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
x11: Unify focus handling code (15.03 KB, patch)
2011-12-19 11:48 UTC, Benjamin Otte (Company)
committed Details | Review
x11: Avoid spurious focus events on grabs (3.57 KB, patch)
2011-12-19 11:48 UTC, Benjamin Otte (Company)
committed Details | Review

Description Joanmarie Diggs (IRC: joanie) 2011-08-29 00:34:43 UTC
Created attachment 195013 [details]
test script

Steps to reproduce:

1. Launch the test script in a terminal
2. Launch gtk3-demo's Printing demo
3. Press Alt+R repeatedly to toggle the state of the 'Reverse' CheckButton

Results: Each keypress results in window:activate and window:deactivate for the Print dialog.
Comment 1 Benjamin Otte (Company) 2011-08-29 00:45:15 UTC
This is because button activations do a key grab and a key grab moves the keyboard focus to the grab window. And then, when releasing the grab, moves the focus back to where it was before. This causes FOCUS_IN/FOCUS_OUT events and because a11y listens to those, we get events. What the code should do is listen to notify::is-active or notify:has-toplevel-focus (no idea which one).
Comment 2 Benjamin Otte (Company) 2011-12-19 11:48:32 UTC
Created attachment 203858 [details] [review]
x11: Unify focus handling code

This code was essentially copy-pasted in two locations, so unify them in
the same place.
Comment 3 Benjamin Otte (Company) 2011-12-19 11:48:38 UTC
Created attachment 203859 [details] [review]
x11: Avoid spurious focus events on grabs

We want to avoid handling focus events for the private focus window,
otherwise the keyboard grab taken by for example buttons will cause a
spurious FOCUS_OUT/FOCUS_IN on the toplevel.

The code that did this seems to have been lost in the XI2 transition for
GTK3.
Comment 4 Matthias Clasen 2011-12-19 12:09:09 UTC
Makes sense to me.
Looking at gtk+ 2.24, I see that we had explicit code to ignore anything but key events on focus_window - do we need something like that, or are these focus events the only thing that happens to the focus window ?
Comment 5 Benjamin Otte (Company) 2011-12-19 12:18:12 UTC
http://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkwindow-x11.c?h=3.2.0#n564 says that we only use GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK. And as we do want and do handle KeyPress and KeyRelease events properly, I think these are the only other events.

I could probably also remove GDK_FOCUS_CHANGE_MASK here, but I'm not sure this has side effects, so I opted for restoring GTK2 behavior instead.
Comment 6 Benjamin Otte (Company) 2011-12-23 08:18:46 UTC
Comment on attachment 203859 [details] [review]
x11: Avoid spurious focus events on grabs

I'm reopening this bug because the patch was backed out. It turns out that it causes some important focus events to not fire because of https://bugs.freedesktop.org/show_bug.cgi?id=44079 - we should wait until that is fixed inside the X server and people actually run that X server before applying this patch again.
Comment 7 André Klapper 2012-01-18 20:20:44 UTC
Comment on attachment 203859 [details] [review]
x11: Avoid spurious focus events on grabs

Patch was committed as db4a6040afd3d1cabbb306037e811f37d62e2e76 and reverted by 18406b7b04da088f8a3efe7cca5ac1647080dc0b , hence updating status to get it off the "accepted-commit_now" list.
Comment 8 Benjamin Otte (Company) 2012-03-07 14:57:53 UTC
Committed the patch again. See https://mail.gnome.org/archives/gtk-devel-list/2012-March/msg00017.html for details.