focus top window when switching to a new workspace

2002-01-03  Havoc Pennington  <hp@pobox.com>

	* src/workspace.c (meta_workspace_activate): focus top window when
	switching to a new workspace

	* src/util.c (meta_topic): start putting verbose output in
	categories

	* src/window.c (meta_window_shade): focus frame after we queue
	the calc_showing so the maps/unmaps have already happened.

	* src/display.c (meta_display_get_current_time): add the "get time
	of current event" function and call it occasionally.

	* src/window.c (meta_window_free): if we have focus, call
	meta_screen_focus_top_window().
	(meta_window_minimize): ditto
	(meta_window_delete): ditto

	* src/screen.c (meta_screen_ensure_tab_popup): fix memory leak -
	didn't free tab list
	(meta_screen_focus_top_window): new function to use when we unmap
	or unmanage a focused window

	* src/stack.c (meta_stack_get_default_focus_window): function used
	in meta_screen_focus_top_window
This commit is contained in:
Havoc Pennington
2002-01-03 23:28:19 +00:00
committed by Havoc Pennington
parent 86e9191d34
commit ee1361fb6e
13 changed files with 395 additions and 36 deletions

View File

@@ -869,8 +869,62 @@ meta_stack_get_below (MetaStack *stack,
return link->next->data;
else
return find_prev_below_layer (stack, window->layer);
}
MetaWindow*
meta_stack_get_default_focus_window (MetaStack *stack,
MetaWorkspace *workspace,
MetaWindow *not_this_one)
{
/* FIXME if stack is frozen this is kind of broken. */
/* Find the topmost, focusable, mapped, window. */
MetaWindow *topmost_dock;
int layer = META_LAYER_LAST;
topmost_dock = NULL;
--layer;
while (layer >= 0)
{
GList *link;
g_assert (layer >= 0 && layer < META_LAYER_LAST);
/* top of this layer is at the front of the list */
link = stack->layers[layer];
while (link)
{
MetaWindow *window = link->data;
if (window &&
window != not_this_one &&
(workspace == NULL ||
meta_window_visible_on_workspace (window, workspace)))
{
if (topmost_dock == NULL &&
window->type == META_WINDOW_DOCK)
topmost_dock = window;
else
return window;
}
link = link->next;
}
--layer;
}
/* If we didn't find a window to focus, we use the topmost dock.
* Note that we already tried the desktop - so we prefer focusing
* desktop to focusing the dock.
*/
return topmost_dock;
}
#define IN_TAB_CHAIN(w) ((w)->type != META_WINDOW_DOCK && (w)->type != META_WINDOW_DESKTOP)
#define GET_XWINDOW(stack, i) (g_array_index ((stack)->windows, \
Window, (i)))