You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use em-dosbox in a situation where I want to be able to manually enable or disable pointerlock when a system is in use. I'm embedding this into another app which has its own pointerlock handling, so I'd like to only lock to the em-dosbox canvas element when it's been clicked directly, or focused in code.
It seems that as it is now, either em-dosbox or emscripten itself is calling emscripten_request_pointerlock() in response to keydown events, regardless of what I try to do to restrict mouse capture.
if (eventType == EMSCRIPTEN_EVENT_POINTERLOCKCHANGE) {
if ((!keyEvent->isActive && sdl.mouse.locked) ||
(keyEvent->isActive && !sdl.mouse.locked)) {
doGFX_CaptureMouse();
}
}
returnfalse;
}
is causing issues, for example, if I already have the pointer locked when the emscripten module boots, when I exit from my own app's pointerlock, maybe this is triggering?
The other place that looks suspicious is Emscripten's deferred fullscreen/pointerlock requesting code, https://github.com/kripken/emscripten/blob/master/src/library_html5.js#L69-L97 - this queues up any requests to requestPointerLock() which may have happened and forces them to be executed on a qualifying user interaction event. So it's possible some code somewhere is requesting pointerlock and it's not being applied until I start trying to press keys (in this case, WASD to move around my virtual world)
Any hints on how to disable the built-in pointerlock logic and handle it myself?
The text was updated successfully, but these errors were encountered:
I can't reproduce this. I can click, get pointer lock, break it with the escape key or with setTimeout(function(){ document.exitPointerLock(); }, 3000); and then press keys without re-establishing pointer lock.
After looking at my code I do have some doubts about GFX_CaptureMouse() correctness. It may have some unexpected side effects via SDL calls in doGFX_CaptureMouse() or due to differences between sdl.mouse.locked and the real mouse capture state. Though there's nothing trying to capture the mouse in response to keyboard key events.
I guess what you describe might be happening due to focus changes? I'm just guessing because I can't reproduce this.
Hmm. I'll play around with it and see if it's something the loader or something else on my end is doing, I'll set up a simplified test case and let you know.
I'm trying to use em-dosbox in a situation where I want to be able to manually enable or disable pointerlock when a system is in use. I'm embedding this into another app which has its own pointerlock handling, so I'd like to only lock to the em-dosbox canvas element when it's been clicked directly, or focused in code.
It seems that as it is now, either em-dosbox or emscripten itself is calling emscripten_request_pointerlock() in response to keydown events, regardless of what I try to do to restrict mouse capture.
Things I've tried so far:
ENV['SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT'] = '#canvas';
Module.elementPointerLock = true
(tried false too, no difference)autolock=false
in the[SDL]
section of dosbox.confI looked into the code to try to trace this, I see two possible places which could be triggering it:
em-dosbox/src/gui/sdlmain.cpp
Lines 1213 to 1225 in 1f46d1d
which is called from several places, but I wonder if
em-dosbox/src/gui/sdlmain.cpp
Lines 1279 to 1289 in 1f46d1d
The other place that looks suspicious is Emscripten's deferred fullscreen/pointerlock requesting code, https://github.com/kripken/emscripten/blob/master/src/library_html5.js#L69-L97 - this queues up any requests to requestPointerLock() which may have happened and forces them to be executed on a qualifying user interaction event. So it's possible some code somewhere is requesting pointerlock and it's not being applied until I start trying to press keys (in this case, WASD to move around my virtual world)
Any hints on how to disable the built-in pointerlock logic and handle it myself?
The text was updated successfully, but these errors were encountered: