Re: Mouse Lock

On Wed, Jun 22, 2011 at 5:20 AM, Simon Pieters <> wrote:

> On Tue, 21 Jun 2011 00:43:52 +0200, Aryeh Gregor <>
> wrote:
>> There's a middle ground here: you can lock the mouse to the window,
>> but not completely.  That is, if the user moves the mouse to the edge,
>> it remains inside, but if they move it fast enough it escapes.  This
>> is enough to stop the window from accidentally losing focus when
>> you're trying to click on something near the edge of the screen, but
>> it lets you easily get outside the window if you actually want to.
>> IIRC, Wine does this in windowed mode.  Of course, it might not be
>> suitable for games that want to hide the cursor, like FPSes, but it
>> might be a possible fallback if the browser doesn't trust the site
>> enough for whatever reason to let it fully lock the mouse.
> This seems weird. When would you use this middle ground? Would users
> understand it? Also, as you say, totally inappropriate for FPS games.

I'd find it annoying to be forced to slow my mouse movements due to mouse
speed having extra, unusual meanings.  I'd suspect accessibility problems
with requiring "move the mouse fast" as a user input, too.

Also, isn't the entire point of mouse lock mouse-delta-based applications,
where there is no mouse pointer?  There's no "moving the mouse to the edge"
when there's no pointer.  I don't think "walling the mouse pointer into a
rectangle" is useful--I can't think of having ever seeing a native Windows
application do that--it'd be very annoying, so I'd remember--and I can't
think of any use cases.

Unrelated, another detail: if most implementations are going to need to warp
the mouse cursor to do this, the other mouse event coordinates should always
be 0 (or null).  Otherwise, implementations on platforms which don't need to
warp the cursor may still fill these in, causing incompatibilities.  Events
like mouseover should probably be suppressed, too.  At that point, it's
probably cleaner to stop firing *all* mouse movement events entirely, as if
the mouse isn't moving, and to use a separate "mousedelta" event when locked
which only has "deltaX" and "deltaY".

Glenn Maynard

Received on Wednesday, 22 June 2011 09:54:38 UTC