26fdd9
diff -up gtk+-2.24.7/gtk/gtkmenushell.c.window-dragging gtk+-2.24.7/gtk/gtkmenushell.c
26fdd9
--- gtk+-2.24.7/gtk/gtkmenushell.c.window-dragging	2011-08-15 22:30:52.000000000 -0400
26fdd9
+++ gtk+-2.24.7/gtk/gtkmenushell.c	2011-10-17 19:50:52.180468086 -0400
26fdd9
@@ -589,18 +589,45 @@ gtk_menu_shell_button_press (GtkWidget
26fdd9
 
26fdd9
   if (!menu_shell->active || !menu_shell->button)
26fdd9
     {
26fdd9
-      gtk_menu_shell_activate (menu_shell);
26fdd9
+      gboolean initially_active = menu_shell->active;
26fdd9
 
26fdd9
       menu_shell->button = event->button;
26fdd9
 
26fdd9
-      if (menu_item && _gtk_menu_item_is_selectable (menu_item) &&
26fdd9
-	  menu_item->parent == widget &&
26fdd9
-          menu_item != menu_shell->active_menu_item)
26fdd9
+      if (menu_item)
26fdd9
         {
26fdd9
-          if (GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement == GTK_TOP_BOTTOM)
26fdd9
+          if (_gtk_menu_item_is_selectable (menu_item) &&
26fdd9
+              menu_item->parent == widget &&
26fdd9
+              menu_item != menu_shell->active_menu_item)
26fdd9
             {
26fdd9
-              menu_shell->activate_time = event->time;
26fdd9
-              gtk_menu_shell_select_item (menu_shell, menu_item);
26fdd9
+              gtk_menu_shell_activate (menu_shell);
26fdd9
+              menu_shell->button = event->button;
26fdd9
+
26fdd9
+              if (GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement == GTK_TOP_BOTTOM)
26fdd9
+                {
26fdd9
+                  menu_shell->activate_time = event->time;
26fdd9
+                  gtk_menu_shell_select_item (menu_shell, menu_item);
26fdd9
+                }
26fdd9
+            }
26fdd9
+        }
26fdd9
+      else
26fdd9
+        {
26fdd9
+          if (!initially_active)
26fdd9
+            {
26fdd9
+              gboolean window_drag = FALSE;
26fdd9
+
26fdd9
+              gtk_widget_style_get (widget,
26fdd9
+                                    "window-dragging", &window_drag,
26fdd9
+                                    NULL);
26fdd9
+
26fdd9
+              if (window_drag)
26fdd9
+                {
26fdd9
+                  gtk_menu_shell_deactivate (menu_shell);
26fdd9
+                  gtk_window_begin_move_drag (GTK_WINDOW (gtk_widget_get_toplevel (widget)),
26fdd9
+                                              event->button,
26fdd9
+                                              event->x_root,
26fdd9
+                                              event->y_root,
26fdd9
+                                              event->time);
26fdd9
+                }
26fdd9
             }
26fdd9
         }
26fdd9
     }
26fdd9
diff -up gtk+-2.24.7/gtk/gtktoolbar.c.window-dragging gtk+-2.24.7/gtk/gtktoolbar.c
26fdd9
--- gtk+-2.24.7/gtk/gtktoolbar.c.window-dragging	2011-10-01 11:29:06.000000000 -0400
26fdd9
+++ gtk+-2.24.7/gtk/gtktoolbar.c	2011-10-17 19:52:56.104463657 -0400
26fdd9
@@ -2701,6 +2701,8 @@ static gboolean
26fdd9
 gtk_toolbar_button_press (GtkWidget      *toolbar,
26fdd9
     			  GdkEventButton *event)
26fdd9
 {
26fdd9
+  GtkWidget *window;
26fdd9
+
26fdd9
   if (_gtk_button_event_triggers_context_menu (event))
26fdd9
     {
26fdd9
       gboolean return_value;
26fdd9
@@ -2711,7 +2713,29 @@ gtk_toolbar_button_press (GtkWidget
26fdd9
       
26fdd9
       return return_value;
26fdd9
     }
26fdd9
-  
26fdd9
+
26fdd9
+  window = gtk_widget_get_toplevel (toolbar);
26fdd9
+
26fdd9
+  if (window)
26fdd9
+    {
26fdd9
+      gboolean window_drag = FALSE;
26fdd9
+
26fdd9
+      gtk_widget_style_get (toolbar,
26fdd9
+                            "window-dragging", &window_drag,
26fdd9
+                            NULL);
26fdd9
+
26fdd9
+      if (window_drag)
26fdd9
+        {
26fdd9
+          gtk_window_begin_move_drag (GTK_WINDOW (window),
26fdd9
+                                      event->button,
26fdd9
+                                      event->x_root,
26fdd9
+                                      event->y_root,
26fdd9
+                                      event->time);
26fdd9
+
26fdd9
+          return TRUE;
26fdd9
+        }
26fdd9
+    }
26fdd9
+
26fdd9
   return FALSE;
26fdd9
 }
26fdd9
 
26fdd9
diff -up gtk+-2.24.7/gtk/gtkwidget.c.window-dragging gtk+-2.24.7/gtk/gtkwidget.c
26fdd9
--- gtk+-2.24.7/gtk/gtkwidget.c.window-dragging	2011-10-17 19:50:52.175468086 -0400
26fdd9
+++ gtk+-2.24.7/gtk/gtkwidget.c	2011-10-17 19:50:52.184468086 -0400
26fdd9
@@ -2467,6 +2467,13 @@ gtk_widget_class_init (GtkWidgetClass *k
26fdd9
 							       0.0, 1.0, 0.04,
26fdd9
 							       GTK_PARAM_READABLE));
26fdd9
 
26fdd9
+  gtk_widget_class_install_style_property (klass,
26fdd9
+                                           g_param_spec_boolean ("window-dragging",
26fdd9
+                                                                 P_("Window dragging"),
26fdd9
+                                                                 P_("Window dragging"),
26fdd9
+                                                                 FALSE,
26fdd9
+                                                                 GTK_PARAM_READWRITE));
26fdd9
+
26fdd9
   /**
26fdd9
    * GtkWidget:draw-border:
26fdd9
    *