fix: 修复特殊情况下背景绘制不正确的问题

This commit is contained in:
刘旭 2022-06-03 22:47:04 +08:00
commit 95aeb6691c
10 changed files with 97 additions and 24 deletions

View file

@ -8,6 +8,7 @@
using namespace winrt;
using namespace Windows::Foundation;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Media;
@ -54,7 +55,25 @@ void App::OnClose() {
bool App::Initialize(Magpie::Settings settings, uint64_t hwndHost) {
_settings = settings;
_hwndHost = hwndHost;
_isHostWndFocused = GetForegroundWindow() == (HWND)hwndHost;
return true;
}
event_token App::HostWndFocusChanged(EventHandler<bool> const& handler) {
return _hostWndFocusChangedEvent.add(handler);
}
void App::HostWndFocusChanged(event_token const& token) noexcept {
_hostWndFocusChangedEvent.remove(token);
}
void App::OnHostWndFocusChanged(bool isFocused) {
if (isFocused == _isHostWndFocused) {
return;
}
_isHostWndFocused = isFocused;
_hostWndFocusChangedEvent(*this, isFocused);
}
}