From bf4007eef579576e9e625f3b4fee7951bb8f494d Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sat, 15 Sep 2007 22:45:08 +0200 Subject: [PATCH] add screen args to grabkeys() --- awesome.c | 2 +- event.c | 17 +++++++++-------- event.h | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/awesome.c b/awesome.c index ee158a392..dfe02be1a 100644 --- a/awesome.c +++ b/awesome.c @@ -152,7 +152,7 @@ setup(Display *disp, DC *drawcontext, awesome_config *awesomeconf) wa.cursor = drawcontext->cursor[CurNormal]; XChangeWindowAttributes(disp, DefaultRootWindow(disp), CWEventMask | CWCursor, &wa); XSelectInput(disp, DefaultRootWindow(disp), wa.event_mask); - grabkeys(disp, awesomeconf); + grabkeys(disp, DefaultScreen(disp), awesomeconf); compileregs(awesomeconf->rules, awesomeconf->nrules); /* bar */ drawcontext->h = awesomeconf->statusbar.height = drawcontext->font.height + 2; diff --git a/event.c b/event.c index b1b17ae0c..ad5fdad50 100644 --- a/event.c +++ b/event.c @@ -337,7 +337,7 @@ handle_event_mappingnotify(XEvent * e, awesome_config *awesomeconf) XRefreshKeyboardMapping(ev); if(ev->request == MappingKeyboard) - grabkeys(e->xany.display, awesomeconf); + grabkeys(e->xany.display, DefaultScreen(e->xany.display), awesomeconf); } void @@ -391,7 +391,8 @@ handle_event_unmapnotify(XEvent * e, awesome_config *awesomeconf) Client *c; XUnmapEvent *ev = &e->xunmap; - if((c = getclient(ev->window)) && ev->event == DefaultRootWindow(e->xany.display) && (ev->send_event || !c->unmapped--)) + if((c = getclient(ev->window)) + && ev->event == RootWindow(e->xany.display, c->screen) && (ev->send_event || !c->unmapped--)) unmanage(c, &dc, WithdrawnState, awesomeconf); } @@ -414,19 +415,19 @@ handle_event_randr_screen_change_notify(XEvent *e, } void -grabkeys(Display *disp, awesome_config *awesomeconf) +grabkeys(Display *disp, int screen, awesome_config *awesomeconf) { int i; KeyCode code; - XUngrabKey(disp, AnyKey, AnyModifier, DefaultRootWindow(disp)); + XUngrabKey(disp, AnyKey, AnyModifier, RootWindow(disp, screen)); for(i = 0; i < awesomeconf->nkeys; i++) { code = XKeysymToKeycode(disp, awesomeconf->keys[i].keysym); - XGrabKey(disp, code, awesomeconf->keys[i].mod, DefaultRootWindow(disp), True, GrabModeAsync, GrabModeAsync); - XGrabKey(disp, code, awesomeconf->keys[i].mod | LockMask, DefaultRootWindow(disp), True, GrabModeAsync, GrabModeAsync); - XGrabKey(disp, code, awesomeconf->keys[i].mod | awesomeconf->numlockmask, DefaultRootWindow(disp), True, GrabModeAsync, GrabModeAsync); - XGrabKey(disp, code, awesomeconf->keys[i].mod | awesomeconf->numlockmask | LockMask, DefaultRootWindow(disp), True, + XGrabKey(disp, code, awesomeconf->keys[i].mod, RootWindow(disp, screen), True, GrabModeAsync, GrabModeAsync); + XGrabKey(disp, code, awesomeconf->keys[i].mod | LockMask, RootWindow(disp, screen), True, GrabModeAsync, GrabModeAsync); + XGrabKey(disp, code, awesomeconf->keys[i].mod | awesomeconf->numlockmask, RootWindow(disp, screen), True, GrabModeAsync, GrabModeAsync); + XGrabKey(disp, code, awesomeconf->keys[i].mod | awesomeconf->numlockmask | LockMask, RootWindow(disp, screen), True, GrabModeAsync, GrabModeAsync); } } diff --git a/event.h b/event.h index c1fd1091a..627f4d521 100644 --- a/event.h +++ b/event.h @@ -24,7 +24,7 @@ #include "config.h" -void grabkeys(Display *, awesome_config *); /* grab all keys defined in config */ +void grabkeys(Display *, int, awesome_config *); /* grab all keys defined in config */ void handle_event_buttonpress(XEvent *, awesome_config *); void handle_event_configurerequest(XEvent *, awesome_config *);