Introduce shadows API
ClosedPublic

Authored by zzag on Jan 6 2020, 10:30 AM.

Details

Summary

The new API provides a platform-independent way for setting drop-shadows
on a window. X11 and Wayland details are completely hidden from the users
of the new API, but you still need to be cautious about QPAs that destroy
the underlying native resources(e.g. wl_surface) upon a window becoming
hidden. It is highly recommended to install an event filter that reacts
to events of type QEvent::PlatformSurface.

Diff Detail

Repository
R278 KWindowSystem
Branch
kwindowshadow
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 20701
Build 20719: arc lint + arc unit
zzag created this revision.Jan 6 2020, 10:30 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptJan 6 2020, 10:30 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
zzag requested review of this revision.Jan 6 2020, 10:30 AM
zzag updated this revision to Diff 72880.Jan 6 2020, 12:44 PM

Remove pointless default member initializers in KWindowShadowPrivate.

Seems generally very clean and sensible. +1

I want to see plasma-framework/dialog.cpp and breeze ports before we merge.

src/kwindowshadow.h
201

For KWindowEffects I did put window tracking into the wayland plugin and it improved the readability of all the client code considerably.

I would recommend looking at doing so, especially as we could probably even share the implementation that kwayland-integration windoweffects.cpp has.

zzag added inline comments.Jan 6 2020, 1:23 PM
src/kwindowshadow.h
201

Could you please point me to that code?

davidedmundson added inline comments.Jan 6 2020, 1:28 PM
src/kwindowshadow.h
201

kwayland-integration

0a0c3f23fce265f36e5b8fb2b4b8bd311c7c1beb
src/windowsystem/windoweffects.cpp

zzag added inline comments.Jan 6 2020, 1:37 PM
src/kwindowshadow.h
201

Oh, that one... Yeah, perhaps it will be worth to handle surface creation/destruction in kwayland-integration.

zzag added inline comments.Jan 6 2020, 6:33 PM
src/kwindowshadow.h
201

Okay, looks like it's do-able. However, we would need to call QWidget::winId() in Breeze::ShadowHelper::installShadows() to create a QWindow...

zzag updated this revision to Diff 73352.EditedJan 12 2020, 6:58 PM
  • Make KWindowShadow a QObject subclass (for memory management)
  • Clarify that it is okay to call destroy() after window() had been destroyed
  • Check whether QWindow has QPlatformWindow associated with it
zzag retitled this revision from Introduce shadow API to Introduce shadows API.Jan 12 2020, 7:27 PM
zzag updated this revision to Diff 73728.Jan 16 2020, 5:57 PM

No noexcept

noexcept is a very rare thing to see in KF code so let's not deviate too much.

zzag updated this revision to Diff 73733.Jan 16 2020, 6:12 PM

Update doc.

davidedmundson accepted this revision.Jan 17 2020, 11:22 AM

Good stuff!

src/platforms/xcb/kwindowshadow_p_x11.h
46

We typically have an m_ prefix for member variables

*3

This revision is now accepted and ready to land.Jan 17 2020, 11:22 AM
zzag updated this revision to Diff 74055.Jan 21 2020, 11:56 PM

Set padding of 1 for missing borders

This revision was automatically updated to reflect the committed changes.