summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2005-02-20 07:38:06 +0000
committerElijah Newren <newren@src.gnome.org>2005-02-20 07:38:06 +0000
commit9a2b10293ece770f073a9d76c83c3c17965eedad (patch)
treee28694897f4bc8758cf08e7d8e2e884afa206e70
parent53f77c312dd814655dd31f058b2d25c88f175071 (diff)
downloadlibwnck-gnome-2-8.tar.gz
Backport of fix in the development branch to allow minimizing an app viagnome-2-8
2005-02-20 Elijah Newren <newren@gmail.com> Backport of fix in the development branch to allow minimizing an app via tasklist even when it has a transient. Fixes #121556. * libwnck/tasklist.c (wnck_tasklist_activate_task_window): minimize the window if the window is active or its transient is * libwnck/window.[ch] (wnck_window_transient_is_active): New function to determine if a transient of a given window is active.
-rw-r--r--ChangeLog11
-rw-r--r--libwnck/tasklist.c2
-rw-r--r--libwnck/window.c38
-rw-r--r--libwnck/window.h2
4 files changed, 51 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 8099d0b..08879a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2005-02-20 Elijah Newren <newren@gmail.com>
+ Backport of fix in the development branch to allow minimizing an
+ app via tasklist even when it has a transient. Fixes #121556.
+
+ * libwnck/tasklist.c (wnck_tasklist_activate_task_window):
+ minimize the window if the window is active or its transient is
+
+ * libwnck/window.[ch] (wnck_window_transient_is_active): New
+ function to determine if a transient of a given window is active.
+
+2005-02-20 Elijah Newren <newren@gmail.com>
+
Backport of fix in the development branch; patch from Juerg
Billeter to fix #163343.
diff --git a/libwnck/tasklist.c b/libwnck/tasklist.c
index 8316953..9f112fc 100644
--- a/libwnck/tasklist.c
+++ b/libwnck/tasklist.c
@@ -1943,7 +1943,7 @@ wnck_tasklist_activate_task_window (WnckTask *task)
}
else
{
- if (task->was_active)
+ if (task->was_active || wnck_window_transient_is_active (task->window))
{
task->was_active = FALSE;
wnck_window_minimize (task->window);
diff --git a/libwnck/window.c b/libwnck/window.c
index 02fb59a..7f1271f 100644
--- a/libwnck/window.c
+++ b/libwnck/window.c
@@ -1161,6 +1161,44 @@ wnck_window_activate_transient (WnckWindow *window)
}
}
+/**
+ * wnck_window_transient_is_active:
+ * @window: a #WnckWindow
+ *
+ * Return whether @window or one of its transients has focus. This
+ * function is needed because clicking on the tasklist once will
+ * activate a transient instead of the window itself
+ * (wnck_window_activate_transient), and clicking again should
+ * minimize the window and it's transients. (Not doing this can be
+ * especially annoying in the case of modal dialogs that don't appear
+ * in the tasklist).
+ *
+ **/
+gboolean
+wnck_window_transient_is_active (WnckWindow *window)
+{
+ GList *windows;
+ WnckWindow *transient;
+
+ if (!WNCK_IS_WINDOW (window))
+ return FALSE;
+
+ windows = wnck_screen_get_windows_stacked (window->priv->screen);
+
+ transient = window;
+ while (transient = find_last_transient_for (windows, transient->priv->xwindow))
+ {
+ /* catch transient cycles */
+ if (transient == window)
+ return FALSE;
+
+ if (wnck_window_is_active (transient))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void
get_icons (WnckWindow *window)
{
diff --git a/libwnck/window.h b/libwnck/window.h
index 6e960f7..b4a1347 100644
--- a/libwnck/window.h
+++ b/libwnck/window.h
@@ -195,7 +195,7 @@ void wnck_window_activate (WnckWindow *window);
gboolean wnck_window_is_active (WnckWindow *window);
gboolean wnck_window_is_most_recently_activated (WnckWindow *window);
void wnck_window_activate_transient (WnckWindow *window);
-
+gboolean wnck_window_transient_is_active (WnckWindow *window);
GdkPixbuf* wnck_window_get_icon (WnckWindow *window);
GdkPixbuf* wnck_window_get_mini_icon (WnckWindow *window);