mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-27 17:00:59 +01:00
Weather: Widget displays with rounded corner after logon; implemented option to change corner preference
This commit is contained in:
parent
46191733d7
commit
7bc56f4191
@ -111,6 +111,7 @@ DWORD dwWeatherUpdateSchedule = EP_WEATHER_UPDATE_NORMAL;
|
||||
DWORD bWeatherFixedSize = FALSE;
|
||||
DWORD dwWeatherTheme = 0;
|
||||
DWORD dwWeatherGeolocationMode = 0;
|
||||
DWORD dwWeatherWindowCornerPreference = DWMWCP_ROUND;
|
||||
WCHAR* wszWeatherTerm = NULL;
|
||||
WCHAR* wszWeatherLanguage = NULL;
|
||||
WCHAR* wszEPWeatherKillswitch = NULL;
|
||||
@ -3955,6 +3956,7 @@ SIZE WINAPI PeopleButton_CalculateMinimumSizeHook(void* _this, SIZE* pSz)
|
||||
epw = NULL;
|
||||
prev_total_h = 0;
|
||||
}
|
||||
epw->lpVtbl->SetWindowCornerPreference(epw, dwWeatherWindowCornerPreference);
|
||||
}
|
||||
ReleaseSRWLockExclusive(&lock_epw);
|
||||
AcquireSRWLockShared(&lock_epw);
|
||||
@ -5867,6 +5869,24 @@ void WINAPI LoadSettings(LPARAM lParam)
|
||||
}
|
||||
}
|
||||
|
||||
DWORD dwOldWeatherWindowCornerPreference = dwWeatherWindowCornerPreference;
|
||||
dwSize = sizeof(DWORD);
|
||||
RegQueryValueExW(
|
||||
hKey,
|
||||
TEXT("WeatherWindowCornerPreference"),
|
||||
0,
|
||||
NULL,
|
||||
&dwWeatherWindowCornerPreference,
|
||||
&dwSize
|
||||
);
|
||||
if (dwWeatherWindowCornerPreference != dwOldWeatherWindowCornerPreference && PeopleButton_LastHWND)
|
||||
{
|
||||
if (epw)
|
||||
{
|
||||
epw->lpVtbl->SetWindowCornerPreference(epw, (LONG64)dwWeatherWindowCornerPreference);
|
||||
}
|
||||
}
|
||||
|
||||
ReleaseSRWLockShared(&lock_epw);
|
||||
#endif
|
||||
|
||||
|
@ -404,6 +404,11 @@
|
||||
;x 1 Light
|
||||
;x 2 Dark
|
||||
"WeatherTheme"=dword:00000000
|
||||
;c 3 Corner preference
|
||||
;x 2 Rounded (default)
|
||||
;x 3 Small rounded
|
||||
;x 1 Not rounded
|
||||
"WeatherWindowCornerPreference"=dword:00000002
|
||||
;q
|
||||
;t Weather data courtesy of Google, and weather.com.
|
||||
;y Learn more about the Weather taskbar widget 🡕
|
||||
|
@ -8,6 +8,21 @@
|
||||
#pragma comment(lib, "Version.lib")
|
||||
#pragma comment(lib, "Shlwapi.lib")
|
||||
|
||||
#ifndef NTDDI_WIN10_CO
|
||||
#define DWMWA_USE_HOSTBACKDROPBRUSH 17 // [set] BOOL, Allows the use of host backdrop brushes for the window.
|
||||
#define DWMWA_USE_IMMERSIVE_DARK_MODE 20 // [set] BOOL, Allows a window to either use the accent color, or dark, according to the user Color Mode preferences.
|
||||
#define DWMWA_WINDOW_CORNER_PREFERENCE 33 // [set] WINDOW_CORNER_PREFERENCE, Controls the policy that rounds top-level window corners
|
||||
#define DWMWA_BORDER_COLOR 34 // [set] COLORREF, The color of the thin border around a top-level window
|
||||
#define DWMWA_CAPTION_COLOR 35 // [set] COLORREF, The color of the caption
|
||||
#define DWMWA_TEXT_COLOR 36 // [set] COLORREF, The color of the caption text
|
||||
#define DWMWA_VISIBLE_FRAME_BORDER_THICKNESS 37 // [get] UINT, width of the visible border around a thick frame window
|
||||
#define DWMWCP_DEFAULT 0
|
||||
#define DWMWCP_DONOTROUND 1
|
||||
#define DWMWCP_ROUND 2
|
||||
#define DWMWCP_ROUNDSMALL 3
|
||||
#endif
|
||||
#define DWMWA_MICA_EFFFECT 1029
|
||||
|
||||
#define ALLOC(x) calloc(1, x)
|
||||
#define FREE(x) free(x)
|
||||
|
||||
|
@ -829,6 +829,17 @@ HRESULT STDMETHODCALLTYPE epw_Weather_SetGeolocationMode(EPWeather* _this, LONG6
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE epw_Weather_SetWindowCornerPreference(EPWeather* _this, LONG64 dwWindowCornerPreference)
|
||||
{
|
||||
InterlockedExchange64(&_this->dwWindowCornerPreference, dwWindowCornerPreference);
|
||||
INT preference = dwWindowCornerPreference;
|
||||
if (_this->hWnd)
|
||||
{
|
||||
DwmSetWindowAttribute(_this->hWnd, DWMWA_WINDOW_CORNER_PREFERENCE, &preference, sizeof(preference));
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
DWORD WINAPI epw_Weather_MainThread(EPWeather* _this)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
@ -1149,6 +1160,8 @@ HRESULT STDMETHODCALLTYPE epw_Weather_Initialize(EPWeather* _this, WCHAR wszName
|
||||
|
||||
HRESULT STDMETHODCALLTYPE epw_Weather_Show(EPWeather* _this)
|
||||
{
|
||||
INT preference = InterlockedAdd64(&_this->dwWindowCornerPreference, 0);
|
||||
DwmSetWindowAttribute(_this->hWnd, DWMWA_WINDOW_CORNER_PREFERENCE, &preference, sizeof(preference));
|
||||
PostMessageW(_this->hWnd, EP_WEATHER_WM_REBOUND_BROWSER, 0, 0);
|
||||
ShowWindow(_this->hWnd, SW_SHOW);
|
||||
_this->pTaskList->lpVtbl->DeleteTab(_this->pTaskList, _this->hWnd);
|
||||
|
@ -47,6 +47,7 @@ typedef interface EPWeather
|
||||
LONG64 bIsNavigatingToError; // interlocked
|
||||
LONG64 g_darkModeEnabled; // interlocked
|
||||
LONG64 dwGeolocationMode;
|
||||
LONG64 dwWindowCornerPreference;
|
||||
|
||||
HANDLE hMutexData; // protects the following:
|
||||
DWORD cbTemperature;
|
||||
@ -100,6 +101,7 @@ HRESULT STDMETHODCALLTYPE epw_Weather_GetIconSize(EPWeather* _this, LONG64* cbx,
|
||||
HRESULT STDMETHODCALLTYPE epw_Weather_SetDarkMode(EPWeather* _this, LONG64 dwDarkMode, LONG64 bRefresh);
|
||||
HRESULT STDMETHODCALLTYPE epw_Weather_IsDarkMode(EPWeather* _this, LONG64 dwDarkMode, LONG64* bEnabled);
|
||||
HRESULT STDMETHODCALLTYPE epw_Weather_SetGeolocationMode(EPWeather* _this, LONG64 dwGeolocationMode);
|
||||
HRESULT STDMETHODCALLTYPE epw_Weather_SetWindowCornerPreference(EPWeather* _this, LONG64 dwWindowCornerPreference);
|
||||
|
||||
static const IEPWeatherVtbl IEPWeather_Vtbl = {
|
||||
.QueryInterface = epw_Weather_QueryInterface,
|
||||
@ -125,6 +127,7 @@ static const IEPWeatherVtbl IEPWeather_Vtbl = {
|
||||
.SetUpdateSchedule = epw_Weather_SetUpdateSchedule,
|
||||
.SetDarkMode = epw_Weather_SetDarkMode,
|
||||
.SetGeolocationMode = epw_Weather_SetGeolocationMode,
|
||||
.SetWindowCornerPreference = epw_Weather_SetWindowCornerPreference,
|
||||
};
|
||||
|
||||
HRESULT STDMETHODCALLTYPE epw_Weather_static_Stub(void* _this);
|
||||
|
@ -62,4 +62,6 @@ import "unknwn.idl";
|
||||
HRESULT SetDarkMode([in] LONG64 dwDarkMode, [in] LONG64 bRefresh);
|
||||
|
||||
HRESULT SetGeolocationMode([in] LONG64 dwGeolocationMode);
|
||||
|
||||
HRESULT SetWindowCornerPreference([in] LONG64 dwWindowCornerPreference);
|
||||
};
|
Loading…
Reference in New Issue
Block a user