client.c
changeset 23 95ffdfd0a819
parent 22 bd3a44353916
child 26 e8f627998d6f
equal deleted inserted replaced
22:bd3a44353916 23:95ffdfd0a819
    91 		XMapWindow(dpy, old->title);
    91 		XMapWindow(dpy, old->title);
    92 		draw_client(old);
    92 		draw_client(old);
    93 	}
    93 	}
    94 	XUnmapWindow(dpy, c->title);
    94 	XUnmapWindow(dpy, c->title);
    95 	draw_bar();
    95 	draw_bar();
       
    96 	discard_events(EnterWindowMask);
    96 	XFlush(dpy);
    97 	XFlush(dpy);
    97 }
    98 }
    98 
    99 
    99 void
   100 void
   100 manage(Window w, XWindowAttributes *wa)
   101 manage(Window w, XWindowAttributes *wa)
   114 	XSetWindowBorder(dpy, c->win, brush.border);
   115 	XSetWindowBorder(dpy, c->win, brush.border);
   115 	XSelectInput(dpy, c->win, CLIENT_MASK);
   116 	XSelectInput(dpy, c->win, CLIENT_MASK);
   116 	XGetTransientForHint(dpy, c->win, &c->trans);
   117 	XGetTransientForHint(dpy, c->win, &c->trans);
   117 	twa.override_redirect = 1;
   118 	twa.override_redirect = 1;
   118 	twa.background_pixmap = ParentRelative;
   119 	twa.background_pixmap = ParentRelative;
   119 	twa.event_mask = SubstructureNotifyMask | ExposureMask;
   120 	twa.event_mask = ExposureMask;
   120 
   121 
   121 	c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
   122 	c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
   122 			0, DefaultDepth(dpy, screen), CopyFromParent,
   123 			0, DefaultDepth(dpy, screen), CopyFromParent,
   123 			DefaultVisual(dpy, screen),
   124 			DefaultVisual(dpy, screen),
   124 			CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
   125 			CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
   189 	free(c);
   190 	free(c);
   190 
   191 
   191 	XFlush(dpy);
   192 	XFlush(dpy);
   192 	XSetErrorHandler(error_handler);
   193 	XSetErrorHandler(error_handler);
   193 	XUngrabServer(dpy);
   194 	XUngrabServer(dpy);
   194 	discard_events(EnterWindowMask);
       
   195 	if(stack)
   195 	if(stack)
   196 		focus(stack);
   196 		focus(stack);
   197 }
   197 }
   198 
   198 
       
   199 Client *
       
   200 gettitle(Window w)
       
   201 {
       
   202 	Client *c;
       
   203 	for(c = clients; c; c = c->next)
       
   204 		if(c->title == w)
       
   205 			return c;
       
   206 	return NULL;
       
   207 }
   199 
   208 
   200 Client *
   209 Client *
   201 getclient(Window w)
   210 getclient(Window w)
   202 {
   211 {
   203 	Client *c;
   212 	Client *c;