[Xfce4-commits] [xfce/xfwm4] 03/05: events: Fix implicit grabs

noreply at xfce.org noreply at xfce.org
Sun Apr 14 21:04:13 CEST 2019


This is an automated email from the git hooks/post-receive script.

o   l   i   v   i   e   r       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfwm4.

commit f5da3d6622c22246ac367bd80fc24ea08c9baa2e
Author: Viktor Odintsev <ninetls at xfce.org>
Date:   Sun Apr 14 15:32:09 2019 +0200

    events: Fix implicit grabs
    
    Bug: 14741
    
    With gtk+-3.x and XI2, pressing a window button and moving the pointer
    out of the window would keep the grab.
    
    Keep a reference of the window where the grab occurred to avoid the
    issue.
---
 src/client.c       |  2 +-
 src/event_filter.c | 13 ++++++++++++-
 src/event_filter.h |  7 ++++++-
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/client.c b/src/client.c
index 8d45696..b6552ad 100644
--- a/src/client.c
+++ b/src/client.c
@@ -3865,7 +3865,7 @@ clientButtonPress (Client *c, Window w, XfwmEventButton *event)
     frameQueueDraw (c, FALSE);
 
     TRACE ("entering button press loop");
-    eventFilterPush (display_info->xfilter, clientButtonPressEventFilter, &passdata);
+    eventFilterPushGrab (display_info->xfilter, clientButtonPressEventFilter, w, &passdata);
     gtk_main ();
     eventFilterPop (display_info->xfilter);
     TRACE ("leaving button press loop");
diff --git a/src/event_filter.c b/src/event_filter.c
index 920ede5..313c434 100644
--- a/src/event_filter.c
+++ b/src/event_filter.c
@@ -172,7 +172,10 @@ eventXfwmFilter (GdkXEvent *gdk_xevent, GdkEvent *gevent, gpointer data)
     while ((filterelt) && (loop == EVENT_FILTER_CONTINUE))
     {
         eventFilterStack *filterelt_next = filterelt->next;
-        loop = (*filterelt->filter) (event, filterelt->data);
+        if (filterelt->window == None || filterelt->window == event->meta.window)
+        {
+            loop = (*filterelt->filter) (event, filterelt->data);
+        }
         filterelt = filterelt_next;
     }
 
@@ -183,12 +186,19 @@ eventXfwmFilter (GdkXEvent *gdk_xevent, GdkEvent *gevent, gpointer data)
 eventFilterStack *
 eventFilterPush (eventFilterSetup *setup, XfwmFilter filter, gpointer data)
 {
+    return eventFilterPushGrab (setup, filter, None, data);
+}
+
+eventFilterStack *
+eventFilterPushGrab (eventFilterSetup *setup, XfwmFilter filter, Window window, gpointer data)
+{
     g_assert (filter != NULL);
     if (setup->filterstack)
     {
         eventFilterStack *newfilterstack =
             (eventFilterStack *) g_new (eventFilterStack, 1);
         newfilterstack->filter = filter;
+        newfilterstack->window = window;
         newfilterstack->data = data;
         newfilterstack->next = setup->filterstack;
         setup->filterstack = newfilterstack;
@@ -198,6 +208,7 @@ eventFilterPush (eventFilterSetup *setup, XfwmFilter filter, gpointer data)
         setup->filterstack =
             (eventFilterStack *) g_new (eventFilterStack, 1);
         setup->filterstack->filter = filter;
+        setup->filterstack->window = window;
         setup->filterstack->data = data;
         setup->filterstack->next = NULL;
     }
diff --git a/src/event_filter.h b/src/event_filter.h
index b9f14d0..36cff6c 100644
--- a/src/event_filter.h
+++ b/src/event_filter.h
@@ -47,6 +47,7 @@ typedef eventFilterStatus (*XfwmFilter) (XfwmEvent *event, gpointer data);
 typedef struct eventFilterStack
 {
     XfwmFilter filter;
+    Window window;
     gpointer data;
     struct eventFilterStack *next;
 }
@@ -64,7 +65,11 @@ GdkWindow               *eventFilterAddWin                      (GdkScreen *,
                                                                  long);
 eventFilterStack        *eventFilterPush                        (eventFilterSetup *,
                                                                  XfwmFilter,
-                                                                 gpointer );
+                                                                 gpointer);
+eventFilterStack        *eventFilterPushGrab                    (eventFilterSetup *,
+                                                                 XfwmFilter,
+                                                                 Window,
+                                                                 gpointer);
 eventFilterStack        *eventFilterPop                         (eventFilterSetup *);
 eventFilterSetup        *eventFilterInit                        (XfwmDevices *,
                                                                  gpointer);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list