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.
This commit is contained in:
Rob Adams 2004-02-15 05:29:49 +00:00 committed by Rob Adams
parent d53afd3ae1
commit fd13022dc4
3 changed files with 53 additions and 42 deletions

View File

@ -1,3 +1,20 @@
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

View File

@ -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)
{

View File

@ -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");