vcl/win/gdi/salnativewidgets-luna.cxx |   51 +++++++++++++++++++++++++---------
 1 file changed, 38 insertions(+), 13 deletions(-)

New commits:
commit 96bb95e64240ddeb59d623d62fa30b2a7191bfc4
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Mon May 14 09:34:52 2018 +0200

    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 <c...@libreoffice.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

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()))
     {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to