[gnome-panel] panel: Fix moving of panel objects to use switch mode again by default



commit e2b6065563e686add9d72c7c9ae93b2fb7760017
Author: Vincent Untz <vuntz gnome org>
Date:   Tue Mar 29 12:02:58 2011 +0530

    panel: Fix moving of panel objects to use switch mode again by default
    
    We were looking at the modifier on the panel, and this was set to Alt,
    since this is required to open the context menu. So we always used the
    free move mode by default, and this could easily break in weird ways
    later on. And we really want the switch mode.
    
    So instead, take the modifier from the event triggering the move.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=646041

 gnome-panel/panel-widget.c |   11 ++++-------
 gnome-panel/panel-widget.h |    1 +
 2 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/gnome-panel/panel-widget.c b/gnome-panel/panel-widget.c
index 9a0eccd..b9fbe6a 100644
--- a/gnome-panel/panel-widget.c
+++ b/gnome-panel/panel-widget.c
@@ -1812,7 +1812,6 @@ panel_widget_applet_move_to_cursor (PanelWidget *panel)
 	int pos;
 	int movement;
 	GtkWidget *applet;
-	GdkModifierType mods;
 	AppletData *ad;
 
 	g_return_if_fail(PANEL_IS_WIDGET(panel));
@@ -1863,19 +1862,16 @@ panel_widget_applet_move_to_cursor (PanelWidget *panel)
 		}
 	}
 
-	gdk_window_get_pointer(gtk_widget_get_window (GTK_WIDGET(panel)),
-			       NULL,NULL,&mods);
-
 	movement = PANEL_SWITCH_MOVE;
 
 	if (panel->packed) {
 		movement = PANEL_SWITCH_MOVE;
 	} else {
-		if (mods & GDK_CONTROL_MASK)
+		if (panel->dragged_state & GDK_CONTROL_MASK)
 			movement = PANEL_SWITCH_MOVE;
-		else if (mods & GDK_SHIFT_MASK)
+		else if (panel->dragged_state & GDK_SHIFT_MASK)
 			movement = PANEL_PUSH_MOVE;
-		else if (mods & GDK_MOD1_MASK)
+		else if (panel->dragged_state & GDK_MOD1_MASK)
 			movement = PANEL_FREE_MOVE;
 	}
 	
@@ -2036,6 +2032,7 @@ panel_widget_applet_motion_notify_event (GtkWidget *widget,
 		return FALSE;
 
 	panel = PANEL_WIDGET (parent);
+	panel->dragged_state = ((GdkEventMotion *) event)->state & GDK_MODIFIER_MASK;
 	
 	schedule_try_move (panel, FALSE);
 
diff --git a/gnome-panel/panel-widget.h b/gnome-panel/panel-widget.h
index 3f3fcf1..0b13166 100644
--- a/gnome-panel/panel-widget.h
+++ b/gnome-panel/panel-widget.h
@@ -90,6 +90,7 @@ struct _PanelWidget
 	int             sz;
 
 	AppletData     *currently_dragged_applet;
+	guint           dragged_state;
 
 	int             thick;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]