vcl/qt5/Qt5Graphics_Controls.cxx          |    9 +------
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx |   35 ++++++++++++------------------
 2 files changed, 17 insertions(+), 27 deletions(-)

New commits:
commit 771f1411c588a02ed276febc9a479323bf4232cd
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Nov 19 11:23:33 2020 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Nov 19 18:10:24 2020 +0100

    tdf#138010 (II) getNativeControlRegion (gtk3/kf5): Consider frame's border
    
    Take the frame border/padding into account when calculating
    the content rectangle (i.e. the area that can safely be
    drawn into without overlapping the actual frame) when
    calculating dimensions in 'getNativeControlRegion' regardless
    of the exact 'DrawFrameFlags' being passed.
    
    Previously, gtk3 and qt5 only did this when the
    'DrawFrameFlags::NoDraw' flag was passed in addition,
    but the actual drawing routine 'drawNativeControl'
    does not make any such distinction, so the frame ended
    up at a place that was still in the "content rectangle"
    as calculated previously (which was the same as the bounding
    rect).
    
    Returning the actual content rect is a prerequisite
    for making 'VclScrolledWindow' take the width of a natively
    drawn frame into account, which will be done in a
    follow-up commit.
    
    Change-Id: I8d3a3fbd387108a24a0478e3465c8950e6d59735
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106155
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/qt5/Qt5Graphics_Controls.cxx b/vcl/qt5/Qt5Graphics_Controls.cxx
index 6f88d66a1c3b..9d6779621234 100644
--- a/vcl/qt5/Qt5Graphics_Controls.cxx
+++ b/vcl/qt5/Qt5Graphics_Controls.cxx
@@ -901,13 +901,8 @@ bool 
Qt5Graphics_Controls::getNativeControlRegion(ControlType type, ControlPart
         {
             if (part == ControlPart::Border)
             {
-                auto nStyle = static_cast<DrawFrameFlags>(val.getNumericVal() 
& 0xFFF0);
-                if (nStyle & DrawFrameFlags::NoDraw)
-                {
-                    int nFrameWidth
-                        = upscale(pixelMetric(QStyle::PM_DefaultFrameWidth), 
Round::Ceil);
-                    contentRect.adjust(nFrameWidth, nFrameWidth, -nFrameWidth, 
-nFrameWidth);
-                }
+                int nFrameWidth = 
upscale(pixelMetric(QStyle::PM_DefaultFrameWidth), Round::Ceil);
+                contentRect.adjust(nFrameWidth, nFrameWidth, -nFrameWidth, 
-nFrameWidth);
                 retVal = true;
             }
             break;
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx 
b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 74f7e421e2f5..6e91fc3503d2 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -2083,30 +2083,25 @@ bool GtkSalGraphics::getNativeControlRegion( 
ControlType nType, ControlPart nPar
     else if (nType == ControlType::Frame && nPart == ControlPart::Border)
     {
         aEditRect = rControlRegion;
-        DrawFrameFlags nStyle = 
static_cast<DrawFrameFlags>(rValue.getNumericVal() & 0xfff0);
-        if (nStyle & DrawFrameFlags::NoDraw)
-        {
-            GtkBorder padding;
-            gtk_style_context_get_padding(mpFrameInStyle, 
gtk_style_context_get_state(mpFrameInStyle), &padding);
 
-            GtkBorder border;
-            gtk_style_context_get_border(mpFrameInStyle, 
gtk_style_context_get_state(mpFrameInStyle), &border);
+        GtkBorder padding;
+        gtk_style_context_get_padding(mpFrameInStyle, 
gtk_style_context_get_state(mpFrameInStyle), &padding);
+
+        GtkBorder border;
+        gtk_style_context_get_border(mpFrameInStyle, 
gtk_style_context_get_state(mpFrameInStyle), &border);
 
-            int x1 = aEditRect.Left();
-            int y1 = aEditRect.Top();
-            int x2 = aEditRect.Right();
-            int y2 = aEditRect.Bottom();
+        int x1 = aEditRect.Left();
+        int y1 = aEditRect.Top();
+        int x2 = aEditRect.Right();
+        int y2 = aEditRect.Bottom();
 
-            rNativeBoundingRegion = aEditRect;
-            rNativeContentRegion = tools::Rectangle(x1 + (padding.left + 
border.left),
-                                             y1 + (padding.top + border.top),
-                                             x2 - (padding.right + 
border.right),
-                                             y2 - (padding.bottom + 
border.bottom));
+        rNativeBoundingRegion = aEditRect;
+        rNativeContentRegion = tools::Rectangle(x1 + (padding.left + 
border.left),
+                                         y1 + (padding.top + border.top),
+                                         x2 - (padding.right + border.right),
+                                         y2 - (padding.bottom + 
border.bottom));
 
-            return true;
-        }
-        else
-            rNativeContentRegion = rControlRegion;
+        return true;
     }
     else
     {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to