From a6cd981b4675fd78e47367e18387084a17e3b778 Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Fri, 23 Apr 2021 12:32:02 -0500 Subject: [PATCH] This animates the window, but it's weird We've got to do a SW_HIDE first if we want the window to appear. That causes the taskbar icon to flash if we're already open. Then, the border is visible always. That's certainly a little weird. It also doesn't work with restoring from minimized, but I haven't played with that much. It _feels_ like a hack, so I don't want to ship this. I'm gonna have to see if the win32 programming discussion alias has ideas. --- src/cascadia/WindowsTerminal/IslandWindow.cpp | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/cascadia/WindowsTerminal/IslandWindow.cpp b/src/cascadia/WindowsTerminal/IslandWindow.cpp index 1c959185830..56f5104713a 100644 --- a/src/cascadia/WindowsTerminal/IslandWindow.cpp +++ b/src/cascadia/WindowsTerminal/IslandWindow.cpp @@ -981,7 +981,15 @@ winrt::fire_and_forget IslandWindow::SummonWindow() // restore-down the window. if (IsIconic(_window.get())) { - LOG_IF_WIN32_BOOL_FALSE(ShowWindow(_window.get(), SW_RESTORE)); + // LOG_IF_WIN32_BOOL_FALSE(ShowWindow(_window.get(), SW_RESTORE)); + + // auto success = AnimateWindow(_window.get(), 200, AW_SLIDE | AW_VER_POSITIVE); + // auto success = AnimateWindow(_window.get(), 200, AW_ACTIVATE | AW_SLIDE | AW_VER_POSITIVE); + // if (!success) + // { + // auto gle = GetLastError(); + // gle; + // } } const DWORD windowThreadProcessId = GetWindowThreadProcessId(GetForegroundWindow(), nullptr); const DWORD currentThreadId = GetCurrentThreadId(); @@ -992,11 +1000,22 @@ winrt::fire_and_forget IslandWindow::SummonWindow() LOG_IF_WIN32_BOOL_FALSE(AttachThreadInput(windowThreadProcessId, currentThreadId, false)); }); LOG_IF_WIN32_BOOL_FALSE(BringWindowToTop(_window.get())); - LOG_IF_WIN32_BOOL_FALSE(ShowWindow(_window.get(), SW_SHOW)); - - // Activate the window too. This will force us to the virtual desktop this - // window is on, if it's on another virtual desktop. - LOG_LAST_ERROR_IF_NULL(SetActiveWindow(_window.get())); + // LOG_IF_WIN32_BOOL_FALSE(ShowWindow(_window.get(), SW_SHOW)); + LOG_IF_WIN32_BOOL_FALSE(ShowWindow(_window.get(), SW_HIDE)); + + // // Activate the window too. This will force us to the virtual desktop this + // // window is on, if it's on another virtual desktop. + // LOG_LAST_ERROR_IF_NULL(SetActiveWindow(_window.get())); + // AnimateWindow(_window.get(), 200, AW_ACTIVATE | AW_SLIDE | AW_VER_POSITIVE); + // LOG_IF_WIN32_BOOL_FALSE(AnimateWindow(_window.get(), 200, AW_ACTIVATE | AW_SLIDE | AW_VER_POSITIVE)); + // auto success = AnimateWindow(_window.get(), 200, AW_SLIDE | AW_VER_POSITIVE); + auto success = AnimateWindow(_window.get(), 200, AW_SLIDE | AW_VER_POSITIVE); + // auto success = AnimateWindow(_window.get(), 200, AW_BLEND); // Hey this actually worked with a SW_HIDE right before it + if (!success) + { + auto gle = GetLastError(); + gle; + } } DEFINE_EVENT(IslandWindow, DragRegionClicked, _DragRegionClickedHandlers, winrt::delegate<>);