Schedule a decoration repaint when client is resized
ClosedPublic

Authored by zzag on Jan 26 2020, 1:29 PM.

Details

Summary

If a client has been resized, it doesn't necessarily mean that the
decoration theme will schedule full repaint of the window frame. In
OpenGL and Xrender scene, we have a little hack that forces a full
repaint of window borders. However, we don't have one in QPainter
scene which causes all sorts of weird looking artifacts when resizing
a server-side decorated client.

We could add yet another hack in the QPainter scene, but a better
approach to tackle this problem would be to make DecoratedClient
schedule a full repaint of the decoration. It makes code in scene
plugins more straightforward and prevents us from repeating the same
mistake again.

Test Plan

No longer able to see invisible decoration borders when
using QPainter render backend.

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
zzag created this revision.Jan 26 2020, 1:29 PM
Restricted Application added a project: KWin. · View Herald TranscriptJan 26 2020, 1:29 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
zzag requested review of this revision.Jan 26 2020, 1:29 PM
zzag added a comment.Jan 26 2020, 1:29 PM

I'm targeting branch Plasma/5.18.

zzag retitled this revision from Repaint decoration borders when client is resized to Schedule a decoration repaint when client is resized.Jan 26 2020, 1:44 PM
zzag edited the summary of this revision. (Show Details)Jan 27 2020, 9:11 AM
davidedmundson added inline comments.
plugins/scenes/opengl/scene_opengl.cpp
2566

Can you talk me through this change:

Previously when we have a non empty scheduled region but image sizes are dirty we didn't return early.

Was that purely a hack for decorations?

zzag updated this revision to Diff 74415.Jan 27 2020, 12:17 PM

Schedule a full repaint in markImageSizesDirty

zzag added inline comments.Jan 27 2020, 12:19 PM
plugins/scenes/opengl/scene_opengl.cpp
2566

This check verifies whether the decoration is actually dirty; that's it, either the decoration was damaged by a call to KDecoration2::Decoration::update() or the decorated client was resized.

Was that purely a hack for decorations?

I think that's a question I should ask. You added this check. :-)

zzag added inline comments.Jan 27 2020, 1:00 PM
decorations/decorationrenderer.cpp
47–48

I'm not happy about these two though. It would be nice to have DecoratedClient::sizeChanged or something.

zzag added inline comments.Jan 27 2020, 1:39 PM
plugins/scenes/opengl/scene_opengl.cpp
2566

The key assumption: if areImageSizesDirty() returns true, then the scheduled region is not empty.

zzag updated this revision to Diff 74485.Jan 28 2020, 11:19 AM

Use the newly added sizeChanged signal

davidedmundson accepted this revision.Jan 28 2020, 11:43 AM
davidedmundson added inline comments.
plugins/scenes/opengl/scene_opengl.cpp
2566

I think that's a question I should ask. You added this check. :-)

Ha, you're right.

Given markAsDirty schedules a region this should be fine.

This revision is now accepted and ready to land.Jan 28 2020, 11:43 AM
This revision was automatically updated to reflect the committed changes.