client.c
changeset 970 d5c3537ee3be
parent 967 66f17bf2c278
child 971 b2a0dfa22b1d
equal deleted inserted replaced
969:50fb50842dbc 970:d5c3537ee3be
     5 #include <X11/Xatom.h>
     5 #include <X11/Xatom.h>
     6 #include <X11/Xutil.h>
     6 #include <X11/Xutil.h>
     7 
     7 
     8 /* static */
     8 /* static */
     9 
     9 
    10 static char prop[128];
    10 static char buf[128];
    11 
    11 
    12 static void
    12 static void
    13 attachstack(Client *c) {
    13 attachstack(Client *c) {
    14 	c->snext = stack;
    14 	c->snext = stack;
    15 	stack = c;
    15 	stack = c;
   184 Bool
   184 Bool
   185 getprops(Client *c) {
   185 getprops(Client *c) {
   186 	unsigned int i;
   186 	unsigned int i;
   187 	Bool result = False;
   187 	Bool result = False;
   188 
   188 
   189 	if(gettextprop(c->win, dwmprops, prop, sizeof prop)) {
   189 	if(gettextprop(c->win, dwmprops, buf, sizeof buf)) {
   190 		for(i = 0; i < ntags && i < sizeof prop - 1 && prop[i] != '\0'; i++)
   190 		for(i = 0; i < ntags && i < sizeof buf - 1 && buf[i] != '\0'; i++)
   191 			if((c->tags[i] = prop[i] == '1'))
   191 			if((c->tags[i] = buf[i] == '1'))
   192 				result = True;
   192 				result = True;
   193 		if(i < sizeof prop - 1 && prop[i] != '\0')
   193 		if(i < sizeof buf - 1 && buf[i] != '\0')
   194 			c->isfloating = prop[i] == '1';
   194 			c->isfloating = buf[i] == '1';
   195 	}
   195 	}
   196 	return result;
   196 	return result;
   197 }
   197 }
   198 
   198 
   199 void
   199 void
   319 
   319 
   320 void
   320 void
   321 setprops(Client *c) {
   321 setprops(Client *c) {
   322 	unsigned int i;
   322 	unsigned int i;
   323 
   323 
   324 	for(i = 0; i < ntags && i < sizeof prop - 1; i++)
   324 	for(i = 0; i < ntags && i < sizeof buf - 1; i++)
   325 		prop[i] = c->tags[i] ? '1' : '0';
   325 		buf[i] = c->tags[i] ? '1' : '0';
   326 	if(i < sizeof prop - 1)
   326 	if(i < sizeof buf - 1)
   327 		prop[i++] = c->isfloating ? '1' : '0';
   327 		buf[i++] = c->isfloating ? '1' : '0';
   328 	prop[i] = '\0';
   328 	buf[i] = '\0';
   329 	XChangeProperty(dpy, c->win, dwmprops, XA_STRING, 8,
   329 	XChangeProperty(dpy, c->win, dwmprops, XA_STRING, 8,
   330 			PropModeReplace, (unsigned char *)prop, i);
   330 			PropModeReplace, (unsigned char *)buf, i);
   331 }
   331 }
   332 
   332 
   333 void
   333 void
   334 unban(Client *c) {
   334 unban(Client *c) {
   335 	if(!c->isbanned)
   335 	if(!c->isbanned)