[PATCH] guarantee that (GdkEventKey.state & GDK_RELEASE_MASK) is 0 in gdk_event_translate() (fwd)



 Please apply this patch too before releasing 1.2.9

 Best regards,
  -Vlad

---------- Forwarded message ----------
Date: Mon, 28 Aug 2000 18:00:36 +0500 (SAMST)
From: Vlad Harchev <hvv hippo ru>
To: gtk-devel-list gnome org
Subject: [PATCH] guarantee that (GdkEventKey.state & GDK_RELEASE_MASK) is 0 in
    gdk_event_translate()

 Hi, 

 This patch fixes a nasty bug in gdk, that prevents signals
registered in bindingsets without GDK_RELEASE_MASK modifier to be emitted when
alternative keyboard language is active (since at least
XFree86-3.3.3 sets 13th bit (the one that set in GDK_RELEASE_MASK) of
xevent->xkey.state to 1 in that case).

 Best regards,
  -Vlad

# Here is a patch produced for gtk-1.2.5 by Vlad Harchev <hvv hippo ru>
#
# This patch fixes a bug in gdk for X. At least XFree86 sets 13th bit of
# XKeyEvent.state to 1 when switching to secondary keyboard language. That bit
# corresponds to GDK_RELEASE_MASK. That bitmask is used by GtkBindingSet (used
# by widgets like clist and ctree for bindings) - it distinguish key events
# with and without GDK_RELEASE_MASK (and that bit is set in gtkwidget.c:
# *_key_{press,release}_event depending on the type of the event).
# So, this patch guarantees that in any condition 
# (event->key.state & GDK_RELEASE_MASK) will be 0 when coming from GDK.
#
--- gdkevents.c-was	Mon Aug 28 17:45:00 2000
+++ gdkevents.c	Mon Aug 28 17:46:09 2000
@@ -1153,7 +1153,7 @@
       event->key.type = GDK_KEY_PRESS;
       event->key.window = window;
       event->key.time = xevent->xkey.time;
-      event->key.state = (GdkModifierType) xevent->xkey.state;
+      event->key.state = (GdkModifierType) (xevent->xkey.state & ~GDK_RELEASE_MASK);
       event->key.string = g_strdup (buf);
       event->key.length = charcount;
       
@@ -1185,7 +1185,7 @@
       event->key.type = GDK_KEY_RELEASE;
       event->key.window = window;
       event->key.time = xevent->xkey.time;
-      event->key.state = (GdkModifierType) xevent->xkey.state;
+      event->key.state = (GdkModifierType) (xevent->xkey.state & ~GDK_RELEASE_MASK);
       event->key.length = 0;
       event->key.string = NULL;
       






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]