aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2020-10-08 09:38:15 +0200
committerOmar Polo <op@omarpolo.com>2020-10-08 09:38:15 +0200
commitc85d4bf338efd6371825dfe51680c62ee65be408 (patch)
tree83fce7f18b156a2e00cff8314d25b1339cdd38e4
parentc7063e0ecdd508cad67bdb8d072630315fbac265 (diff)
downloadstar-platinum-c85d4bf338efd6371825dfe51680c62ee65be408.tar.gz
star-platinum-c85d4bf338efd6371825dfe51680c62ee65be408.tar.bz2
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.
-rw-r--r--star-platinum.c9
-rw-r--r--star-platinum.h2
2 files changed, 4 insertions, 7 deletions
diff --git a/star-platinum.c b/star-platinum.c
index 9e75a59..1bfeb83 100644
--- a/star-platinum.c
+++ b/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);
}
}
diff --git a/star-platinum.h b/star-platinum.h
index 83905bd..96277b5 100644
--- a/star-platinum.h
+++ b/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*);