summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog37
-rw-r--r--src/actions.c1
-rw-r--r--src/data.h5
-rw-r--r--src/events.c38
-rw-r--r--src/list.c62
-rw-r--r--src/manage.c34
-rw-r--r--src/manage.h3
-rw-r--r--src/split.c91
-rw-r--r--src/split.h2
9 files changed, 202 insertions, 71 deletions
diff --git a/ChangeLog b/ChangeLog
index f510d3a..af71a1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,42 @@
2001-08-22 Shawn <sabetts@hotdog>
+ * src/split.h (set_frames_window): new prototype
+ (maximize_all_windows_in_frame): likewise
+
+ * src/split.c (set_frames_window): new function. all code setting
+ a frame's window updated to use this function.
+ (maximize_all_windows_in_frame): new function
+ (find_window_for_frame): don't include windows that are mapped in
+ another frame (not necessarily the frames active window).
+ (split_frame): maximize all windows in the existing frame, not
+ just the active one.
+ (split_frame): comment out unhiding transient window code.
+ (remove_all_splits): hide all mapped windows not in the current
+ frame.
+ (remove_all_splits): maximize all windows mapped in the current
+ frame.
+ (remove_all_splits): comment out hiding transient window code.
+ (remove_frame): when a frame's size has been changed, maximize all
+ windows in that frame.
+ (remove_frame): hide all windows in the frame being removed.
+
+ * src/manage.h (hide_others): new prototype
+
+ * src/manage.c (hide_window): set win's frame to NULL.
+ (unhide_window_below): renamed frame unhide_below_window. All
+ callers updated.
+ (hide_others): new function
+
+ * src/list.c (set_active_window): comment out hiding transient
+ window code.
+
+ * src/events.c (cleanup_frame): comment out hiding transient
+ window code.
+
+ * src/data.h (struct rp_window): new field 'frame'.
+
+ * src/actions.c (cmd_help): initialize old_i to 0
+
* src/list.c (set_active_window): Don't hide last_win's transient_for
windows if last_win and win share the same transient_for window.
diff --git a/src/actions.c b/src/actions.c
index 89bb18f..9ca22eb 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1100,6 +1100,7 @@ cmd_help (int interactive, void *data)
y += FONT_HEIGHT (s->font) * 2;
i = 0;
+ old_i = 0;
while (i<key_actions_last || drawing_keys)
{
if (drawing_keys)
diff --git a/src/data.h b/src/data.h
index 06f028b..832fbb3 100644
--- a/src/data.h
+++ b/src/data.h
@@ -70,6 +70,11 @@ struct rp_window
/* Saved mouse position */
int mouse_x, mouse_y;
+ /* A window can be visible inside a frame but not the frame's
+ current window. This keeps track of what frame the window was
+ mapped into. */
+ rp_window_frame *frame;
+
rp_window *next, *prev;
};
diff --git a/src/events.c b/src/events.c
index d3b4004..3ae1fd8 100644
--- a/src/events.c
+++ b/src/events.c
@@ -67,32 +67,36 @@ cleanup_frame (rp_window_frame *frame)
if (win)
{
rp_window *last_win;
- last_win = frame->win;
- frame->win = win;
+ last_win = set_frames_window (frame, win);
maximize (win);
- unhide_transient_for (win);
+// unhide_transient_for (win);
unhide_window (win);
- if (is_transient_ancestor (last_win, win))
+ if (!win->transient)
{
- hide_transient_for_between (last_win, win);
- }
- else if (last_win->transient && win->transient &&
- last_win->transient_for == win->transient_for)
- {
- /* Both last_win and win have the same transient_for so we
- don't need to hide anything more */
- }
- else
- {
- hide_transient_for (last_win);
+ hide_others(win);
}
+
+// if (is_transient_ancestor (last_win, win))
+// {
+// hide_transient_for_between (last_win, win);
+// }
+// else if (last_win->transient && win->transient &&
+// last_win->transient_for == win->transient_for)
+// {
+// /* Both last_win and win have the same transient_for so we
+// don't need to hide anything more */
+// }
+// else
+// {
+// hide_transient_for (last_win);
+// }
}
else
{
- hide_transient_for (frame->win);
- frame->win = NULL;
+// hide_transient_for (frame->win);
+ set_frames_window (frame, NULL);
}
}
diff --git a/src/list.c b/src/list.c
index 4d0cc8e..da2cc9b 100644
--- a/src/list.c
+++ b/src/list.c
@@ -119,7 +119,7 @@ find_window (Window w)
void
set_current_window (rp_window *win)
{
- rp_current_frame->win = win;
+ set_frames_window (rp_current_frame, win);
}
void
@@ -419,19 +419,19 @@ unhide_transient_for (rp_window *win)
if (find_windows_frame (transient_for) == NULL)
{
- frame->win = transient_for;
+ set_frames_window (frame, transient_for);
maximize (transient_for);
PRINT_DEBUG ("unhide transient window: %s\n", transient_for->name);
- unhide_below_window (transient_for);
+ unhide_window_below (transient_for);
if (transient_for->transient)
{
unhide_transient_for (transient_for);
}
- frame->win = win;
+ set_frames_window (frame, win);
}
else if (transient_for->transient)
{
@@ -504,42 +504,46 @@ set_active_window (rp_window *win)
if (win == NULL) return;
- last_win = rp_current_frame->win;
- rp_current_frame->win = win;
+ last_win = set_frames_window (rp_current_frame, win);
if (last_win) PRINT_DEBUG ("last window: %s\n", last_win->name);
PRINT_DEBUG ("new window: %s\n", win->name);
/* Make sure the window comes up full screen */
- unhide_transient_for (win);
+// unhide_transient_for (win);
maximize (win);
unhide_window (win);
- /* Hide the last window and its transients_fors */
- if (is_transient_ancestor (win, last_win))
+ if (!win->transient)
{
- /* Do nothing if last_win is a transient since it should stay visible */
+ hide_others(win);
}
- else
- {
- hide_window (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 if (last_win && last_win->transient && win->transient &&
- last_win->transient_for == win->transient_for)
- {
- /* Both last_win and win have the same transient_for so we
- don't need to hide anything more */
- }
- else
- {
- hide_transient_for (last_win);
- }
- }
+// /* Hide the last window and its transients_fors */
+// if (is_transient_ancestor (win, last_win))
+// {
+// /* Do nothing if last_win is a transient since it should stay visible */
+// }
+// else
+// {
+// hide_window (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 if (last_win && last_win->transient && win->transient &&
+// last_win->transient_for == win->transient_for)
+// {
+// /* Both last_win and win have the same transient_for so we
+// don't need to hide anything more */
+// }
+// else
+// {
+// hide_transient_for (last_win);
+// }
+// }
give_window_focus (win, last_win);
diff --git a/src/manage.c b/src/manage.c
index c1113d9..d85e875 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -298,7 +298,7 @@ maximize_transient (rp_window *win)
/* Set the window's border */
win->border = WINDOW_BORDER_WIDTH;
- frame = find_windows_frame (win);
+ frame = win->frame;
/* Honour the window's maximum size */
if (win->hints->flags & PMaxSize)
@@ -368,7 +368,7 @@ maximize_normal (rp_window *win)
/* Set the window's border */
win->border = WINDOW_BORDER_WIDTH;
- frame = find_windows_frame (win);
+ frame = win->frame;
/* Honour the window's maximum size */
if (win->hints->flags & PMaxSize)
@@ -500,6 +500,9 @@ hide_window (rp_window *win)
{
if (win == NULL) return;
+ /* An unmapped window is not inside a frame. */
+ win->frame = NULL;
+
/* Ignore the unmap_notify event. */
XSelectInput(dpy, win->w, WIN_EVENTS&~(StructureNotifyMask));
XUnmapWindow (dpy, win->w);
@@ -520,7 +523,7 @@ unhide_window (rp_window *win)
/* 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)
+unhide_window_below (rp_window *win)
{
if (win == NULL) return;
@@ -534,7 +537,6 @@ unhide_below_window (rp_window *win)
set_state (win, NormalState);
}
-
void
withdraw_window (rp_window *win)
{
@@ -558,3 +560,27 @@ withdraw_window (rp_window *win)
ignore_badwindow--;
}
+
+/* Hide all other mapped windows except for win in win's frame. */
+void
+hide_others (rp_window *win)
+{
+ rp_window_frame *frame;
+ rp_window *cur;
+
+ if (win == NULL) return;
+ frame = find_windows_frame (win);
+ if (frame == NULL) return;
+
+ for (cur = rp_mapped_window_sentinel->next;
+ cur != rp_mapped_window_sentinel;
+ cur = cur->next)
+ {
+ if (find_windows_frame (cur)
+ || cur->state != NormalState
+ || cur->frame != frame)
+ continue;
+
+ hide_window (cur);
+ }
+}
diff --git a/src/manage.h b/src/manage.h
index fb4c937..499e4f2 100644
--- a/src/manage.h
+++ b/src/manage.h
@@ -45,7 +45,8 @@ 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 unhide_window_below (rp_window *win);
void withdraw_window (rp_window *win);
+void hide_others (rp_window *win);
#endif /* ! _RATPOISION_MANAGE_H */
diff --git a/src/split.c b/src/split.c
index d81f385..2a282f9 100644
--- a/src/split.c
+++ b/src/split.c
@@ -28,6 +28,35 @@
rp_window_frame *rp_window_frame_sentinel;
rp_window_frame *rp_current_frame;
+rp_window *
+set_frames_window (rp_window_frame *frame, rp_window *win)
+{
+ rp_window *last_win;
+
+ last_win = frame->win;
+ frame->win = win;
+ if (win)
+ win->frame = frame;
+
+ return last_win;
+}
+
+void
+maximize_all_windows_in_frame (rp_window_frame *frame)
+{
+ rp_window *win;
+
+ for (win = rp_mapped_window_sentinel->next;
+ win != rp_mapped_window_sentinel;
+ win = win->next)
+ {
+ if (win->frame == frame)
+ {
+ maximize (win);
+ }
+ }
+}
+
static void
delete_frame_from_list (rp_window_frame *frame)
{
@@ -60,7 +89,7 @@ create_initial_frame ()
maximize_frame (rp_current_frame);
- rp_current_frame->win = NULL;
+ set_frames_window (rp_current_frame, NULL);
}
void
@@ -167,7 +196,8 @@ find_window_for_frame (rp_window_frame *frame)
if (cur != current_window()
&& !find_windows_frame (cur)
&& cur->last_access >= last_access
- && window_fits_in_frame (cur, frame))
+ && window_fits_in_frame (cur, frame)
+ && !cur->frame)
{
most_recent = cur;
last_access = cur->last_access;
@@ -193,7 +223,7 @@ split_frame (rp_window_frame *frame, int way)
rp_window_frame_sentinel->prev = new_frame;
new_frame->next = rp_window_frame_sentinel;
- new_frame->win = NULL;
+ set_frames_window (new_frame, NULL);
if (way)
{
@@ -219,24 +249,24 @@ split_frame (rp_window_frame *frame, int way)
{
PRINT_DEBUG ("Found a window for the frame!\n");
- new_frame->win = win;
+ set_frames_window (new_frame, win);
maximize (win);
unhide_window (win);
- unhide_transient_for (win);
+/* unhide_transient_for (win); */
XRaiseWindow (dpy, win->w);
}
else
{
PRINT_DEBUG ("No window fits the frame.\n");
- new_frame->win = NULL;
+ set_frames_window (new_frame, NULL);
}
/* resize the existing frame */
if (frame->win)
{
- maximize (frame->win);
+ maximize_all_windows_in_frame (frame);
XRaiseWindow (dpy, frame->win->w);
}
@@ -261,25 +291,45 @@ void
remove_all_splits ()
{
rp_window *cur_window;
- rp_window_frame *cur;
+ rp_window_frame *frame, *cur_frame;
+ rp_window *win;
cur_window = current_window();
+ cur_frame = rp_current_frame;
while (rp_window_frame_sentinel->next != rp_window_frame_sentinel)
{
- cur = rp_window_frame_sentinel->next;
- delete_frame_from_list (cur);
- if (cur != rp_current_frame)
+ frame = rp_window_frame_sentinel->next;
+ delete_frame_from_list (frame);
+ if (frame != rp_current_frame)
{
- hide_window (cur->win);
- hide_transient_for (cur->win);
+ for (win = rp_mapped_window_sentinel->next;
+ win != rp_mapped_window_sentinel;
+ win = win->next)
+ {
+ if (win->frame == frame)
+ hide_window (win);
+/* hide_transient_for (cur->win); */
+ }
}
- free (cur);
+ free (frame);
}
create_initial_frame ();
- rp_current_frame->win = cur_window;
- maximize (cur_window);
+
+ /* Maximize all the windows that were in the current frame. */
+ for (win = rp_mapped_window_sentinel->next;
+ win != rp_mapped_window_sentinel;
+ win = win->next)
+ {
+ if (win->frame == cur_frame)
+ {
+ set_frames_window (rp_current_frame, win);
+ maximize (win);
+ }
+ }
+
+ set_frames_window (rp_current_frame, cur_window);
}
static int
@@ -387,6 +437,7 @@ remove_frame (rp_window_frame *frame)
delete_frame_from_list (frame);
hide_window (frame->win);
+ hide_others (frame->win);
for (cur = rp_window_frame_sentinel->next;
cur != rp_window_frame_sentinel;
@@ -454,7 +505,7 @@ remove_frame (rp_window_frame *frame)
the new frame size. */
if (cur->win)
{
- maximize (cur->win);
+ maximize_all_windows_in_frame (cur);
XRaiseWindow (dpy, cur->win->w);
}
}
@@ -493,10 +544,10 @@ void
blank_frame (rp_window_frame *frame)
{
if (frame->win == NULL) return;
-
- hide_transient_for (frame->win);
+
+/* hide_transient_for (frame->win); */
hide_window (frame->win);
- frame->win = NULL;
+ set_frames_window (frame, NULL);
if (frame == rp_current_frame)
{
diff --git a/src/split.h b/src/split.h
index 00139f3..afc8c27 100644
--- a/src/split.h
+++ b/src/split.h
@@ -22,6 +22,8 @@
#ifndef SPLIT_H
#define SPLIT_H
+rp_window *set_frames_window (rp_window_frame *frame, rp_window *win);
+void maximize_all_windows_in_frame (rp_window_frame *frame);
void h_split_frame (rp_window_frame *frame);
void v_split_frame (rp_window_frame *frame);
void remove_all_splits ();