[Xfce4-commits] [panel-plugins/xfce4-places-plugin] 13/30: Sync todo from xfce4-panel panel_utils_grab_available to pview_grab_available

noreply at xfce.org noreply at xfce.org
Mon Apr 22 12:08:04 CEST 2019


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

b   l   u   e   s   a   b   r   e       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 panel-plugins/xfce4-places-plugin.

commit 26c04d3bb2bd5faeef1c00d5051f3915b79d70fa
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sat Apr 20 11:06:40 2019 -0400

    Sync todo from xfce4-panel panel_utils_grab_available to pview_grab_available
---
 panel-plugin/view.c | 67 ++++++++++++++++++++++++++++-------------------------
 1 file changed, 35 insertions(+), 32 deletions(-)

diff --git a/panel-plugin/view.c b/panel-plugin/view.c
index cde4931..4010998 100644
--- a/panel-plugin/view.c
+++ b/panel-plugin/view.c
@@ -822,50 +822,53 @@ pview_button_update(PlacesView *view)
 static gboolean
 pview_grab_available (void)
 {
-  GdkScreen     *screen;
-  GdkWindow     *root;
-  GdkGrabStatus  grab_pointer = GDK_GRAB_FROZEN;
-  GdkGrabStatus  grab_keyboard = GDK_GRAB_FROZEN;
-  gboolean       grab_succeed = FALSE;
-  guint          i;
-  GdkEventMask   pointer_mask = GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
-                                | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK
-                                | GDK_POINTER_MOTION_MASK;
-
-  screen = xfce_gdk_screen_get_active (NULL);
-  root = gdk_screen_get_root_window (screen);
-
-  /* don't try to get the grab for longer then 1/4 second */
-  for (i = 0; i < (G_USEC_PER_SEC / 100 / 4); i++)
+#if GTK_CHECK_VERSION(3, 0, 0)
+    /* TODO fix for gtk3 */
+    return TRUE;
+#else
+    GdkScreen *screen;
+    GdkWindow *root;
+    GdkGrabStatus grab_pointer = GDK_GRAB_FROZEN;
+    GdkGrabStatus grab_keyboard = GDK_GRAB_FROZEN;
+    gboolean grab_succeed = FALSE;
+    guint i;
+    GdkEventMask pointer_mask = GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_POINTER_MOTION_MASK;
+
+    screen = xfce_gdk_screen_get_active(NULL);
+    root = gdk_screen_get_root_window(screen);
+
+    /* don't try to get the grab for longer then 1/4 second */
+    for (i = 0; i < (G_USEC_PER_SEC / 100 / 4); i++)
     {
-      grab_keyboard = gdk_keyboard_grab (root, TRUE, GDK_CURRENT_TIME);
-      if (grab_keyboard == GDK_GRAB_SUCCESS)
+        grab_keyboard = gdk_keyboard_grab(root, TRUE, GDK_CURRENT_TIME);
+        if (grab_keyboard == GDK_GRAB_SUCCESS)
         {
-          grab_pointer = gdk_pointer_grab (root, TRUE, pointer_mask,
-                                           NULL, NULL, GDK_CURRENT_TIME);
-          if (grab_pointer == GDK_GRAB_SUCCESS)
+            grab_pointer = gdk_pointer_grab(root, TRUE, pointer_mask,
+                                            NULL, NULL, GDK_CURRENT_TIME);
+            if (grab_pointer == GDK_GRAB_SUCCESS)
             {
-              grab_succeed = TRUE;
-              break;
+                grab_succeed = TRUE;
+                break;
             }
         }
 
-      g_usleep (100);
+        g_usleep(100);
     }
 
-  /* release the grab so the gtk_menu_popup() can take it */
-  if (grab_pointer == GDK_GRAB_SUCCESS)
-    gdk_pointer_ungrab (GDK_CURRENT_TIME);
-  if (grab_keyboard == GDK_GRAB_SUCCESS)
-    gdk_keyboard_ungrab (GDK_CURRENT_TIME);
+    /* release the grab so the gtk_menu_popup() can take it */
+    if (grab_pointer == GDK_GRAB_SUCCESS)
+        gdk_pointer_ungrab(GDK_CURRENT_TIME);
+    if (grab_keyboard == GDK_GRAB_SUCCESS)
+        gdk_keyboard_ungrab(GDK_CURRENT_TIME);
 
-  if (!grab_succeed)
+    if (!grab_succeed)
     {
-      g_printerr (PACKAGE_NAME ": Unable to get keyboard and mouse "
-                  "grab. Menu popup failed.\n");
+        g_printerr(PACKAGE_NAME ": Unable to get keyboard and mouse "
+                                "grab. Menu popup failed.\n");
     }
 
-  return grab_succeed;
+    return grab_succeed;
+#endif
 }
 
 

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


More information about the Xfce4-commits mailing list