client.c
changeset 772 a1dd3d977e25
parent 771 05946fa53085
child 775 920b51271fc8
equal deleted inserted replaced
771:05946fa53085 772:a1dd3d977e25
    57 xerrordummy(Display *dsply, XErrorEvent *ee) {
    57 xerrordummy(Display *dsply, XErrorEvent *ee) {
    58 	return 0;
    58 	return 0;
    59 }
    59 }
    60 
    60 
    61 /* extern */
    61 /* extern */
    62 
       
    63 void
       
    64 attach(Client *c) {
       
    65 	if(clients)
       
    66 		clients->prev = c;
       
    67 	c->next = clients;
       
    68 	clients = c;
       
    69 }
       
    70 
       
    71 void
       
    72 attachstack(Client *c) {
       
    73 	c->snext = stack;
       
    74 	stack = c;
       
    75 }
       
    76 
    62 
    77 void
    63 void
    78 configure(Client *c) {
    64 configure(Client *c) {
    79 	XConfigureEvent ce;
    65 	XConfigureEvent ce;
    80 
    66 
    91 	ce.override_redirect = False;
    77 	ce.override_redirect = False;
    92 	XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce);
    78 	XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ce);
    93 }
    79 }
    94 
    80 
    95 void
    81 void
    96 detach(Client *c) {
       
    97 	if(c->prev)
       
    98 		c->prev->next = c->next;
       
    99 	if(c->next)
       
   100 		c->next->prev = c->prev;
       
   101 	if(c == clients)
       
   102 		clients = c->next;
       
   103 	c->next = c->prev = NULL;
       
   104 }
       
   105 
       
   106 void
       
   107 detachstack(Client *c) {
       
   108 	Client **tc;
       
   109 	for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext);
       
   110 	*tc = c->snext;
       
   111 }
       
   112 
       
   113 void
       
   114 focus(Client *c) {
    82 focus(Client *c) {
   115 	if(c && !isvisible(c))
    83 	if(c && !isvisible(c))
   116 		return;
    84 		return;
   117 	if(sel && sel != c) {
    85 	if(sel && sel != c) {
   118 		grabbuttons(sel, False);
    86 		grabbuttons(sel, False);
   131 		XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
    99 		XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
   132 		XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
   100 		XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
   133 	}
   101 	}
   134 	else
   102 	else
   135 		XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
   103 		XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
   136 }
       
   137 
       
   138 Client *
       
   139 getclient(Window w) {
       
   140 	Client *c;
       
   141 
       
   142 	for(c = clients; c; c = c->next)
       
   143 		if(c->win == w)
       
   144 			return c;
       
   145 	return NULL;
       
   146 }
   104 }
   147 
   105 
   148 Bool
   106 Bool
   149 isprotodel(Client *c) {
   107 isprotodel(Client *c) {
   150 	int i, n;
   108 	int i, n;