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 151555 - XkbGetState() and XkbStateNotify
XkbGetState() and XkbStateNotify
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
unspecified
Other Linux
: Normal normal
: Small fix
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2004-08-31 21:39 UTC by Soren Sandmann Pedersen
Modified: 2005-09-20 05:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
a patch (4.68 KB, patch)
2005-09-07 15:05 UTC, Matthias Clasen
none Details | Review

Description Soren Sandmann Pedersen 2004-08-31 21:39:59 UTC
Currently, gtk+ selects for XKBStateNotify in *all* circumstances. This event is
emitted every time a modifier or a mouse button is pressed. GTK+'s response to
this event is to call XkbGetState() to see what changed.

- This is not needed. The necessary information is already available in the
  XkbStateNotify event

- The call XkbSelectEventDetail() can be used to specify when exactly the
  X server should emit the XkbStateNotify event. Calling XkbSelectEventDetail()
  with the right mask would allow GTK+ to only get the event when something
  interesting actually happens.
Comment 1 Matthias Clasen 2004-12-23 18:43:41 UTC
Soeren, do you have a patch for this ?
Comment 2 Matthias Clasen 2005-09-07 15:05:35 UTC
Created attachment 51922 [details] [review]
a patch

Does this patch look right, Soeren ?
Comment 3 Matthias Clasen 2005-09-20 05:45:15 UTC
2005-09-20  Matthias Clasen  <mclasen@redhat.com>

        Avoid unnecessary XkbGetState() calls and XkbStateNotify
        events.  (#151555, Søren Sandmann)

        * gdk/x11/gdkdisplay-x11.c (gdk_display_open): Use
        XkbSelectEventDetails() to select XkbStateNotify events
        for only the state we care about.

        * gdk/x11/gdkprivate-x11.h:
        * gdk/x11/gdkkeys-x11.c (_gdk_keymap_state_changed): Pass
        the event into the function and update the keymap state from
        the state information contained in the event. Adjust all callers.