1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-23 23:21:08 +01:00

Weather: Implemented zoom levels (#1033)

This commit is contained in:
Valentin Radu 2022-03-09 20:08:03 +02:00
parent aa8524487b
commit 25ef1b23e1
7 changed files with 178 additions and 39 deletions

View File

@ -127,6 +127,7 @@ DWORD dwWeatherDevMode = FALSE;
DWORD dwWeatherIconPack = EP_WEATHER_ICONPACK_MICROSOFT;
DWORD dwWeatherToLeft = 0;
DWORD dwWeatherContentsMode = 0;
DWORD dwWeatherZoomFactor = 0;
WCHAR* wszWeatherTerm = NULL;
WCHAR* wszWeatherLanguage = NULL;
WCHAR* wszEPWeatherKillswitch = NULL;
@ -4366,10 +4367,10 @@ SIZE WINAPI PeopleButton_CalculateMinimumSizeHook(void* _this, SIZE* pSz)
RECT rcWeatherFlyoutWindow;
rcWeatherFlyoutWindow.left = mi.rcWork.left;
rcWeatherFlyoutWindow.top = mi.rcWork.top;
rcWeatherFlyoutWindow.right = rcWeatherFlyoutWindow.left + MulDiv(MulDiv(EP_WEATHER_WIDTH, dpiX, 96), dwTextScaleFactor, 100);
rcWeatherFlyoutWindow.bottom = rcWeatherFlyoutWindow.top + MulDiv(MulDiv(EP_WEATHER_HEIGHT, dpiX, 96), dwTextScaleFactor, 100);
rcWeatherFlyoutWindow.right = rcWeatherFlyoutWindow.left + MulDiv(MulDiv(MulDiv(EP_WEATHER_WIDTH, dpiX, 96), dwTextScaleFactor, 100), dwWeatherZoomFactor, 100);
rcWeatherFlyoutWindow.bottom = rcWeatherFlyoutWindow.top + MulDiv(MulDiv(MulDiv(EP_WEATHER_HEIGHT, dpiX, 96), dwTextScaleFactor, 100), dwWeatherZoomFactor, 100);
int k = 0;
while (FAILED(hr = epw->lpVtbl->Initialize(epw, wszEPWeatherKillswitch, bAllocConsole, EP_WEATHER_PROVIDER_GOOGLE, rt, rt, dwWeatherTemperatureUnit, dwWeatherUpdateSchedule * 1000, rcWeatherFlyoutWindow, dwWeatherTheme, dwWeatherGeolocationMode, &hWndWeatherFlyout)))
while (FAILED(hr = epw->lpVtbl->Initialize(epw, wszEPWeatherKillswitch, bAllocConsole, EP_WEATHER_PROVIDER_GOOGLE, rt, rt, dwWeatherTemperatureUnit, dwWeatherUpdateSchedule * 1000, rcWeatherFlyoutWindow, dwWeatherTheme, dwWeatherGeolocationMode, &hWndWeatherFlyout, dwWeatherZoomFactor ? dwWeatherZoomFactor : 100, dpiX, dpiY)))
{
BOOL bFailed = FALSE;
if (k == 0 && hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
@ -6521,7 +6522,7 @@ void WINAPI LoadSettings(LPARAM lParam)
dwRefreshUIMask = REFRESHUI_PEOPLE;
}
DWORD bOldWeatherContentsMode = dwWeatherContentsMode;
DWORD dwOldWeatherContentsMode = dwWeatherContentsMode;
dwSize = sizeof(DWORD);
RegQueryValueExW(
hKey,
@ -6531,11 +6532,29 @@ void WINAPI LoadSettings(LPARAM lParam)
&dwWeatherContentsMode,
&dwSize
);
if (dwWeatherContentsMode != bOldWeatherContentsMode && epw)
if (dwWeatherContentsMode != dwOldWeatherContentsMode && PeopleButton_LastHWND)
{
dwRefreshUIMask |= REFRESHUI_PEOPLE;
}
DWORD dwOldWeatherZoomFactor = dwWeatherZoomFactor;
dwSize = sizeof(DWORD);
RegQueryValueExW(
hKey,
TEXT("WeatherZoomFactor"),
0,
NULL,
&dwWeatherZoomFactor,
&dwSize
);
if (dwWeatherZoomFactor != dwOldWeatherZoomFactor && PeopleButton_LastHWND)
{
if (epw)
{
epw->lpVtbl->SetZoomFactor(epw, dwWeatherZoomFactor ? (LONG64)dwWeatherZoomFactor : 100);
}
}
ReleaseSRWLockShared(&lock_epw);
#endif

View File

@ -477,6 +477,25 @@
;x 0 On a single line (default)
;x 1 On 2 lines, if possible
"WeatherContentsMode"=dword:00000000
;c 17 Zoom
;x 25 25 %
;x 33 33 %
;x 50 50 %
;x 67 67 %
;x 75 75 %
;x 80 80 %
;x 90 90 %
;x 0 100 % (default)
;x 110 110 %
;x 125 125 %
;x 150 150 %
;x 175 175 %
;x 200 200 %
;x 250 250 %
;x 300 300 %
;x 400 400 %
;x 500 500 %
"WeatherZoomFactor"=dword:00000000
;q
;t Weather data courtesy of Google, and weather.com.
;y Learn more about the Weather taskbar widget 🡕

View File

@ -416,6 +416,25 @@
;x 0 On a single line (default)
;x 1 On 2 lines, if possible
"WeatherContentsMode"=dword:00000000
;c 17 Zoom
;x 25 25 %
;x 33 33 %
;x 50 50 %
;x 67 67 %
;x 75 75 %
;x 80 80 %
;x 90 90 %
;x 0 100 % (default)
;x 110 110 %
;x 125 125 %
;x 150 150 %
;x 175 175 %
;x 200 200 %
;x 250 250 %
;x 300 300 %
;x 400 400 %
;x 500 500 %
"WeatherZoomFactor"=dword:00000000
;q
;t Weather data courtesy of Google, and weather.com.
;y Learn more about the Weather taskbar widget 🡕

View File

@ -67,9 +67,11 @@ DEFINE_GUID(IID_IEPWeather,
#define EP_WEATHER_WM_SET_BROWSER_THEME (WM_USER + 11)
#define EP_WEATHER_WM_REBOUND_BROWSER (WM_USER + 12)
#define EP_WEATHER_WM_SETDEVMODE (WM_USER + 13)
#define EP_WEATHER_WM_SETZOOMFACTOR (WM_USER + 14)
#define EP_WEATHER_HEIGHT 391
#define EP_WEATHER_WIDTH 690
#define EP_WEATHER_HEIGHT_ERROR 260
#define EP_WEATHER_HEIGHT 353
#define EP_WEATHER_WIDTH 673
#define EP_WEATHER_ICONPACK_MICROSOFT 0
#define EP_WEATHER_ICONPACK_GOOGLE 1

View File

@ -43,8 +43,7 @@ static void epw_Weather_SetTextScaleFactorFromRegistry(EPWeather* _this, HKEY hK
}
if (bRefresh)
{
_this->cntResizeWindow = 0;
SetTimer(_this->hWnd, EP_WEATHER_TIMER_RESIZE_WINDOW, EP_WEATHER_TIMER_RESIZE_WINDOW_DELAY, NULL);
_ep_Weather_StartResize(_this);
}
}
@ -152,16 +151,21 @@ HRESULT STDMETHODCALLTYPE ICoreWebView2_CreateCoreWebView2EnvironmentCompleted(I
HRESULT STDMETHODCALLTYPE _epw_Weather_NavigateToError(EPWeather* _this)
{
_ep_weather_ReboundBrowser(_this, TRUE);
_ep_Weather_ReboundBrowser(_this, TRUE);
InterlockedExchange64(&_this->bIsNavigatingToError, TRUE);
UINT dpi = GetDpiForWindow(_this->hWnd);
int ch = MulDiv(MulDiv(305, dpi, 96), epw_Weather_GetTextScaleFactor(_this), 100);
DWORD dwTextScaleFactor = epw_Weather_GetTextScaleFactor(_this);
DWORD dwZoomFactor = epw_Weather_GetZoomFactor(_this);
int ch = MulDiv(MulDiv(MulDiv(EP_WEATHER_HEIGHT_ERROR, dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100);
RECT rc;
GetWindowRect(_this->hWnd, &rc);
int w = MulDiv(MulDiv(EP_WEATHER_WIDTH, GetDpiForWindow(_this->hWnd), 96), epw_Weather_GetTextScaleFactor(_this), 100);
GetClientRect(_this->hWnd, &rc);
int w = MulDiv(MulDiv(MulDiv(EP_WEATHER_WIDTH, GetDpiForWindow(_this->hWnd), 96), dwTextScaleFactor, 100), dwZoomFactor, 100);
if ((rc.bottom - rc.top != ch) || (rc.right - rc.left != w))
{
SetWindowPos(_this->hWnd, NULL, 0, 0, w, ch, SWP_NOMOVE | SWP_NOSENDCHANGING);
RECT rcAdj;
SetRect(&rcAdj, 0, 0, w, ch);
AdjustWindowRectExForDpi(&rcAdj, epw_Weather_GetStyle(_this) & ~WS_OVERLAPPED, epw_Weather_HasMenuBar(_this), epw_Weather_GetExtendedStyle(_this), dpi);
SetWindowPos(_this->hWnd, NULL, 0, 0, rcAdj.right - rcAdj.left, rcAdj.bottom - rcAdj.top, SWP_NOMOVE | SWP_NOSENDCHANGING);
HWND hNotifyWnd = InterlockedAdd64(&_this->hNotifyWnd, 0);
if (hNotifyWnd)
{
@ -180,7 +184,7 @@ HRESULT STDMETHODCALLTYPE _epw_Weather_NavigateToError(EPWeather* _this)
HRESULT STDMETHODCALLTYPE _epw_Weather_NavigateToProvider(EPWeather* _this)
{
_ep_weather_ReboundBrowser(_this, FALSE);
_ep_Weather_ReboundBrowser(_this, FALSE);
HRESULT hr = S_OK;
LONG64 dwProvider = InterlockedAdd64(&_this->dwProvider, 0);
if (dwProvider == EP_WEATHER_PROVIDER_TEST)
@ -259,7 +263,14 @@ HRESULT STDMETHODCALLTYPE _epw_Weather_ExecuteDataScript(EPWeather* _this)
return hr;
}
HRESULT STDMETHODCALLTYPE _ep_weather_ReboundBrowser(EPWeather* _this, LONG64 dwType)
HRESULT STDMETHODCALLTYPE _ep_Weather_StartResize(EPWeather* _this)
{
_this->cntResizeWindow = 0;
SetTimer(_this->hWnd, EP_WEATHER_TIMER_RESIZE_WINDOW, EP_WEATHER_TIMER_RESIZE_WINDOW_DELAY, NULL);
return S_OK;
}
HRESULT STDMETHODCALLTYPE _ep_Weather_ReboundBrowser(EPWeather* _this, LONG64 dwType)
{
UINT dpi = GetDpiForWindow(_this->hWnd);
RECT bounds;
@ -271,10 +282,11 @@ HRESULT STDMETHODCALLTYPE _ep_weather_ReboundBrowser(EPWeather* _this, LONG64 dw
else
{
DWORD dwTextScaleFactor = epw_Weather_GetTextScaleFactor(_this);
bounds.left = 0 - MulDiv(MulDiv(167, dpi, 96), dwTextScaleFactor, 100);
bounds.top = 0 - MulDiv(MulDiv(178, dpi, 96), dwTextScaleFactor, 100);
bounds.right = MulDiv(MulDiv((!InterlockedAdd64(&_this->dwTextDir, 0) ? 1333 : 705), dpi, 96), dwTextScaleFactor, 100);// 5560;
bounds.bottom = MulDiv(MulDiv(600, dpi, 96), dwTextScaleFactor, 100);// 15600;
DWORD dwZoomFactor = epw_Weather_GetZoomFactor(_this);
bounds.left = 0 - MulDiv(MulDiv(MulDiv(167, dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100);
bounds.top = 0 - MulDiv(MulDiv(MulDiv(178, dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100);
bounds.right = MulDiv(MulDiv(MulDiv((!InterlockedAdd64(&_this->dwTextDir, 0) ? 1333 : 705), dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100);// 5560;
bounds.bottom = MulDiv(MulDiv(MulDiv(600, dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100);// 15600;
}
if (_this->pCoreWebView2Controller)
{
@ -293,9 +305,10 @@ HRESULT STDMETHODCALLTYPE ICoreWebView2_CreateCoreWebView2ControllerCompleted(IC
_this->pCoreWebView2Controller = pCoreWebView2Controller;
_this->pCoreWebView2Controller->lpVtbl->get_CoreWebView2(_this->pCoreWebView2Controller, &_this->pCoreWebView2);
_this->pCoreWebView2Controller->lpVtbl->AddRef(_this->pCoreWebView2Controller);
_this->pCoreWebView2Controller->lpVtbl->put_ZoomFactor(_this->pCoreWebView2Controller, InterlockedAdd64(&_this->dwZoomFactor, 0) / 100.0);
}
_ep_weather_ReboundBrowser(_this, FALSE);
_ep_Weather_ReboundBrowser(_this, FALSE);
ICoreWebView2Controller2* pCoreWebView2Controller2 = NULL;
_this->pCoreWebView2Controller->lpVtbl->QueryInterface(_this->pCoreWebView2Controller, &IID_ICoreWebView2Controller2, &pCoreWebView2Controller2);
@ -537,14 +550,19 @@ HRESULT STDMETHODCALLTYPE ICoreWebView2_ExecuteScriptCompleted(ICoreWebView2Exec
int h = _wtoi(wszHeight);
int ch = MulDiv(h, EP_WEATHER_HEIGHT, 367);
UINT dpi = GetDpiForWindow(_this->hWnd);
ch = MulDiv(MulDiv(ch, dpi, 96), epw_Weather_GetTextScaleFactor(_this), 100);
DWORD dwTextScaleFactor = epw_Weather_GetTextScaleFactor(_this);
DWORD dwZoomFactor = epw_Weather_GetZoomFactor(_this);
ch = MulDiv(MulDiv(MulDiv(ch, dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100);
RECT rc;
GetWindowRect(_this->hWnd, &rc);
int w = MulDiv(MulDiv(EP_WEATHER_WIDTH, GetDpiForWindow(_this->hWnd), 96), epw_Weather_GetTextScaleFactor(_this), 100);
GetClientRect(_this->hWnd, &rc);
int w = MulDiv(MulDiv(MulDiv(EP_WEATHER_WIDTH, GetDpiForWindow(_this->hWnd), 96), dwTextScaleFactor, 100), dwZoomFactor, 100);
if ((rc.bottom - rc.top != ch) || (rc.right - rc.left != w))
{
SetWindowPos(_this->hWnd, NULL, 0, 0, w, ch, SWP_NOMOVE | SWP_NOSENDCHANGING);
_ep_weather_ReboundBrowser(_this, FALSE);
RECT rcAdj;
SetRect(&rcAdj, 0, 0, w, ch);
AdjustWindowRectExForDpi(&rcAdj, epw_Weather_GetStyle(_this) & ~WS_OVERLAPPED, epw_Weather_HasMenuBar(_this), epw_Weather_GetExtendedStyle(_this), dpi);
SetWindowPos(_this->hWnd, NULL, 0, 0, rcAdj.right - rcAdj.left, rcAdj.bottom - rcAdj.top, SWP_NOMOVE | SWP_NOSENDCHANGING);
_ep_Weather_ReboundBrowser(_this, FALSE);
HWND hNotifyWnd = InterlockedAdd64(&_this->hNotifyWnd, 0);
if (hNotifyWnd)
{
@ -784,9 +802,19 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
}
else if (uMsg == WM_TIMER && wParam == EP_WEATHER_TIMER_RESIZE_WINDOW)
{
LPWSTR uri = NULL;
if (_this->pCoreWebView2)
{
_this->pCoreWebView2->lpVtbl->get_Source(_this->pCoreWebView2, &uri);
}
DWORD dwTextScaleFactor = epw_Weather_GetTextScaleFactor(_this);
DWORD dwZoomFactor = epw_Weather_GetZoomFactor(_this);
UINT dpi = GetDpiForWindow(_this->hWnd);
SetWindowPos(_this->hWnd, NULL, 0, 0, MulDiv(MulDiv(EP_WEATHER_WIDTH, dpi, 96), dwTextScaleFactor, 100), MulDiv(MulDiv(EP_WEATHER_HEIGHT, dpi, 96), dwTextScaleFactor, 100), SWP_NOMOVE | SWP_NOSENDCHANGING);
RECT rcAdj;
SetRect(&rcAdj, 0, 0, MulDiv(MulDiv(MulDiv(EP_WEATHER_WIDTH, dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100), MulDiv(MulDiv(MulDiv((!wcscmp(L"about:blank", uri ? uri : L"") ? EP_WEATHER_HEIGHT_ERROR : EP_WEATHER_HEIGHT), dpi, 96), dwTextScaleFactor, 100), dwZoomFactor, 100));
AdjustWindowRectExForDpi(&rcAdj, epw_Weather_GetStyle(_this) & ~WS_OVERLAPPED, epw_Weather_HasMenuBar(_this), epw_Weather_GetExtendedStyle(_this), dpi);
SetWindowPos(_this->hWnd, NULL, 0, 0, rcAdj.right - rcAdj.left, rcAdj.bottom - rcAdj.top, SWP_NOMOVE | SWP_NOSENDCHANGING);
CoTaskMemFree(uri);
if (_this->cntResizeWindow == 7)
{
_this->cntResizeWindow = 0;
@ -805,7 +833,7 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
{
_this->pCoreWebView2->lpVtbl->get_Source(_this->pCoreWebView2, &uri);
}
_ep_weather_ReboundBrowser(_this, !wcscmp(L"about:blank", uri ? uri : L""));
_ep_Weather_ReboundBrowser(_this, !wcscmp(L"about:blank", uri ? uri : L""));
CoTaskMemFree(uri);
return 0;
}
@ -862,13 +890,12 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
pCoreWebView2Settings6->lpVtbl->put_AreBrowserAcceleratorKeysEnabled(pCoreWebView2Settings6, wParam);
pCoreWebView2Settings6->lpVtbl->put_AreDefaultScriptDialogsEnabled(pCoreWebView2Settings6, wParam);
pCoreWebView2Settings6->lpVtbl->Release(pCoreWebView2Settings6);
SetLastError(0);
LONG dwStyle = GetWindowLongW(_this->hWnd, GWL_STYLE);
LONG dwStyle = epw_Weather_GetStyle(_this);
if (!GetLastError())
{
if (wParam) dwStyle |= WS_SIZEBOX;
else dwStyle &= ~WS_SIZEBOX;
SetWindowLong(_this->hWnd, GWL_STYLE, dwStyle);
SetWindowLongW(_this->hWnd, GWL_STYLE, dwStyle);
}
PostMessageW(_this->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0);
}
@ -876,6 +903,14 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
}
}
}
else if (uMsg == EP_WEATHER_WM_SETZOOMFACTOR)
{
if (_this->pCoreWebView2Controller)
{
_this->pCoreWebView2Controller->lpVtbl->put_ZoomFactor(_this->pCoreWebView2Controller, wParam / 100.0);
_ep_Weather_StartResize(_this);
}
}
else if (uMsg == WM_CLOSE || (uMsg == WM_KEYUP && wParam == VK_ESCAPE) || (uMsg == WM_ACTIVATEAPP && wParam == FALSE && GetAncestor(GetForegroundWindow(), GA_ROOT) != _this->hWnd))
{
epw_Weather_Hide(_this);
@ -890,7 +925,7 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
pwp->flags |= (!dwDevMode ? (SWP_NOMOVE | SWP_NOSIZE) : 0);
if (dwDevMode)
{
_ep_weather_ReboundBrowser(_this, TRUE);
_ep_Weather_ReboundBrowser(_this, TRUE);
}
}
return 0;
@ -942,10 +977,15 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
}
else if (uMsg == WM_DPICHANGED)
{
UINT dpiX = LOWORD(wParam);
int w = MulDiv(MulDiv(EP_WEATHER_WIDTH, dpiX, 96), epw_Weather_GetTextScaleFactor(_this), 100);
//UINT dpiX = LOWORD(wParam);
//UINT dpiY = HIWORD(wParam);
//DWORD dwTextScaleFactor = epw_Weather_GetTextScaleFactor(_this);
//DWORD dwZoomFactor = epw_Weather_GetZoomFactor(_this);
//RECT rcAdj;
//SetRect(&rcAdj, 0, 0, MulDiv(MulDiv(MulDiv(EP_WEATHER_WIDTH, dpiX, 96), dwTextScaleFactor, 100), dwZoomFactor, 100), MulDiv(MulDiv(MulDiv(EP_WEATHER_HEIGHT, dpiY, 96), dwTextScaleFactor, 100), dwZoomFactor, 100));
//AdjustWindowRectExForDpi(&rcAdj, epw_Weather_GetStyle(_this) & ~WS_OVERLAPPED, epw_Weather_HasMenuBar(_this), epw_Weather_GetExtendedStyle(_this), dpiX);
RECT* rc = lParam;
SetWindowPos(_this->hWnd, NULL, rc->left, rc->top, w, rc->bottom - rc->top, 0);
SetWindowPos(_this->hWnd, NULL, rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top, 0);
return 0;
}
else if (uMsg == WM_PAINT && !IsWindows11())
@ -1110,6 +1150,13 @@ HRESULT STDMETHODCALLTYPE epw_Weather_SetIconPack(EPWeather* _this, LONG64 dwIco
return S_OK;
}
HRESULT STDMETHODCALLTYPE epw_Weather_SetZoomFactor(EPWeather* _this, LONG64 dwZoomFactor)
{
InterlockedExchange64(&_this->dwZoomFactor, dwZoomFactor);
PostMessageW(_this->hWnd, EP_WEATHER_WM_SETZOOMFACTOR, dwZoomFactor, 0);
return S_OK;
}
DWORD WINAPI epw_Weather_MainThread(EPWeather* _this)
{
HRESULT hr = S_OK;
@ -1150,7 +1197,11 @@ DWORD WINAPI epw_Weather_MainThread(EPWeather* _this)
}
DWORD dwDevMode = InterlockedAdd64(&_this->dwDevMode, 0);
_this->hWnd = CreateWindowExW(0, _T(EPW_WEATHER_CLASSNAME), L"", WS_OVERLAPPED | WS_CAPTION | (dwDevMode ? WS_SIZEBOX : 0), _this->rc.left, _this->rc.top, _this->rc.right - _this->rc.left, _this->rc.bottom - _this->rc.top, NULL, NULL, epw_hModule, _this); // 1030, 630
DWORD dwStyle = WS_CAPTION | (dwDevMode ? WS_SIZEBOX : 0);
DWORD dwExStyle = 0;
RECT rc = _this->rc;
AdjustWindowRectExForDpi(&rc, dwStyle, FALSE, dwExStyle, _this->dpiXInitial);
_this->hWnd = CreateWindowExW(dwExStyle, _T(EPW_WEATHER_CLASSNAME), L"", WS_OVERLAPPED | dwStyle, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, epw_hModule, _this); // 1030, 630
if (!_this->hWnd)
{
_this->hrLastError = HRESULT_FROM_WIN32(GetLastError());
@ -1361,7 +1412,7 @@ DWORD WINAPI epw_Weather_MainThread(EPWeather* _this)
return 0;
}
HRESULT STDMETHODCALLTYPE epw_Weather_Initialize(EPWeather* _this, WCHAR wszName[MAX_PATH], BOOL bAllocConsole, LONG64 dwProvider, LONG64 cbx, LONG64 cby, LONG64 dwTemperatureUnit, LONG64 dwUpdateSchedule, RECT rc, LONG64 dwDarkMode, LONG64 dwGeolocationMode, HWND* hWnd)
HRESULT STDMETHODCALLTYPE epw_Weather_Initialize(EPWeather* _this, WCHAR wszName[MAX_PATH], BOOL bAllocConsole, LONG64 dwProvider, LONG64 cbx, LONG64 cby, LONG64 dwTemperatureUnit, LONG64 dwUpdateSchedule, RECT rc, LONG64 dwDarkMode, LONG64 dwGeolocationMode, HWND* hWnd, LONG64 dwZoomFactor, LONG64 dpiXInitial, LONG64 dpiYInitial)
{
InitializeGlobalVersionAndUBR();
@ -1417,6 +1468,9 @@ HRESULT STDMETHODCALLTYPE epw_Weather_Initialize(EPWeather* _this, WCHAR wszName
}
InterlockedExchange64(&_this->dwGeolocationMode, dwGeolocationMode);
InterlockedExchange64(&_this->dwZoomFactor, dwZoomFactor);
_this->dpiXInitial = dpiXInitial;
_this->dpiYInitial = dpiYInitial;
_this->hUxtheme = LoadLibraryW(L"uxtheme.dll");
if (_this->hUxtheme)

View File

@ -54,6 +54,7 @@ typedef interface EPWeather
LONG64 dwDevMode;
LONG64 dwTextDir;
LONG64 dwIconPack;
LONG64 dwZoomFactor;
HANDLE hMutexData; // protects the following:
DWORD cbTemperature;
@ -80,6 +81,8 @@ typedef interface EPWeather
EventRegistrationToken* tkOnNavigationCompleted;
EventRegistrationToken* tkOnPermissionRequested;
RECT rc;
LONG64 dpiXInitial;
LONG64 dpiYInitial;
HANDLE hSignalExitMainThread;
HANDLE hSignalKillSwitch;
@ -92,7 +95,7 @@ ULONG STDMETHODCALLTYPE epw_Weather_Release(EPWeather* _this);
HRESULT STDMETHODCALLTYPE epw_Weather_QueryInterface(EPWeather* _this, REFIID riid, void** ppv);
HRESULT STDMETHODCALLTYPE epw_Weather_About(EPWeather* _this, HWND hWnd);
HRESULT STDMETHODCALLTYPE epw_Weather_Initialize(EPWeather* _this, WCHAR wszName[MAX_PATH], BOOL bAllocConsole, LONG64 dwProvider, LONG64 cbx, LONG64 cby, LONG64 dwTemperatureUnit, LONG64 dwUpdateSchedule, RECT rc, LONG64 dwDarkMode, LONG64 dwGeolocationMode, HWND* hWnd);
HRESULT STDMETHODCALLTYPE epw_Weather_Initialize(EPWeather* _this, WCHAR wszName[MAX_PATH], BOOL bAllocConsole, LONG64 dwProvider, LONG64 cbx, LONG64 cby, LONG64 dwTemperatureUnit, LONG64 dwUpdateSchedule, RECT rc, LONG64 dwDarkMode, LONG64 dwGeolocationMode, HWND* hWnd, LONG64 dwZoomFactor, LONG64 dpiXInitial, LONG64 dpiYInitial);
HRESULT STDMETHODCALLTYPE epw_Weather_Show(EPWeather* _this);
HRESULT STDMETHODCALLTYPE epw_Weather_Hide(EPWeather* _this);
@ -118,6 +121,7 @@ HRESULT STDMETHODCALLTYPE epw_Weather_SetGeolocationMode(EPWeather* _this, LONG6
HRESULT STDMETHODCALLTYPE epw_Weather_SetWindowCornerPreference(EPWeather* _this, LONG64 dwWindowCornerPreference);
HRESULT STDMETHODCALLTYPE epw_Weather_SetDevMode(EPWeather* _this, LONG64 dwDevMode, LONG64 bRefresh);
HRESULT STDMETHODCALLTYPE epw_Weather_SetIconPack(EPWeather* _this, LONG64 dwIconPack, LONG64 bRefresh);
HRESULT STDMETHODCALLTYPE epw_Weather_SetZoomFactor(EPWeather* _this, LONG64 dwZoomFactor);
static const IEPWeatherVtbl IEPWeather_Vtbl = {
.QueryInterface = epw_Weather_QueryInterface,
@ -146,9 +150,14 @@ static const IEPWeatherVtbl IEPWeather_Vtbl = {
.SetWindowCornerPreference = epw_Weather_SetWindowCornerPreference,
.SetDevMode = epw_Weather_SetDevMode,
.SetIconPack = epw_Weather_SetIconPack,
.SetZoomFactor = epw_Weather_SetZoomFactor,
};
static inline DWORD epw_Weather_GetTextScaleFactor(EPWeather* _this) { return InterlockedAdd64(&_this->dwTextScaleFactor, 0); }
static inline DWORD epw_Weather_GetZoomFactor(EPWeather* _this) { return InterlockedAdd64(&_this->dwZoomFactor, 0); }
static inline DWORD epw_Weather_GetStyle(EPWeather* _this) { SetLastError(0); return GetWindowLongW(_this->hWnd, GWL_STYLE); }
static inline DWORD epw_Weather_HasMenuBar(EPWeather* _this) { return 0; }
static inline DWORD epw_Weather_GetExtendedStyle(EPWeather* _this) { SetLastError(0); return GetWindowLongW(_this->hWnd, GWL_EXSTYLE); }
static void epw_Weather_SetTextScaleFactorFromRegistry(EPWeather* _this, HKEY hKey, BOOL bRefresh);
HRESULT STDMETHODCALLTYPE epw_Weather_static_Stub(void* _this);

View File

@ -11,7 +11,22 @@ import "unknwn.idl";
{
HRESULT About([in] HWND hWnd);
HRESULT Initialize([in] WCHAR wszName[260], [in] BOOL bAllocConsole, [in] LONG64 dwProvider, [in] LONG64 cbx, [in] LONG64 cby, [in] LONG64 dwTemperatureUnit, [in] LONG64 dwUpdateSchedule, [in] RECT rc, [in] LONG64 dwDarkMode, [in] LONG64 dwGeolocationMode, [out] HWND* hWnd);
HRESULT Initialize(
[in] WCHAR wszName[260],
[in] BOOL bAllocConsole,
[in] LONG64 dwProvider,
[in] LONG64 cbx,
[in] LONG64 cby,
[in] LONG64 dwTemperatureUnit,
[in] LONG64 dwUpdateSchedule,
[in] RECT rc,
[in] LONG64 dwDarkMode,
[in] LONG64 dwGeolocationMode,
[out] HWND* hWnd,
[in] LONG64 dwZoomFactor,
[in] LONG64 dpiXInitial,
[in] LONG64 dpiYInitial
);
HRESULT Show();
@ -68,4 +83,6 @@ import "unknwn.idl";
HRESULT SetDevMode([in] LONG64 dwDevMode, [in] LONG64 bRefresh);
HRESULT SetIconPack([in] LONG64 dwIconPack, [in] LONG64 bRefresh);
HRESULT SetZoomFactor([in] LONG64 dwZoomFactor);
};