From f65b7c59d377b77d0851b176c52c3f0c10b42bec Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Sat, 14 Apr 2012 15:12:48 +0200 Subject: [PATCH] Make it possible to reimplement move-to-workspace keybindings from plugins Export the necessary functions so that a plugin that wishes to do so can reimplement those keybindings without loss of functionality. https://bugzilla.gnome.org/show_bug.cgi?id=674104 --- src/core/display.c | 15 +++++++++++++++ src/core/keybindings.c | 2 +- src/core/window.c | 3 +++ src/meta/display.h | 2 ++ src/meta/window.h | 2 ++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/core/display.c b/src/core/display.c index a789fcb9e..661480e7a 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -5535,3 +5535,18 @@ meta_display_get_leader_window (MetaDisplay *display) { return display->leader_window; } + +/** + * meta_display_clear_mouse_mode: + * @display: a #MetaDisplay + * + * Sets the mouse-mode flag to %FALSE, which means that motion events are + * no longer ignored in mouse or sloppy focus. + * This is an internal function. It should be used only for reimplementing + * keybindings, and only in a manner compatible with core code. + */ +void +meta_display_clear_mouse_mode (MetaDisplay *display) +{ + display->mouse_mode = FALSE; +} diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 9c41fc0de..cba90f3a5 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -3434,7 +3434,7 @@ handle_move_to_workspace (MetaDisplay *display, meta_topic (META_DEBUG_FOCUS, "Resetting mouse_mode to FALSE due to " "handle_move_to_workspace() call with flip set.\n"); - workspace->screen->display->mouse_mode = FALSE; + meta_display_clear_mouse_mode (workspace->screen->display); meta_workspace_activate_with_focus (workspace, window, event->xkey.time); diff --git a/src/core/window.c b/src/core/window.c index d93026c0e..9f1c99d31 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -5677,6 +5677,9 @@ meta_window_change_workspace (MetaWindow *window, { g_return_if_fail (!window->override_redirect); + if (window->always_sticky) + return; + meta_window_change_workspace_without_transients (window, workspace); meta_window_foreach_transient (window, change_workspace_foreach, diff --git a/src/meta/display.h b/src/meta/display.h index afdfac472..04d545c36 100644 --- a/src/meta/display.h +++ b/src/meta/display.h @@ -175,4 +175,6 @@ void meta_display_unmanage_screen (MetaDisplay *display, MetaScreen *screen, guint32 timestamp); +void meta_display_clear_mouse_mode (MetaDisplay *display); + #endif diff --git a/src/meta/window.h b/src/meta/window.h index 1d2f59b76..48ce79a3d 100644 --- a/src/meta/window.h +++ b/src/meta/window.h @@ -116,6 +116,8 @@ void meta_window_change_workspace_by_index (MetaWindow *window, gint space_index, gboolean append, guint32 timestamp); +void meta_window_change_workspace (MetaWindow *window, + MetaWorkspace *workspace); GObject *meta_window_get_compositor_private (MetaWindow *window); void meta_window_set_compositor_private (MetaWindow *window, GObject *priv); void meta_window_configure_notify (MetaWindow *window, XConfigureEvent *event);