File xfdesktop-fix-slow-popup-menu.patch of Package xfdesktop.openSUSE_11.4_Update

From 803ea66061417317df2b2968a81a4cfdfd052e8d Mon Sep 17 00:00:00 2001
From: Eric Koegel <eric.koegel@gmail.com>
Date: Mon, 05 Dec 2011 11:44:59 +0000
Subject: Added a check for GDK_GRAB_INVALID_TIME in xfdesktop_popup_grab_available to mitigate slow menu popups on a right mouse click. Fixes bug 7172.

---
diff --git a/common/xfdesktop-common.c b/common/xfdesktop-common.c
index 9e4f22c..64aee8d 100644
--- a/common/xfdesktop-common.c
+++ b/common/xfdesktop-common.c
@@ -370,7 +370,10 @@ xfdesktop_popup_grab_available (GdkWindow *win, guint32 timestamp)
     while ((i++ < 2500) && (grab_failed = ((g1 != GDK_GRAB_SUCCESS)
                 || (g2 != GDK_GRAB_SUCCESS))))
     {
-        TRACE ("grab not available yet, waiting... (%i)", i);
+        TRACE ("grab not available yet, mouse reason: %d, keyboard reason: %d, waiting... (%i)", g1, g2, i);
+        if(g1 == GDK_GRAB_INVALID_TIME || g2 == GDK_GRAB_INVALID_TIME)
+            break;
+
         g_usleep (100);
         if (g1 != GDK_GRAB_SUCCESS)
         {
diff --git a/src/xfce-desktop.c b/src/xfce-desktop.c
index cd98ae7..bcd4bd8 100644
--- a/src/xfce-desktop.c
+++ b/src/xfce-desktop.c
@@ -1340,29 +1340,29 @@ xfce_desktop_do_menu_popup(XfceDesktop *desktop,
         screen = gtk_widget_get_screen(GTK_WIDGET(desktop));
     else
         screen = gdk_display_get_default_screen(gdk_display_get_default());
-    
-    menu = gtk_menu_new();
-    gtk_menu_set_screen(GTK_MENU(menu), screen);
-    g_signal_connect_swapped(G_OBJECT(menu), "deactivate",
-                             G_CALLBACK(g_idle_add),
-                             (gpointer)xfce_desktop_menu_destroy_idled);
-    
-    g_signal_emit(G_OBJECT(desktop), populate_signal, 0, menu);
-    
-    /* if nobody populated the menu, don't do anything */
-    menu_children = gtk_container_get_children(GTK_CONTAINER(menu));
-    if(!menu_children) {
-        gtk_widget_destroy(menu);
-        return;
-    }
-    
-    g_list_free(menu_children);
-    
-    gtk_menu_attach_to_widget(GTK_MENU(menu), GTK_WIDGET(desktop), NULL);
-    
+
     if(xfdesktop_popup_grab_available(gdk_screen_get_root_window(screen),
                                       activate_time))
     {
+        menu = gtk_menu_new();
+        gtk_menu_set_screen(GTK_MENU(menu), screen);
+        g_signal_connect_swapped(G_OBJECT(menu), "deactivate",
+                                 G_CALLBACK(g_idle_add),
+                                 (gpointer)xfce_desktop_menu_destroy_idled);
+
+        g_signal_emit(G_OBJECT(desktop), populate_signal, 0, menu);
+
+        /* if nobody populated the menu, don't do anything */
+        menu_children = gtk_container_get_children(GTK_CONTAINER(menu));
+        if(!menu_children) {
+            gtk_widget_destroy(menu);
+            return;
+        }
+
+        g_list_free(menu_children);
+
+        gtk_menu_attach_to_widget(GTK_MENU(menu), GTK_WIDGET(desktop), NULL);
+
         /* bug #3652: for some reason passing the correct button here breaks
          * on some systems but not others.  always pass 0 for now. */
         gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0,
--
cgit v0.9.0.3
openSUSE Build Service is sponsored by