add sloppy monitor focus
This commit is contained in:
parent
f099d2d5b5
commit
b5068e32e9
22
dwm.c
22
dwm.c
@ -200,6 +200,7 @@ static void manage(Window w, XWindowAttributes *wa);
|
|||||||
static void mappingnotify(XEvent *e);
|
static void mappingnotify(XEvent *e);
|
||||||
static void maprequest(XEvent *e);
|
static void maprequest(XEvent *e);
|
||||||
static void monocle(Monitor *m);
|
static void monocle(Monitor *m);
|
||||||
|
static void motionnotify(XEvent *e);
|
||||||
static void movemouse(const Arg *arg);
|
static void movemouse(const Arg *arg);
|
||||||
static Client *nexttiled(Client *c);
|
static Client *nexttiled(Client *c);
|
||||||
static void pop(Client *);
|
static void pop(Client *);
|
||||||
@ -271,6 +272,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
|
|||||||
[KeyPress] = keypress,
|
[KeyPress] = keypress,
|
||||||
[MappingNotify] = mappingnotify,
|
[MappingNotify] = mappingnotify,
|
||||||
[MapRequest] = maprequest,
|
[MapRequest] = maprequest,
|
||||||
|
[MotionNotify] = motionnotify,
|
||||||
[PropertyNotify] = propertynotify,
|
[PropertyNotify] = propertynotify,
|
||||||
[UnmapNotify] = unmapnotify
|
[UnmapNotify] = unmapnotify
|
||||||
};
|
};
|
||||||
@ -1201,6 +1203,21 @@ monocle(Monitor *m) {
|
|||||||
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, False);
|
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
motionnotify(XEvent *e) {
|
||||||
|
static Monitor *mon = NULL;
|
||||||
|
Monitor *m;
|
||||||
|
XMotionEvent *ev = &e->xmotion;
|
||||||
|
|
||||||
|
if(ev->window != root)
|
||||||
|
return;
|
||||||
|
if((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) {
|
||||||
|
selmon = m;
|
||||||
|
focus(NULL);
|
||||||
|
}
|
||||||
|
mon = m;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
movemouse(const Arg *arg) {
|
movemouse(const Arg *arg) {
|
||||||
int x, y, ocx, ocy, nx, ny;
|
int x, y, ocx, ocy, nx, ny;
|
||||||
@ -1614,9 +1631,8 @@ setup(void) {
|
|||||||
PropModeReplace, (unsigned char *) netatom, NetLast);
|
PropModeReplace, (unsigned char *) netatom, NetLast);
|
||||||
/* select for events */
|
/* select for events */
|
||||||
wa.cursor = cursor[CurNormal];
|
wa.cursor = cursor[CurNormal];
|
||||||
wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask
|
wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask|PointerMotionMask
|
||||||
|EnterWindowMask|LeaveWindowMask|StructureNotifyMask
|
|EnterWindowMask|LeaveWindowMask|StructureNotifyMask|PropertyChangeMask;
|
||||||
|PropertyChangeMask;
|
|
||||||
XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
|
XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa);
|
||||||
XSelectInput(dpy, root, wa.event_mask);
|
XSelectInput(dpy, root, wa.event_mask);
|
||||||
grabkeys();
|
grabkeys();
|
||||||
|
Loading…
Reference in New Issue
Block a user