diff options
author | sabetts <sabetts> | 2003-03-07 07:40:18 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2003-03-07 07:40:18 +0000 |
commit | 3cba68b1ba37124ae3e74252eb1b7f9125a22b2f (patch) | |
tree | 95e673ff771fb30391d3351c93714cdf6c656c5b /src/split.c | |
parent | e401dac992736a1a0ba3ee20146c9fec37a80df7 (diff) | |
download | ratpoison-3cba68b1ba37124ae3e74252eb1b7f9125a22b2f.zip |
* src/split.h (find_frame_number): new prototype
* src/split.c (create_initial_frame): give a number to the
initial frame
(split_frame): give the new frame a unique number
(split_frame): add the new frame after the current frame
(remove_all_splits): return the frame's number when deleting it.
(remove_frame): likewise
(find_frame_number): new function
* src/main.c (init_screen): initialize the frames_numset member
(free_screen): free the frames_numset member
* src/data.h (struct screen_info): new member, frames_numset
* src/actions.h (cmd_fselect): new prototype
* src/actions.c (user_commands): new command "fselect"
(cmd_fselect): new function
Diffstat (limited to 'src/split.c')
-rw-r--r-- | src/split.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/split.c b/src/split.c index e52fd94..c110001 100644 --- a/src/split.c +++ b/src/split.c @@ -148,7 +148,9 @@ create_initial_frame (screen_info *screen) list_add_tail (&screen->rp_current_frame->node, &screen->rp_window_frames); + screen->rp_current_frame->number = numset_request (screen->frames_numset); update_last_access (screen->rp_current_frame); + maximize_frame (screen->rp_current_frame); set_frames_window (screen->rp_current_frame, NULL); } @@ -284,6 +286,9 @@ split_frame (rp_window_frame *frame, int way, int pixels) new_frame = xmalloc (sizeof (rp_window_frame)); + /* Give the frame a unique number. */ + new_frame->number = numset_request (s->frames_numset); + /* It seems intuitive to make the last frame the newly created frame. */ update_last_access (new_frame); @@ -291,7 +296,7 @@ split_frame (rp_window_frame *frame, int way, int pixels) /* TODO: don't put the new frame at the end of the list, put it after the existing frame. Then cycling frames cycles in the order they were created. */ - list_add_tail (&new_frame->node, &s->rp_window_frames); + list_add (&new_frame->node, &s->rp_current_frame->node); set_frames_window (new_frame, NULL); @@ -379,6 +384,8 @@ remove_all_splits () if (frame != s->rp_current_frame) { list_del (&frame->node); + + numset_release (s->frames_numset, frame->number); free (frame); } } @@ -520,7 +527,7 @@ resize_frame_horizontally (rp_window_frame *frame, int diff) list_for_each_entry (cur, &s->rp_window_frames, node) { if (cur->x == (frame->x + frame->width) - && (cur->y + cur->height) > frame->y + && (cur->y + cur->height) > frame->y && cur->y < (frame->y + frame->height)) { cur->width -= diff; @@ -687,6 +694,7 @@ remove_frame (rp_window_frame *frame) area = total_frame_area(s); PRINT_DEBUG (("Total Area: %d\n", area)); + numset_release (s->frames_numset, frame->number); list_del (&frame->node); hide_window (frame->win); hide_others (frame->win); @@ -940,3 +948,17 @@ find_frame_right (rp_window_frame *frame) return NULL; } + +rp_window_frame * +find_frame_number (screen_info *s, int num) +{ + rp_window_frame *cur; + + list_for_each_entry (cur, &s->rp_window_frames, node) + { + if (cur->number == num) + return cur; + } + + return NULL; +} |