Author: olivier
Date: 2008-05-18 22:02:30 +0000 (Sun, 18 May 2008)
New Revision: 26976

Modified:
   xfwm4/trunk/src/display.h
   xfwm4/trunk/src/events.c
   xfwm4/trunk/src/startup_notification.c
Log:
Make sure to release keyboard events even when a modifier is released before 
the regular key (bug #4072)

Modified: xfwm4/trunk/src/display.h
===================================================================
--- xfwm4/trunk/src/display.h   2008-05-18 18:28:29 UTC (rev 26975)
+++ xfwm4/trunk/src/display.h   2008-05-18 22:02:30 UTC (rev 26976)
@@ -70,11 +70,11 @@
  * if that needs some explanation, please refer to metacity's
  * display.h source where it is explaned
  */
-#define TIMESTAMP_IS_BEFORE_REAL(time1, time2)  ((((time1) < (time2)) && 
((time2) - (time1) < ((guint32)-1)/2 )) || \
-                                                 (((time1) > (time2)) && 
((time1) - (time2) > ((guint32)-1)/2 )))
-#define TIMESTAMP_IS_BEFORE(time1, time2)       ((time1) == 0 ||               
                                     \
+#define TIMESTAMP_IS_BEFORE_REAL(time1, time2)  (((time1 < time2) && (time2 - 
time1 < (G_MAXUINT32 >> 1))) || \
+                                                 ((time1 > time2) && (time1 - 
time2 > (G_MAXUINT32 >> 1))))
+#define TIMESTAMP_IS_BEFORE(time1, time2)       ((time1 == 0) ||               
                                     \
                                                 
(TIMESTAMP_IS_BEFORE_REAL(time1, time2) &&                          \
-                                                (time2) != 0))
+                                                (time2 != 0)))
 
 enum
 {

Modified: xfwm4/trunk/src/events.c
===================================================================
--- xfwm4/trunk/src/events.c    2008-05-18 18:28:29 UTC (rev 26975)
+++ xfwm4/trunk/src/events.c    2008-05-18 22:02:30 UTC (rev 26976)
@@ -346,7 +346,7 @@
     if (!ev_screen_info)
     {
         /* Release queued events */
-        XAllowEvents (display_info->dpy, SyncKeyboard, myDisplayGetCurrentTime 
(display_info));
+        XAllowEvents (display_info->dpy, SyncKeyboard, CurrentTime);
 
         return EVENT_FILTER_PASS;
     }
@@ -569,6 +569,17 @@
     return status;
 }
 
+static eventFilterStatus
+handleKeyRelease (DisplayInfo *display_info, XKeyEvent * ev)
+{
+    TRACE ("entering handleKeyRelease");
+
+    /* Release queued events */
+    XAllowEvents (display_info->dpy, SyncKeyboard, CurrentTime);
+
+    return EVENT_FILTER_PASS;
+}
+
 /* User has clicked on an edge or corner.
  * Button 1 : Raise and resize
  * Button 2 : Move
@@ -1051,23 +1062,15 @@
 
     TRACE ("entering handleButtonRelease");
 
-#if CHECK_BUTTON_TIME
-    /* Avoid treating the same event twice */
-    if (!check_button_time (ev))
-    {
-        TRACE ("ignoring ButtonRelease event because it has been already 
handled");
-        return EVENT_FILTER_REMOVE;
-    }
-#endif
-
     /* Get the screen structure from the root of the event */
     screen_info = myDisplayGetScreenFromRoot (display_info, ev->root);
-    if (!screen_info)
+    if (screen_info)
     {
-        return EVENT_FILTER_REMOVE;
+        XSendEvent (display_info->dpy, screen_info->xfwm4_win, FALSE, 
SubstructureNotifyMask, (XEvent *) ev);
     }
 
-    XSendEvent (display_info->dpy, screen_info->xfwm4_win, FALSE, 
SubstructureNotifyMask, (XEvent *) ev);
+    /* Release pending events */
+    XAllowEvents (display_info->dpy, SyncPointer, CurrentTime);
 
     return EVENT_FILTER_REMOVE;
 }
@@ -2450,6 +2453,9 @@
         case KeyPress:
             status = handleKeyPress (display_info, (XKeyEvent *) ev);
             break;
+        case KeyRelease:
+            status = handleKeyRelease (display_info, (XKeyEvent *) ev);
+            break;
         case ButtonPress:
             status = handleButtonPress (display_info, (XButtonEvent *) ev);
             break;

Modified: xfwm4/trunk/src/startup_notification.c
===================================================================
--- xfwm4/trunk/src/startup_notification.c      2008-05-18 18:28:29 UTC (rev 
26975)
+++ xfwm4/trunk/src/startup_notification.c      2008-05-18 22:02:30 UTC (rev 
26976)
@@ -290,7 +290,7 @@
             c->user_time = timestamp;
             if (c->user_time != (Time) 0)
             {
-                myDisplaySetLastUserTime (screen_info->display_info, 
c->user_time);
+                myDisplayUpdateLastUserTime (screen_info->display_info, 
c->user_time);
             }
         }
         FLAG_SET (c->flags, CLIENT_FLAG_HAS_STARTUP_TIME);

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to