+fix: Settings2:DrawAnimatedWindow - support system settings (value = 0 or undefined)

This commit is contained in:
METANEOCORTEX\Kotti 2024-02-24 15:09:33 +01:00
parent 6aceba202a
commit f26b3602bd
6 changed files with 13 additions and 14 deletions

View File

@ -12,7 +12,7 @@ SettingsVersion=5
;DefaultDirectory=
;DefaultExtension=txt
;DenyVirtualSpaceAccess=0
;DrawAnimatedWindow=true
;DrawAnimatedWindow=0 ; 0 or undefined = use system settings, 1 = draw animated, 2 = do not draw animated
;filebrowser.exe=minipath.exe
;grepWin.exe=grepWinNP3.exe
;FileCheckInterval=2000 ;(min: 200[msec] - if equal or less, notify immediately)

View File

@ -1314,7 +1314,7 @@ void LoadSettings()
Settings2.IMEInteraction = ((codePage == 949 || codePage == 1361) ? SC_IME_INLINE : SC_IME_WINDOWED);
}
Settings2.DrawAnimatedWindow = IniSectionGetBool(IniSecSettings2, L"DrawAnimatedWindow", true);
Settings2.DrawAnimatedWindow = clampi(IniSectionGetInt(IniSecSettings2, L"DrawAnimatedWindow", 0), 0, 2);
Settings2.LaunchInstanceWndPosOffset = clampi(IniSectionGetInt(IniSecSettings2, L"LaunchInstanceWndPosOffset", 28), -10000, 10000);
Settings2.LaunchInstanceFullVisible = IniSectionGetBool(IniSecSettings2, L"LaunchInstanceFullVisible", true);

View File

@ -676,8 +676,7 @@ static bool GetTrayWndRect(LPRECT lpTrayRect) {
// Check to see if the animation has been disabled
// call SetAnimateMinimizeRestore(Settings2.DrawAnimatedWindow ? 1 : -1 | 0 for reset);
bool SetAnimateMinimizeRestore(const int flag)
bool SetAnimateMinimizeRestore(const unsigned flag)
{
static int systemFlag = 0;
bool bAnim = false;
@ -696,7 +695,7 @@ bool SetAnimateMinimizeRestore(const int flag)
bAnim = ai.iMinAnimate ? true : false;
systemFlag = 0;
}
else if (flag > 0) { // set animation
else if (flag == 1) { // set animation
ai.iMinAnimate = 1;
SystemParametersInfo(SPI_SETANIMATION, sizeof(ai), &ai, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
bAnim = true;
@ -713,7 +712,7 @@ bool SetAnimateMinimizeRestore(const int flag)
void MinimizeWndToTray(HWND hWnd) {
if (SetAnimateMinimizeRestore(Settings2.DrawAnimatedWindow ? 1 : -1)) {
if (SetAnimateMinimizeRestore(Settings2.DrawAnimatedWindow)) {
// Get the rect of the window. It is safe to use the rect of the whole
// window - DrawAnimatedRects will only draw the caption
@ -739,7 +738,7 @@ void MinimizeWndToTray(HWND hWnd) {
void RestoreWndFromTray(HWND hWnd) {
if (SetAnimateMinimizeRestore(Settings2.DrawAnimatedWindow ? 1 : -1)) {
if (SetAnimateMinimizeRestore(Settings2.DrawAnimatedWindow)) {
// Get the rect of the tray and the window. Note that the window rect
// is still valid even though the window is hidden
@ -4766,7 +4765,7 @@ void SnapToWinInfoPos(HWND hwnd, const WININFO winInfo, SCREEN_MODE mode, UINT n
}
else {
WINDOWPLACEMENT wndpl = WindowPlacementFromInfo(hwnd, &winInfo, mode, nCmdShow);
if (SetAnimateMinimizeRestore(Settings2.DrawAnimatedWindow ? 1 : -1) && wndpl.showCmd) {
if (SetAnimateMinimizeRestore(Settings2.DrawAnimatedWindow) && wndpl.showCmd) {
DrawAnimatedRects(hwnd, IDANI_CAPTION, &rcCurrent, &wndpl.rcNormalPosition);
}
SetWindowPlacement(hwnd, &wndpl); // 1st set correct screen (DPI Aware)
@ -4788,7 +4787,7 @@ void SnapToWinInfoPos(HWND hwnd, const WININFO winInfo, SCREEN_MODE mode, UINT n
GetMonitorInfo(MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY), &mi);
SetWindowLong(hwnd, GWL_STYLE, dwStyle & ~dwRmvFScrStyle);
WINDOWPLACEMENT const wndpl = WindowPlacementFromInfo(hwnd, NULL, mode, nCmdShow);
if (SetAnimateMinimizeRestore(Settings2.DrawAnimatedWindow ? 1 : -1) && wndpl.showCmd) {
if (SetAnimateMinimizeRestore(Settings2.DrawAnimatedWindow) && wndpl.showCmd) {
DrawAnimatedRects(hwnd, IDANI_CAPTION, &rcCurrent, &wndpl.rcNormalPosition);
}
SetWindowPlacement(hwnd, &wndpl);

View File

@ -40,7 +40,7 @@
// ----------------------------------------------------------------------------
// === MinimizeToTray Functions - see comments in Dialogs.c ===
bool SetAnimateMinimizeRestore(const int flag);
bool SetAnimateMinimizeRestore(const unsigned flag);
void MinimizeWndToTray(HWND hWnd);
void RestoreWndFromTray(HWND hWnd);

View File

@ -7630,16 +7630,16 @@ LRESULT MsgSysCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
return FALSE; // swallowed
}
else {
SetAnimateMinimizeRestore(Settings2.DrawAnimatedWindow ? 1 : -1);
SetAnimateMinimizeRestore(Settings2.DrawAnimatedWindow);
}
break;
case SC_MAXIMIZE:
SetAnimateMinimizeRestore(Settings2.DrawAnimatedWindow ? 1 : -1);
SetAnimateMinimizeRestore(Settings2.DrawAnimatedWindow);
break;
case SC_RESTORE: {
SetAnimateMinimizeRestore(Settings2.DrawAnimatedWindow ? 1 : -1);
SetAnimateMinimizeRestore(Settings2.DrawAnimatedWindow);
LRESULT lrv = DefWindowProc(hwnd, umsg, wParam, lParam);
ShowOwnedPopups(hwnd, true);
return (lrv);

View File

@ -770,7 +770,7 @@ typedef struct SETTINGS2_T {
int WrapAroundTooltipTimeout;
int LargeIconScalePrecent;
int DarkModeHiglightContrast;
bool DrawAnimatedWindow;
int DrawAnimatedWindow;
float AnalyzeReliableConfidenceLevel;
float LocaleAnsiCodePageAnalysisBonus;