From eb64f8a3228184a67e61ab209f5c9f64cf9c120a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 23 Jul 2019 01:07:37 +0200 Subject: Windows: Only kill timer when actually flashing --- pugl/pugl_win.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pugl/pugl_win.c b/pugl/pugl_win.c index acf1700..b5afe90 100644 --- a/pugl/pugl_win.c +++ b/pugl/pugl_win.c @@ -79,6 +79,7 @@ struct PuglInternalsImpl { HGLRC hglrc; DWORD refreshRate; double timerFrequency; + bool flashing; bool resizing; bool mouseTracked; }; @@ -653,8 +654,10 @@ handleCrossing(PuglView* view, const PuglEventType type, POINT pos) static void stopFlashing(PuglView* view) { - KillTimer(view->impl->hwnd, PUGL_URGENT_TIMER_ID); - FlashWindow(view->impl->hwnd, FALSE); + if (view->impl->flashing) { + KillTimer(view->impl->hwnd, PUGL_URGENT_TIMER_ID); + FlashWindow(view->impl->hwnd, FALSE); + } } static LRESULT @@ -838,6 +841,7 @@ puglRequestAttention(PuglView* view) if (!view->impl->mouseTracked || GetFocus() != view->impl->hwnd) { FlashWindow(view->impl->hwnd, TRUE); SetTimer(view->impl->hwnd, PUGL_URGENT_TIMER_ID, 500, NULL); + view->impl->flashing = true; } } -- cgit v1.2.1