1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-27 17:00:59 +01:00

Weather: Fixed a bug that could prevent the widget from properly loading

It seems that either the web page, either something in Microsoft's
WebView2 implementation changed so that when
`ICoreWebView2::NavigationCompleted` is fired, the elements of interest
on the page are not ready, which causes all this mess, as you can tell.

The solution for now was to delay the execution of my scripts, which
seemed to have gotten rid of the problem for now. I don't particularly
like the solution, I'd of course want something more robust, but I
guess these are the pitfalls when you do not control the entire
ecosystem...
This commit is contained in:
Valentin Radu 2023-03-01 20:38:35 +02:00
parent ca8ce137d8
commit a8c7fbadaa
2 changed files with 9 additions and 1 deletions

View File

@ -572,7 +572,7 @@ HRESULT STDMETHODCALLTYPE ICoreWebView2_NavigationCompleted(GenericObjectWithThi
}
else
{
_epw_Weather_ExecuteDataScript(_this);
SetTimer(_this->hWnd, EP_WEATHER_TIMER_EXECUTEDATASCRIPT, EP_WEATHER_TIMER_EXECUTEDATASCRIPT_DELAY, NULL);
}
}
else
@ -1004,6 +1004,12 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
}
return 0;
}
else if (uMsg == WM_TIMER && wParam == EP_WEATHER_TIMER_EXECUTEDATASCRIPT)
{
_epw_Weather_ExecuteDataScript(_this);
KillTimer(_this->hWnd, EP_WEATHER_TIMER_EXECUTEDATASCRIPT);
return 0;
}
else if (uMsg == EP_WEATHER_WM_REBOUND_BROWSER)
{
LPWSTR uri = NULL;

View File

@ -29,6 +29,8 @@ DEFINE_GUID(IID_ITaskbarList,
#define EP_WEATHER_TIMER_SCHEDULE_REFRESH 11
#define EP_WEATHER_TIMER_RESIZE_WINDOW 15
#define EP_WEATHER_TIMER_RESIZE_WINDOW_DELAY 150
#define EP_WEATHER_TIMER_EXECUTEDATASCRIPT 20
#define EP_WEATHER_TIMER_EXECUTEDATASCRIPT_DELAY 500
typedef struct _GenericObjectWithThis GenericObjectWithThis;