mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2025-02-07 14:51:28 +01:00
Disable weather flyout title bar if visual styles are not active
This commit is contained in:
parent
60f1bac1f1
commit
ef19e3d399
@ -508,7 +508,7 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
|
|||||||
}
|
}
|
||||||
return HRESULT_FROM_WIN32(ERROR_BUSY);
|
return HRESULT_FROM_WIN32(ERROR_BUSY);
|
||||||
}
|
}
|
||||||
else if ((uMsg == WM_KEYUP && wParam == VK_ESCAPE) || (uMsg == WM_ACTIVATEAPP && wParam == FALSE && GetAncestor(GetForegroundWindow(), GA_ROOT) != _this->hWnd))
|
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);
|
epw_Weather_Hide(_this);
|
||||||
return 0;
|
return 0;
|
||||||
@ -531,7 +531,10 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (uMsg == WM_CREATE)
|
BOOL bIsRunningWithoutVisualStyle = !IsThemeActive() || IsHighContrast();
|
||||||
|
if (uMsg == WM_CREATE)
|
||||||
|
{
|
||||||
|
if (bIsRunningWithoutVisualStyle)
|
||||||
{
|
{
|
||||||
SetRectEmpty(&_this->rcBorderThickness);
|
SetRectEmpty(&_this->rcBorderThickness);
|
||||||
if (GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_THICKFRAME)
|
if (GetWindowLongPtrW(hWnd, GWL_STYLE) & WS_THICKFRAME)
|
||||||
@ -546,7 +549,10 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
|
|||||||
}
|
}
|
||||||
SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (uMsg == WM_NCCALCSIZE)
|
else if (uMsg == WM_NCCALCSIZE)
|
||||||
|
{
|
||||||
|
if (bIsRunningWithoutVisualStyle)
|
||||||
{
|
{
|
||||||
if (lParam)
|
if (lParam)
|
||||||
{
|
{
|
||||||
@ -557,7 +563,10 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (uMsg == WM_NCHITTEST)
|
else if (uMsg == WM_NCHITTEST)
|
||||||
|
{
|
||||||
|
if (bIsRunningWithoutVisualStyle)
|
||||||
{
|
{
|
||||||
LRESULT lRes = DefWindowProcW(hWnd, uMsg, wParam, lParam);
|
LRESULT lRes = DefWindowProcW(hWnd, uMsg, wParam, lParam);
|
||||||
if (lRes == HTCLIENT)
|
if (lRes == HTCLIENT)
|
||||||
@ -578,17 +587,20 @@ LRESULT CALLBACK epw_Weather_WindowProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPA
|
|||||||
return lRes;
|
return lRes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (uMsg == WM_NCACTIVATE)
|
else if (uMsg == WM_NCACTIVATE)
|
||||||
|
{
|
||||||
|
if (bIsRunningWithoutVisualStyle)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}*/
|
}
|
||||||
|
}
|
||||||
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
|
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD WINAPI epw_Weather_MainThread(EPWeather* _this)
|
DWORD WINAPI epw_Weather_MainThread(EPWeather* _this)
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
DWORD bIsThemeActive = IsThemeActive();
|
|
||||||
|
|
||||||
SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
|
SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
|
||||||
|
|
||||||
@ -615,7 +627,7 @@ DWORD WINAPI epw_Weather_MainThread(EPWeather* _this)
|
|||||||
wc.style = CS_DBLCLKS;
|
wc.style = CS_DBLCLKS;
|
||||||
wc.lpfnWndProc = epw_Weather_WindowProc;
|
wc.lpfnWndProc = epw_Weather_WindowProc;
|
||||||
wc.hInstance = epw_hModule;
|
wc.hInstance = epw_hModule;
|
||||||
wc.hbrBackground = bIsThemeActive ? (HBRUSH)GetStockObject(BLACK_BRUSH) : (HBRUSH)GetStockObject(WHITE_BRUSH);
|
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
|
||||||
wc.lpszClassName = _T(EPW_WEATHER_CLASSNAME);
|
wc.lpszClassName = _T(EPW_WEATHER_CLASSNAME);
|
||||||
wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
|
wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
|
||||||
if (!RegisterClassW(&wc))
|
if (!RegisterClassW(&wc))
|
||||||
@ -650,13 +662,10 @@ DWORD WINAPI epw_Weather_MainThread(EPWeather* _this)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bIsThemeActive)
|
|
||||||
{
|
|
||||||
MARGINS marGlassInset = { -1, -1, -1, -1 }; // -1 means the whole window
|
MARGINS marGlassInset = { -1, -1, -1, -1 }; // -1 means the whole window
|
||||||
DwmExtendFrameIntoClientArea(_this->hWnd, &marGlassInset);
|
DwmExtendFrameIntoClientArea(_this->hWnd, &marGlassInset);
|
||||||
BOOL value = 1;
|
BOOL value = 1;
|
||||||
DwmSetWindowAttribute(_this->hWnd, 1029, &value, sizeof(BOOL));
|
DwmSetWindowAttribute(_this->hWnd, 1029, &value, sizeof(BOOL));
|
||||||
}
|
|
||||||
|
|
||||||
InterlockedExchange64(&_this->bBrowserBusy, TRUE);
|
InterlockedExchange64(&_this->bBrowserBusy, TRUE);
|
||||||
|
|
||||||
|
@ -2,6 +2,15 @@
|
|||||||
#define _H_EP_WEATHER_UTILITY_H_
|
#define _H_EP_WEATHER_UTILITY_H_
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
inline BOOL IsHighContrast()
|
||||||
|
{
|
||||||
|
HIGHCONTRASTW highContrast;
|
||||||
|
ZeroMemory(&highContrast, sizeof(HIGHCONTRASTW));
|
||||||
|
highContrast.cbSize = sizeof(highContrast);
|
||||||
|
if (SystemParametersInfoW(SPI_GETHIGHCONTRAST, sizeof(highContrast), &highContrast, FALSE))
|
||||||
|
return highContrast.dwFlags & HCF_HIGHCONTRASTON;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
inline void QueryVersionInfo(HMODULE hModule, WORD Resource, DWORD* dwLeftMost, DWORD* dwSecondLeft, DWORD* dwSecondRight, DWORD* dwRightMost)
|
inline void QueryVersionInfo(HMODULE hModule, WORD Resource, DWORD* dwLeftMost, DWORD* dwSecondLeft, DWORD* dwSecondRight, DWORD* dwRightMost)
|
||||||
{
|
{
|
||||||
HRSRC hResInfo;
|
HRSRC hResInfo;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user