fix(windows): stop taskbar icon flashing on minimize after playback

This commit is contained in:
edde746
2026-05-30 03:01:48 +02:00
parent 7cac050500
commit a4f0b92b4e
+11 -1
View File
@@ -67,7 +67,17 @@ MpvContainer::WindowProc(HWND const window, UINT const message, WPARAM const wpa
// Redirect focus to Flutter window.
auto user_data = ::GetWindowLongPtr(window, GWLP_USERDATA);
if (user_data) {
::SetForegroundWindow(reinterpret_cast<HWND>(user_data));
HWND flutter_window = reinterpret_cast<HWND>(user_data);
// Don't try to foreground a minimized window (Windows refuses and flashes
// the taskbar button instead), and don't steal foreground from another
// application. Only redirect focus when our own window already owns the
// foreground.
if (!::IsIconic(flutter_window)) {
HWND foreground = ::GetForegroundWindow();
if (foreground == flutter_window || foreground == window) {
::SetForegroundWindow(flutter_window);
}
}
}
break;
}