summaryrefslogtreecommitdiff
path: root/debian/patches/brl-enlarge.diff
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/brl-enlarge.diff')
-rw-r--r--debian/patches/brl-enlarge.diff416
1 files changed, 416 insertions, 0 deletions
diff --git a/debian/patches/brl-enlarge.diff b/debian/patches/brl-enlarge.diff
new file mode 100644
index 0000000..6d62032
--- /dev/null
+++ b/debian/patches/brl-enlarge.diff
@@ -0,0 +1,416 @@
+Index: ChangeLog
+===================================================================
+--- ChangeLog.orig 2006-10-28 19:56:37.000000000 +0200
++++ ChangeLog 2006-10-28 19:56:41.000000000 +0200
+@@ -1,1 +1,18 @@
++2005-06-28 Bernhard R. Link <brlink@debian.org>
++
++ * src/split.c: new functions enlarge_frame_{left,up,right,down}
++ to enlarge a frame in a given direction, optionally removing all
++ direct adjacent frames.
++ (remove_frame): moved code to new rotine maximaize_all_in_frame.
++ (find_frame_{left,up,right,down}): try harder to find a frame in
++ the specified direction. (So that it also works with parts of
++ the screen not beeing in any frame).
++
++ * src/split.h: added prototypes for enlarge_frame_{left,up,right,down}
++
++ * src/actions.{c,h}: Added cmd_remove{left,up,right,down} calling
++ enlarge_frame_*, added C-t M-{Left,Right,Up,Down} as keybindings.
++
++ * doc/ratpoison.1: Document the new commands and keybindings.
++
+ 2006-10-03 Shawn Betts <sabetts@vcn.bc.ca>
+Index: doc/ratpoison.1
+===================================================================
+--- doc/ratpoison.1.orig 2006-10-28 19:56:37.000000000 +0200
++++ doc/ratpoison.1 2006-10-28 19:56:41.000000000 +0200
+@@ -499,6 +499,18 @@
+ .cmd remove ( C\-t R )
+ Remove the current frame and extend some frames around to fill the remaining
+ gap.
++.cmd removedown ( C\-t M\-Down )
++Kill frames directly below the current frame, extending the current
++frame as much as possible.
++.cmd removeleft ( C\-t M\-Left )
++Kill frames directly left of the current frame, extending the current
++frame as much as possible.
++.cmd removeup ( C\-t M\-Up )
++Kill frames directly above the current frame, extending the current
++frame as much as possible.
++.cmd removeright ( C\-t M\-Right )
++Kill frames directly right of the current frame, extending the current
++frame as much as possible.
+ .cmd resize [ deltax deltay ] ( C\-t r )
+ If \fIdeltax\fP and \fIdeltay\fP are supplied, resize the current frame
+ by that (i.e. move the bottom right corner by the given offsets and then
+Index: src/actions.c
+===================================================================
+--- src/actions.c.orig 2006-10-28 19:56:37.000000000 +0200
++++ src/actions.c 2006-10-28 19:56:41.000000000 +0200
+@@ -281,6 +281,10 @@
+ "Hook: ", arg_HOOK,
+ "Command: ", arg_REST);
+ add_command ("remove", cmd_remove, 0, 0, 0);
++ add_command ("removeup", cmd_removeup, 0, 0, 0);
++ add_command ("removedown", cmd_removedown, 0, 0, 0);
++ add_command ("removeleft", cmd_removeleft, 0, 0, 0);
++ add_command ("removeright", cmd_removeright, 0, 0, 0);
+ add_command ("resize", cmd_resize, 2, 0, 2,
+ "", arg_NUMBER,
+ "", arg_NUMBER);
+@@ -742,6 +746,10 @@
+ add_keybinding (XK_Down, 0, "focusdown", map);
+ add_keybinding (XK_Q, 0, "only", map);
+ add_keybinding (XK_R, 0, "remove", map);
++ add_keybinding (XK_Left, RP_META_MASK, "removeleft", map);
++ add_keybinding (XK_Right, RP_META_MASK, "removeright", map);
++ add_keybinding (XK_Up, RP_META_MASK, "removeup", map);
++ add_keybinding (XK_Down, RP_META_MASK, "removedown", map);
+ add_keybinding (XK_f, 0, "fselect", map);
+ add_keybinding (XK_f, RP_CONTROL_MASK, "fselect", map);
+ add_keybinding (XK_F, 0, "curframe", map);
+@@ -2869,6 +2877,38 @@
+ }
+
+ cmdret *
++cmd_removeup (int interactive, struct cmdarg **args)
++{
++ push_frame_undo (current_screen()); /* fdump to stack */
++ enlarge_frame_up (current_frame(), 1);
++ return cmdret_new(RET_SUCCESS, NULL);
++}
++
++cmdret *
++cmd_removedown (int interactive, struct cmdarg **args)
++{
++ push_frame_undo (current_screen()); /* fdump to stack */
++ enlarge_frame_down (current_frame(), 1);
++ return cmdret_new(RET_SUCCESS, NULL);
++}
++
++cmdret *
++cmd_removeleft (int interactive, struct cmdarg **args)
++{
++ push_frame_undo (current_screen()); /* fdump to stack */
++ enlarge_frame_left (current_frame(), 1);
++ return cmdret_new(RET_SUCCESS, NULL);
++}
++
++cmdret *
++cmd_removeright (int interactive, struct cmdarg **args)
++{
++ push_frame_undo (current_screen()); /* fdump to stack */
++ enlarge_frame_right (current_frame(), 1);
++ return cmdret_new(RET_SUCCESS, NULL);
++}
++
++cmdret *
+ cmd_shrink (int interactive, struct cmdarg **args)
+ {
+ push_frame_undo (current_screen()); /* fdump to stack */
+Index: src/actions.h
+===================================================================
+--- src/actions.h.orig 2006-10-28 19:56:37.000000000 +0200
++++ src/actions.h 2006-10-28 19:56:41.000000000 +0200
+@@ -165,6 +165,10 @@
+ RP_CMD (redisplay);
+ RP_CMD (remhook);
+ RP_CMD (remove);
++RP_CMD (removedown);
++RP_CMD (removeup);
++RP_CMD (removeleft);
++RP_CMD (removeright);
+ RP_CMD (rename);
+ RP_CMD (resize);
+ RP_CMD (restart);
+Index: src/split.c
+===================================================================
+--- src/split.c.orig 2006-10-28 19:56:37.000000000 +0200
++++ src/split.c 2006-10-28 19:56:41.000000000 +0200
+@@ -703,6 +703,147 @@
+ return 0;
+ }
+
++
++static void
++delete_frame (rp_frame *frame)
++{
++ rp_screen *s;
++ rp_window *win;
++
++ if (frame == NULL) return;
++
++ s = frames_screen (frame);
++
++ list_del (&frame->node);
++ win = find_window_number (frame->win_number);
++ hide_window (win);
++ hide_others (win);
++
++ frame_free (s, frame);
++}
++
++static void
++maximize_all_in_frame (rp_frame *frame)
++{
++ rp_window *win;
++
++ /* The current frame fits into the new space so keep its
++ new frame parameters and maximize the window to fit
++ the new frame size. */
++ if (frame->win_number != EMPTY)
++ {
++ win = find_window_number (frame->win_number);
++ maximize_all_windows_in_frame (frame);
++ XRaiseWindow (dpy, win->w);
++ }
++}
++
++void
++enlarge_frame_left (rp_frame *frame, int remove)
++{
++ rp_screen *s = frames_screen (frame);
++ rp_frame *cur;
++ struct list_head *tmp, *iter;
++
++ int new_x = screen_left(s);
++
++ list_for_each_safe_entry (cur, iter, tmp, &s->frames, node)
++ {
++ if (frame_top(frame) < frame_bottom(cur)
++ && frame_top(cur) < frame_bottom(frame))
++ {
++ int cur_border = frame_right (cur);
++
++ if (remove && cur_border == frame_left(frame))
++ delete_frame(cur);
++ else if (cur_border <= frame_left(frame) && cur_border > new_x )
++ new_x = cur_border;
++ }
++ }
++ frame->width += frame->x - new_x;
++ frame->x = new_x;
++ maximize_all_in_frame(frame);
++}
++
++void
++enlarge_frame_right (rp_frame *frame, int remove)
++{
++ rp_screen *s = frames_screen (frame);
++ rp_frame *cur;
++ struct list_head *tmp, *iter;
++
++ int new_x = screen_right(s);
++
++ list_for_each_safe_entry (cur, iter, tmp, &s->frames, node)
++ {
++ if (frame_top(frame) < frame_bottom(cur)
++ && frame_top(cur) < frame_bottom(frame))
++ {
++ int frame_border = frame_right(frame);
++
++ if (remove && frame_border == frame_left(cur))
++ delete_frame(cur);
++ else if (frame_border <= frame_left(cur) && frame_left(cur) < new_x )
++ new_x = cur->x;
++ }
++ }
++ frame->width = new_x - frame->x;
++ maximize_all_in_frame(frame);
++}
++
++void
++enlarge_frame_up (rp_frame *frame, int remove)
++{
++ rp_screen *s = frames_screen (frame);
++ rp_frame *cur;
++ struct list_head *tmp, *iter;
++
++ int new_y = screen_top(s);
++
++ list_for_each_safe_entry (cur, iter, tmp, &s->frames, node)
++ {
++ if (frame_left(frame) < frame_right(cur)
++ && frame_left(cur) < frame_right(frame))
++ {
++ int cur_border = frame_bottom (cur);
++
++ if (remove && cur_border == frame_top(frame))
++ delete_frame(cur);
++ else if (cur_border <= frame_top(frame) && cur_border > new_y )
++ new_y = cur_border;
++ }
++ }
++ frame->height += frame->y - new_y;
++ frame->y = new_y;
++ maximize_all_in_frame(frame);
++}
++
++void
++enlarge_frame_down (rp_frame *frame, int remove)
++{
++ rp_screen *s = frames_screen (frame);
++ rp_frame *cur;
++ struct list_head *tmp, *iter;
++
++ int new_y = screen_bottom(s);
++
++ list_for_each_safe_entry (cur, iter, tmp, &s->frames, node)
++ {
++ if (frame_left(frame) < frame_right(cur)
++ && frame_left(cur) < frame_right(frame))
++ {
++ int frame_border = frame_bottom(frame);
++
++ if (remove && frame_border == frame_top(cur))
++ delete_frame(cur);
++ else if (frame_border <= frame_top(cur) && frame_top(cur) < new_y )
++ new_y = frame_top(cur);
++ }
++ }
++ frame->height = new_y - frame->y;
++ maximize_all_in_frame(frame);
++}
++
+ void
+ remove_frame (rp_frame *frame)
+ {
+@@ -800,17 +941,7 @@
+ }
+
+ if (fits)
+- {
+- /* The current frame fits into the new space so keep its
+- new frame parameters and maximize the window to fit
+- the new frame size. */
+- if (cur->win_number != EMPTY)
+- {
+- win = find_window_number (cur->win_number);
+- maximize_all_windows_in_frame (cur);
+- XRaiseWindow (dpy, win->w);
+- }
+- }
++ maximize_all_in_frame(cur);
+ else
+ {
+ memcpy (cur, &tmp_frame, sizeof (rp_frame));
+@@ -1002,16 +1133,24 @@
+ rp_screen *s = frames_screen (frame);
+ rp_frame *cur;
+
++ rp_frame *best_frame_yet = NULL;
++ int best_x_yet = frame->x + frame->width + 1;
++
+ list_for_each_entry (cur, &s->frames, node)
+ {
+ if (frame->y == cur->y + cur->height)
+ {
+ if (frame->x >= cur->x && frame->x < cur->x + cur->width)
+ return cur;
++ if (cur->x >= frame->x && cur->x < best_x_yet )
++ {
++ best_x_yet = cur->x;
++ best_frame_yet = cur;
++ }
+ }
+ }
+
+- return NULL;
++ return best_frame_yet;
+ }
+
+ rp_frame *
+@@ -1020,16 +1159,24 @@
+ rp_screen *s = frames_screen (frame);
+ rp_frame *cur;
+
++ rp_frame *best_frame_yet = NULL;
++ int best_x_yet = frame->x + frame->width + 1;
++
+ list_for_each_entry (cur, &s->frames, node)
+ {
+ if (frame->y + frame->height == cur->y)
+ {
+ if (frame->x >= cur->x && frame->x < cur->x + cur->width)
+ return cur;
++ if (cur->x >= frame->x && cur->x < best_x_yet )
++ {
++ best_x_yet = cur->x;
++ best_frame_yet = cur;
++ }
+ }
+ }
+
+- return NULL;
++ return best_frame_yet;
+ }
+
+ rp_frame *
+@@ -1038,16 +1185,24 @@
+ rp_screen *s = frames_screen (frame);
+ rp_frame *cur;
+
++ rp_frame *best_frame_yet = NULL;
++ int best_y_yet = frame->y + frame->height + 1;
++
+ list_for_each_entry (cur, &s->frames, node)
+ {
+ if (frame->x == cur->x + cur->width)
+ {
+ if (frame->y >= cur->y && frame->y < cur->y + cur->height)
+ return cur;
++ if (cur->y >= frame->y && cur->y < best_y_yet )
++ {
++ best_y_yet = cur->y;
++ best_frame_yet = cur;
++ }
+ }
+ }
+
+- return NULL;
++ return best_frame_yet;
+ }
+
+ rp_frame *
+@@ -1056,16 +1211,24 @@
+ rp_screen *s = frames_screen (frame);
+ rp_frame *cur;
+
++ rp_frame *best_frame_yet = NULL;
++ int best_y_yet = frame->y + frame->height + 1;
++
+ list_for_each_entry (cur, &s->frames, node)
+ {
+ if (frame->x + frame->width == cur->x)
+ {
+ if (frame->y >= cur->y && frame->y < cur->y + cur->height)
+ return cur;
++ if (cur->y >= frame->y && cur->y < best_y_yet )
++ {
++ best_y_yet = cur->y;
++ best_frame_yet = cur;
++ }
+ }
+ }
+
+- return NULL;
++ return best_frame_yet;
+ }
+
+ rp_frame *
+Index: src/split.h
+===================================================================
+--- src/split.h.orig 2006-10-28 19:56:37.000000000 +0200
++++ src/split.h 2006-10-28 19:56:41.000000000 +0200
+@@ -33,6 +33,10 @@
+ void resize_frame_horizontally (rp_frame *frame, int diff);
+ void resize_frame_vertically (rp_frame *frame, int diff);
+ void remove_frame (rp_frame *frame);
++void enlarge_frame_left (rp_frame *frame, int remove);
++void enlarge_frame_up (rp_frame *frame, int remove);
++void enlarge_frame_right (rp_frame *frame, int remove);
++void enlarge_frame_down (rp_frame *frame, int remove);
+ rp_window *find_window_for_frame (rp_frame *frame);
+ rp_frame *find_windows_frame (rp_window *win);
+ rp_frame *find_frame_next (rp_frame *frame);