view.c
changeset 772 a1dd3d977e25
parent 771 05946fa53085
equal deleted inserted replaced
771:05946fa53085 772:a1dd3d977e25
     4 #include "dwm.h"
     4 #include "dwm.h"
     5 
     5 
     6 /* extern */
     6 /* extern */
     7 
     7 
     8 void (*arrange)(void) = DEFMODE;
     8 void (*arrange)(void) = DEFMODE;
       
     9 
       
    10 void
       
    11 attach(Client *c) {
       
    12 	if(clients)
       
    13 		clients->prev = c;
       
    14 	c->next = clients;
       
    15 	clients = c;
       
    16 }
       
    17 
       
    18 void
       
    19 attachstack(Client *c) {
       
    20 	c->snext = stack;
       
    21 	stack = c;
       
    22 }
     9 
    23 
    10 void
    24 void
    11 dofloat(void) {
    25 dofloat(void) {
    12 	Client *c;
    26 	Client *c;
    13 
    27 
    26 	if(!sel || !isvisible(sel)) {
    40 	if(!sel || !isvisible(sel)) {
    27 		for(c = stack; c && !isvisible(c); c = c->snext);
    41 		for(c = stack; c && !isvisible(c); c = c->snext);
    28 		focus(c);
    42 		focus(c);
    29 	}
    43 	}
    30 	restack();
    44 	restack();
       
    45 }
       
    46 
       
    47 void
       
    48 detach(Client *c) {
       
    49 	if(c->prev)
       
    50 		c->prev->next = c->next;
       
    51 	if(c->next)
       
    52 		c->next->prev = c->prev;
       
    53 	if(c == clients)
       
    54 		clients = c->next;
       
    55 	c->next = c->prev = NULL;
       
    56 }
       
    57 
       
    58 void
       
    59 detachstack(Client *c) {
       
    60 	Client **tc;
       
    61 	for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext);
       
    62 	*tc = c->snext;
    31 }
    63 }
    32 
    64 
    33 void
    65 void
    34 focusnext(Arg *arg) {
    66 focusnext(Arg *arg) {
    35 	Client *c;
    67 	Client *c;
    58 	}
    90 	}
    59 	if(c) {
    91 	if(c) {
    60 		focus(c);
    92 		focus(c);
    61 		restack();
    93 		restack();
    62 	}
    94 	}
       
    95 }
       
    96 
       
    97 Client *
       
    98 getclient(Window w) {
       
    99 	Client *c;
       
   100 
       
   101 	for(c = clients; c; c = c->next)
       
   102 		if(c->win == w)
       
   103 			return c;
       
   104 	return NULL;
    63 }
   105 }
    64 
   106 
    65 Bool
   107 Bool
    66 isvisible(Client *c) {
   108 isvisible(Client *c) {
    67 	unsigned int i;
   109 	unsigned int i;