summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsabetts <sabetts>2002-10-18 09:03:42 +0000
committersabetts <sabetts>2002-10-18 09:03:42 +0000
commit1320a80e669c272c80f50e670684b1b689dcf4b2 (patch)
tree6eb4e39ff61dee260239e8de71ef48bc7eea3808 /src
parent37798ce885a55a4400ac3b0c72a0fb4fe33efb57 (diff)
downloadratpoison-1320a80e669c272c80f50e670684b1b689dcf4b2.zip
* src/actions.c (read_split): a negative number means subtract the
pixels from the frame's current size to get the new frame's size.
Diffstat (limited to 'src')
-rw-r--r--src/actions.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/actions.c b/src/actions.c
index 87ad310..579d2ad 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1273,12 +1273,14 @@ read_split (const char *str, int max)
p = (int)(max * (float)(a) / (float)(b));
}
else if (sscanf(str, "%d", &p) == 1)
- {
+ {
+ if (p < 0)
+ p = max + p;
}
else
{
/* Failed to read input. */
- p = -1;
+ return -1;
}
/* Input out of range. */
@@ -1296,9 +1298,10 @@ cmd_h_split (int interactive, void *data)
/* Default to dividing the frame in half. */
if (data == NULL)
pixels = current_screen()->rp_current_frame->height / 2;
- else
+ else
pixels = read_split (data, current_screen()->rp_current_frame->height);
+
if (pixels > 0)
h_split_frame (current_screen()->rp_current_frame, pixels);