From bd72362cf682c093fe84802b6c08b67f6f9d819e Mon Sep 17 00:00:00 2001 From: sabetts Date: Sat, 18 Aug 2001 20:11:49 +0000 Subject: window flicker problems fixed --- ChangeLog | 21 +++++++++++++++++++++ src/events.c | 4 ++-- src/list.c | 53 +++++++++++++++++++++++++++++++++++++++++++++-------- src/list.h | 2 ++ src/manage.c | 6 +++++- src/split.c | 7 ++++++- 6 files changed, 81 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index e423c0f..ffda688 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2001-08-18 Shawn + + * src/split.c (split_frame): unhide transient_for windows as well + as the active window. + (remove_all_splits): hide transient_for windows as well as the + frame's active window. + + * src/manage.c (unhide_below_window): always lower the window + + * src/list.h (hide_transient_for_between): new prototype + (is_transient_ancestor): likewise + + * src/list.c (hide_transient_for_between): new function + (hide_transient_for): calls hide_transient_for_between + (is_transient_ancestor): new function + (set_active_window): don't temporarily hide windows that the newly + active window is a transient for (removes unnecessary flicker). + + * src/events.c (cleanup_frame): don't temporarily hide windows that the new + window is a transient for (removes unnecessary flicker). + 2001-08-07 Ryan Yeske * doc/ratpoison.texi: Fix spelling and grammar. diff --git a/src/events.c b/src/events.c index 86361bf..0937b0b 100644 --- a/src/events.c +++ b/src/events.c @@ -66,9 +66,9 @@ cleanup_frame (rp_window_frame *frame) win = find_window_other (); if (win) { - if (frame->win->transient - && find_window (win->transient_for) == frame->win) + if (is_transient_ancestor (frame->win, win)) { + hide_transient_for_between (frame->win, win); } else { 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); diff --git a/src/list.h b/src/list.h index 71b94ad..e216e9d 100644 --- a/src/list.h +++ b/src/list.h @@ -37,6 +37,8 @@ void goto_window (rp_window *win); void set_current_window (rp_window *win); void unhide_transient_for (rp_window *win); void hide_transient_for (rp_window *win); +void hide_transient_for_between (rp_window *win, rp_window *last); +int is_transient_ancestor (rp_window *win, rp_window *transient_for); /* int goto_window_name (char *name); */ rp_window *find_window_other (); rp_window *find_window_by_number (int n); diff --git a/src/manage.c b/src/manage.c index 434f698..c1113d9 100644 --- a/src/manage.c +++ b/src/manage.c @@ -523,9 +523,13 @@ void unhide_below_window (rp_window *win) { if (win == NULL) return; - if (win->state != IconicState) return; + /* Always lower the window, but if its not iconic we don't need to + map it since it already is mapped. */ XLowerWindow (dpy, win->w); + + if (win->state != IconicState) return; + XMapWindow (dpy, win->w); set_state (win, NormalState); } diff --git a/src/split.c b/src/split.c index 053ef5b..d81f385 100644 --- a/src/split.c +++ b/src/split.c @@ -223,6 +223,7 @@ split_frame (rp_window_frame *frame, int way) maximize (win); unhide_window (win); + unhide_transient_for (win); XRaiseWindow (dpy, win->w); } else @@ -268,7 +269,11 @@ remove_all_splits () { cur = rp_window_frame_sentinel->next; delete_frame_from_list (cur); - if (cur != rp_current_frame) hide_window (cur->win); + if (cur != rp_current_frame) + { + hide_window (cur->win); + hide_transient_for (cur->win); + } free (cur); } -- cgit v1.2.3