https://bugs.kde.org/show_bug.cgi?id=433776

--- Comment #1 from Vlad Zahorodnii <vlad.zahorod...@kde.org> ---
Git commit 1fb44b5bd500a32cb47062b41453848df1799f4f by Vlad Zahorodnii.
Committed on 09/03/2021 at 08:58.
Pushed by vladz into branch 'master'.

effects/screenshot: Prepare for versioned dbus interface

On Wayland, when the compositor sends a screenshot to the requesting
app, it encodes the screenshot as a PNG image and sends the encoded data
over the pipe. The requesting app (Spectacle) then needs to decode the
data.

The issue is that encoding PNG images is not cheap. This is the main
reason why Spectacle is shown with a huge delay after you press the
PrtScr key.

In order to fix the latency issue, we need to transfer raw image data.
Unfortunately, the current dbus api of the screenshot is too cluttered
and the best option at the moment is to start with a clean slate.

This change prepares the screenshot effect for versioned dbus interface.
Most of existing dbus logic was moved out in a separate class. In order
to schedule screen shots, the screenshot effect got some new API.

    QFuture<QImage> scheduleScreenShot(window, flags)
    QFuture<QImage> scheduleScreenShot(area, flags)
    QFuture<QImage> scheduleScreenShot(screen, flags)

If a dbus interface needs to take a screenshot, it needs to call one of
the overloaded scheduleScreenShot() functions. Every overload returns a
QFuture object that can be used for querying the result.

This change also introduces "sink" and "source" objects in the dbus api
implementation to simplify handling of QFuture objects.

Note that the QFutureInterface is undocumented, so if you use it, you do
it on your own risk. However, since Qt 5.15 is frozen for non-commercial
use and some other Plasma projects already use QFutureInterface, this
is not a big concern. For what it's worth, in Qt 6, there's the QPromise
class, which is equivalent to the QFutureInterface class.
Related: bug 430869

M  +1    -0    src/effects/screenshot/CMakeLists.txt
M  +307  -699  src/effects/screenshot/screenshot.cpp
M  +60   -139  src/effects/screenshot/screenshot.h
A  +860  -0    src/effects/screenshot/screenshotdbusinterface1.cpp    
[License: GPL(v2.0+)]
C  +61   -74   src/effects/screenshot/screenshotdbusinterface1.h [from:
src/effects/screenshot/screenshot.h - 066% similarity]

https://invent.kde.org/plasma/kwin/commit/1fb44b5bd500a32cb47062b41453848df1799f4f

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to