Add option to set the new windows as master or not

This commit is contained in:
linkdd 2009-10-20 18:20:52 +02:00 committed by Philippe Pepiot
parent 39ef26690c
commit a84cc5ef48
5 changed files with 32 additions and 19 deletions

View File

@ -558,6 +558,9 @@ client_manage(Window w, XWindowAttributes *wa, Bool ar)
if(ar) if(ar)
arrange(c->screen, True); arrange(c->screen, True);
if(conf.client.set_new_win_master)
layout_set_client_master(c);
return c; return c;
} }

View File

@ -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_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.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.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"))) if((conf.client.nmouse = get_size_sec(src, "mouse")))
{ {

View File

@ -756,23 +756,7 @@ mirror_horizontal(int screen)
void void
uicb_tile_switch(uicb_t cmd) uicb_tile_switch(uicb_t cmd)
{ {
Client *c; layout_set_client_master (sel);
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);
return; return;
} }
@ -869,3 +853,27 @@ uicb_set_layout(uicb_t cmd)
return; 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;
}

View File

@ -348,6 +348,7 @@ typedef struct
} root; } root;
struct struct
{ {
Bool set_new_win_master;
Bool place_at_mouse; Bool place_at_mouse;
Bool border_shadow; Bool border_shadow;
int borderheight; int borderheight;
@ -356,7 +357,7 @@ typedef struct
uint resizecorner_normal; uint resizecorner_normal;
uint resizecorner_focus; uint resizecorner_focus;
uint mod; uint mod;
MouseBinding *mouse; MouseBinding *mouse;
int nmouse; int nmouse;
} client; } client;
struct struct

View File

@ -303,7 +303,7 @@ void uicb_set_layout(uicb_t);
void uicb_toggle_resizehint(uicb_t); void uicb_toggle_resizehint(uicb_t);
void uicb_set_layer(uicb_t cmd); void uicb_set_layer(uicb_t cmd);
void uicb_set_client_layer(uicb_t cmd); void uicb_set_client_layer(uicb_t cmd);
void layout_set_client_master(Client *c);
/* init.c */ /* init.c */
void init(void); void init(void);