diff --git a/src/cascadia/WindowsTerminal/IslandWindow.cpp b/src/cascadia/WindowsTerminal/IslandWindow.cpp index 2bfe9d1dd96..e0b13ded48f 100644 --- a/src/cascadia/WindowsTerminal/IslandWindow.cpp +++ b/src/cascadia/WindowsTerminal/IslandWindow.cpp @@ -510,6 +510,15 @@ long IslandWindow::_calculateTotalSize(const bool isWidth, const long clientSize _HandleCreateWindow(wparam, lparam); return 0; } + case WM_ENABLE: + { + if (_interopWindowHandle != nullptr) + { + // send focus to the child window + SetFocus(_interopWindowHandle); + } + break; + } case WM_SETFOCUS: { if (_interopWindowHandle != nullptr) diff --git a/src/interactivity/base/InteractivityFactory.cpp b/src/interactivity/base/InteractivityFactory.cpp index 0af2cb76d11..862b4db514d 100644 --- a/src/interactivity/base/InteractivityFactory.cpp +++ b/src/interactivity/base/InteractivityFactory.cpp @@ -463,6 +463,7 @@ using namespace Microsoft::Console::Interactivity; { _WritePseudoWindowCallback((bool)wParam); } + return 0; } case WM_GETOBJECT: { @@ -476,6 +477,15 @@ using namespace Microsoft::Console::Interactivity; } return 0; } + case WM_ACTIVATE: + { + if (const auto ownerHwnd{ ::GetAncestor(hWnd, GA_ROOTOWNER) }) + { + SetFocus(ownerHwnd); + return 0; + } + break; + } } // If we get this far, call the default window proc return DefWindowProcW(hWnd, Message, wParam, lParam);