From af0ddeda3f2948d156ba325e064d6a21e9fce69b Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Sat, 4 Jun 2011 11:34:58 +0200 Subject: [PATCH] Split/Conf: Add split_move_direction function --- src/config.c | 6 +++++- src/split.c | 33 +++++++++++++++++++++++++++++++++ src/wmfs.h | 8 ++++++++ wmfsrc | 6 ++++++ 4 files changed, 52 insertions(+), 1 deletion(-) diff --git a/src/config.c b/src/config.c index 3774937..9ab5eb5 100644 --- a/src/config.c +++ b/src/config.c @@ -109,7 +109,11 @@ const func_name_list_t func_list[] = {"toggle_tagautohide", uicb_toggle_tagautohide }, {"toggle_tag_expose", uicb_tag_toggle_expose}, {"split_toggle", uicb_split_toggle }, - /*{"split_client_vertical", uicb_split_client_vertical }, + {"split_move_right", uicb_split_move_Right }, + {"split_move_left", uicb_split_move_Left }, + {"split_move_top", uicb_split_move_Top }, + {"split_move_bottom", uicb_split_move_Bottom }, + /*{"split_client_vertical" uicb_split_client_vertical }, {"split_client_horizontal", uicb_split_client_horizontal }, */ {NULL, NULL} }; diff --git a/src/split.c b/src/split.c index 3727f09..4ccbfe2 100644 --- a/src/split.c +++ b/src/split.c @@ -32,6 +32,20 @@ #include "wmfs.h" +#define SPLIT_MOVE_DIR(d) \ +void \ +uicb_split_move_##d(uicb_t cmd) \ +{ \ + CHECK(sel); \ + split_move_dir(sel, d); \ +} + +/* uicb_split_move_dir() */ +SPLIT_MOVE_DIR(Right); +SPLIT_MOVE_DIR(Left); +SPLIT_MOVE_DIR(Top); +SPLIT_MOVE_DIR(Bottom); + /** Arrange size of parent client of last closed client */ static void @@ -320,6 +334,25 @@ split_client_integrate(Client *c, Client *sc, int screen, int tag) return; } +/** Move splitted client by re-arranging it in next by direction client +*/ +void +split_move_dir(Client *c, Position p) +{ + Client *sc; + + if(!c || !(tags[c->screen][c->tag].flags & SplitFlag)) + return; + + if((sc = client_get_next_with_direction(c, p))) + { + split_arrange_closed(c); + split_client_integrate(c, sc, sc->screen, sc->tag); + } + + return; +} + /** Toggle split mode */ void diff --git a/src/wmfs.h b/src/wmfs.h index 0ee8552..d7907b1 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -405,7 +405,15 @@ void split_arrange_closed(Client *ghost); XRectangle split_client(Client *c, Bool p); void split_client_fill(Client *c, XRectangle geo); void split_client_integrate(Client *c, Client *sc, int screen, int tag); +void split_move_dir(Client *c, Position p); void uicb_split_toggle(uicb_t cmd); +/* Generated with macro {{{ */ +void uicb_split_move_Right(uicb_t); +void uicb_split_move_Left(uicb_t); +void uicb_split_move_Top(uicb_t); +void uicb_split_move_Bottom(uicb_t); +/* }}} */ + /* viwmfs.c */ void viwmfs(int argc, char **argv); diff --git a/wmfsrc b/wmfsrc index 0d7ab04..d58edd7 100644 --- a/wmfsrc +++ b/wmfsrc @@ -450,6 +450,12 @@ [key] mod = {"Control"} key = "k" func = "client_swap_top" [/key] [key] mod = {"Control"} key = "j" func = "client_swap_bottom" [/key] + # Move next splitted client with direction + [key] mod = {"Control", "Shift"} key = "h" func = "split_move_left" [/key] + [key] mod = {"Control", "Shift"} key = "l" func = "split_move_right" [/key] + [key] mod = {"Control", "Shift"} key = "k" func = "split_move_top" [/key] + [key] mod = {"Control", "Shift"} key = "j" func = "split_move_bottom" [/key] + # Resize selected tiled client with direction [key] mod = {"Super"} key = "h" func = "client_resize_left" cmd = "20" [/key] [key] mod = {"Super"} key = "l" func = "client_resize_right" cmd = "20" [/key]