summaryrefslogtreecommitdiff
path: root/src/list.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2001-08-18 20:11:49 +0000
committersabetts <sabetts>2001-08-18 20:11:49 +0000
commitbd72362cf682c093fe84802b6c08b67f6f9d819e (patch)
tree4ec3cee8a08ff482d3bc355cfd44615516b26958 /src/list.c
parent0e8dcd222996415bfa403b8e385e441c24375339 (diff)
downloadratpoison-bd72362cf682c093fe84802b6c08b67f6f9d819e.zip
window flicker problems fixed
Diffstat (limited to 'src/list.c')
-rw-r--r--src/list.c53
1 files changed, 45 insertions, 8 deletions
diff --git a/src/list.c b/src/list.c
index d4a7ab5..e1f982d 100644
--- a/src/list.c
+++ b/src/list.c
@@ -439,8 +439,9 @@ unhide_transient_for (rp_window *win)
}
}
+/* Hide all transient windows for win until we get to last. */
void
-hide_transient_for (rp_window *win)
+hide_transient_for_between (rp_window *win, rp_window *last)
{
rp_window *transient_for;
@@ -448,7 +449,7 @@ hide_transient_for (rp_window *win)
if (!win->transient) return;
transient_for = find_window (win->transient_for);
- if (transient_for == NULL)
+ if (transient_for == last)
{
PRINT_DEBUG ("Can't find transient_for for '%s'", win->name );
return;
@@ -459,13 +460,42 @@ hide_transient_for (rp_window *win)
PRINT_DEBUG ("hide transient window: %s\n", transient_for->name);
hide_window (transient_for);
}
-
+
if (transient_for->transient)
{
hide_transient_for (transient_for);
}
}
+void
+hide_transient_for (rp_window *win)
+{
+ /* Hide ALL the transient windows for win. */
+ hide_transient_for_between (win, NULL);
+}
+
+/* return 1 if transient_for is a transient window for win or one of
+ win's transient_for ancestors. */
+int
+is_transient_ancestor (rp_window *win, rp_window *transient_for)
+{
+ rp_window *tmp;
+
+ if (win == NULL) return 0;
+ if (!win->transient) return 0;
+ if (transient_for == NULL) return 0;
+
+ tmp = win;
+
+ do
+ {
+ tmp = find_window (tmp->transient_for);
+ if (tmp == transient_for)
+ return 1;
+ } while (tmp->transient);
+
+ return 0;
+}
void
set_active_window (rp_window *win)
@@ -480,17 +510,24 @@ set_active_window (rp_window *win)
if (last_win) PRINT_DEBUG ("last window: %s\n", last_win->name);
PRINT_DEBUG ("new window: %s\n", win->name);
- if (win->transient
- && find_window (win->transient_for) == last_win)
+ if (is_transient_ancestor (win, last_win))
{
- /* Do nothing if the transient is already in the frame */
+ /* Do nothing if last_win is a transient since it should stay visible */
}
else
{
hide_window (last_win);
- }
- hide_transient_for (last_win);
+ if (last_win && is_transient_ancestor (last_win, win))
+ {
+ /* We only need to hide the transients "between" last_win and win */
+ hide_transient_for_between (last_win, win);
+ }
+ else
+ {
+ hide_transient_for (last_win);
+ }
+ }
/* Make sure the window comes up full screen */
unhide_transient_for (win);