diff options
author | Daniel Drake <dsd@laptop.org> | 2012-05-30 09:42:34 -0600 |
---|---|---|
committer | Daniel Drake <dsd@laptop.org> | 2012-06-07 09:15:13 -0600 |
commit | 86fd12cbf06f693405650b9d6f7c6234757cc354 (patch) | |
tree | b1a7fb6c6d35e9ffd3de1eb7acf2492479ab5ecc /src/core | |
parent | 0e339a7ce6c8100b2d85c4576ebc8e82b96aaab5 (diff) | |
download | metacity-86fd12cbf06f693405650b9d6f7c6234757cc354.tar.gz |
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
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/atomnames.h | 1 | ||||
-rw-r--r-- | src/core/display.c | 23 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/core/atomnames.h b/src/core/atomnames.h index 338d0555..14dbd8f3 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 b70112d0..440f2fb8 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) { |