diff options
author | sabetts <sabetts> | 2003-03-18 03:56:57 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2003-03-18 03:56:57 +0000 |
commit | 7e2c4ccc01fbaf3ea93aa3963ba6cc2e9f5ce163 (patch) | |
tree | 412bb53a1b4aeaf9b6c60a8c6c116988b4c0fd0a /src/split.c | |
parent | d9712b14bec0317663b9464108d8155152e41cad (diff) | |
download | ratpoison-7e2c4ccc01fbaf3ea93aa3963ba6cc2e9f5ce163.zip |
* src/actions.c (initialize_default_keybindings): add keybindings
for fselect and resize. Move keybinding for curframe.
* src/split.c (create_initial_frame): call frame_new to allocate a frame.
(split_frame): likewise
* src/main.c (free_screen): call frame_free to free the screen
frames.
* src/frame.h (frame_new): new prototype
(frame_free): likewise
* src/frame.c (frame_new): new function.
(frame_free): likewise
Diffstat (limited to 'src/split.c')
-rw-r--r-- | src/split.c | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/src/split.c b/src/split.c index c39c1ce..29cb1a9 100644 --- a/src/split.c +++ b/src/split.c @@ -144,11 +144,10 @@ maximize_frame (rp_window_frame *frame) static void create_initial_frame (screen_info *screen) { - screen->rp_current_frame = xmalloc (sizeof (rp_window_frame)); + screen->rp_current_frame = frame_new (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); @@ -284,10 +283,8 @@ split_frame (rp_window_frame *frame, int way, int pixels) s = frames_screen (frame); - new_frame = xmalloc (sizeof (rp_window_frame)); - - /* Give the frame a unique number. */ - new_frame->number = numset_request (s->frames_numset); + /* Make our new frame. */ + new_frame = frame_new (s); /* It seems intuitive to make the last frame the newly created frame. */ @@ -384,9 +381,7 @@ remove_all_splits () if (frame != s->rp_current_frame) { list_del (&frame->node); - - numset_release (s->frames_numset, frame->number); - free (frame); + frame_free (s, frame); } } @@ -726,7 +721,6 @@ 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); @@ -824,7 +818,7 @@ remove_frame (rp_window_frame *frame) } } - free (frame); + frame_free (s, frame); } /* Switch the input focus to another frame, and therefore a different @@ -994,3 +988,30 @@ find_frame_number (screen_info *s, int num) return NULL; } + +/* Frame split tree code. */ + +rp_frame_split * +find_frame_parent (screen_info *s, rp_window_frame *frame) +{ + return find_frame_parent_helper (s->split_tree, frame); +} + +rp_frame_split * +find_frame_parent_helper (rp_frame_split *split, rp_window_frame *frame) +{ + rp_frame_split *cur; + + if (split->frame == frame) + return split; + + /* Look for the frame in each child. If find_frame_parent_helper + returns not NULL, then we found it. */ + list_for_each_entry (cur, &split->children, node) + { + if (find_frame_parent_helper (cur, frame);) + return split; + } + + return NULL; +} |