summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsabetts <sabetts>2001-06-01 11:33:51 +0000
committersabetts <sabetts>2001-06-01 11:33:51 +0000
commit8161a84a50dde1a2af5707b25e2130ea2819470a (patch)
tree8eaa096f92d6800f2ebfa40d8f4194613603875f
parent7329ec0e6d192dc8f4046e3776d5a3bc07cd3f12 (diff)
downloadratpoison-8161a84a50dde1a2af5707b25e2130ea2819470a.zip
transients appear overtop of other windows
-rw-r--r--ChangeLog5
-rw-r--r--src/events.c23
-rw-r--r--src/list.c102
-rw-r--r--src/list.h2
-rw-r--r--src/manage.c14
-rw-r--r--src/manage.h1
-rw-r--r--src/split.c1
7 files changed, 144 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 65e57ba..aa0b2ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-06-01 shawn <sabetts@diggin.lamenet.tmp>
+
+ * src/events.c (cleanup_frame): hide the frame's window's
+ transient_for windows.
+
2001-05-24 Shawn Betts <sabetts@van.gobasis.com>
* src/events.c (colormap_notify): ignore badwindows when
diff --git a/src/events.c b/src/events.c
index 26edccb..bb1ddbc 100644
--- a/src/events.c
+++ b/src/events.c
@@ -58,12 +58,31 @@ new_window (XCreateWindowEvent *e)
static void
cleanup_frame (rp_window_frame *frame)
{
- frame->win = find_window_other ();
- if (frame->win)
+ rp_window *win;
+
+ win = find_window_other ();
+ if (win)
{
+ if (frame->win->transient
+ && find_window (win->transient_for) == frame->win)
+ {
+ }
+ else
+ {
+ hide_transient_for (frame->win);
+ }
+
+ frame->win = win;
+
maximize (frame->win);
+ unhide_transient_for (frame->win);
unhide_window (frame->win);
}
+ else
+ {
+ hide_transient_for (frame->win);
+ frame->win = NULL;
+ }
}
void
diff --git a/src/list.c b/src/list.c
index 750221e..a53d0b8 100644
--- a/src/list.c
+++ b/src/list.c
@@ -403,6 +403,61 @@ give_window_focus (rp_window *win, rp_window *last_win)
}
void
+unhide_transient_for (rp_window *win)
+{
+ rp_window_frame *frame;
+ rp_window *transient_for;
+
+ if (win == NULL) return;
+ if (!win->transient) return;
+ frame = find_windows_frame (win);
+
+ transient_for = find_window (win->transient_for);
+ if (find_windows_frame (transient_for) == NULL)
+ {
+ frame->win = transient_for;
+ maximize (transient_for);
+
+ PRINT_DEBUG ("unhide transient window: %s\n", transient_for->name);
+
+ unhide_below_window (transient_for);
+
+ if (transient_for->transient)
+ {
+ unhide_transient_for (transient_for);
+ }
+
+ frame->win = win;
+ }
+ else if (transient_for->transient)
+ {
+ unhide_transient_for (transient_for);
+ }
+}
+
+void
+hide_transient_for (rp_window *win)
+{
+ rp_window *transient_for;
+
+ if (win == NULL) return;
+ if (!win->transient) return;
+
+ transient_for = find_window (win->transient_for);
+ if (find_windows_frame (transient_for) == NULL)
+ {
+ PRINT_DEBUG ("hide transient window: %s\n", transient_for->name);
+ hide_window (transient_for);
+ }
+
+ if (transient_for->transient)
+ {
+ hide_transient_for (transient_for);
+ }
+}
+
+
+void
set_active_window (rp_window *win)
{
rp_window *last_win;
@@ -412,14 +467,57 @@ set_active_window (rp_window *win)
last_win = rp_current_frame->win;
rp_current_frame->win = 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)
+ {
+ /* Do nothing if the transient is already in the frame */
+ }
+ else
+ {
+ hide_window (last_win);
+ }
+
+ hide_transient_for (last_win);
+
/* Make sure the window comes up full screen */
+ unhide_transient_for (win);
maximize (win);
unhide_window (win);
- give_window_focus (win, last_win);
- hide_window (last_win);
+
+ /* hide the old active window */
+/* if (win->transient */
+/* && find_window (win->transient_for) == last_win) */
+/* { */
+/* /\* Do nothing if the transient is already in the frame *\/ */
+/* } */
+/* else */
+/* { */
+/* if (last_win) */
+/* { */
+/* if(win->transient && last_win->transient */
+/* && find_window (win->transient_for) == find_window (last_win->transient_for)) */
+/* { */
+/* /\* Do nothing if last win's transient is already in the */
+/* frame. *\/ */
+/* } */
+/* else */
+/* { */
+/* hide_transient_for (last_win); */
+/* } */
+
+/* hide_window (last_win); */
+/* } */
+
+ give_window_focus (win, last_win);
+/* } */
/* Make sure the program bar is always on the top */
update_window_names (win->scr);
+
+ XSync (dpy, False);
}
/* Go to the window, switching frames if the window is already in a
diff --git a/src/list.h b/src/list.h
index 8a97f92..71b94ad 100644
--- a/src/list.h
+++ b/src/list.h
@@ -35,6 +35,8 @@ void give_window_focus (rp_window *win, rp_window *last_win);
void set_active_window (rp_window *win);
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);
/* 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 11fbfd9..e611b1f 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -515,6 +515,20 @@ unhide_window (rp_window *win)
set_state (win, NormalState);
}
+/* same as unhide_window except that it make sure the window is mapped
+ on the bottom of the window stack. */
+void
+unhide_below_window (rp_window *win)
+{
+ if (win == NULL) return;
+ if (win->state != IconicState) return;
+
+ XLowerWindow (dpy, win->w);
+ XMapWindow (dpy, win->w);
+ set_state (win, NormalState);
+}
+
+
void
withdraw_window (rp_window *win)
{
diff --git a/src/manage.h b/src/manage.h
index 5607cda..fb4c937 100644
--- a/src/manage.h
+++ b/src/manage.h
@@ -45,6 +45,7 @@ void ungrab_prefix_key (Window w);
void hide_window (rp_window *win);
void unhide_window (rp_window *win);
+void unhide_below_window (rp_window *win);
void withdraw_window (rp_window *win);
#endif /* ! _RATPOISION_MANAGE_H */
diff --git a/src/split.c b/src/split.c
index eafef7a..b14dca3 100644
--- a/src/split.c
+++ b/src/split.c
@@ -489,6 +489,7 @@ blank_frame (rp_window_frame *frame)
{
if (frame->win == NULL) return;
+ hide_transient_for (frame->win);
hide_window (frame->win);
frame->win = NULL;