diff options
Diffstat (limited to 'dwm.c')
| -rw-r--r-- | dwm.c | 22 |
1 files changed, 19 insertions, 3 deletions
| @@ -200,6 +200,7 @@ static void manage(Window w, XWindowAttributes *wa); | |||
| 200 | static void mappingnotify(XEvent *e); | 200 | static void mappingnotify(XEvent *e); |
| 201 | static void maprequest(XEvent *e); | 201 | static void maprequest(XEvent *e); |
| 202 | static void monocle(Monitor *m); | 202 | static void monocle(Monitor *m); |
| 203 | static void motionnotify(XEvent *e); | ||
| 203 | static void movemouse(const Arg *arg); | 204 | static void movemouse(const Arg *arg); |
| 204 | static Client *nexttiled(Client *c); | 205 | static Client *nexttiled(Client *c); |
| 205 | static void pop(Client *); | 206 | static void pop(Client *); |
| @@ -271,6 +272,7 @@ static void (*handler[LASTEvent]) (XEvent *) = { | |||
| 271 | [KeyPress] = keypress, | 272 | [KeyPress] = keypress, |
| 272 | [MappingNotify] = mappingnotify, | 273 | [MappingNotify] = mappingnotify, |
| 273 | [MapRequest] = maprequest, | 274 | [MapRequest] = maprequest, |
| 275 | [MotionNotify] = motionnotify, | ||
| 274 | [PropertyNotify] = propertynotify, | 276 | [PropertyNotify] = propertynotify, |
| 275 | [UnmapNotify] = unmapnotify | 277 | [UnmapNotify] = unmapnotify |
| 276 | }; | 278 | }; |
| @@ -1202,6 +1204,21 @@ monocle(Monitor *m) { | |||
| 1202 | } | 1204 | } |
| 1203 | 1205 | ||
| 1204 | void | 1206 | void |
| 1207 | motionnotify(XEvent *e) { | ||
| 1208 | static Monitor *mon = NULL; | ||
| 1209 | Monitor *m; | ||
| 1210 | XMotionEvent *ev = &e->xmotion; | ||
| 1211 | |||
| 1212 | if(ev->window != root) | ||
| 1213 | return; | ||
| 1214 | if((m = recttomon(ev->x_root, ev->y_root, 1, 1)) != mon && mon) { | ||
| 1215 | selmon = m; | ||
| 1216 | focus(NULL); | ||
| 1217 | } | ||
| 1218 | mon = m; | ||
| 1219 | } | ||
| 1220 | |||
| 1221 | void | ||
| 1205 | movemouse(const Arg *arg) { | 1222 | movemouse(const Arg *arg) { |
| 1206 | int x, y, ocx, ocy, nx, ny; | 1223 | int x, y, ocx, ocy, nx, ny; |
| 1207 | Client *c; | 1224 | Client *c; |
| @@ -1614,9 +1631,8 @@ setup(void) { | |||
| 1614 | PropModeReplace, (unsigned char *) netatom, NetLast); | 1631 | PropModeReplace, (unsigned char *) netatom, NetLast); |
| 1615 | /* select for events */ | 1632 | /* select for events */ |
| 1616 | wa.cursor = cursor[CurNormal]; | 1633 | wa.cursor = cursor[CurNormal]; |
| 1617 | wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask | 1634 | wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask|PointerMotionMask |
| 1618 | |EnterWindowMask|LeaveWindowMask|StructureNotifyMask | 1635 | |EnterWindowMask|LeaveWindowMask|StructureNotifyMask|PropertyChangeMask; |
| 1619 | |PropertyChangeMask; | ||
| 1620 | XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa); | 1636 | XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa); |
| 1621 | XSelectInput(dpy, root, wa.event_mask); | 1637 | XSelectInput(dpy, root, wa.event_mask); |
| 1622 | grabkeys(); | 1638 | grabkeys(); |
