diff options
author | Rob Adams <readams@readams.net> | 2004-02-15 05:29:49 +0000 |
---|---|---|
committer | Rob Adams <readams@src.gnome.org> | 2004-02-15 05:29:49 +0000 |
commit | fd13022dc43864205fdbca0906d7c3343c537f7e (patch) | |
tree | b59655e06439bac8809028140ca6699b6cba6633 /src/workspace.c | |
parent | d53afd3ae1edc5bc084c7438393acb0b611e6832 (diff) | |
download | metacity-fd13022dc43864205fdbca0906d7c3343c537f7e.tar.gz |
If we're moving a window and receive a _NET_CURRENT_DESKTOP message
2004-02-14 Rob Adams <readams@readams.net>
If we're moving a window and receive a _NET_CURRENT_DESKTOP
message indicating a workspace switch, bring along the drag window
to the new workspace, solving a potentially weird bug where the
window would be lost on the old workspace. This also makes it
possible to implement edge flipping in an external program with
just a few lines of code. Patch for #131630 from ed@catmur.co.uk.
* src/keybindings.c (switch_to_workspace): remove function -- no
longer needed.
(handle_activate_workspace): call meta_workspace_activate instead
of switch_to_workspace
* src/workspace.c (meta_workspace_activate_with_focus): if we're
in a move grab op, bring along the drag window.
Diffstat (limited to 'src/workspace.c')
-rw-r--r-- | src/workspace.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/workspace.c b/src/workspace.c index df7a72dd..ee4d0bad 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -261,6 +261,7 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace, MetaWindow *focus_this) { MetaWorkspace *old; + MetaWindow *move_window; meta_verbose ("Activating workspace %d\n", meta_workspace_index (workspace)); @@ -277,15 +278,46 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace, if (old == NULL) return; + move_window = NULL; + if (workspace->screen->display->grab_op == META_GRAB_OP_MOVING || + workspace->screen->display->grab_op == META_GRAB_OP_KEYBOARD_MOVING) + move_window = workspace->screen->display->grab_window; + + if (move_window != NULL) + { + if (move_window->on_all_workspaces) + move_window = NULL; /* don't move it after all */ + + /* We put the window on the new workspace, flip spaces, + * then remove from old workspace, so the window + * never gets unmapped and we maintain the button grab + * on it. + */ + if (move_window) + { + if (!meta_workspace_contains_window (workspace, + move_window)) + meta_workspace_add_window (workspace, move_window); + } + } + meta_workspace_queue_calc_showing (old); meta_workspace_queue_calc_showing (workspace); + if (move_window) + /* Removes window from other spaces */ + meta_window_change_workspace (move_window, workspace); + if (focus_this) { meta_window_focus (focus_this, meta_display_get_current_time (focus_this->display)); meta_window_raise (focus_this); } + else if (move_window) + { + meta_window_raise (move_window); + } else { meta_topic (META_DEBUG_FOCUS, "Focusing default window on new workspace\n"); |