mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-23 23:21:08 +01:00
Weather: Registry setting to toggle dev tools in the browser
This commit is contained in:
parent
a69dffba61
commit
7ab3ac2be9
@ -114,6 +114,7 @@ DWORD bWeatherFixedSize = FALSE;
|
||||
DWORD dwWeatherTheme = 0;
|
||||
DWORD dwWeatherGeolocationMode = 0;
|
||||
DWORD dwWeatherWindowCornerPreference = DWMWCP_ROUND;
|
||||
DWORD dwWeatherDevMode = FALSE;
|
||||
WCHAR* wszWeatherTerm = NULL;
|
||||
WCHAR* wszWeatherLanguage = NULL;
|
||||
WCHAR* wszEPWeatherKillswitch = NULL;
|
||||
@ -4065,6 +4066,7 @@ SIZE WINAPI PeopleButton_CalculateMinimumSizeHook(void* _this, SIZE* pSz)
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
epw->lpVtbl->SetWindowCornerPreference(epw, dwWeatherWindowCornerPreference);
|
||||
epw->lpVtbl->SetDevMode(epw, dwWeatherDevMode);
|
||||
}
|
||||
}
|
||||
ReleaseSRWLockExclusive(&lock_epw);
|
||||
@ -6055,6 +6057,24 @@ void WINAPI LoadSettings(LPARAM lParam)
|
||||
}
|
||||
}
|
||||
|
||||
DWORD dwOldWeatherDevMode = dwWeatherDevMode;
|
||||
dwSize = sizeof(DWORD);
|
||||
RegQueryValueExW(
|
||||
hKey,
|
||||
TEXT("WeatherDevMode"),
|
||||
0,
|
||||
NULL,
|
||||
&dwWeatherDevMode,
|
||||
&dwSize
|
||||
);
|
||||
if (dwWeatherDevMode != dwOldWeatherDevMode && PeopleButton_LastHWND)
|
||||
{
|
||||
if (epw)
|
||||
{
|
||||
epw->lpVtbl->SetDevMode(epw, (LONG64)dwWeatherDevMode);
|
||||
}
|
||||
}
|
||||
|
||||
ReleaseSRWLockShared(&lock_epw);
|
||||
#endif
|
||||
|
||||
|
@ -67,6 +67,7 @@ DEFINE_GUID(IID_IEPWeather,
|
||||
#define EP_WEATHER_WM_FETCH_DATA (WM_USER + 10)
|
||||
#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_HEIGHT 391
|
||||
#define EP_WEATHER_WIDTH 690
|
||||
|
@ -308,16 +308,17 @@ HRESULT STDMETHODCALLTYPE ICoreWebView2_CreateCoreWebView2ControllerCompleted(IC
|
||||
pCoreWebView2Settings->lpVtbl->QueryInterface(pCoreWebView2Settings, &IID_ICoreWebView2Settings6, &pCoreWebView2Settings6);
|
||||
if (pCoreWebView2Settings6)
|
||||
{
|
||||
pCoreWebView2Settings6->lpVtbl->put_AreDevToolsEnabled(pCoreWebView2Settings6, FALSE);
|
||||
pCoreWebView2Settings6->lpVtbl->put_AreDefaultContextMenusEnabled(pCoreWebView2Settings6, FALSE);
|
||||
DWORD dwDevMode = InterlockedAdd64(&_this->dwDevMode, 0);
|
||||
pCoreWebView2Settings6->lpVtbl->put_AreDevToolsEnabled(pCoreWebView2Settings6, dwDevMode);
|
||||
pCoreWebView2Settings6->lpVtbl->put_AreDefaultContextMenusEnabled(pCoreWebView2Settings6, dwDevMode);
|
||||
pCoreWebView2Settings6->lpVtbl->put_IsStatusBarEnabled(pCoreWebView2Settings6, FALSE);
|
||||
pCoreWebView2Settings6->lpVtbl->put_IsZoomControlEnabled(pCoreWebView2Settings6, FALSE);
|
||||
pCoreWebView2Settings6->lpVtbl->put_IsGeneralAutofillEnabled(pCoreWebView2Settings6, FALSE);
|
||||
pCoreWebView2Settings6->lpVtbl->put_IsPasswordAutosaveEnabled(pCoreWebView2Settings6, FALSE);
|
||||
pCoreWebView2Settings6->lpVtbl->put_IsPinchZoomEnabled(pCoreWebView2Settings6, FALSE);
|
||||
pCoreWebView2Settings6->lpVtbl->put_IsSwipeNavigationEnabled(pCoreWebView2Settings6, FALSE);
|
||||
pCoreWebView2Settings6->lpVtbl->put_AreBrowserAcceleratorKeysEnabled(pCoreWebView2Settings6, FALSE);
|
||||
pCoreWebView2Settings6->lpVtbl->put_AreDefaultScriptDialogsEnabled(pCoreWebView2Settings6, FALSE);
|
||||
pCoreWebView2Settings6->lpVtbl->put_AreBrowserAcceleratorKeysEnabled(pCoreWebView2Settings6, dwDevMode);
|
||||
pCoreWebView2Settings6->lpVtbl->put_AreDefaultScriptDialogsEnabled(pCoreWebView2Settings6, dwDevMode);
|
||||
pCoreWebView2Settings6->lpVtbl->Release(pCoreWebView2Settings6);
|
||||
}
|
||||
pCoreWebView2Settings->lpVtbl->Release(pCoreWebView2Settings);
|
||||
@ -813,6 +814,29 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
else if (uMsg == EP_WEATHER_WM_SETDEVMODE)
|
||||
{
|
||||
if (_this->pCoreWebView2)
|
||||
{
|
||||
ICoreWebView2Settings* pCoreWebView2Settings = NULL;
|
||||
_this->pCoreWebView2->lpVtbl->get_Settings(_this->pCoreWebView2, &pCoreWebView2Settings);
|
||||
if (pCoreWebView2Settings)
|
||||
{
|
||||
ICoreWebView2Settings6* pCoreWebView2Settings6 = NULL;
|
||||
pCoreWebView2Settings->lpVtbl->QueryInterface(pCoreWebView2Settings, &IID_ICoreWebView2Settings6, &pCoreWebView2Settings6);
|
||||
if (pCoreWebView2Settings6)
|
||||
{
|
||||
pCoreWebView2Settings6->lpVtbl->put_AreDevToolsEnabled(pCoreWebView2Settings6, wParam);
|
||||
pCoreWebView2Settings6->lpVtbl->put_AreDefaultContextMenusEnabled(pCoreWebView2Settings6, wParam);
|
||||
pCoreWebView2Settings6->lpVtbl->put_AreBrowserAcceleratorKeysEnabled(pCoreWebView2Settings6, wParam);
|
||||
pCoreWebView2Settings6->lpVtbl->put_AreDefaultScriptDialogsEnabled(pCoreWebView2Settings6, wParam);
|
||||
pCoreWebView2Settings6->lpVtbl->Release(pCoreWebView2Settings6);
|
||||
PostMessageW(_this->hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0);
|
||||
}
|
||||
pCoreWebView2Settings->lpVtbl->Release(pCoreWebView2Settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
@ -1023,6 +1047,13 @@ HRESULT STDMETHODCALLTYPE epw_Weather_SetWindowCornerPreference(EPWeather* _this
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE epw_Weather_SetDevMode(EPWeather* _this, LONG64 dwDevMode)
|
||||
{
|
||||
InterlockedExchange64(&_this->dwDevMode, dwDevMode);
|
||||
PostMessageW(_this->hWnd, EP_WEATHER_WM_SETDEVMODE, dwDevMode, 0);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
DWORD WINAPI epw_Weather_MainThread(EPWeather* _this)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
@ -51,6 +51,7 @@ typedef interface EPWeather
|
||||
LONG64 g_darkModeEnabled; // interlocked
|
||||
LONG64 dwGeolocationMode;
|
||||
LONG64 dwWindowCornerPreference;
|
||||
LONG64 dwDevMode;
|
||||
|
||||
HANDLE hMutexData; // protects the following:
|
||||
DWORD cbTemperature;
|
||||
@ -113,6 +114,7 @@ HRESULT STDMETHODCALLTYPE epw_Weather_SetDarkMode(EPWeather* _this, LONG64 dwDar
|
||||
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);
|
||||
HRESULT STDMETHODCALLTYPE epw_Weather_SetDevMode(EPWeather* _this, LONG64 dwDevMode);
|
||||
|
||||
static const IEPWeatherVtbl IEPWeather_Vtbl = {
|
||||
.QueryInterface = epw_Weather_QueryInterface,
|
||||
@ -139,6 +141,7 @@ static const IEPWeatherVtbl IEPWeather_Vtbl = {
|
||||
.SetDarkMode = epw_Weather_SetDarkMode,
|
||||
.SetGeolocationMode = epw_Weather_SetGeolocationMode,
|
||||
.SetWindowCornerPreference = epw_Weather_SetWindowCornerPreference,
|
||||
.SetDevMode = epw_Weather_SetDevMode,
|
||||
};
|
||||
|
||||
static inline DWORD epw_Weather_GetTextScaleFactor(EPWeather* _this) { return InterlockedAdd64(&_this->dwTextScaleFactor, 0); }
|
||||
|
@ -64,4 +64,6 @@ import "unknwn.idl";
|
||||
HRESULT SetGeolocationMode([in] LONG64 dwGeolocationMode);
|
||||
|
||||
HRESULT SetWindowCornerPreference([in] LONG64 dwWindowCornerPreference);
|
||||
|
||||
HRESULT SetDevMode([in] LONG64 dwDevMode);
|
||||
};
|
Loading…
Reference in New Issue
Block a user