add screen args to grabkeys()

This commit is contained in:
Julien Danjou 2007-09-15 22:45:08 +02:00
parent 5c78f4785f
commit bf4007eef5
3 changed files with 11 additions and 10 deletions

View File

@ -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;

17
event.c
View File

@ -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);
}
}

View File

@ -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 *);