Hi, A while ago dwm started requesting MotionNotify events from the X server (that wasn't always the case). This was added when focus-follows-mouse was implemented for monitors (in addition to windows) in 2011 by commit b5068e32e9.
This causes lots of useless communication between the X server and dwm every time the mouse pointer is moved, even when nothing could possibly change as a result (e.g. if Xinerama is not compiled in, or only one monitor is present). On my system, the resulting syscalls-per-second count in dwm is about 490, if the mouse if moved continuously. The following patch fixes the issue in the minimal way only when Xinerama support is not enabled at all. I'd find it worthwhile to fix this under Xinerama too. To outline a partial solution for one-monitor-connected case, moving XSelectInput to updategeom will allow to request MotionNotify events only when monitor count is 2 or more. I don't have a patch for this yet, but I'll be happy to create one if desired. For multiple-monitors case, it should be possible to avoid MotionNotify events too, by creating InputOnly subwindows of the root window corresponding to monitor boundaries, and using EnterNotify events on those to trigger monitor focus changes. I'm not really familiar with Xlib, so I haven't worked out the details here, but if there's interest in this solution I can look into it. Thanks. Alexander diff --git a/dwm.c b/dwm.c index b2bc9bd..304d53b 100644 --- a/dwm.c +++ b/dwm.c @@ -1594,8 +1594,11 @@ setup(void) XDeleteProperty(dpy, root, netatom[NetClientList]); /* select for events */ wa.cursor = cursor[CurNormal]->cursor; - wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask|PointerMotionMask + wa.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask |EnterWindowMask|LeaveWindowMask|StructureNotifyMask|PropertyChangeMask; +#ifdef XINERAMA + wa.event_mask |= PointerMotionMask; +#endif XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa); XSelectInput(dpy, root, wa.event_mask); grabkeys();