[gnome-panel] panel: Require modifier to move applets by clicking on handle
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] panel: Require modifier to move applets by clicking on handle
- Date: Mon, 28 Mar 2011 21:10:49 +0000 (UTC)
commit f9a7efdc90727a2089bd5d8924d39afa1e1cd97e
Author: Vincent Untz <vuntz gnome org>
Date: Wed Mar 23 11:12:54 2011 +0100
panel: Require modifier to move applets by clicking on handle
Also do the same for internal object (eg: menubar) when clicking with
middle button.
gnome-panel/panel-applet-frame.c | 12 ++++++------
gnome-panel/panel-widget.c | 10 ++++++++--
2 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/gnome-panel/panel-applet-frame.c b/gnome-panel/panel-applet-frame.c
index cfa8786..ae395e7 100644
--- a/gnome-panel/panel-applet-frame.c
+++ b/gnome-panel/panel-applet-frame.c
@@ -351,6 +351,7 @@ panel_applet_frame_button_changed (GtkWidget *widget,
{
PanelAppletFrame *frame;
gboolean handled = FALSE;
+ guint modifiers;
GdkDisplay *display;
GdkDevice *pointer;
GdkDeviceManager *device_manager;
@@ -363,12 +364,15 @@ panel_applet_frame_button_changed (GtkWidget *widget,
if (event->window != gtk_widget_get_window (widget))
return FALSE;
+ modifiers = event->state & GDK_MODIFIER_MASK;
+
switch (event->button) {
case 1:
case 2:
if (button_event_in_rect (event, &frame->priv->handle_rect)) {
- if (event->type == GDK_BUTTON_PRESS ||
- event->type == GDK_2BUTTON_PRESS) {
+ if ((event->type == GDK_BUTTON_PRESS ||
+ event->type == GDK_2BUTTON_PRESS) &&
+ modifiers == panel_bindings_get_mouse_button_modifier_keymask ()){
panel_widget_applet_drag_start (
frame->priv->panel, GTK_WIDGET (frame),
PW_DRAG_OFF_CURSOR, event->time);
@@ -382,10 +386,6 @@ panel_applet_frame_button_changed (GtkWidget *widget,
case 3:
if (event->type == GDK_BUTTON_PRESS ||
event->type == GDK_2BUTTON_PRESS) {
- guint modifiers;
-
- modifiers = event->state & GDK_MODIFIER_MASK;
-
display = gtk_widget_get_display (widget);
device_manager = gdk_display_get_device_manager (display);
pointer = gdk_device_manager_get_client_pointer (device_manager);
diff --git a/gnome-panel/panel-widget.c b/gnome-panel/panel-widget.c
index bcd89d1..dcc08ff 100644
--- a/gnome-panel/panel-widget.c
+++ b/gnome-panel/panel-widget.c
@@ -19,6 +19,7 @@
#include "panel-widget.h"
#include "button-widget.h"
#include "panel.h"
+#include "panel-bindings.h"
#include "panel-util.h"
#include "panel-marshal.h"
#include "panel-typebuiltins.h"
@@ -2161,6 +2162,7 @@ panel_widget_applet_button_press_event (GtkWidget *widget,
{
GtkWidget *parent;
PanelWidget *panel;
+ guint modifiers;
guint32 event_time;
parent = gtk_widget_get_parent (widget);
@@ -2178,9 +2180,13 @@ panel_widget_applet_button_press_event (GtkWidget *widget,
return TRUE;
}
- /* Begin drag if the middle mouse button is pressed, unless the panel
- * is locked down or a grab is active (meaning a menu is open) */
+ modifiers = event->state & GDK_MODIFIER_MASK;
+
+ /* Begin drag if the middle mouse button and modifier are pressed,
+ * unless the panel is locked down or a grab is active (meaning a menu
+ * is open) */
if (panel_lockdown_get_locked_down () || event->button != 2 ||
+ modifiers != panel_bindings_get_mouse_button_modifier_keymask () ||
gtk_grab_get_current() != NULL)
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]