commit c85d4bf338efd6371825dfe51680c62ee65be408 from: Omar Polo date: Thu Oct 08 07:38:15 2020 UTC make grabkey accept the target window as parameter This is needed so we can later grabkey on particular window and not on the root one. commit - c7063e0ecdd508cad67bdb8d072630315fbac265 commit + c85d4bf338efd6371825dfe51680c62ee65be408 blob - 9e75a59c549998c166ff62b57ac5a26638f133f3 blob + 1bfeb83ff93c564131f3b33e7cced7fa172bd3c6 --- star-platinum.c +++ star-platinum.c @@ -185,7 +185,7 @@ main(int argc, char **argv) /* grab all the keys */ for (g = config; g != NULL; g = g->next) for (r = g->rules; r != NULL; r = r->next) - grabkey(r->key); + grabkey(r->key, root); XSelectInput(d, root, KeyPressMask); XFlush(d); @@ -223,19 +223,16 @@ error_handler(Display *d, XErrorEvent *e) /* TODO: it should grab ALL POSSIBLE COMBINATIONS of `ignored_modifiers`! */ void -grabkey(struct key k) +grabkey(struct key k, Window w) { static size_t len = sizeof(ignored_modifiers)/sizeof(int); size_t i; - Window root; - root = DefaultRootWindow(d); - /* printf("Grabbing "); printkey(k); printf("\n"); */ for (i = 0; i < len; ++i) { XGrabKey(d, XKeysymToKeycode(d, k.key), k.modifier | ignored_modifiers[i], - root, False, GrabModeAsync, GrabModeAsync); + w, False, GrabModeAsync, GrabModeAsync); } } blob - 83905bdcc9785249932bafd61fc815e1e9a09cc6 blob + 96277b5de8bfaf10a929c1180880cf9968434770 --- star-platinum.h +++ star-platinum.h @@ -90,7 +90,7 @@ int group_match(struct group*, Window); /* xlib-related */ int error_handler(Display*, XErrorEvent*); -void grabkey(struct key); +void grabkey(struct key, Window); KeySym keycode_to_keysym(unsigned int); Window focused_window(); void send_fake(Window, struct key, XKeyEvent*);