51 static unsigned int cwidth = 0; |
51 static unsigned int cwidth = 0; |
52 static const int seek = 30; /* 30px */ |
52 static const int seek = 30; /* 30px */ |
53 |
53 |
54 static Brush brush = {0}; |
54 static Brush brush = {0}; |
55 |
55 |
56 static void draw_menu(void); |
56 static void draw_menu(); |
57 static void kpress(XKeyEvent * e); |
57 static void kpress(XKeyEvent * e); |
58 |
58 |
59 static char version[] = "gridmenu - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n"; |
59 static char version[] = "gridmenu - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n"; |
60 |
60 |
61 static void |
61 static void |
395 loadcolors(dpy, screen, &brush, BGCOLOR, FGCOLOR, BORDERCOLOR); |
395 loadcolors(dpy, screen, &brush, BGCOLOR, FGCOLOR, BORDERCOLOR); |
396 loadfont(dpy, &brush.font, FONT); |
396 loadfont(dpy, &brush.font, FONT); |
397 |
397 |
398 wa.override_redirect = 1; |
398 wa.override_redirect = 1; |
399 wa.background_pixmap = ParentRelative; |
399 wa.background_pixmap = ParentRelative; |
400 wa.event_mask = ExposureMask | ButtonPressMask | KeyPressMask |
400 wa.event_mask = ExposureMask | ButtonPressMask | KeyPressMask; |
401 | SubstructureRedirectMask | SubstructureNotifyMask; |
|
402 |
401 |
403 rect.width = DisplayWidth(dpy, screen); |
402 rect.width = DisplayWidth(dpy, screen); |
404 rect.height = brush.font.height + 4; |
403 rect.height = labelheight(&brush.font); |
405 rect.y = DisplayHeight(dpy, screen) - rect.height; |
404 rect.y = DisplayHeight(dpy, screen) - rect.height; |
406 rect.x = 0; |
405 rect.x = 0; |
407 |
406 |
408 win = XCreateWindow(dpy, root, rect.x, rect.y, |
407 win = XCreateWindow(dpy, root, rect.x, rect.y, |
409 rect.width, rect.height, 0, DefaultDepth(dpy, screen), |
408 rect.width, rect.height, 0, DefaultDepth(dpy, screen), |
411 CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); |
410 CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); |
412 XDefineCursor(dpy, win, XCreateFontCursor(dpy, XC_xterm)); |
411 XDefineCursor(dpy, win, XCreateFontCursor(dpy, XC_xterm)); |
413 XFlush(dpy); |
412 XFlush(dpy); |
414 |
413 |
415 /* pixmap */ |
414 /* pixmap */ |
416 brush.gc = XCreateGC(dpy, win, 0, 0); |
415 brush.gc = XCreateGC(dpy, root, 0, 0); |
417 brush.drawable = XCreatePixmap(dpy, win, rect.width, rect.height, |
416 brush.drawable = XCreatePixmap(dpy, win, rect.width, rect.height, |
418 DefaultDepth(dpy, screen)); |
417 DefaultDepth(dpy, screen)); |
419 XFlush(dpy); |
418 XFlush(dpy); |
420 |
419 |
421 if(maxname) |
420 if(maxname) |