[Xfce4-commits] <xfce4-panel:master> Block grabs from outside the panel.

Nick Schermer noreply at xfce.org
Tue Dec 28 21:46:01 CET 2010


Updating branch refs/heads/master
         to a2b5a93be6807a3182655f587fe7bb317c98cd3c (commit)
       from f044801982f197ab58a2c016949bb13aec39e0c6 (commit)

commit a2b5a93be6807a3182655f587fe7bb317c98cd3c
Author: Nick Schermer <nick at xfce.org>
Date:   Tue Dec 28 21:43:42 2010 +0100

    Block grabs from outside the panel.
    
    The panel was unhiding when starting a grab in a dialog
    that was part of the panel process; for example a dnd or
    scroll in the launcher dialogs.
    Prevent this by checking if the pointer is shading the panel.

 panel/panel-window.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/panel/panel-window.c b/panel/panel-window.c
index d2a4312..a41a308 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -1014,6 +1014,8 @@ panel_window_grab_notify (GtkWidget *widget,
 {
   PanelWindow *window = PANEL_WINDOW (widget);
   GtkWidget   *current;
+  GdkScreen   *screen;
+  gint         x, y;
 
   current = gtk_grab_get_current ();
   if (GTK_IS_MENU_SHELL (current))
@@ -1024,11 +1026,31 @@ panel_window_grab_notify (GtkWidget *widget,
     }
   else if (window->autohide_grab_block > 0)
     {
-      /* drop previous menu block */
+      /* drop previous menu block or grab from outside window */
       window->autohide_grab_block--;
     }
   else if (window->autohide_grab_block == 0)
     {
+      if (current != NULL)
+        {
+          gdk_display_get_pointer (gtk_widget_get_display (current),
+                                   &screen, &x, &y, NULL);
+
+          /* filter out grab event that did not occur in the panel window,
+           * but in a windows that is part of this process */
+          if (gtk_window_get_screen (GTK_WINDOW (window)) != screen
+              || x < window->alloc.x
+              || x > window->alloc.x + window->alloc.width
+              || y < window->alloc.y
+              || y > window->alloc.y + window->alloc.height)
+            {
+              /* block the next notification */
+              window->autohide_grab_block++;
+
+              return;
+            }
+       }
+
       /* avoid hiding the panel when the window is grabbed. this
        * (for example) happens when the user drags in the pager plugin
        * see bug #4597 */



More information about the Xfce4-commits mailing list