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