wm.c
changeset 7 49e2fc9fb94f
parent 6 e0cefb3981c8
child 8 7066ff2fe8bc
equal deleted inserted replaced
6:e0cefb3981c8 7:49e2fc9fb94f
    18 Window root, barwin;
    18 Window root, barwin;
    19 Atom wm_atom[WMLast], net_atom[NetLast];
    19 Atom wm_atom[WMLast], net_atom[NetLast];
    20 Cursor cursor[CurLast];
    20 Cursor cursor[CurLast];
    21 XRectangle rect, barrect;
    21 XRectangle rect, barrect;
    22 Bool running = True;
    22 Bool running = True;
    23 
    23 Client *client = NULL;
    24 char *bartext;
    24 
       
    25 char *bartext, tag[256];
    25 int screen, sel_screen;
    26 int screen, sel_screen;
    26 unsigned int lock_mask, numlock_mask;
    27 unsigned int lock_mask, numlock_mask;
    27 
    28 
    28 /* draw structs */
    29 /* draw structs */
    29 Brush brush = {0};
    30 Brush brush = {0};
    72 	int status;
    73 	int status;
    73 
    74 
    74 	status = XGetWindowProperty(dpy, w, a, 0L, l, False, t, &real, &format,
    75 	status = XGetWindowProperty(dpy, w, a, 0L, l, False, t, &real, &format,
    75 			&res, &extra, prop);
    76 			&res, &extra, prop);
    76 
    77 
    77 	if(status != Success || *prop == 0) {
    78 	if(status != Success || *prop == NULL) {
    78 		return 0;
    79 		return 0;
    79 	}
    80 	}
    80 	if(res == 0) {
    81 	if(res == 0)
    81 		free((void *) *prop);
    82 		free((void *) *prop);
    82 	}
       
    83 	return res;
    83 	return res;
    84 }
    84 }
    85 
    85 
    86 int
    86 int
    87 win_proto(Window w)
    87 win_proto(Window w)
   262 	barrect.y = rect.height - barrect.height;
   262 	barrect.y = rect.height - barrect.height;
   263 	barwin = XCreateWindow(dpy, root, barrect.x, barrect.y,
   263 	barwin = XCreateWindow(dpy, root, barrect.x, barrect.y,
   264 			barrect.width, barrect.height, 0, DefaultDepth(dpy, screen),
   264 			barrect.width, barrect.height, 0, DefaultDepth(dpy, screen),
   265 			CopyFromParent, DefaultVisual(dpy, screen),
   265 			CopyFromParent, DefaultVisual(dpy, screen),
   266 			CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
   266 			CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
   267 	bartext = 0;
   267 	bartext = NULL;
   268 	XDefineCursor(dpy, barwin, cursor[CurNormal]);
   268 	XDefineCursor(dpy, barwin, cursor[CurNormal]);
   269 	XMapRaised(dpy, barwin);
   269 	XMapRaised(dpy, barwin);
   270 	draw_bar();
   270 	draw_bar();
   271 
   271 
   272 	wa.event_mask = SubstructureRedirectMask | EnterWindowMask | LeaveWindowMask;
   272 	wa.event_mask = SubstructureRedirectMask | EnterWindowMask | LeaveWindowMask;