summaryrefslogtreecommitdiff
path: root/vcl/win
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-03-19 19:42:48 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-03-19 21:52:25 +0100
commit348407dfdf5fd41b99f5998463eb032128799555 (patch)
treea46607ac19f288a4f26e6bdb915332b445b7305c /vcl/win
parent32dc2d14287a4210589c33dbd62c6e36e095aa6e (diff)
Related: tdf#118320 tabitems appear as light in darkmode
so use a Button theme and matching button properties for drawing those instead as a workaround Change-Id: I5ba0e360adc109e80ab7ecb1ff2fd5bc84028b61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131852 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/win')
-rw-r--r--vcl/win/gdi/salnativewidgets-luna.cxx37
1 files changed, 36 insertions, 1 deletions
diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx
index 805db681a211..b58731f1db42 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -813,6 +813,32 @@ static bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
iState = TILES_FOCUSED; // may need to draw focus rect
else
iState = TILES_NORMAL;
+
+ // tabitem in tabcontrols gets drawn in "darkmode" as if it was a
+ // a "light" theme, so bodge this by drawing with a button instead
+ if (UseDarkMode())
+ {
+ iPart = BP_PUSHBUTTON;
+ switch (iState)
+ {
+ case TILES_DISABLED:
+ iState = PBS_DISABLED;
+ break;
+ case TILES_SELECTED:
+ iState = PBS_PRESSED;
+ break;
+ case TILES_HOT:
+ iState = PBS_HOT;
+ break;
+ case TILES_FOCUSED:
+ iState = PBS_DEFAULTED;
+ break;
+ default:
+ iState = PBS_NORMAL;
+ break;
+ }
+ }
+
return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption);
}
@@ -1148,9 +1174,18 @@ bool WinSalGraphics::drawNativeControl( ControlType nType,
break;
case ControlType::TabPane:
case ControlType::TabBody:
- case ControlType::TabItem:
hTheme = getThemeHandle(mhWnd, L"Tab", mpImpl.get());
break;
+ case ControlType::TabItem:
+ if (bUseDarkMode)
+ {
+ // tabitem in tabcontrols gets drawn in "darkmode" as if it was a
+ // a "light" theme, so bodge this by drawing with a button instead
+ hTheme = getThemeHandle(mhWnd, L"Button", mpImpl.get());
+ }
+ else
+ hTheme = getThemeHandle(mhWnd, L"Tab", mpImpl.get());
+ break;
case ControlType::Toolbar:
if( nPart == ControlPart::Entire || nPart == ControlPart::Button )
hTheme = getThemeHandle(mhWnd, L"Toolbar", mpImpl.get());