mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0032638: Draw Harness, ViewerTest - HTML input range misbehavior in WebAssembly
ViewerTest_EventManager - added tracking of EMSCRIPTEN_EVENT_FOCUSOUT event. onWasmMouseCallback() has been adjusted to return FALSE for EMSCRIPTEN_EVENT_TARGET_WINDOW target to avoid misbehavior of other HTML controls. WNT_Window::ProcessMessage() now handles WM_SETFOCUS/WM_KILLFOCUS instead of WM_ACTIVATE to track focus changes. AIS_ViewController::ProcessFocus() now redirects to AIS_ViewController::ResetViewInput() on focus loss. This fixes issues when key action (like WASD navigation) keep working even after releasing key if window has been switched.
This commit is contained in:
@@ -243,6 +243,12 @@ bool Wasm_Window::ProcessMessage (Aspect_WindowInputListener& theListener,
|
||||
{
|
||||
return ProcessUiEvent (theListener, theEventType, (const EmscriptenUiEvent* )theEvent);
|
||||
}
|
||||
case EMSCRIPTEN_EVENT_FOCUS:
|
||||
case EMSCRIPTEN_EVENT_FOCUSIN:
|
||||
case EMSCRIPTEN_EVENT_FOCUSOUT:
|
||||
{
|
||||
return ProcessFocusEvent (theListener, theEventType, (const EmscriptenFocusEvent* )theEvent);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
#else
|
||||
@@ -536,6 +542,29 @@ bool Wasm_Window::ProcessUiEvent (Aspect_WindowInputListener& theListener,
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ProcessFocusEvent
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool Wasm_Window::ProcessFocusEvent (Aspect_WindowInputListener& theListener,
|
||||
int theEventType, const EmscriptenFocusEvent* )
|
||||
{
|
||||
bool isActivated = false;
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
if (theEventType != EMSCRIPTEN_EVENT_FOCUS
|
||||
&& theEventType != EMSCRIPTEN_EVENT_FOCUSIN // about to receive focus
|
||||
&& theEventType != EMSCRIPTEN_EVENT_FOCUSOUT)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
isActivated = theEventType == EMSCRIPTEN_EVENT_FOCUS;
|
||||
#else
|
||||
(void )theEventType;
|
||||
#endif
|
||||
theListener.ProcessFocus (isActivated);
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : MouseButtonsFromNative
|
||||
// purpose :
|
||||
|
Reference in New Issue
Block a user