summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-10-26 16:22:51 +0000
committerHavoc Pennington <hp@src.gnome.org>2003-10-26 16:22:51 +0000
commit8658268847b63805d6cba9382e888234dbe03697 (patch)
treeec6eb73f24278c762d2842f9bce7eb301e594451
parent8a271ee5ac91871cbc658eb725f0440383cbaaf3 (diff)
downloadmetacity-8658268847b63805d6cba9382e888234dbe03697.tar.gz
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
-rw-r--r--ChangeLog7
-rw-r--r--src/window.c68
2 files changed, 75 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 7d259b58..be54b043 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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
diff --git a/src/window.c b/src/window.c
index b6cc5d57..b24620e5 100644
--- a/src/window.c
+++ b/src/window.c
@@ -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)