From a84cc5ef484f8b12db955cfee1bf4da773820bc3 Mon Sep 17 00:00:00 2001 From: linkdd Date: Tue, 20 Oct 2009 18:20:52 +0200 Subject: [PATCH] Add option to set the new windows as master or not --- src/client.c | 3 +++ src/config.c | 1 + src/layout.c | 42 +++++++++++++++++++++++++----------------- src/structs.h | 3 ++- src/wmfs.h | 2 +- 5 files changed, 32 insertions(+), 19 deletions(-) diff --git a/src/client.c b/src/client.c index fa56246..e834afa 100644 --- a/src/client.c +++ b/src/client.c @@ -558,6 +558,9 @@ client_manage(Window w, XWindowAttributes *wa, Bool ar) if(ar) arrange(c->screen, True); + if(conf.client.set_new_win_master) + layout_set_client_master(c); + return c; } diff --git a/src/config.c b/src/config.c index f145124..dca9897 100644 --- a/src/config.c +++ b/src/config.c @@ -193,6 +193,7 @@ conf_client_section(char *src) conf.client.resizecorner_normal = getcolor(get_opt(src, "#222222", "resize_corner_normal").str); conf.client.resizecorner_focus = getcolor(get_opt(src, "#DDDDDD", "resize_corner_focus").str); conf.client.mod |= char_to_modkey(get_opt(src, "Alt", "modifier").str, key_list); + conf.client.set_new_win_master = get_opt(src, "true", "set_new_win_master").bool; if((conf.client.nmouse = get_size_sec(src, "mouse"))) { diff --git a/src/layout.c b/src/layout.c index f74f2e3..3ec7c5e 100644 --- a/src/layout.c +++ b/src/layout.c @@ -756,23 +756,7 @@ mirror_horizontal(int screen) void uicb_tile_switch(uicb_t cmd) { - Client *c; - - screen_get_sel(); - - if(!sel - || (sel->flags & HintFlag) - || !(sel->flags & TileFlag) - || (sel->flags & FSSFlag)) - return; - - if((c = sel) == tiled_client(selscreen, clients)) - CHECK((c = tiled_client(selscreen, c->next))); - client_detach(c); - client_attach(c); - client_focus(c); - tags[selscreen][seltag[selscreen]].layout.func(selscreen); - + layout_set_client_master (sel); return; } @@ -869,3 +853,27 @@ uicb_set_layout(uicb_t cmd) return; } + +/** Set the client as master + * \param c Client + */ +void +layout_set_client_master(Client *c) +{ + screen_get_sel(); + + if(!c + || (c->flags & HintFlag) + || !(c->flags & TileFlag) + || (c->flags & FSSFlag)) + return; + + if(c == tiled_client(selscreen, clients)) + CHECK((c = tiled_client(selscreen, c->next))); + client_detach(c); + client_attach(c); + client_focus(c); + tags[selscreen][seltag[selscreen]].layout.func(selscreen); + + return; +} diff --git a/src/structs.h b/src/structs.h index 7fab91c..ef0b31c 100644 --- a/src/structs.h +++ b/src/structs.h @@ -348,6 +348,7 @@ typedef struct } root; struct { + Bool set_new_win_master; Bool place_at_mouse; Bool border_shadow; int borderheight; @@ -356,7 +357,7 @@ typedef struct uint resizecorner_normal; uint resizecorner_focus; uint mod; - MouseBinding *mouse; + MouseBinding *mouse; int nmouse; } client; struct diff --git a/src/wmfs.h b/src/wmfs.h index 2d0ad00..5b75d91 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -303,7 +303,7 @@ void uicb_set_layout(uicb_t); void uicb_toggle_resizehint(uicb_t); void uicb_set_layer(uicb_t cmd); void uicb_set_client_layer(uicb_t cmd); - +void layout_set_client_master(Client *c); /* init.c */ void init(void);