Commit 86582688 authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington

if a window is focused which is not either a dock or a transient in the

2003-10-25  Havoc Pennington  <hp@redhat.com>

	* src/window.c (meta_window_notify_focus): if a window is focused
	which is not either a dock or a transient in the same group as a
	dock, shuffle all dock/desktop windows to the end of the MRU list
	so they won't annoyingly get focus all the time. #123816
parent 8a271ee5
2003-10-25 Havoc Pennington <hp@redhat.com>
* src/window.c (meta_window_notify_focus): if a window is focused
which is not either a dock or a transient in the same group as a
dock, shuffle all dock/desktop windows to the end of the MRU list
so they won't annoyingly get focus all the time. #123816
2003-10-15 Yukihiro Nakai <nakai@gnome.gr.jp>
Gettextize metacity-theme-viewer. #121747
......
......@@ -3896,6 +3896,72 @@ meta_window_client_message (MetaWindow *window,
return FALSE;
}
static gboolean
is_in_dock_group (MetaWindow *window)
{
MetaGroup *group;
GSList *list;
GSList *tmp;
if (META_WINDOW_IN_DOCK_TAB_CHAIN (window))
return TRUE;
if (window->type == META_WINDOW_NORMAL)
return FALSE;
/* If a transient-type window is in dock group,
* return TRUE
*/
group = meta_window_get_group (window);
list = meta_group_list_windows (group);
tmp = list;
while (tmp != NULL)
{
MetaWindow *gw = tmp->data;
if (META_WINDOW_IN_DOCK_TAB_CHAIN (gw))
{
g_slist_free (list);
return TRUE;
}
tmp = tmp->next;
}
g_slist_free (list);
return FALSE;
}
static int
docks_at_end_cmp (const void *a,
const void *b)
{
MetaWindow *window_a = (MetaWindow*) a;
MetaWindow *window_b = (MetaWindow*) b;
if (META_WINDOW_IN_DOCK_TAB_CHAIN (window_a))
{
if (META_WINDOW_IN_DOCK_TAB_CHAIN (window_b))
return 0;
else
return 1; /* a > b since a is a dock */
}
else
{
if (META_WINDOW_IN_DOCK_TAB_CHAIN (window_b))
return -1; /* b > a since b is a dock */
else
return 0;
}
}
static void
shuffle_docks_to_end (GList **mru_list_p)
{
*mru_list_p = g_list_sort (*mru_list_p,
docks_at_end_cmp);
}
gboolean
meta_window_notify_focus (MetaWindow *window,
XEvent *event)
......@@ -3991,6 +4057,8 @@ meta_window_notify_focus (MetaWindow *window,
window->screen->active_workspace->mru_list =
g_list_prepend (window->screen->active_workspace->mru_list,
window);
if (!is_in_dock_group (window))
shuffle_docks_to_end (&window->screen->active_workspace->mru_list);
}
if (window->frame)
......
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