From 8e318943c13625f468fca002e6e260146a929385 Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Thu, 3 Mar 2022 04:33:10 +0200 Subject: [PATCH] Weather: Fixed wrong height when taskbar is vertically aligned --- ExplorerPatcher/dllmain.c | 67 ++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/ExplorerPatcher/dllmain.c b/ExplorerPatcher/dllmain.c index b518865..5603702 100644 --- a/ExplorerPatcher/dllmain.c +++ b/ExplorerPatcher/dllmain.c @@ -4099,48 +4099,51 @@ SIZE WINAPI PeopleButton_CalculateMinimumSizeHook(void* _this, SIZE* pSz) int PeopleBand_MulDivHook(int nNumber, int nNumerator, int nDenominator) { - //printf("[MulDivHook] %d %d %d\n", nNumber, nNumerator, nDenominator); - AcquireSRWLockShared(&lock_epw); - if (epw) + if (nNumber != 46) // 46 = vertical taskbar, 48 = horizontal taskbar { - if (bWeatherFixedSize == 1) + //printf("[MulDivHook] %d %d %d\n", nNumber, nNumerator, nDenominator); + AcquireSRWLockShared(&lock_epw); + if (epw) { - int mul = 1; - switch (dwWeatherViewMode) - { - case EP_WEATHER_VIEW_ICONTEXT: - mul = 4; - break; - case EP_WEATHER_VIEW_TEXTONLY: - mul = 3; - break; - case EP_WEATHER_VIEW_ICONTEMP: - mul = 2; - break; - case EP_WEATHER_VIEW_ICONONLY: - case EP_WEATHER_VIEW_TEMPONLY: - mul = 1; - break; - } - ReleaseSRWLockShared(&lock_epw); - return MulDiv(nNumber * mul, nNumerator, nDenominator); - } - else - { - if (prev_total_h) + if (bWeatherFixedSize == 1) { + int mul = 1; + switch (dwWeatherViewMode) + { + case EP_WEATHER_VIEW_ICONTEXT: + mul = 4; + break; + case EP_WEATHER_VIEW_TEXTONLY: + mul = 3; + break; + case EP_WEATHER_VIEW_ICONTEMP: + mul = 2; + break; + case EP_WEATHER_VIEW_ICONONLY: + case EP_WEATHER_VIEW_TEMPONLY: + mul = 1; + break; + } ReleaseSRWLockShared(&lock_epw); - return prev_total_h; + return MulDiv(nNumber * mul, nNumerator, nDenominator); } else { - prev_total_h = MulDiv(nNumber, nNumerator, nDenominator); - ReleaseSRWLockShared(&lock_epw); - return prev_total_h; + if (prev_total_h) + { + ReleaseSRWLockShared(&lock_epw); + return prev_total_h; + } + else + { + prev_total_h = MulDiv(nNumber, nNumerator, nDenominator); + ReleaseSRWLockShared(&lock_epw); + return prev_total_h; + } } } + ReleaseSRWLockShared(&lock_epw); } - ReleaseSRWLockShared(&lock_epw); return MulDiv(nNumber, nNumerator, nDenominator); }