layout.c
changeset 904 2dfd50e4cfde
parent 901 8f6f61e07567
child 905 ca352bd2f8f7
equal deleted inserted replaced
903:467c754b607d 904:2dfd50e4cfde
    10 /* static */
    10 /* static */
    11 
    11 
    12 static unsigned int nlayouts = 0;
    12 static unsigned int nlayouts = 0;
    13 static unsigned int masterw = MASTERWIDTH;
    13 static unsigned int masterw = MASTERWIDTH;
    14 static unsigned int nmaster = NMASTER;
    14 static unsigned int nmaster = NMASTER;
       
    15 
       
    16 static void
       
    17 ban(Client *c) {
       
    18 	if (c->isbanned)
       
    19 		return;
       
    20 	XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
       
    21 	c->isbanned = True;
       
    22 }
       
    23 
       
    24 static void
       
    25 unban(Client *c) {
       
    26 	if (!c->isbanned)
       
    27 		return;
       
    28 	XMoveWindow(dpy, c->win, c->x, c->y);
       
    29 	c->isbanned = False;
       
    30 }
    15 
    31 
    16 static void
    32 static void
    17 tile(void) {
    33 tile(void) {
    18 	unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th;
    34 	unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th;
    19 	Client *c;
    35 	Client *c;
    26 	th = (n > nmaster) ? wah / (n - nmaster) : 0;
    42 	th = (n > nmaster) ? wah / (n - nmaster) : 0;
    27 	tw = waw - mw;
    43 	tw = waw - mw;
    28 
    44 
    29 	for(i = 0, c = clients; c; c = c->next)
    45 	for(i = 0, c = clients; c; c = c->next)
    30 		if(isvisible(c)) {
    46 		if(isvisible(c)) {
    31 			if(c->isbanned)
    47 			unban(c);
    32 				XMoveWindow(dpy, c->win, c->x, c->y);
       
    33 			c->isbanned = False;
       
    34 			if(c->isfloating)
    48 			if(c->isfloating)
    35 				continue;
    49 				continue;
    36 			c->ismax = False;
    50 			c->ismax = False;
    37 			nx = wax;
    51 			nx = wax;
    38 			ny = way;
    52 			ny = way;
    58 					nh = wah - 2 * c->border;
    72 					nh = wah - 2 * c->border;
    59 			}
    73 			}
    60 			resize(c, nx, ny, nw, nh, False);
    74 			resize(c, nx, ny, nw, nh, False);
    61 			i++;
    75 			i++;
    62 		}
    76 		}
    63 		else {
    77 		else
    64 			c->isbanned = True;
    78 			ban(c);
    65 			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
    79 	focus(NULL);
    66 		}
       
    67 	if(!sel || !isvisible(sel)) 
       
    68 		focustopvisible();
       
    69 	restack();
    80 	restack();
    70 }
    81 }
    71 
    82 
    72 LAYOUTS
    83 LAYOUTS
    73 
    84 
    75 
    86 
    76 void
    87 void
    77 floating(void) {
    88 floating(void) {
    78 	Client *c;
    89 	Client *c;
    79 
    90 
    80 	for(c = clients; c; c = c->next) {
    91 	for(c = clients; c; c = c->next)
    81 		if(isvisible(c)) {
    92 		if(isvisible(c)) {
    82 			if(c->isbanned)
    93 			if(c->isbanned)
    83 				XMoveWindow(dpy, c->win, c->x, c->y);
    94 				XMoveWindow(dpy, c->win, c->x, c->y);
    84 			c->isbanned = False;
    95 			c->isbanned = False;
    85 			resize(c, c->x, c->y, c->w, c->h, True);
    96 			resize(c, c->x, c->y, c->w, c->h, True);
    86 		}
    97 		}
    87 		else {
    98 		else
    88 			c->isbanned = True;
    99 			ban(c);
    89 			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
   100 	focus(NULL);
    90 		}
       
    91 	}
       
    92 	if(!sel || !isvisible(sel))
       
    93 		focustopvisible();
       
    94 	restack();
   101 	restack();
    95 }
   102 }
    96 
   103 
    97 void
   104 void
    98 focusclient(const char *arg) {
   105 focusclient(const char *arg) {