gnome-panel freeze break request: fix moving mode for applets



Hi,

The requirement of Alt to open the panel context menu broke the default
to move applets. This changed to a mode which doesn't feel natural to
most people.

The patch fixes this by looking at the current modifiers in the last
GDK event.

https://bugzilla.gnome.org/show_bug.cgi?id=646041

Vincent

-- 
Les gens heureux ne sont pas pressés.
>From 26c2a5c32aa4cb05aa0bd9b85f1e13b91118beef Mon Sep 17 00:00:00 2001
From: Vincent Untz <vuntz gnome org>
Date: Tue, 29 Mar 2011 12:02:58 +0530
Subject: [PATCH] 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;
 
-- 
1.7.4.1


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