Bug 473358 - Bad repaint region for window caption leaves artifacts when text changes in tabletMode
Summary: Bad repaint region for window caption leaves artifacts when text changes in t...
Status: REPORTED
Alias: None
Product: Breeze
Classification: Plasma
Component: window decoration (show other bugs)
Version: master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-14 10:09 UTC by ratijas
Modified: 2023-08-16 21:24 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
glitches (38.92 KB, image/png)
2023-08-14 10:09 UTC, ratijas
Details
window-title.qml (240 bytes, text/x-qml)
2023-08-14 10:11 UTC, ratijas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ratijas 2023-08-14 10:09:07 UTC
Created attachment 160944 [details]
glitches

SUMMARY

With Tablet Mode (configurable in Workspace Behavior -> General Behavior -> Touch Mode) window decorations of Breeze become almost twice as large. However, when window caption text changes, it might leave a trail of artifacts due to bad repaint region not extending enough to the bottom.

STEPS TO REPRODUCE
1. Enable Touch Mode
2. Switch web browser tabs, or force change window caption text to change without resizing the window.
3. Resize the window.

OBSERVED RESULT
After step 2 you might get glitches artifacts as shown on the picture. After step 3 it should fully repaint and become normal.

EXPECTED RESULT
Text should repaint its full height.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.109.0
Qt Version: 5.15.10
Kernel Version: 6.4.10-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-6700HQ CPU @ 2.60GHz
Memory: 15.6 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 970M/PCIe/SSE2

ADDITIONAL INFORMATION

I use default AlignCenterFullWidth title alignment mode.

I *suspect* the offending code is in function Decoration::captionRect() or in Decoration::paintTitleBar which is the only client of captionRect. It could as well be Decoration::captionHeight() because it does not seem to be accounting for neither touch mode or font size.

It could also be a rounding error when converting QRectF::toRect()

>             QRect boundingRect(settings()->fontMetrics().boundingRect(c->caption()).toRect());

unlikely, however, because fontMetrics' height is disregarded in favor of captionHeight()
Comment 1 ratijas 2023-08-14 10:11:17 UTC
Created attachment 160945 [details]
window-title.qml

Simple QML snippet to help reproduce the issue. Literally just a QtQuick/Window with a title bound to TextInput's text.