Changes

Jump to: navigation, search

Implementing the Mouse Lock API in Firefox

353 bytes removed, 22:28, 23 November 2011
High-Level Mouse Lock Implementation Tasks
This list is incomplete, and needs more detail added as the following bits are completed.
# <s>No mouse cursor is displayed when the mouse is locked</s> - rhung## Completed# <s>MouseLockable DOM Implementation, navigator.pointer ([[Notes on MouseLock DOM Implementation Nov 13, 2011]])</s> - humph
## [[void lock (in Element target, optional in VoidCallback successCallback, optional in VoidCallback failureCallback);]]
### Callback implementation
## void unlock ();
### Needs to reset the mouse position back to the original position
## bool islocked ();### Completed- humph
# Mouse Lock Platform Implementations
## Windows: [http://msdn.microsoft.com/en-us/library/windows/desktop/ms648394%28v=vs.85%29.aspx SetCursorPos(x, y)]
## Linux (GTK) [http://www.gtkforums.com/viewtopic.php?t=182 gdk_display_warp_pointer (display, screen, x, y)], add to http://mxr.mozilla.org/mozilla-central/source/widget/src/gtk2/nsWindow.cpp ???
## Mobile?
# <s>mouselocklost event DOM Implementation</s> - diogogmt## Completed# <s>Extend MouseEvent DOM implementation with movementX, movementY</s> - humph, JSilver999## <s>[[Stack Trace for nsDOMMouseEvent::nsDOMMouseEvent ctor]] (created on mouse move)</s>## <s>[[Stack Trace for nsDOMMouseEvent::GetScreenX]]</s>## <s>[[Where to store the state info (e.g., previous position) between mouse events?]]</s>## Completed# <s>The browser must exit the mouse lock state if the user agent, window, or tab loses focus## Completed </s> - Full screen is lost during the above action, losing full screen automatically triggers the mouselock's unlock()diogogmt# The ESC key should exit mouse lock## Completed - Same as abovediogogmt# Mouse lock should only work when in Full Screen Mode## Completed- diogogmt, rhung
# [[Refactor nsIDOMNavigator changes for pointer attribute to be in separate interface]]
# Do we need to add a user pref to enable/disable mouse lock?
# Do we need to do conditional compilation for mouse lock?
# When mouse lock is enabled clientX, clientY, screenX, and screenY must hold constant values as if the mouse did not move at all once mouse lock was entered.
## Needs work - Feel free to work on this one!
# Freeze mouse pointer in centre of window when mouse lock is enabled (e.g., moving the mouse causes an event, but forces the mouse to go back to the original position).
## Almost complete - Awaiting patch
# Proper IDL documentation for navigator.pointer (see example in https://mxr.mozilla.org/mozilla-central/source/dom/interfaces/html/nsIDOMHTMLElement.idl#103), MouseLockable and its methods, MouseLockLost event, etc.
## Needs work - Feel free to work on this one!
# Write a JavaScript library to somehow combine element.mozRequestFullScreen() and navigator.pointer.lock(). It would be good to hide the complexities of doing fullscreen then locking in a single API call.
## Needs work - Feel free to work on this one!
# Convert Rescue Fox to use Mouse Lock, see https://github.com/mozilla/rescuefox
## Needs work - Feel free to work on this one!
# Convert http://cjcliffe.github.com/CubicVR.js/cubicvr/samples/fps_demo/level1.html to use Mouse Lock
## Needs work - Feel free to work on this one!
# Tests, tests, tests. We need tests for all aspects of the spec. List tests we need below:
## Check the mouse cursor during mouse lock and after mouse lock. (Needs content scripts?)
## <test cases go here...>
# Create a tutorial on how to use Mouse Lock, with code examples
## Needs work Add demo pages to gh- Feel free to work on this one!pages branch
==Resources==
1
edit

Navigation menu