diff options
author | Peter Robinson <pbrobinson@gmail.com> | 2012-06-14 20:16:00 +0100 |
---|---|---|
committer | Peter Robinson <pbrobinson@gmail.com> | 2012-06-14 20:16:00 +0100 |
commit | 24f36ef4c149514a963849af9b5549a47ac5b42a (patch) | |
tree | 4a4c1f2b5484c0e89da7495ae17216a7d581afb1 | |
parent | cfb9e5a843f205c891e6bbb291110aba1b53cde7 (diff) | |
download | metacity-24f36ef4c149514a963849af9b5549a47ac5b42a.tar.gz metacity-24f36ef4c149514a963849af9b5549a47ac5b42a.tar.xz metacity-24f36ef4c149514a963849af9b5549a47ac5b42a.zip |
Add options to disable mouse button modifers
-rw-r--r-- | disable-mouse-button-modifiers.patch | 150 | ||||
-rw-r--r-- | metacity.spec | 6 |
2 files changed, 156 insertions, 0 deletions
diff --git a/disable-mouse-button-modifiers.patch b/disable-mouse-button-modifiers.patch new file mode 100644 index 0000000..51ff411 --- /dev/null +++ b/disable-mouse-button-modifiers.patch @@ -0,0 +1,150 @@ +From 86fd12cbf06f693405650b9d6f7c6234757cc354 Mon Sep 17 00:00:00 2001 +From: Daniel Drake <dsd@laptop.org> +Date: Wed, 30 May 2012 15:42:34 +0000 +Subject: Add disable-mouse-button-modifiers message + +Similar to the disable-keybindings message, Sugar would like to be able +to disable this specific part of the metacity functionality without +changing the GSettings configuration (which would also affect GNOME). + +Add a new metacity-message command to disable mouse button modifiers, +which ordinarily let windows be dragged around the screen when a specific +modifier is pressed. + +https://bugzilla.gnome.org/show_bug.cgi?id=677115 +--- +diff --git a/src/core/atomnames.h b/src/core/atomnames.h +index 338d055..14dbd8f 100644 +--- a/src/core/atomnames.h ++++ b/src/core/atomnames.h +@@ -57,6 +57,7 @@ item(_KWM_WIN_ICON) + item(_METACITY_RESTART_MESSAGE) + item(_METACITY_RELOAD_THEME_MESSAGE) + item(_METACITY_SET_KEYBINDINGS_MESSAGE) ++item(_METACITY_SET_MOUSEMODS_MESSAGE) + item(_METACITY_TOGGLE_VERBOSE) + item(_GNOME_PANEL_ACTION) + item(_GNOME_PANEL_ACTION_MAIN_MENU) +diff --git a/src/core/display.c b/src/core/display.c +index b70112d..440f2fb 100644 +--- a/src/core/display.c ++++ b/src/core/display.c +@@ -135,6 +135,8 @@ typedef struct + */ + static MetaDisplay *the_display = NULL; + ++static gboolean mousemods_disabled = FALSE; ++ + #ifdef WITH_VERBOSE_MODE + static void meta_spew_event (MetaDisplay *display, + XEvent *event); +@@ -157,6 +159,9 @@ static void process_selection_clear (MetaDisplay *display, + + static void update_window_grab_modifiers (MetaDisplay *display); + ++static void set_mousemods_disabled (MetaDisplay *display, ++ gboolean setting); ++ + static void prefs_changed_callback (MetaPreference pref, + void *data); + +@@ -2271,6 +2276,13 @@ event_callback (XEvent *event, + meta_set_keybindings_disabled (display, !event->xclient.data.l[0]); + } + else if (event->xclient.message_type == ++ display->atom__METACITY_SET_MOUSEMODS_MESSAGE) ++ { ++ meta_verbose ("Received set mousemods request = %d\n", ++ (int) event->xclient.data.l[0]); ++ set_mousemods_disabled (display, !event->xclient.data.l[0]); ++ } ++ else if (event->xclient.message_type == + display->atom__METACITY_TOGGLE_VERBOSE) + { + meta_verbose ("Received toggle verbose message\n"); +@@ -3701,7 +3713,7 @@ meta_display_grab_window_buttons (MetaDisplay *display, + * XSync() + */ + +- if (display->window_grab_modifiers != 0) ++ if (display->window_grab_modifiers != 0 && !mousemods_disabled) + { + gboolean debug = g_getenv ("METACITY_DEBUG_BUTTON_GRABS") != NULL; + int i; +@@ -3835,6 +3847,15 @@ meta_display_ungrab_focus_window_button (MetaDisplay *display, + } + } + ++static void ++set_mousemods_disabled (MetaDisplay *display, ++ gboolean setting) ++{ ++ mousemods_disabled = setting; ++ prefs_changed_callback(META_PREF_MOUSE_BUTTON_MODS, display); ++ meta_verbose ("Mouse button modifiers %s\n", mousemods_disabled ? "disabled" : "enabled"); ++} ++ + void + meta_display_increment_event_serial (MetaDisplay *display) + { +diff --git a/src/tools/metacity-message.c b/src/tools/metacity-message.c +index 8d5548c..9aae733 100644 +--- a/src/tools/metacity-message.c ++++ b/src/tools/metacity-message.c +@@ -114,6 +114,34 @@ send_set_keybindings (gboolean enabled) + XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), False); + } + ++static void ++send_set_mousemods (gboolean enabled) ++{ ++ XEvent xev; ++ ++ xev.xclient.type = ClientMessage; ++ xev.xclient.serial = 0; ++ xev.xclient.send_event = True; ++ xev.xclient.display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); ++ xev.xclient.window = gdk_x11_get_default_root_xwindow (); ++ xev.xclient.message_type = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), ++ "_METACITY_SET_MOUSEMODS_MESSAGE", ++ False); ++ xev.xclient.format = 32; ++ xev.xclient.data.l[0] = enabled; ++ xev.xclient.data.l[1] = 0; ++ xev.xclient.data.l[2] = 0; ++ ++ XSendEvent (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), ++ gdk_x11_get_default_root_xwindow (), ++ False, ++ SubstructureRedirectMask | SubstructureNotifyMask, ++ &xev); ++ ++ XFlush (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); ++ XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), False); ++} ++ + #ifdef WITH_VERBOSE_MODE + static void + send_toggle_verbose (void) +@@ -148,7 +176,7 @@ static void + usage (void) + { + g_printerr (_("Usage: %s\n"), +- "metacity-message (restart|reload-theme|enable-keybindings|disable-keybindings|toggle-verbose)"); ++ "metacity-message (restart|reload-theme|enable-keybindings|disable-keybindings|enable-mouse-button-modifiers|disable-mouse-button-modifiers|toggle-verbose)"); + exit (1); + } + +@@ -170,6 +198,10 @@ main (int argc, char **argv) + send_set_keybindings (TRUE); + else if (strcmp (argv[1], "disable-keybindings") == 0) + send_set_keybindings (FALSE); ++ else if (strcmp (argv[1], "enable-mouse-button-modifiers") == 0) ++ send_set_mousemods (TRUE); ++ else if (strcmp (argv[1], "disable-mouse-button-modifiers") == 0) ++ send_set_mousemods (FALSE); + else if (strcmp (argv[1], "toggle-verbose") == 0) + { + #ifndef WITH_VERBOSE_MODE +-- +cgit v0.9.0.2 diff --git a/metacity.spec b/metacity.spec index e75847b..ba2c9bc 100644 --- a/metacity.spec +++ b/metacity.spec @@ -32,6 +32,8 @@ Patch25: metacity-2.28-xioerror-unknown-display.patch Patch28: Stop-confusing-GDK-s-grab-tracking.patch # https://bugzilla.gnome.org/show_bug.cgi?id=622517 Patch29: Allow-breaking-out-from-maximization-during-mouse.patch +# https://bugzilla.gnome.org/show_bug.cgi?id=677115 +Patch30: disable-mouse-button-modifiers.patch Source1: window.png Source2: mini-window.png @@ -101,6 +103,7 @@ API. This package exists purely for technical reasons. %patch25 -p1 -b .xioerror-unknown-display %patch28 -p1 -b .grab-tracking %patch29 -p1 -b .mouse-unmaximize +%patch30 -p1 -b .button-modifiers cp -p %{SOURCE1} %{SOURCE2} src/ @@ -183,6 +186,9 @@ fi %{_mandir}/man1/metacity-window-demo.1.gz %changelog +* Thu Jun 14 2012 Peter Robinson <pbrobinson@fedoraproject.org> - 2.34.3-2 +- Add options to disable mouse button modifers + * Tue Mar 20 2012 Florian Müllner <fmuellner@redhat.com> - 2.34.3-1 - Update to new upstream version |