W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2011

Re: Mouse Lock

From: Robert O'Callahan <robert@ocallahan.org>
Date: Thu, 11 Aug 2011 13:08:19 +1200
Message-ID: <CAOp6jLY83niW8jDTByZMLjxir6t1FtzZ==8gVubQopCYEughjA@mail.gmail.com>
To: Vincent Scheib <scheib@google.com>
Cc: Brandon Andrews <warcraftthreeft@sbcglobal.net>, Olli@pettay.fi, "Tab Atkins Jr." <jackalmage@gmail.com>, Ryosuke Niwa <rniwa@webkit.org>, Adam Barth <w3c@adambarth.com>, "Gregg Tavares (wrk)" <gman@google.com>, Glenn Maynard <glenn@zewt.org>, Charles Pritchard <chuck@jumis.com>, Kenneth Russell <kbr@google.com>, public-webapps@w3.org
A few comments:

Is there a need to provide mouse-locking on a per-element basis? It seems to
me it would be enough for mouse-locking to be per-DOM-window (or
per-DOM-document) and deliver events to the focused element. This simplifies
the model a little bit by not having to define new state for the
"mouse-locked element". Or is there a need for mouse-lock motion events to
go to one element while keyboard input goes elsewhere?

As was suggested earlier in this thread, I think given we're not displaying
the normal mouse cursor and in fact warping the system mouse cursor to the
center of the screen in some implementations, we shouldn't deliver normal
mouse-move events. Instead, while mouselock is active, we should deliver a
new kind of mouse motion event, which carries the delta properties. If you
do that, then hopefully you don't need a failure or success callback. Your
app should just be able to handle both kinds of mouse motion events.

I'm not really sure how touch events fit into this. Unlike mouse events,
touch events always correspond to a position on the screen, so the delta
information isn't as useful. (Or do some platforms detect touches outside
the screen?) Maybe the only thing you need to do for touch events is to
capture them to the focused element.

In many of your use cases, it's OK to automatically release the mouse-lock
on mouse-up. If you automatically release on mouse-up, the security issues
are far less serious. So I think it would be a good idea to allow
applications to accept that behavior via the API.

A lot of this would be much simpler if we could somehow get mouse delta
information from all platforms (Windows!) without having to warp the cursor
:-(. Has research definitively ruled out achieving that by any combination
of hacks?

Rob
-- 
"If we claim to be without sin, we deceive ourselves and the truth is not in
us. If we confess our sins, he is faithful and just and will forgive us our
sins and purify us from all unrighteousness. If we claim we have not sinned,
we make him out to be a liar and his word is not in us." [1 John 1:8-10]
Received on Thursday, 11 August 2011 01:08:46 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:47 GMT