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.
This commit is contained in:
Mike Griese
2021-04-23 12:32:02 -05:00
parent 045a8db5e1
commit a6cd981b46

View File

@@ -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));
// 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()));
// // 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<>);