mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[FancyZones] Fix deadlocks in ZoneWindowDrawing (#10461)
* Fixed deadlocks in ZoneWindowDrawing Moved all possibly reentrant or blocking calls to ShowWindow out of critical sections. * Initialize bools * Tune flashing visuals * Address PR comments * Use = true; to initialize bools * Remove tracing from GetAnimationAlpha * Use member initialization when constructing AnimationInfo * Refactor rendering * Whitespace * Hide window on render failure
This commit is contained in:
@@ -25,8 +25,14 @@ class ZoneWindowDrawing
|
||||
struct AnimationInfo
|
||||
{
|
||||
std::chrono::steady_clock::time_point tStart;
|
||||
unsigned duration;
|
||||
bool fadeIn;
|
||||
bool autoHide;
|
||||
};
|
||||
|
||||
enum struct RenderResult
|
||||
{
|
||||
Ok,
|
||||
AnimationEnded,
|
||||
Failed,
|
||||
};
|
||||
|
||||
HWND m_window = nullptr;
|
||||
@@ -42,7 +48,7 @@ class ZoneWindowDrawing
|
||||
static IDWriteFactory* GetWriteFactory();
|
||||
static D2D1_COLOR_F ConvertColor(COLORREF color);
|
||||
static D2D1_RECT_F ConvertRect(RECT rect);
|
||||
void Render();
|
||||
RenderResult Render();
|
||||
void RenderLoop();
|
||||
|
||||
std::atomic<bool> m_shouldRender = false;
|
||||
@@ -55,8 +61,8 @@ public:
|
||||
~ZoneWindowDrawing();
|
||||
ZoneWindowDrawing(HWND window);
|
||||
void Hide();
|
||||
void Show(unsigned animationMillis);
|
||||
void Flash(unsigned animationMillis);
|
||||
void Show();
|
||||
void Flash();
|
||||
void DrawActiveZoneSet(const IZoneSet::ZonesMap& zones,
|
||||
const std::vector<size_t>& highlightZones,
|
||||
winrt::com_ptr<IZoneWindowHost> host);
|
||||
|
||||
Reference in New Issue
Block a user