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]