diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-01-31 16:08:53 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2023-02-01 06:27:55 +0000 |
commit | 6f4b8b7cfe2907b7da46eec6951a0e09b836a6de (patch) | |
tree | 7c12fa043732cc50ed08d2528b974315bfcc7c5d /vcl/qt5 | |
parent | 36343165c251e30c700360cc5c4266f576d4ac00 (diff) |
tdf#152073 qt: Draw background when drawing frame
For native drawing of a frame (border), use
the window background color as default color.
As mentioned in commit f39f21d92ec83c3a5062f29dd26214fc83012c06
("tdf#138010 (IV) VclScrolledWindow: Use actual border width"),
the Qt/KDE Breeze style uses a frame width of 2, with the
actual 1 pixel border being surrounded by a 1 pixel
padding/margin.
Transparent background did not ensure that the 1 pixel
padding/margin is repainted and could thus result
in artifacts from what was painted to that location
previously (s. the Basic IDE editor example from
tdf#152073).
Use the window background for the default image color
when drawing a frame to avoid this.
The gtk3 VCL plugin also explicitly draws a background
for the corresponding code path, using
`gtk_render_background`.
An alternative might be to explicitly draw the
background further up the call stack, or pass
an explicit background color from
`DecorationView::DrawFrame` and only apply
a default color in `QtGraphics_Controls::drawNativeControl`
when a background color (other than `COL_DEFAULT`)
is passed to that method.
Sample bt for gtk3:
1 GtkSalGraphics::drawNativeControl salnativewidgets-gtk.cxx 1835 0x7fffe6271f92
2 SalGraphics::DrawNativeControl salgdilayout.cxx 807 0x7fffee887739
3 OutputDevice::DrawNativeControl nativecontrols.cxx 287 0x7fffee58906e
4 (anonymous namespace)::ImplDrawFrame decoview.cxx 600 0x7fffee1b2055
5 DecorationView::DrawFrame decoview.cxx 886 0x7fffee1b32c8
6 ImplSmallBorderWindowView::DrawWindow brdwin.cxx 742 0x7fffee0ea3ea
7 ImplBorderWindow::Paint brdwin.cxx 1630 0x7fffee0ee99a
8 PaintHelper::DoPaint paint.cxx 313 0x7fffee0c9f1c
9 vcl::Window::ImplCallPaint paint.cxx 617 0x7fffee0cb4b3
10 PaintHelper::~PaintHelper paint.cxx 552 0x7fffee0cae14
11 vcl::Window::ImplCallPaint paint.cxx 623 0x7fffee0cb513
Many thanks to Rafael Lima for the
very helpful analysis in [1] and [2].
[1] https://bugs.documentfoundation.org/show_bug.cgi?id=152073#c2
[2] https://bugs.documentfoundation.org/show_bug.cgi?id=152073#c3
Change-Id: I08e6d05d0fc3d0e54952a65cd28dee92615df0a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146419
Reviewed-by: Rafael Lima <rafael.palma.lima@gmail.com>
Tested-by: Jenkins
Diffstat (limited to 'vcl/qt5')
-rw-r--r-- | vcl/qt5/QtGraphics_Controls.cxx | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/vcl/qt5/QtGraphics_Controls.cxx b/vcl/qt5/QtGraphics_Controls.cxx index e6e3d820da59..e08b84719e61 100644 --- a/vcl/qt5/QtGraphics_Controls.cxx +++ b/vcl/qt5/QtGraphics_Controls.cxx @@ -283,6 +283,7 @@ bool QtGraphics_Controls::drawNativeControl(ControlType type, ControlPart part, break; } [[fallthrough]]; // QPalette::Window + case ControlType::Frame: case ControlType::Menubar: case ControlType::WindowBackground: m_image->fill(QApplication::palette().color(QPalette::Window).rgb()); |