An irritating X Windows limitation with wheel mice

November 26, 2006

I use what I call 'lazy focus follows mouse' in my window manager (fvwm2 calls it SloppyFocus): the last window that the mouse touched has focus, but the mouse doesn't have to actually stay inside the window. I like this because it means that I don't have to have the mouse cursor obscuring some of the window contents.

(I am not a fan of click to focus, but that's another entry.)

Unfortunately, this exposes an X limitation in how it handles wheel mice. The problem is in two parts; first, turning the wheel produces mouse button events, and second, X sends mouse button events to the focused window only if the mouse cursor is actually over it. Thus I can't touch a window, move my cursor away, and still use the mouse wheel.

(I believe you would see the same issue with click to focus, although I'm not sure.)

How it should work is that mouse wheel events should be like keyboard events, and thus get delivered to the focused window regardless of where the mouse is. I tend to believe that this is actually how people see the mouse wheel; it's less like clicking a mouse button and more like hitting a key on the keyboard.

This issue is one significant reason that I don't like wheel mice. (Another is that the wheel generally steals the middle mouse button position, so that actually clicking the middle mouse button requires more force and is more error-prone; I use my middle mouse button a lot more than I would use a wheel. I would probably like a three button wheel mouse that put the wheel under my thumb and left the middle mouse button alone, but I have no idea if they make such a thing.)

Comments on this page:

From at 2006-11-27 02:06:37:

I totally disagree with you there. The mouse functions exactly as I would expect it to. Click to focus is really bad, you're right. Scrolling on my desktop (or root window) switches desktops.

By cks at 2006-11-27 11:54:11:

I suppose this is a perception issue. I think of the mouse wheel as doing a keyboard-like job (scroll up/down, for example), so I expect it to behave like the keyboard and affect the currently focused window when the keyboard does. I might feel differently if I had wheel actions bound for the root window, or if I was less attached to being able to park the mouse cursor out of the way.

From at 2006-12-07 17:10:14:

Surprisingly, this is the default behaviour on MS Windows, as I noticed explicitely after you described this.

I prefer the opposite of your preference.

--Sean (formerly of 128.6.229.x)

By cwe at 2016-06-24 12:10:13:

Well, I don't like your idea. For me it's not a problem to move the mouse where I want it to do something - maybe related to larger screen size since you have written this? I mostly use the mousewheel instead a mouse button for change of focus. Does not do any action in most windows (opposed to a click), but changes focus.

Written on 26 November 2006.
« Link: Serif vs. Sans Serif Legibility
Why I don't rip my CDs »

Page tools: View Source, View Normal, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sun Nov 26 23:39:32 2006
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.