[Libreoffice-commits] core.git: vcl/qt5 vcl/unx
Michael Weghorn (via logerrit)
logerrit at kemper.freedesktop.org
Thu Nov 19 17:11:06 UTC 2020
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.weghorn at posteo.de>
AuthorDate: Thu Nov 19 11:23:33 2020 +0100
Commit: Michael Weghorn <m.weghorn at 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.weghorn at 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
{
More information about the Libreoffice-commits
mailing list