commit - cb28fcb80e8bd522d328e48d0271cdb123e43e7a
commit + 044328a9d61f0290c4bc4b7e25e9b2fdf4e96d86
blob - ac1e066b5bd4c7ae99eea36554066efb93fa4791
blob + 6a2a1cc7657f0df7d6f4a844c3f2057bd655f3c4
--- xitems.c
+++ xitems.c
int width = 0; /* XXX */
int height;
XGCValues values;
+ XSetWindowAttributes swa = {
+ .override_redirect = True,
+ .save_under = True,
+ //.background_pixel = WhitePixel(dpy, screen),
+ .event_mask = ExposureMask | KeyPressMask | StructureNotifyMask,
+ };
+ XClassHint ch = {"xitems", "xitems"};
/* XXX take keysyms into account */
while ((linelen = getline(&line, &linesize, stdin)) != -1) {
last = last->next;
} while (last != first);
- win = XCreateSimpleWindow(dpy, RootWindow(dpy, screen), 0, 0, width,
- nitems*height + VPAD, 1, BlackPixel(dpy, screen),
- WhitePixel(dpy, screen));
+ swa.background_pixel = WhitePixel(dpy, screen);
+ win = XCreateWindow(dpy, RootWindow(dpy, screen), 0, 0,
+ width, nitems*height + VPAD, 1, CopyFromParent, CopyFromParent,
+ CopyFromParent, CWOverrideRedirect | CWBackPixel | CWEventMask,
+ &swa);
+ XSetClassHint(dpy, win, &ch);
gc_sel = XCreateGC(dpy, win, 0, &values);
gc_norm = XCreateGC(dpy, win, 0, &values);
XSetForeground(dpy, gc_sel, WhitePixel(dpy, screen));
XSetForeground(dpy, gc_norm, BlackPixel(dpy, screen));
+ if (XGrabKeyboard(dpy, RootWindow(dpy, screen), True, GrabModeAsync,
+ GrabModeAsync, CurrentTime) != GrabSuccess)
+ errx(1, "cannot grab keyboard");
+
XMapRaised(dpy, win);
- XSelectInput(dpy, win, ExposureMask | KeyPressMask |
- StructureNotifyMask);
for (;;) {
XKeyEvent ke;