Browse Source

Add option to set the new windows as master or not

linkdd 14 years ago
parent
commit
a84cc5ef48
5 changed files with 32 additions and 19 deletions
  1. 3 0
      src/client.c
  2. 1 0
      src/config.c
  3. 25 17
      src/layout.c
  4. 2 1
      src/structs.h
  5. 1 1
      src/wmfs.h

+ 3 - 0
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;
 }
 

+ 1 - 0
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")))
      {

+ 25 - 17
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;
+}

+ 2 - 1
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

+ 1 - 1
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);