summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrcyeske <rcyeske>2001-02-19 20:50:33 +0000
committerrcyeske <rcyeske>2001-02-19 20:50:33 +0000
commit5cb654fb6e542c8b8d8fe7d1e3a5c91ea4f36c37 (patch)
tree1dd4b5b910fc353e8b6d82c82d576fb59220e173 /src
parentdd5571c433c5cb52d4ade34ee12e75acbc2d04e8 (diff)
downloadratpoison-5cb654fb6e542c8b8d8fe7d1e3a5c91ea4f36c37.zip
renamed functions
Diffstat (limited to 'src')
-rw-r--r--src/list.c58
-rw-r--r--src/list.h12
2 files changed, 48 insertions, 22 deletions
diff --git a/src/list.c b/src/list.c
index 83241b3..ecd5836 100644
--- a/src/list.c
+++ b/src/list.c
@@ -135,7 +135,7 @@ init_window_list ()
}
rp_window *
-find_window_by_number (int n)
+find_window_number (int n)
{
rp_window *cur;
@@ -161,37 +161,59 @@ str_comp (char *s1, char *s2, int len)
return 1;
}
-static rp_window *
-find_window_by_name (char *name)
+/* return a window by name */
+rp_window *
+find_window_name (char *name)
{
- rp_window *cur;
+ rp_window *w;
- for (cur=rp_window_head; cur; cur=cur->next)
+ for (w = rp_window_head; w; w = w->next)
{
- if (cur->state == STATE_UNMAPPED) continue;
+ if (w->state == STATE_UNMAPPED)
+ continue;
- if (str_comp (name, cur->name, strlen (name))) return cur;
+ if (str_comp (name, w->name, strlen (name)))
+ return w;
}
+ /* didn't find it */
return NULL;
}
-int
-goto_window_name (char *name)
+/* return the previous window in the list */
+rp_window*
+find_window_prev (rp_window *w)
{
- rp_window *win;
-
- if ((win = find_window_by_name (name)) == NULL)
- {
- return 0;
- }
+ if (!(w || (w = rp_current_window)))
+ return NULL;
+
+ w = w->prev;
+ if (w == NULL)
+ w = rp_window_tail;
+ if (w->state == STATE_UNMAPPED)
+ return find_window_prev (w);
+ else
+ return w;
+}
- set_active_window (win);
- return 1;
+/* return the next window in the list */
+rp_window*
+find_window_next (rp_window *w)
+{
+ if (!(w || (w = rp_current_window)))
+ return NULL;
+
+ w = w->next;
+ if (w == NULL)
+ w = rp_window_head;
+ if (w->state == STATE_UNMAPPED)
+ return find_window_next (w);
+ else
+ return w;
}
rp_window *
-find_last_accessed_window ()
+find_window_other ()
{
int last_access = 0;
rp_window *cur, *most_recent;
diff --git a/src/list.h b/src/list.h
index 04100f6..672b520 100644
--- a/src/list.h
+++ b/src/list.h
@@ -25,16 +25,20 @@
rp_window *add_to_window_list (screen_info *s, Window w);
void init_window_list ();
void remove_from_window_list (rp_window *w);
-void next_window ();
-void prev_window ();
+/* void next_window (); */
+/* void prev_window (); */
void last_window ();
rp_window *find_window (Window w);
void maximize_current_window ();
void set_active_window (rp_window *rp_w);
void set_current_window (rp_window *win);
-int goto_window_name (char *name);
-rp_window *find_last_accessed_window ();
+/* int goto_window_name (char *name); */
+rp_window *find_window_other ();
rp_window *find_window_by_number (int n);
+rp_window* find_window_name (char *name);
+rp_window* find_window_prev (rp_window *w);
+rp_window* find_window_next (rp_window *w);
+rp_window* find_window_number (int n);
void sort_window_list_by_number ();
#endif /* ! _RATPOISON_LIST_H */