Implement better mouse capturing #91
Labels
high-level concept
pre-alpha grind
Pre-alpha MVP task: tasks used as rough indication of what needs to be done to get out of pre-alpha
The current implementation uses the standard pointer API. This is problematic because pressing Escape locks the player out of being able to relock the mouse for 2 seconds (even being triggered by a manual keypress isn't good enough for the browser engine).
There is a hack solution to dealing with the problem: implement an OS-wide NW.js shortcut key which is just
Escape
. On blur, deactivate the shortcut so we don't wreck user experience when alt-tabbed. On focus, reactivate shortcut. This allows us to hide thatEscape
was pressed from the browser engine.The 'shortcut' needs to be deactivated prior to window reload in dev mode as the application loses knowledge that it has a shortcut assigned, and then loses control of
Escape
overrides.Example snippets
Task
Use above snippets to forcibly grab
Escape
appropriately. We should can overridenw.Window.get().reload()
andchrome.tabs.reload()
to produce a seamless experience in the early-load polyfill bits that don't work with the usual engine lifecycles.An additional thing we should probably try do is keep track of whether of not the app has focus so that we can check a flag at any stage. This is because the application currently forcibly uses
nw.Window.get().focus
to ensure initial focus, which causes the mouse to freak out on Windows in some cases.The text was updated successfully, but these errors were encountered: