mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-30 17:39:07 +08:00
FZ: ZoneWindowDrawing is now properly initialized (#8836)
This commit is contained in:
parent
8b8f87c7e8
commit
4aecabae47
@ -140,8 +140,7 @@ bool ZoneWindow::Init(IZoneWindowHost* host, HINSTANCE hinstance, HMONITOR monit
|
|||||||
}
|
}
|
||||||
|
|
||||||
MakeWindowTransparent(m_window.get());
|
MakeWindowTransparent(m_window.get());
|
||||||
// Call ShowWindow(m_window.get(), SW_SHOWNORMAL) here so we can call ShowWindow(m_window.get(), SW_SHOWNA) later
|
// According to ShowWindow docs, we must call it with SW_SHOWNORMAL the first time
|
||||||
// without causing the unexpected behaviour reported in https://github.com/microsoft/PowerToys/issues/8808
|
|
||||||
ShowWindow(m_window.get(), SW_SHOWNORMAL);
|
ShowWindow(m_window.get(), SW_SHOWNORMAL);
|
||||||
ShowWindow(m_window.get(), SW_HIDE);
|
ShowWindow(m_window.get(), SW_HIDE);
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <common/logger/logger.h>
|
||||||
|
|
||||||
namespace NonLocalizable
|
namespace NonLocalizable
|
||||||
{
|
{
|
||||||
const wchar_t SegoeUiFont[] = L"Segoe ui";
|
const wchar_t SegoeUiFont[] = L"Segoe ui";
|
||||||
@ -74,7 +76,7 @@ ZoneWindowDrawing::ZoneWindowDrawing(HWND window)
|
|||||||
// Obtain the size of the drawing area.
|
// Obtain the size of the drawing area.
|
||||||
if (!GetClientRect(window, &m_clientRect))
|
if (!GetClientRect(window, &m_clientRect))
|
||||||
{
|
{
|
||||||
// TODO: Log failures and errors using spdlog
|
Logger::error("couldn't initialize ZoneWindowDrawing: GetClientRect failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,6 +95,7 @@ ZoneWindowDrawing::ZoneWindowDrawing(HWND window)
|
|||||||
|
|
||||||
if (!SUCCEEDED(hr))
|
if (!SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
|
Logger::error("couldn't initialize ZoneWindowDrawing: CreateHwndRenderTarget failed with {}", hr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,9 +28,9 @@ class ZoneWindowDrawing
|
|||||||
unsigned duration;
|
unsigned duration;
|
||||||
};
|
};
|
||||||
|
|
||||||
HWND m_window;
|
HWND m_window = nullptr;
|
||||||
RECT m_clientRect;
|
RECT m_clientRect{};
|
||||||
ID2D1HwndRenderTarget* m_renderTarget;
|
ID2D1HwndRenderTarget* m_renderTarget = nullptr;
|
||||||
std::optional<AnimationInfo> m_animation;
|
std::optional<AnimationInfo> m_animation;
|
||||||
|
|
||||||
std::mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
@ -43,9 +43,9 @@ class ZoneWindowDrawing
|
|||||||
static D2D1_RECT_F ConvertRect(RECT rect);
|
static D2D1_RECT_F ConvertRect(RECT rect);
|
||||||
void Render();
|
void Render();
|
||||||
|
|
||||||
std::atomic<bool> m_shouldRender;
|
std::atomic<bool> m_shouldRender = false;
|
||||||
std::atomic<bool> m_abortThread;
|
std::atomic<bool> m_abortThread = false;
|
||||||
std::atomic<bool> m_lowLatencyLock;
|
std::atomic<bool> m_lowLatencyLock = false;
|
||||||
std::condition_variable m_cv;
|
std::condition_variable m_cv;
|
||||||
std::thread m_renderThread;
|
std::thread m_renderThread;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user