From 306424d93d5a1a379a751394acbc696415b4281b Mon Sep 17 00:00:00 2001 From: sabetts Date: Fri, 18 Oct 2002 08:39:17 +0000 Subject: * src/split.c (VERTICALLY): new define (VERTICALLY): likewise (split_frame): new argument 'pixels'. The current frame is split and resized to 'pixels' pixels. (v_split_frame): new argument 'pixels'. prototype updated. (h_split_frame): likewise * src/actions.c (user_commands): hsplit, vsplit, and split take a string argument. (read_split): new function (cmd_h_split): takes a ratio or number to determine how big the frame split will be. (cmd_v_split): likewise --- src/split.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'src/split.c') diff --git a/src/split.c b/src/split.c index f9805ce..b364868 100644 --- a/src/split.c +++ b/src/split.c @@ -26,6 +26,9 @@ #include "ratpoison.h" +#define VERTICALLY 0 +#define HORIZONTALLY 1 + static void update_last_access (rp_window_frame *frame) { @@ -272,7 +275,7 @@ 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) +split_frame (rp_window_frame *frame, int way, int pixels) { screen_info *s; rp_window *win; @@ -294,23 +297,23 @@ split_frame (rp_window_frame *frame, int way) set_frames_window (new_frame, NULL); - if (way) + if (way == HORIZONTALLY) { new_frame->x = frame->x; - new_frame->y = frame->y + frame->height / 2; + new_frame->y = frame->y + pixels; new_frame->width = frame->width; - new_frame->height = frame->height / 2 + frame->height % 2; + new_frame->height = frame->height - pixels; - frame->height /= 2; + frame->height = pixels; } else { - new_frame->x = frame->x + frame->width / 2; + new_frame->x = frame->x + pixels; new_frame->y = frame->y; - new_frame->width = frame->width / 2 + frame->width % 2; + new_frame->width = frame->width - pixels; new_frame->height = frame->height; - frame->width /= 2; + frame->width = pixels; } win = find_window_for_frame (new_frame); @@ -341,18 +344,20 @@ split_frame (rp_window_frame *frame, int way) show_frame_indicator(); } -/* Splits the window vertically in 2. */ +/* Splits the window vertically leaving the original with 'pixels' + pixels . */ void -v_split_frame (rp_window_frame *frame) +v_split_frame (rp_window_frame *frame, int pixels) { - split_frame (frame, 0); + split_frame (frame, VERTICALLY, pixels); } -/* Splits the window horizontally in 2. */ +/* Splits the frame horizontally leaving the original with 'pixels' + pixels . */ void -h_split_frame (rp_window_frame *frame) +h_split_frame (rp_window_frame *frame, int pixels) { - split_frame (frame, 1); + split_frame (frame, HORIZONTALLY, pixels); } void -- cgit v1.2.3