docs: update

This commit is contained in:
Dylan Araps 2019-10-13 18:37:44 +03:00
parent 121f17d632
commit c027e8912b

29
sowm.c
View File

@ -124,22 +124,19 @@ void key_grab() {
} }
void key_press(XEvent *e) { void key_press(XEvent *e) {
XKeyEvent ke = e->xkey; KeySym keysym = XKeycodeToKeysym(dis, e->xkey.keycode, 0);
KeySym keysym = XKeycodeToKeysym(dis,ke.keycode,0);
for (int i=0; i < sizeof(keys)/sizeof(*keys); ++i) for (int i=0; i < sizeof(keys)/sizeof(*keys); ++i)
if (keys[i].keysym == keysym && keys[i].mod == ke.state) if (keys[i].keysym == keysym && keys[i].mod == e->xkey.state)
keys[i].function(keys[i].arg); keys[i].function(keys[i].arg);
} }
void button_press(XEvent *e) { void button_press(XEvent *e) {
XButtonEvent bu = e->xbutton; if (e->xbutton.subwindow == None) return;
if (bu.subwindow != None) { XGetWindowAttributes(dis, e->xbutton.subwindow, &attr);
XGetWindowAttributes(dis, bu.subwindow, &attr); XRaiseWindow(dis, e->xbutton.subwindow);
XRaiseWindow(dis, bu.subwindow); start = e->xbutton;
start = bu;
}
} }
void button_release() { void button_release() {
@ -316,14 +313,14 @@ void configure_request(XEvent *e) {
} }
void map_request(XEvent *e) { void map_request(XEvent *e) {
XMapRequestEvent *ev = &e->xmaprequest; Window w = e->xmaprequest.window;
XSelectInput(dis, ev->window, PropertyChangeMask|StructureNotifyMask| XSelectInput(dis, w, PropertyChangeMask|StructureNotifyMask|
EnterWindowMask|FocusChangeMask); EnterWindowMask|FocusChangeMask);
win_center(ev->window); win_center(w);
XMapWindow(dis, ev->window); XMapWindow(dis, w);
FOC(ev->window); FOC(w);
win_add(ev->window); win_add(w);
} }
void run(const Arg arg) { void run(const Arg arg) {