summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2020-11-19 11:23:33 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2020-11-19 18:10:24 +0100
commit771f1411c588a02ed276febc9a479323bf4232cd (patch)
treeb91ad5135c2c24083f650731c0ba91b41ede53bf /vcl/unx
parent70d2d1945a06dc6ec4f605e7462369a2f4937975 (diff)
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@posteo.de>
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx35
1 files changed, 15 insertions, 20 deletions
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
{