vcl/win/gdi/salnativewidgets-luna.cxx |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

New commits:
commit b9464eadfc39c93f7c8beb04dc0d2b94b3a2e841
Author:     Sahil Gautam <sahil.gautam.ext...@allotropia.de>
AuthorDate: Fri Dec 27 02:41:49 2024 +0530
Commit:     Sahil Gautam <sahil.gautam.ext...@allotropia.de>
CommitDate: Fri Jan 17 09:07:34 2025 +0100

    Set StyleSettings::DisableColor value in Win
    
    WinSalFrame::UpdateSettings function loads colors from the widget
    toolkit into the StyleSettings objects. Themes uses these colors as
    default values.
    
    I tried using `OpenThemeData(mhWnd, L"Button")` to get the fill color
    value for background color, but didn't get the appropriate color.
    For the time being, modifying the ButtonRect luminance for the disabled
    state. Would replace it with something more appropriate as the Win32
    welding work progresses.
    
    Change-Id: Ied04a8c6c6cb01b1388ef1d744077ae6dfd27b1b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179439
    Reviewed-by: Sahil Gautam <sahil.gautam.ext...@allotropia.de>
    Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org>
    Tested-by: Jenkins
    Tested-by: Heiko Tietze <heiko.tie...@documentfoundation.org>

diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index 18946824ed99..993a0113dcff 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -543,25 +543,28 @@ static bool drawThemedControl(HDC hDC, ControlType nType, 
int iPart, int iState,
         if (iPart == BP_PUSHBUTTON)
         {
             Color aButtonColor = 
ThemeColors::GetThemeColors().GetButtonColor();
-            const Color& rButtonRectColor = 
ThemeColors::GetThemeColors().GetDisabledColor();
+            Color aButtonRectColor = 
ThemeColors::GetThemeColors().GetDisabledColor();
 
             if (iState == PBS_PRESSED)
-                aButtonColor.Merge(rButtonRectColor, 230);
+                aButtonColor.Merge(aButtonRectColor, 230);
             else if (iState == PBS_DISABLED)
-                aButtonColor = 
ThemeColors::GetThemeColors().GetDisabledColor();
+                if (UseDarkMode())
+                    aButtonRectColor.DecreaseLuminance(150);
+                else
+                    aButtonRectColor.IncreaseLuminance(150);
             else if (iState == PBS_HOT)
-                aButtonColor.Merge(rButtonRectColor, 170);
+                aButtonColor.Merge(aButtonRectColor, 170);
             else if (iState == PBS_DEFAULTED)
-                aButtonColor.Merge(rButtonRectColor, 150);
+                aButtonColor.Merge(aButtonRectColor, 150);
 
             ScopedHBRUSH hbrush(CreateSolidBrush(RGB(aButtonColor.GetRed(),
                                                      aButtonColor.GetGreen(),
                                                      aButtonColor.GetBlue())));
             FillRect(hDC, &rc, hbrush.get());
 
-            hbrush = 
ScopedHBRUSH(CreateSolidBrush(RGB(rButtonRectColor.GetRed(),
-                                                       
rButtonRectColor.GetGreen(),
-                                                       
rButtonRectColor.GetBlue())));
+            hbrush = 
ScopedHBRUSH(CreateSolidBrush(RGB(aButtonRectColor.GetRed(),
+                                                       
aButtonRectColor.GetGreen(),
+                                                       
aButtonRectColor.GetBlue())));
             FrameRect(hDC, &rc, hbrush.get());
             return true;
         }

Reply via email to