Commit fd13022d authored by Rob Adams's avatar Rob Adams Committed by Rob Adams

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.
parent d53afd3a
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.
2004-02-14 Rob Adams <readams@readams.net>
* configure.in: Add configure option to not even try using
......
......@@ -2441,44 +2441,6 @@ process_tab_grab (MetaDisplay *display,
return key_used;
}
static void
switch_to_workspace (MetaDisplay *display,
MetaWorkspace *workspace)
{
MetaWindow *move_window;
move_window = NULL;
if (display->grab_op == META_GRAB_OP_MOVING)
move_window = 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_activate (workspace);
if (move_window)
{
/* Removes window from other spaces */
meta_window_change_workspace (move_window, workspace);
meta_window_raise (move_window);
}
}
static void
handle_activate_workspace (MetaDisplay *display,
MetaScreen *screen,
......@@ -2504,7 +2466,7 @@ handle_activate_workspace (MetaDisplay *display,
if (workspace)
{
switch_to_workspace (display, workspace);
meta_workspace_activate (workspace);
}
else
{
......@@ -2704,7 +2666,7 @@ process_workspace_switch_grab (MetaDisplay *display,
meta_topic (META_DEBUG_KEYBINDINGS,
"Activating target workspace\n");
switch_to_workspace (display, target_workspace);
meta_workspace_activate (target_workspace);
return TRUE; /* we already ended the grab */
}
......@@ -2770,7 +2732,7 @@ process_workspace_switch_grab (MetaDisplay *display,
meta_topic (META_DEBUG_KEYBINDINGS,
"Activating target workspace\n");
switch_to_workspace (display, target_workspace);
meta_workspace_activate (target_workspace);
return TRUE; /* we already ended the grab */
}
......@@ -3392,7 +3354,7 @@ handle_workspace_switch (MetaDisplay *display,
meta_display_end_grab_op (display, event->xkey.time);
}
switch_to_workspace (display, next);
meta_workspace_activate (next);
if (grabbed_before_release)
{
......
......@@ -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");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment