#include "WindowMessageDispatchHandlers.h" #include "Platform/Win32/EditorWindow.h" #include "WindowMessageHost.h" namespace XCEngine::UI::Editor::Host { bool TryDispatchWindowInputMessage( const WindowMessageDispatchContext& context, UINT message, WPARAM wParam, LPARAM lParam, LRESULT& outResult) { if (TryDispatchWindowPointerMessage(context, message, wParam, lParam, outResult)) { return true; } switch (message) { case WM_SETFOCUS: context.window.SyncInputModifiersFromSystemState(); context.window.QueueWindowFocusEvent(::XCEngine::UI::UIInputEventType::FocusGained); outResult = 0; return true; case WM_KILLFOCUS: context.window.ResetInputModifiers(); context.window.QueueWindowFocusEvent(::XCEngine::UI::UIInputEventType::FocusLost); outResult = 0; return true; case WM_CAPTURECHANGED: if (context.windowHost.OwnsActiveGlobalTabDrag(context.window.GetWindowId()) && reinterpret_cast(lParam) != context.hwnd) { context.windowHost.EndGlobalTabDragSession(); outResult = 0; return true; } if (reinterpret_cast(lParam) != context.hwnd && context.window.HasInteractiveCaptureState()) { context.window.QueueWindowFocusEvent(::XCEngine::UI::UIInputEventType::FocusLost); context.window.ForceClearBorderlessWindowResizeState(); context.window.ClearBorderlessWindowChromeDragRestoreState(); context.window.ClearBorderlessWindowChromeState(); outResult = 0; return true; } if (reinterpret_cast(lParam) != context.hwnd) { context.window.ForceClearBorderlessWindowResizeState(); context.window.ClearBorderlessWindowChromeDragRestoreState(); context.window.ClearBorderlessWindowChromeState(); } return false; case WM_KEYDOWN: case WM_SYSKEYDOWN: if (wParam == VK_F12) { context.window.RequestManualScreenshot(); } context.window.QueueKeyEvent(::XCEngine::UI::UIInputEventType::KeyDown, wParam, lParam); outResult = 0; return true; case WM_KEYUP: case WM_SYSKEYUP: context.window.QueueKeyEvent(::XCEngine::UI::UIInputEventType::KeyUp, wParam, lParam); outResult = 0; return true; case WM_CHAR: context.window.QueueCharacterEvent(wParam, lParam); outResult = 0; return true; default: return false; } } } // namespace XCEngine::UI::Editor::Host