From: Wander Lairson Costa Date: Mon, 21 Dec 2020 17:39:42 +0000 (-0300) Subject: windows: Use FindWindow to locate the window related to the timer X-Git-Tag: dali_2.0.8~2^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F78%2F250178%2F3;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git windows: Use FindWindow to locate the window related to the timer If our window is not the foreground window, GetActiveWindow() will return a null handle, which causes the call to SetTimer to ignore the given timer ID. We solve this by calling FindWindow() passing the window class name when GetActiveWindow returns null. Change-Id: Icc3e3c9f3fd0f9cfb4f4e8cb97fabffe347c7b5d --- diff --git a/dali/internal/window-system/windows/platform-implement-win.cpp b/dali/internal/window-system/windows/platform-implement-win.cpp index c56d31e..4a2a60b 100755 --- a/dali/internal/window-system/windows/platform-implement-win.cpp +++ b/dali/internal/window-system/windows/platform-implement-win.cpp @@ -261,13 +261,24 @@ void CALLBACK TimerProc(HWND hWnd, UINT nMsg, UINT_PTR nTimerid, DWORD dwTime) intptr_t SetTimer(int interval, timerCallback callback, void *data) { + HWND hwnd = GetActiveWindow(); + if (!hwnd) + { + hwnd = FindWindow(DALI_WINDOW_CLASS_NAME.c_str(), nullptr); + } + + if (!hwnd) + { + return -1; + } + TTimerCallbackInfo *callbackInfo = new TTimerCallbackInfo; callbackInfo->data = data; callbackInfo->callback = callback; - callbackInfo->hWnd = ::GetActiveWindow(); + callbackInfo->hWnd = hwnd; INT_PTR timerID = (INT_PTR)callbackInfo; - ::SetTimer( callbackInfo->hWnd, timerID, interval, TimerProc ); + ::SetTimer( hwnd, timerID, interval, TimerProc ); return timerID; }