summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog23
-rw-r--r--src/actions.c57
-rw-r--r--src/data.h28
-rw-r--r--src/events.c21
-rw-r--r--src/frame.c52
-rw-r--r--src/frame.h38
-rw-r--r--src/main.c24
-rw-r--r--src/manage.c8
-rw-r--r--src/screen.c20
-rw-r--r--src/screen.h2
-rw-r--r--src/split.c194
-rw-r--r--src/split.h44
-rw-r--r--src/window.c8
-rw-r--r--src/window.h2
14 files changed, 295 insertions, 226 deletions
diff --git a/ChangeLog b/ChangeLog
index 32bcc0d..55d8d97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2003-05-15 Shawn Betts <sabetts@sfu.ca>
+
+ * src/data.h (struct rp_frame): renamed from rp_window_frame. All
+ dependant code updated.
+
+ * src/main.c: remove child_info global. Add rp_children global.
+ (chld_handler): update the terminated and status fields of any
+ terminated children.
+
+ * src/events.c (handle_signals): loop through each child process
+ and remove them from the list. Print a message for any child that
+ doesn't return a 0 status.
+
+ * src/data.h (rp_child_info): new fields, terminated and node.
+ remove child_info global. Add rp_children global.
+
+ * src/actions.c (spawn): Add the command to the list of children.
+
+2003-05-14 Shawn Betts <sabetts@sfu.ca>
+
+ * src/data.h (struct rp_screen): rename from
+ screen_info. Dependant code updated.
+
2003-05-09 Shawn Betts <sabetts@sfu.ca>
* src/manage.h (clear_unmanaged_list): new prototype
diff --git a/src/actions.c b/src/actions.c
index 7c270ce..e293aa1 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -672,7 +672,7 @@ cmd_prev (int interactive, char *data)
char *
cmd_prev_frame (int interactive, char *data)
{
- rp_window_frame *frame;
+ rp_frame *frame;
frame = find_frame_next (current_frame());
if (!frame)
@@ -714,7 +714,7 @@ cmd_next (int interactive, char *data)
char *
cmd_next_frame (int interactive, char *data)
{
- rp_window_frame *frame;
+ rp_frame *frame;
frame = find_frame_next (current_frame());
if (!frame)
@@ -1012,6 +1012,7 @@ cmd_exec (int interactive, char *data)
int
spawn(char *cmd)
{
+ rp_child_info *child;
int pid;
pid = fork();
@@ -1038,6 +1039,14 @@ spawn(char *cmd)
/* wait((int *) 0); */
PRINT_DEBUG (("spawned %s\n", cmd));
+ /* Add this child process to our list. */
+ child = malloc (sizeof (rp_child_info));
+ child->cmd = strdup (cmd);
+ child->pid = pid;
+ child->terminated = 0;
+
+ list_add (&child->node, &rp_children);
+
return pid;
}
@@ -1107,7 +1116,7 @@ cmd_time (int interactive, char *data)
char *
cmd_number (int interactive, char *data)
{
- rp_window_frame *frame;
+ rp_frame *frame;
int old_number, new_number;
rp_window *other_win, *win;
char *str;
@@ -1350,7 +1359,7 @@ read_split (const char *str, int max)
char *
cmd_h_split (int interactive, char *data)
{
- rp_window_frame *frame;
+ rp_frame *frame;
int pixels;
frame = current_frame();
@@ -1372,7 +1381,7 @@ cmd_h_split (int interactive, char *data)
char *
cmd_v_split (int interactive, char *data)
{
- rp_window_frame *frame;
+ rp_frame *frame;
int pixels;
frame = current_frame();
@@ -1404,7 +1413,7 @@ char *
cmd_remove (int interactive, char *data)
{
rp_screen *s = current_screen();
- rp_window_frame *frame;
+ rp_frame *frame;
if (num_frames(s) <= 1)
{
@@ -1474,10 +1483,10 @@ cmd_resize (int interactive, char *data)
resize_shrink_to_window (current_frame());
else if (c == INPUT_ABORT_KEY && mod == INPUT_ABORT_MODIFIER)
{
- rp_window_frame *cur;
+ rp_frame *cur;
screen_restore_frameset (s, bk);
- list_for_each_entry (cur, &s->rp_window_frames, node)
+ list_for_each_entry (cur, &s->frames, node)
{
maximize_all_windows_in_frame (cur);
}
@@ -2059,7 +2068,7 @@ cmd_deffont (int interactive, char *data)
char *
cmd_defpadding (int interactive, char *data)
{
- rp_window_frame *frame;
+ rp_frame *frame;
int l, t, r, b;
if (data == NULL && !interactive)
@@ -2078,7 +2087,7 @@ cmd_defpadding (int interactive, char *data)
/* Resize the frames to make sure they are not too big and not too
small. */
- list_for_each_entry (frame,&(current_screen()->rp_window_frames),node)
+ list_for_each_entry (frame,&(current_screen()->frames),node)
{
int bk_pos, bk_len;
@@ -2510,7 +2519,7 @@ cmd_lastmsg (int interactive, char *data)
char *
cmd_focusup (int interactive, char *data)
{
- rp_window_frame *frame;
+ rp_frame *frame;
if ((frame = find_frame_up (current_frame())))
set_active_frame (frame);
@@ -2521,7 +2530,7 @@ cmd_focusup (int interactive, char *data)
char *
cmd_focusdown (int interactive, char *data)
{
- rp_window_frame *frame;
+ rp_frame *frame;
if ((frame = find_frame_down (current_frame())))
set_active_frame (frame);
@@ -2532,7 +2541,7 @@ cmd_focusdown (int interactive, char *data)
char *
cmd_focusleft (int interactive, char *data)
{
- rp_window_frame *frame;
+ rp_frame *frame;
if ((frame = find_frame_left (current_frame())))
set_active_frame (frame);
@@ -2543,7 +2552,7 @@ cmd_focusleft (int interactive, char *data)
char *
cmd_focusright (int interactive, char *data)
{
- rp_window_frame *frame;
+ rp_frame *frame;
if ((frame = find_frame_right (current_frame())))
set_active_frame (frame);
@@ -2583,7 +2592,7 @@ cmd_startup_message (int interactive, char *data)
char *
cmd_focuslast (int interactive, char *data)
{
- rp_window_frame *frame = find_last_frame(current_screen());
+ rp_frame *frame = find_last_frame(current_screen());
if (frame)
set_active_frame (frame);
@@ -2842,7 +2851,7 @@ cmd_tmpwm (int interactive, char *data)
/* FIXME: drop all our windows. We shouldn't do this. */
list_for_each_safe_entry (win, iter, tmp, &rp_mapped_window, node)
{
- rp_window_frame *frame;
+ rp_frame *frame;
/* Remove the window from the frame. */
frame = find_windows_frame (win);
@@ -2892,7 +2901,7 @@ cmd_tmpwm (int interactive, char *data)
char *
cmd_fselect (int interactive, char *data)
{
- rp_window_frame *frame;
+ rp_frame *frame;
rp_screen *s = current_screen();
int fnum = -1;
@@ -2927,7 +2936,7 @@ cmd_fselect (int interactive, char *data)
Window *wins;
XSetWindowAttributes attr;
int i;
- rp_window_frame *cur;
+ rp_frame *cur;
/* Set up the window attributes to be used in the loop. */
attr.border_pixel = s->fg_color;
@@ -2939,7 +2948,7 @@ cmd_fselect (int interactive, char *data)
/* Loop through each frame and display its number in it's top
left corner. */
i = 0;
- list_for_each_entry (cur, &s->rp_window_frames, node)
+ list_for_each_entry (cur, &s->frames, node)
{
int width, height;
char *num;
@@ -3005,12 +3014,12 @@ cmd_fdump (int interactively, char *data)
{
struct sbuf *s;
char *tmp;
- rp_window_frame *cur;
+ rp_frame *cur;
s = sbuf_new (0);
/* FIXME: Oooh, gross! there's a trailing comma, yuk! */
- list_for_each_entry (cur, &current_screen()->rp_window_frames, node)
+ list_for_each_entry (cur, &current_screen()->frames, node)
{
sbuf_concat (s, frame_dump (cur));
sbuf_concat (s, ",");
@@ -3027,7 +3036,7 @@ cmd_frestore (int interactively, char *data)
rp_screen *s = current_screen();
char *token;
char *dup;
- rp_window_frame *new, *cur;
+ rp_frame *new, *cur;
rp_window *win;
struct list_head fset;
int max = -1;
@@ -3066,7 +3075,7 @@ cmd_frestore (int interactively, char *data)
free (dup);
/* Clear all the frames. */
- list_for_each_entry (cur, &s->rp_window_frames, node)
+ list_for_each_entry (cur, &s->frames, node)
{
PRINT_DEBUG (("blank %d\n", cur->number));
blank_frame (cur);
@@ -3077,7 +3086,7 @@ cmd_frestore (int interactively, char *data)
numset_clear (s->frames_numset);
/* Process the frames a bit to make sure everything lines up. */
- list_for_each_entry (cur, &s->rp_window_frames, node)
+ list_for_each_entry (cur, &s->frames, node)
{
rp_window *win;
diff --git a/src/data.h b/src/data.h
index 46115e1..c14040b 100644
--- a/src/data.h
+++ b/src/data.h
@@ -49,9 +49,10 @@
typedef struct rp_window rp_window;
typedef struct rp_screen rp_screen;
typedef struct rp_action rp_action;
-typedef struct rp_window_frame rp_window_frame;
+typedef struct rp_frame rp_frame;
+typedef struct rp_child_info rp_child_info;
-struct rp_window_frame
+struct rp_frame
{
int number;
int x, y, width, height;
@@ -123,7 +124,7 @@ struct rp_screen
/* A list of frames that may or may not contain windows. There should
always be one in the list. */
- struct list_head rp_window_frames;
+ struct list_head frames;
/* Keep track of which numbers have been given to frames. */
struct numset *frames_numset;
@@ -194,13 +195,28 @@ struct rp_defaults
/* Information about a child process. */
struct rp_child_info
{
+ /* The command that was executed. */
+ char *cmd;
+
+ /* PID of the process. */
int pid;
+
+ /* Return status when the child process finished. */
int status;
+
+ /* When this is != 0 then the process finished. */
+ int terminated;
+
+ /* This structure can exist in a list. */
+ struct list_head node;
};
-/* When a child process exits this structure holds the information
- about it to be used to report back to the user. */
-extern struct rp_child_info child_info;
+/* Each child process is stored in this list. spawn, creates a new
+ entry in this list, the SIGCHLD handler sets child.terminated to be
+ true and handle_signals in events.c processes each terminated
+ process by printing a message saying the process ended and
+ displaying it's exit code. */
+extern struct list_head rp_children;
extern struct rp_defaults defaults;
diff --git a/src/events.c b/src/events.c
index 94647a5..b827751 100644
--- a/src/events.c
+++ b/src/events.c
@@ -68,7 +68,7 @@ new_window (XCreateWindowEvent *e)
static void
unmap_notify (XEvent *ev)
{
- rp_window_frame *frame;
+ rp_frame *frame;
rp_window *win;
/* ignore SubstructureNotify unmaps. */
@@ -775,7 +775,24 @@ handle_signals ()
if (chld_signalled > 0)
{
- marked_message_printf (0,0, " Command not found ");
+ rp_child_info *cur;
+ struct list_head *iter, *tmp;
+
+ /* Report and remove terminated processes. */
+ list_for_each_safe_entry (cur, iter, tmp, &rp_children, node)
+ {
+ if (cur->terminated)
+ {
+ /* Report any child that didn't return 0. */
+ if (cur->status != 0)
+ marked_message_printf (0,0, " /bin/sh -c \"%s\" finished (%d) ",
+ cur->cmd, cur->status);
+ free (cur->cmd);
+ free (cur);
+ list_del (&cur->node);
+ }
+ }
+
chld_signalled = 0;
}
diff --git a/src/frame.c b/src/frame.c
index 821f47f..c978d7c 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -22,97 +22,97 @@
#include "ratpoison.h"
int
-frame_left (rp_window_frame *frame)
+frame_left (rp_frame *frame)
{
return frame->x;
}
int
-frame_top (rp_window_frame *frame)
+frame_top (rp_frame *frame)
{
return frame->y;
}
int
-frame_right (rp_window_frame *frame)
+frame_right (rp_frame *frame)
{
return frame->x + frame->width;
}
int
-frame_bottom (rp_window_frame *frame)
+frame_bottom (rp_frame *frame)
{
return frame->y + frame->height;
}
int
-frame_width(rp_window_frame *frame)
+frame_width(rp_frame *frame)
{
return frame->width;
}
int
-frame_height(rp_window_frame *frame)
+frame_height(rp_frame *frame)
{
return frame->height;
}
void
-frame_resize_left (rp_window_frame *frame, int amount)
+frame_resize_left (rp_frame *frame, int amount)
{
frame->x -= amount;
frame->width += amount;
}
void
-frame_resize_right (rp_window_frame *frame, int amount)
+frame_resize_right (rp_frame *frame, int amount)
{
frame->width += amount;
}
void
-frame_resize_up (rp_window_frame *frame, int amount)
+frame_resize_up (rp_frame *frame, int amount)
{
frame->y -= amount;
frame->height += amount;
}
void
-frame_resize_down (rp_window_frame *frame, int amount)
+frame_resize_down (rp_frame *frame, int amount)
{
frame->height += amount;
}
void
-frame_move_left (rp_window_frame *frame, int amount)
+frame_move_left (rp_frame *frame, int amount)
{
frame->x -= amount;
}
void
-frame_move_right (rp_window_frame *frame, int amount)
+frame_move_right (rp_frame *frame, int amount)
{
frame->x += amount;
}
void
-frame_move_up (rp_window_frame *frame, int amount)
+frame_move_up (rp_frame *frame, int amount)
{
frame->y -= amount;
}
void
-frame_move_down (rp_window_frame *frame, int amount)
+frame_move_down (rp_frame *frame, int amount)
{
frame->y += amount;
}
-rp_window_frame *
+rp_frame *
frame_new (rp_screen *s)
{
- rp_window_frame *f;
+ rp_frame *f;
- f = xmalloc (sizeof (rp_window_frame));
+ f = xmalloc (sizeof (rp_frame));
f->number = numset_request (s->frames_numset);
f->last_access = 0;
@@ -120,19 +120,19 @@ frame_new (rp_screen *s)
}
void
-frame_free (rp_screen *s, rp_window_frame *f)
+frame_free (rp_screen *s, rp_frame *f)
{
numset_release (s->frames_numset, f->number);
free (f);
}
-rp_window_frame *
-frame_copy (rp_window_frame *frame)
+rp_frame *
+frame_copy (rp_frame *frame)
{
- rp_window_frame *copy;
+ rp_frame *copy;
- copy = xmalloc (sizeof (rp_window_frame));
+ copy = xmalloc (sizeof (rp_frame));
copy->number = frame->number;
copy->x = frame->x;
@@ -146,7 +146,7 @@ frame_copy (rp_window_frame *frame)
}
char *
-frame_dump (rp_window_frame *frame)
+frame_dump (rp_frame *frame)
{
rp_window *win;
char *tmp;
@@ -171,14 +171,14 @@ frame_dump (rp_window_frame *frame)
return tmp;
}
-rp_window_frame *
+rp_frame *
frame_read (char *str)
{
Window w;
rp_window *win;
- rp_window_frame *f;
+ rp_frame *f;
- f = xmalloc (sizeof (rp_window_frame));
+ f = xmalloc (sizeof (rp_frame));
if (sscanf (str, "%d %d %d %d %d %ld %d",
&f->number,
&f->x,
diff --git a/src/frame.h b/src/frame.h
index 75fbb95..0e79434 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -21,25 +21,25 @@
#ifndef FRAME_H
#define FRAME_H
-void frame_move_down (rp_window_frame *frame, int amount);
-void frame_move_up (rp_window_frame *frame, int amount);
-void frame_move_right (rp_window_frame *frame, int amount);
-void frame_move_left (rp_window_frame *frame, int amount);
-void frame_resize_down (rp_window_frame *frame, int amount);
-void frame_resize_up (rp_window_frame *frame, int amount);
-void frame_resize_right (rp_window_frame *frame, int amount);
-void frame_resize_left (rp_window_frame *frame, int amount);
-int frame_height(rp_window_frame *frame);
-int frame_width(rp_window_frame *frame);
-int frame_bottom (rp_window_frame *frame);
-int frame_right (rp_window_frame *frame);
-int frame_top (rp_window_frame *frame);
-int frame_left (rp_window_frame *frame);
+void frame_move_down (rp_frame *frame, int amount);
+void frame_move_up (rp_frame *frame, int amount);
+void frame_move_right (rp_frame *frame, int amount);
+void frame_move_left (rp_frame *frame, int amount);
+void frame_resize_down (rp_frame *frame, int amount);
+void frame_resize_up (rp_frame *frame, int amount);
+void frame_resize_right (rp_frame *frame, int amount);
+void frame_resize_left (rp_frame *frame, int amount);
+int frame_height(rp_frame *frame);
+int frame_width(rp_frame *frame);
+int frame_bottom (rp_frame *frame);
+int frame_right (rp_frame *frame);
+int frame_top (rp_frame *frame);
+int frame_left (rp_frame *frame);
-rp_window_frame *frame_new (rp_screen *s);
-void frame_free (rp_screen *s, rp_window_frame *f);
-rp_window_frame *frame_copy (rp_window_frame *frame);
-char *frame_dump (rp_window_frame *frame);
-rp_window_frame *frame_read (char *str);
+rp_frame *frame_new (rp_screen *s);
+void frame_free (rp_screen *s, rp_frame *f);
+rp_frame *frame_copy (rp_frame *frame);
+char *frame_dump (rp_frame *frame);
+rp_frame *frame_read (char *str);
#endif
diff --git a/src/main.c b/src/main.c
index 07eec84..8ecc045 100644
--- a/src/main.c
+++ b/src/main.c
@@ -70,7 +70,7 @@ rp_screen *screens;
int num_screens;
Display *dpy;
-struct rp_child_info child_info;
+LIST_HEAD (rp_children);
struct rp_defaults defaults;
int ignore_badwindow = 0;
@@ -218,6 +218,7 @@ chld_handler (int signum)
{
int pid, status, serrno;
serrno = errno;
+ rp_child_info *cur;
while (1)
{
@@ -227,15 +228,18 @@ chld_handler (int signum)
PRINT_DEBUG(("Child status: %d\n", WEXITSTATUS (status)));
- /* Tell ratpoison about the CHLD signal. We are only interested
- in reporting commands that failed to execute. These processes
- have a return value of 127 (according to the sh manual). */
- if (WEXITSTATUS (status) == 127)
+ /* Find the child and update its structure. */
+ list_for_each_entry (cur, &rp_children, node)
{
- chld_signalled = 1;
- child_info.pid = pid;
- child_info.status = status;
+ if (cur->pid == pid)
+ {
+ cur->terminated = 1;
+ cur->status = WEXITSTATUS (status);
+ break;
+ }
}
+
+ chld_signalled = 1;
}
errno = serrno;
}
@@ -763,10 +767,10 @@ init_screen (rp_screen *s, int screen_num)
static void
free_screen (rp_screen *s)
{
- rp_window_frame *frame;
+ rp_frame *frame;
struct list_head *iter, *tmp;
- list_for_each_safe_entry (frame, iter, tmp, &s->rp_window_frames, node)
+ list_for_each_safe_entry (frame, iter, tmp, &s->frames, node)
{
frame_free (s, frame);
}
diff --git a/src/manage.c b/src/manage.c
index ee7de02..4f7fe14 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -475,7 +475,7 @@ get_state (rp_window *win)
static void
move_window (rp_window *win)
{
- rp_window_frame *frame;
+ rp_frame *frame;
if (win->frame_number == EMPTY)
return;
@@ -528,7 +528,7 @@ move_window (rp_window *win)
static void
maximize_transient (rp_window *win)
{
- rp_window_frame *frame;
+ rp_frame *frame;
int maxx, maxy;
frame = win_get_frame (win);
@@ -586,7 +586,7 @@ maximize_transient (rp_window *win)
static void
maximize_normal (rp_window *win)
{
- rp_window_frame *frame;
+ rp_frame *frame;
int maxx, maxy;
frame = win_get_frame (win);
@@ -819,7 +819,7 @@ withdraw_window (rp_window *win)
void
hide_others (rp_window *win)
{
- rp_window_frame *frame;
+ rp_frame *frame;
rp_window *cur;
if (win == NULL) return;
diff --git a/src/screen.c b/src/screen.c
index bfa7ee4..ff9c7d0 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -61,14 +61,14 @@ struct list_head *
screen_copy_frameset (rp_screen *s)
{
struct list_head *head;
- rp_window_frame *cur;
+ rp_frame *cur;
/* Init our new list. */
head = xmalloc (sizeof (struct list_head));
INIT_LIST_HEAD (head);
/* Copy each frame to our new list. */
- list_for_each_entry (cur, &s->rp_window_frames, node)
+ list_for_each_entry (cur, &s->frames, node)
{
list_add_tail (&(frame_copy (cur))->node, head);
}
@@ -80,11 +80,11 @@ screen_copy_frameset (rp_screen *s)
void
screen_restore_frameset (rp_screen *s, struct list_head *head)
{
- frameset_free (&s->rp_window_frames);
- INIT_LIST_HEAD (&s->rp_window_frames);
+ frameset_free (&s->frames);
+ INIT_LIST_HEAD (&s->frames);
/* Hook in our new frameset. */
- list_splice (head, &s->rp_window_frames);
+ list_splice (head, &s->frames);
}
/* Given a list of frames, free them, but don't remove their numbers
@@ -92,23 +92,23 @@ screen_restore_frameset (rp_screen *s, struct list_head *head)
void
frameset_free (struct list_head *head)
{
- rp_window_frame *frame;
+ rp_frame *frame;
struct list_head *iter, *tmp;
list_for_each_safe_entry (frame, iter, tmp, head, node)
{
- /* FIXME: what if rp_window_frames has memory inside its struct
+ /* FIXME: what if frames has memory inside its struct
that needs to be freed? */
free (frame);
}
}
-rp_window_frame *
+rp_frame *
screen_get_frame (rp_screen *s, int frame_num)
{
- rp_window_frame *cur;
+ rp_frame *cur;
- list_for_each_entry (cur, &s->rp_window_frames, node)
+ list_for_each_entry (cur, &s->frames, node)
{
if (cur->number == frame_num)
return cur;
diff --git a/src/screen.h b/src/screen.h
index 614bb04..cda098e 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -31,6 +31,6 @@ int screen_width (rp_screen *s);
struct list_head *screen_copy_frameset (rp_screen *s);
void screen_restore_frameset (rp_screen *s, struct list_head *head);
void frameset_free (struct list_head *head);
-rp_window_frame *screen_get_frame (rp_screen *s, int frame_num);
+rp_frame *screen_get_frame (rp_screen *s, int frame_num);
#endif
diff --git a/src/split.c b/src/split.c
index f6f8a09..7b4106b 100644
--- a/src/split.c
+++ b/src/split.c
@@ -30,7 +30,7 @@
#define HORIZONTALLY 1
static void
-update_last_access (rp_window_frame *frame)
+update_last_access (rp_frame *frame)
{
static int counter = 0;
@@ -38,7 +38,7 @@ update_last_access (rp_window_frame *frame)
counter++;
}
-rp_window_frame *
+rp_frame *
current_frame ()
{
rp_screen *s = current_screen();
@@ -49,9 +49,9 @@ int
num_frames (rp_screen *s)
{
int count = 0;
- rp_window_frame *cur;
+ rp_frame *cur;
- list_for_each_entry (cur, &s->rp_window_frames, node)
+ list_for_each_entry (cur, &s->frames, node)
{
count++;
}
@@ -60,7 +60,7 @@ num_frames (rp_screen *s)
}
void
-cleanup_frame (rp_window_frame *frame)
+cleanup_frame (rp_frame *frame)
{
rp_window *last_win;
rp_window *win;
@@ -90,7 +90,7 @@ cleanup_frame (rp_window_frame *frame)
}
rp_window *
-set_frames_window (rp_window_frame *frame, rp_window *win)
+set_frames_window (rp_frame *frame, rp_window *win)
{
int last_win;
@@ -109,13 +109,13 @@ set_frames_window (rp_window_frame *frame, rp_window *win)
}
static rp_screen *
-frames_screen (rp_window_frame *frame)
+frames_screen (rp_frame *frame)
{
int i;
- rp_window_frame *cur;
+ rp_frame *cur;
for (i=0; i<num_screens; i++)
- list_for_each_entry (cur, &screens[i].rp_window_frames, node)
+ list_for_each_entry (cur, &screens[i].frames, node)
{
if (frame == cur)
return &screens[i];
@@ -127,7 +127,7 @@ frames_screen (rp_window_frame *frame)
}
void
-maximize_all_windows_in_frame (rp_window_frame *frame)
+maximize_all_windows_in_frame (rp_frame *frame)
{
rp_window *win;
@@ -142,7 +142,7 @@ maximize_all_windows_in_frame (rp_window_frame *frame)
/* Make the frame occupy the entire screen */
static void
-maximize_frame (rp_window_frame *frame)
+maximize_frame (rp_frame *frame)
{
rp_screen *s = frames_screen (frame);
@@ -157,11 +157,11 @@ maximize_frame (rp_window_frame *frame)
static void
create_initial_frame (rp_screen *screen)
{
- rp_window_frame *frame;
+ rp_frame *frame;
frame = frame_new (screen);
screen->current_frame = frame->number;
- list_add_tail (&frame->node, &screen->rp_window_frames);
+ list_add_tail (&frame->node, &screen->frames);
update_last_access (frame);
@@ -181,18 +181,18 @@ init_frame_lists ()
void
init_frame_list (rp_screen *screen)
{
- INIT_LIST_HEAD (&screen->rp_window_frames);
+ INIT_LIST_HEAD (&screen->frames);
create_initial_frame(screen);
}
-rp_window_frame *
+rp_frame *
find_last_frame (rp_screen *s)
{
- rp_window_frame *cur, *last = NULL;
+ rp_frame *cur, *last = NULL;
int last_access = -1;
- list_for_each_entry (cur, &s->rp_window_frames, node)
+ list_for_each_entry (cur, &s->frames, node)
{
if (cur->number != s->current_frame
&& cur->last_access > last_access)
@@ -206,15 +206,15 @@ find_last_frame (rp_screen *s)
}
/* Return the frame that contains the window. */
-rp_window_frame *
+rp_frame *
find_windows_frame (rp_window *win)
{
rp_screen *s;
- rp_window_frame *cur;
+ rp_frame *cur;
s = win->scr;
- list_for_each_entry (cur, &s->rp_window_frames, node)
+ list_for_each_entry (cur, &s->frames, node)
{
if (cur->win_number == win->number) return cur;
}
@@ -222,18 +222,18 @@ find_windows_frame (rp_window *win)
return NULL;
}
-rp_window_frame *
-find_frame_next (rp_window_frame *frame)
+rp_frame *
+find_frame_next (rp_frame *frame)
{
if (frame == NULL) return NULL;
- return list_next_entry (frame, &frames_screen (frame)->rp_window_frames, node);
+ return list_next_entry (frame, &frames_screen (frame)->frames, node);
}
-rp_window_frame *
-find_frame_prev (rp_window_frame *frame)
+rp_frame *
+find_frame_prev (rp_frame *frame)
{
if (frame == NULL) return NULL;
- return list_prev_entry (frame, &frames_screen (frame)->rp_window_frames, node);
+ return list_prev_entry (frame, &frames_screen (frame)->frames, node);
}
rp_window *
@@ -243,7 +243,7 @@ current_window ()
}
static int
-window_fits_in_frame (rp_window *win, rp_window_frame *frame)
+window_fits_in_frame (rp_window *win, rp_frame *frame)
{
/* If the window has minimum size hints, make sure they are smaller
than the frame. */
@@ -263,7 +263,7 @@ window_fits_in_frame (rp_window *win, rp_window_frame *frame)
/* Search the list of mapped windows for a window that will fit in the
specified frame. */
rp_window *
-find_window_for_frame (rp_window_frame *frame)
+find_window_for_frame (rp_frame *frame)
{
rp_screen *s = frames_screen (frame);
int last_access = 0;
@@ -290,11 +290,11 @@ find_window_for_frame (rp_window_frame *frame)
/* Splits the frame in 2. if way is 0 then split vertically otherwise
split it horizontally. */
static void
-split_frame (rp_window_frame *frame, int way, int pixels)
+split_frame (rp_frame *frame, int way, int pixels)
{
rp_screen *s;
rp_window *win;
- rp_window_frame *new_frame;
+ rp_frame *new_frame;
s = frames_screen (frame);
@@ -357,7 +357,7 @@ split_frame (rp_window_frame *frame, int way, int pixels)
/* Splits the window vertically leaving the original with 'pixels'
pixels . */
void
-v_split_frame (rp_window_frame *frame, int pixels)
+v_split_frame (rp_frame *frame, int pixels)
{
split_frame (frame, VERTICALLY, pixels);
}
@@ -365,7 +365,7 @@ v_split_frame (rp_window_frame *frame, int pixels)
/* Splits the frame horizontally leaving the original with 'pixels'
pixels . */
void
-h_split_frame (rp_window_frame *frame, int pixels)
+h_split_frame (rp_frame *frame, int pixels)
{
split_frame (frame, HORIZONTALLY, pixels);
}
@@ -375,7 +375,7 @@ remove_all_splits ()
{
struct list_head *tmp, *iter;
rp_screen *s = current_screen();
- rp_window_frame *frame;
+ rp_frame *frame;
rp_window *win;
/* Hide all the windows not in the current frame. */
@@ -386,7 +386,7 @@ remove_all_splits ()
}
/* Delete all the frames except the current one. */
- list_for_each_safe_entry (frame, iter, tmp, &s->rp_window_frames, node)
+ list_for_each_safe_entry (frame, iter, tmp, &s->frames, node)
{
if (frame->number != s->current_frame)
{
@@ -402,7 +402,7 @@ remove_all_splits ()
/* Shrink the size of the frame to fit it's current window. */
void
-resize_shrink_to_window (rp_window_frame *frame)
+resize_shrink_to_window (rp_frame *frame)
{
rp_window *win;
@@ -419,19 +419,19 @@ resize_shrink_to_window (rp_window_frame *frame)
functions passed to it. Returns -1 if the resize failed, 0 for
success. */
static int
-resize_frame (rp_window_frame *frame, rp_window_frame *pusher, int diff,
- int (*c1)(rp_window_frame *), int (c2)(rp_window_frame *),
- int (*c3)(rp_window_frame *), int (c4)(rp_window_frame *),
- void (*resize1)(rp_window_frame *, int),
- void (*resize2)(rp_window_frame *, int),
- int (*resize3)(rp_window_frame *, rp_window_frame *, int))
+resize_frame (rp_frame *frame, rp_frame *pusher, int diff,
+ int (*c1)(rp_frame *), int (c2)(rp_frame *),
+ int (*c3)(rp_frame *), int (c4)(rp_frame *),
+ void (*resize1)(rp_frame *, int),
+ void (*resize2)(rp_frame *, int),
+ int (*resize3)(rp_frame *, rp_frame *, int))
{
rp_screen *s = frames_screen (frame);
- rp_window_frame *cur;
+ rp_frame *cur;
/* Loop through the frames and determine which ones are affected by
resizing frame. */
- list_for_each_entry (cur, &s->rp_window_frames, node)
+ list_for_each_entry (cur, &s->frames, node)
{
if (cur == frame || cur == pusher) continue;
/* If cur is touching frame along the axis that is being
@@ -484,14 +484,14 @@ resize_frame (rp_window_frame *frame, rp_window_frame *pusher, int diff,
return 0;
}
-static int resize_frame_bottom (rp_window_frame *frame, rp_window_frame *pusher, int diff);
-static int resize_frame_top (rp_window_frame *frame, rp_window_frame *pusher, int diff);
-static int resize_frame_left (rp_window_frame *frame, rp_window_frame *pusher, int diff);
-static int resize_frame_right (rp_window_frame *frame, rp_window_frame *pusher, int diff);
+static int resize_frame_bottom (rp_frame *frame, rp_frame *pusher, int diff);
+static int resize_frame_top (rp_frame *frame, rp_frame *pusher, int diff);
+static int resize_frame_left (rp_frame *frame, rp_frame *pusher, int diff);
+static int resize_frame_right (rp_frame *frame, rp_frame *pusher, int diff);
/* Resize frame by moving it's right side. */
static int
-resize_frame_right (rp_window_frame *frame, rp_window_frame *pusher, int diff)
+resize_frame_right (rp_frame *frame, rp_frame *pusher, int diff)
{
return resize_frame (frame, pusher, diff,
frame_left, frame_top, frame_right, frame_bottom,
@@ -500,7 +500,7 @@ resize_frame_right (rp_window_frame *frame, rp_window_frame *pusher, int diff)
/* Resize frame by moving it's left side. */
static int
-resize_frame_left (rp_window_frame *frame, rp_window_frame *pusher, int diff)
+resize_frame_left (rp_frame *frame, rp_frame *pusher, int diff)
{
return resize_frame (frame, pusher, diff,
frame_right, frame_top, frame_left, frame_bottom,
@@ -509,7 +509,7 @@ resize_frame_left (rp_window_frame *frame, rp_window_frame *pusher, int diff)
/* Resize frame by moving it's top side. */
static int
-resize_frame_top (rp_window_frame *frame, rp_window_frame *pusher, int diff)
+resize_frame_top (rp_frame *frame, rp_frame *pusher, int diff)
{
return resize_frame (frame, pusher, diff,
frame_bottom, frame_left, frame_top, frame_right,
@@ -518,7 +518,7 @@ resize_frame_top (rp_window_frame *frame, rp_window_frame *pusher, int diff)
/* Resize frame by moving it's bottom side. */
static int
-resize_frame_bottom (rp_window_frame *frame, rp_window_frame *pusher, int diff)
+resize_frame_bottom (rp_frame *frame, rp_frame *pusher, int diff)
{
return resize_frame (frame, pusher, diff,
frame_top, frame_left, frame_bottom, frame_right,
@@ -528,9 +528,9 @@ resize_frame_bottom (rp_window_frame *frame, rp_window_frame *pusher, int diff)
/* Resize frame diff pixels by expanding it to the right. If the frame
is against the right side of the screen, expand it to the left. */
void
-resize_frame_horizontally (rp_window_frame *frame, int diff)
+resize_frame_horizontally (rp_frame *frame, int diff)
{
- int (*resize_fn)(rp_window_frame *, rp_window_frame*, int);
+ int (*resize_fn)(rp_frame *, rp_frame*, int);
struct list_head *l;
rp_screen *s = frames_screen (frame);
@@ -574,9 +574,9 @@ resize_frame_horizontally (rp_window_frame *frame, int diff)
/* Resize frame diff pixels by expanding it down. If the frame is
against the bottom of the screen, expand it up. */
void
-resize_frame_vertically (rp_window_frame *frame, int diff)
+resize_frame_vertically (rp_frame *frame, int diff)
{
- int (*resize_fn)(rp_window_frame *, rp_window_frame*, int);
+ int (*resize_fn)(rp_frame *, rp_frame*, int);
struct list_head *l;
rp_screen *s = frames_screen (frame);
@@ -618,28 +618,28 @@ resize_frame_vertically (rp_window_frame *frame, int diff)
}
static int
-frame_is_below (rp_window_frame *src, rp_window_frame *frame)
+frame_is_below (rp_frame *src, rp_frame *frame)
{
if (frame->y > src->y) return 1;
return 0;
}
static int
-frame_is_above (rp_window_frame *src, rp_window_frame *frame)
+frame_is_above (rp_frame *src, rp_frame *frame)
{
if (frame->y < src->y) return 1;
return 0;
}
static int
-frame_is_left (rp_window_frame *src, rp_window_frame *frame)
+frame_is_left (rp_frame *src, rp_frame *frame)
{
if (frame->x < src->x) return 1;
return 0;
}
static int
-frame_is_right (rp_window_frame *src, rp_window_frame *frame)
+frame_is_right (rp_frame *src, rp_frame *frame)
{
if (frame->x > src->x) return 1;
return 0;
@@ -649,9 +649,9 @@ static int
total_frame_area (rp_screen *s)
{
int area = 0;
- rp_window_frame *cur;
+ rp_frame *cur;
- list_for_each_entry (cur, &s->rp_window_frames, node)
+ list_for_each_entry (cur, &s->frames, node)
{
area += cur->width * cur->height;
}
@@ -661,7 +661,7 @@ total_frame_area (rp_screen *s)
/* Return 1 if frames f1 and f2 overlap */
static int
-frames_overlap (rp_window_frame *f1, rp_window_frame *f2)
+frames_overlap (rp_frame *f1, rp_frame *f2)
{
if (f1->x >= f2->x + f2->width
|| f1->y >= f2->y + f2->height
@@ -675,14 +675,14 @@ frames_overlap (rp_window_frame *f1, rp_window_frame *f2)
/* Return 1 if w's frame overlaps any other window's frame */
static int
-frame_overlaps (rp_window_frame *frame)
+frame_overlaps (rp_frame *frame)
{
rp_screen *s;
- rp_window_frame *cur;
+ rp_frame *cur;
s = frames_screen (frame);
- list_for_each_entry (cur, &s->rp_window_frames, node)
+ list_for_each_entry (cur, &s->frames, node)
{
if (cur != frame && frames_overlap (cur, frame))
{
@@ -693,11 +693,11 @@ frame_overlaps (rp_window_frame *frame)
}
void
-remove_frame (rp_window_frame *frame)
+remove_frame (rp_frame *frame)
{
rp_screen *s;
int area;
- rp_window_frame *cur;
+ rp_frame *cur;
rp_window *win;
if (frame == NULL) return;
@@ -712,9 +712,9 @@ remove_frame (rp_window_frame *frame)
hide_window (win);
hide_others (win);
- list_for_each_entry (cur, &s->rp_window_frames, node)
+ list_for_each_entry (cur, &s->frames, node)
{
- rp_window_frame tmp_frame;
+ rp_frame tmp_frame;
int fits = 0;
/* if (cur->win_number != EMPTY) */
@@ -727,7 +727,7 @@ remove_frame (rp_window_frame *frame)
/* } */
/* Backup the frame */
- memcpy (&tmp_frame, cur, sizeof (rp_window_frame));
+ memcpy (&tmp_frame, cur, sizeof (rp_frame));
if (frame_is_below (frame, cur)
|| frame_is_above (frame, cur))
@@ -752,14 +752,14 @@ remove_frame (rp_window_frame *frame)
PRINT_DEBUG (("Didn't fit vertically\n"));
/* Restore the current window's frame */
- memcpy (cur, &tmp_frame, sizeof (rp_window_frame));
+ memcpy (cur, &tmp_frame, sizeof (rp_frame));
}
else
{
PRINT_DEBUG (("It fit vertically!!\n"));
/* update the frame backup */
- memcpy (&tmp_frame, cur, sizeof (rp_window_frame));
+ memcpy (&tmp_frame, cur, sizeof (rp_frame));
fits = 1;
}
@@ -780,7 +780,7 @@ remove_frame (rp_window_frame *frame)
PRINT_DEBUG (("Didn't fit horizontally\n"));
/* Restore the current window's frame */
- memcpy (cur, &tmp_frame, sizeof (rp_window_frame));
+ memcpy (cur, &tmp_frame, sizeof (rp_frame));
}
else
{
@@ -802,7 +802,7 @@ remove_frame (rp_window_frame *frame)
}
else
{
- memcpy (cur, &tmp_frame, sizeof (rp_window_frame));
+ memcpy (cur, &tmp_frame, sizeof (rp_frame));
}
}
@@ -812,13 +812,13 @@ remove_frame (rp_window_frame *frame)
/* Switch the input focus to another frame, and therefore a different
window. */
void
-set_active_frame (rp_window_frame *frame)
+set_active_frame (rp_frame *frame)
{
rp_screen *old_s = current_screen();
rp_screen *s = frames_screen (frame);
int old = current_screen()->current_frame;
rp_window *win, *old_win;
- rp_window_frame *old_frame;
+ rp_frame *old_frame;
win = find_window_number (frame->win_number);
old_frame = current_frame();
@@ -858,7 +858,7 @@ set_active_frame (rp_window_frame *frame)
}
void
-blank_frame (rp_window_frame *frame)
+blank_frame (rp_frame *frame)
{
rp_screen *s;
rp_window *win;
@@ -898,7 +898,7 @@ show_frame_message (char *msg)
{
rp_screen *s = current_screen ();
int width, height;
- rp_window_frame *frame;
+ rp_frame *frame;
frame = current_frame();
@@ -920,13 +920,13 @@ show_frame_message (char *msg)
msg, strlen (msg));
}
-rp_window_frame *
-find_frame_up (rp_window_frame *frame)
+rp_frame *
+find_frame_up (rp_frame *frame)
{
rp_screen *s = frames_screen (frame);
- rp_window_frame *cur;
+ rp_frame *cur;
- list_for_each_entry (cur, &s->rp_window_frames, node)
+ list_for_each_entry (cur, &s->frames, node)
{
if (frame->y == cur->y + cur->height)
{
@@ -938,13 +938,13 @@ find_frame_up (rp_window_frame *frame)
return NULL;
}
-rp_window_frame *
-find_frame_down (rp_window_frame *frame)
+rp_frame *
+find_frame_down (rp_frame *frame)
{
rp_screen *s = frames_screen (frame);
- rp_window_frame *cur;
+ rp_frame *cur;
- list_for_each_entry (cur, &s->rp_window_frames, node)
+ list_for_each_entry (cur, &s->frames, node)
{
if (frame->y + frame->height == cur->y)
{
@@ -956,13 +956,13 @@ find_frame_down (rp_window_frame *frame)
return NULL;
}
-rp_window_frame *
-find_frame_left (rp_window_frame *frame)
+rp_frame *
+find_frame_left (rp_frame *frame)
{
rp_screen *s = frames_screen (frame);
- rp_window_frame *cur;
+ rp_frame *cur;
- list_for_each_entry (cur, &s->rp_window_frames, node)
+ list_for_each_entry (cur, &s->frames, node)
{
if (frame->x == cur->x + cur->width)
{
@@ -974,13 +974,13 @@ find_frame_left (rp_window_frame *frame)
return NULL;
}
-rp_window_frame *
-find_frame_right (rp_window_frame *frame)
+rp_frame *
+find_frame_right (rp_frame *frame)
{
rp_screen *s = frames_screen (frame);
- rp_window_frame *cur;
+ rp_frame *cur;
- list_for_each_entry (cur, &s->rp_window_frames, node)
+ list_for_each_entry (cur, &s->frames, node)
{
if (frame->x + frame->width == cur->x)
{
@@ -992,12 +992,12 @@ find_frame_right (rp_window_frame *frame)
return NULL;
}
-rp_window_frame *
+rp_frame *
find_frame_number (rp_screen *s, int num)
{
- rp_window_frame *cur;
+ rp_frame *cur;
- list_for_each_entry (cur, &s->rp_window_frames, node)
+ list_for_each_entry (cur, &s->frames, node)
{
if (cur->number == num)
return cur;
diff --git a/src/split.h b/src/split.h
index cf308ae..3dc113f 100644
--- a/src/split.h
+++ b/src/split.h
@@ -23,37 +23,37 @@
#define SPLIT_H
int num_frames (rp_screen *s);
-rp_window *set_frames_window (rp_window_frame *frame, rp_window *win);
-void cleanup_frame (rp_window_frame *frame);
-void maximize_all_windows_in_frame (rp_window_frame *frame);
-void h_split_frame (rp_window_frame *frame, int pixels);
-void v_split_frame (rp_window_frame *frame, int pixels);
+rp_window *set_frames_window (rp_frame *frame, rp_window *win);
+void cleanup_frame (rp_frame *frame);
+void maximize_all_windows_in_frame (rp_frame *frame);
+void h_split_frame (rp_frame *frame, int pixels);
+void v_split_frame (rp_frame *frame, int pixels);
void remove_all_splits ();
-void resize_shrink_to_window (rp_window_frame *frame);
-void resize_frame_horizontally (rp_window_frame *frame, int diff);
-void resize_frame_vertically (rp_window_frame *frame, int diff);
-void remove_frame (rp_window_frame *frame);
-rp_window *find_window_for_frame (rp_window_frame *frame);
-rp_window_frame *find_windows_frame (rp_window *win);
-rp_window_frame *find_frame_next (rp_window_frame *frame);
-rp_window_frame *find_frame_prev (rp_window_frame *frame);
+void resize_shrink_to_window (rp_frame *frame);
+void resize_frame_horizontally (rp_frame *frame, int diff);
+void resize_frame_vertically (rp_frame *frame, int diff);
+void remove_frame (rp_frame *frame);
+rp_window *find_window_for_frame (rp_frame *frame);
+rp_frame *find_windows_frame (rp_window *win);
+rp_frame *find_frame_next (rp_frame *frame);
+rp_frame *find_frame_prev (rp_frame *frame);
rp_window *current_window ();
void init_frame_lists ();
void init_frame_list (rp_screen *screen);
-void set_active_frame (rp_window_frame *frame);
-void blank_frame (rp_window_frame *frame);
+void set_active_frame (rp_frame *frame);
+void blank_frame (rp_frame *frame);
void show_frame_indicator ();
void hide_frame_indicator ();
void show_frame_message (char *msg);
-rp_window_frame *find_frame_right (rp_window_frame *frame);
-rp_window_frame *find_frame_left (rp_window_frame *frame);
-rp_window_frame *find_frame_down (rp_window_frame *frame);
-rp_window_frame *find_frame_up (rp_window_frame *frame);
-rp_window_frame *find_last_frame (rp_screen *s);
-rp_window_frame *find_frame_number (rp_screen *s, int num);
+rp_frame *find_frame_right (rp_frame *frame);
+rp_frame *find_frame_left (rp_frame *frame);
+rp_frame *find_frame_down (rp_frame *frame);
+rp_frame *find_frame_up (rp_frame *frame);
+rp_frame *find_last_frame (rp_screen *s);
+rp_frame *find_frame_number (rp_screen *s, int num);
-rp_window_frame *current_frame ();
+rp_frame *current_frame ();
#endif
diff --git a/src/window.c b/src/window.c
index cb17d60..5c1cfb5 100644
--- a/src/window.c
+++ b/src/window.c
@@ -368,7 +368,7 @@ give_window_focus (rp_window *win, rp_window *last_win)
void
unhide_transient_for (rp_window *win)
{
- rp_window_frame *frame;
+ rp_frame *frame;
rp_window *transient_for;
if (win == NULL) return;
@@ -474,7 +474,7 @@ void
set_active_window (rp_window *win)
{
rp_window *last_win;
- rp_window_frame *frame;
+ rp_frame *frame;
if (win == NULL) return;
@@ -511,7 +511,7 @@ set_active_window (rp_window *win)
void
goto_window (rp_window *win)
{
- rp_window_frame *frame;
+ rp_frame *frame;
frame = find_windows_frame (win);
if (frame)
@@ -692,7 +692,7 @@ free_window_stuff ()
numset_free (rp_window_numset);
}
-rp_window_frame *
+rp_frame *
win_get_frame (rp_window *win)
{
if (win->frame_number != EMPTY)
diff --git a/src/window.h b/src/window.h
index 75d83ea..9103f0a 100644
--- a/src/window.h
+++ b/src/window.h
@@ -63,6 +63,6 @@ void get_window_list (char *fmt, char *delim, struct sbuf *buffer,
void init_window_stuff ();
void free_window_stuff ();
-rp_window_frame *win_get_frame (rp_window *win);
+rp_frame *win_get_frame (rp_window *win);
#endif /* ! _RATPOISON_LIST_H */