summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-05-14 09:34:52 +0200
committerAndras Timar <andras.timar@collabora.com>2018-05-17 15:23:45 +0200
commit2dbde06ab7dd730bf2ecbeb80103379fa9dddb29 (patch)
tree1e7dfb1b649b12eff2075120ef4af304432d8284 /vcl
parent47d735dff2d9f373945496666e235f266fa62eeb (diff)
tdf#96947 vcl opengl win: fix background of menu items w/ check/radio marks
Extract the actually used bounding box from the rendering code and reuse that for OpenGL texture purposes, so the available and the used size can't mismatch. The background itself is almost invisible, but the borders were lost due to this size difference. (cherry picked from commit b160db926b574b7e9d6696d49dbbce8dd289aade) Change-Id: I31b3e5aa0c0106461b90bfaab3a84d45b33afd71 Reviewed-on: https://gerrit.libreoffice.org/54324 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 96bb95e64240ddeb59d623d62fa30b2a7191bfc4)
Diffstat (limited to 'vcl')
-rw-r--r--vcl/win/gdi/salnativewidgets-luna.cxx51
1 files changed, 38 insertions, 13 deletions
diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx
index 73e780ca1584..2370efcfec69 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -498,6 +498,31 @@ static void impl_drawAeroToolbar( HDC hDC, RECT rc, bool bHorizontal )
}
}
+/**
+ * Gives the actual rectangle used for rendering by ControlType::MenuPopup's
+ * ControlPart::MenuItemCheckMark or ControlPart::MenuItemRadioMark.
+ */
+static tools::Rectangle GetMenuPopupMarkRegion(const ImplControlValue& rValue)
+{
+ tools::Rectangle aRet;
+
+ const MenupopupValue& rMVal(static_cast<const MenupopupValue&>(rValue));
+ aRet.Top() = rMVal.maItemRect.Top();
+ aRet.Bottom() = rMVal.maItemRect.Bottom() + 1; // see below in drawNativeControl
+ if (AllSettings::GetLayoutRTL())
+ {
+ aRet.Right() = rMVal.maItemRect.Right() + 1;
+ aRet.Left() = aRet.Right() - (rMVal.getNumericVal() - rMVal.maItemRect.Left());
+ }
+ else
+ {
+ aRet.Right() = rMVal.getNumericVal();
+ aRet.Left() = rMVal.maItemRect.Left();
+ }
+
+ return aRet;
+}
+
bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
ControlType nType,
ControlPart nPart,
@@ -1088,19 +1113,11 @@ bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
RECT aBGRect = rc;
if( aValue.getType() == ControlType::MenuPopup )
{
- const MenupopupValue& rMVal( static_cast<const MenupopupValue&>(aValue) );
- aBGRect.top = rMVal.maItemRect.Top();
- aBGRect.bottom = rMVal.maItemRect.Bottom()+1; // see below in drawNativeControl
- if( AllSettings::GetLayoutRTL() )
- {
- aBGRect.right = rMVal.maItemRect.Right()+1;
- aBGRect.left = aBGRect.right - (rMVal.getNumericVal()-rMVal.maItemRect.Left());
- }
- else
- {
- aBGRect.right = rMVal.getNumericVal();
- aBGRect.left = rMVal.maItemRect.Left();
- }
+ tools::Rectangle aRectangle = GetMenuPopupMarkRegion(aValue);
+ aBGRect.top = aRectangle.Top();
+ aBGRect.left = aRectangle.Left();
+ aBGRect.bottom = aRectangle.Bottom();
+ aBGRect.right = aRectangle.Right();
rc = aBGRect;
}
iState = (nState & ControlState::ENABLED) ? MCB_NORMAL : MCB_DISABLED;
@@ -1164,6 +1181,14 @@ bool WinSalGraphics::drawNativeControl( ControlType nType,
}
}
+ if (pImpl && nType == ControlType::MenuPopup && (nPart == ControlPart::MenuItemCheckMark || nPart == ControlPart::MenuItemRadioMark))
+ {
+ cacheRect = GetMenuPopupMarkRegion(aValue);
+ buttonRect = cacheRect;
+ keySize = cacheRect.GetSize();
+ }
+
+
ControlCacheKey aControlCacheKey(nType, nPart, nState, keySize);
if (pImpl != nullptr && pImpl->TryRenderCachedNativeControl(aControlCacheKey, buttonRect.Left(), buttonRect.Top()))
{