Commit Graph

34 Commits (309a656e00f5af7e403774f4064f76881441e4e8)

Author SHA1 Message Date
Méven Car 309a656e00 Screenshot effect: add a screenshotScreens(...) to screenshot specific screens 2020-09-30 07:44:30 +00:00
Vlad Zahorodnii 4ce853e8e4 Prettify license headers 2020-08-07 19:57:56 +00:00
Vlad Zahorodnii 1fb9f6f13a Switch to SPDX license markers
The main advantage of SPDX license identifiers over the traditional
license headers is that it's more difficult to overlook inappropriate
licenses for kwin, for example GPL 3. We also don't have to copy a
lot of boilerplate text.

In order to create this change, I ran licensedigger -r -c from the
toplevel source directory.
2020-08-07 19:57:56 +00:00
Méven Car e3df2e15a6 ScreenshotEffect: Use Service Property to authorize screenshot without confirmation
Summary:
Restrict to process with `X-KDE-DBUS-Restricted-Interfaces=org.kde.kwin.Screenshot` in their corresponding Service file,
 to take screenshots.
Such a program can now take immediate screenshots.

Adds a utility file to group KService related logic.

Needed for D29408

Reviewers: #kwin, apol, davidedmundson, bport, zzag

Reviewed By: #kwin, davidedmundson

Subscribers: ngraham, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29407
2020-06-16 19:00:04 +02:00
Méven Car 137a6a1705 ScreenShotEffect: Add a shouldReturnNativeSize argument to screenshotFullscreen
Summary:
Add a shouldReturnNativeSize to screenshotFullscreen so that KWin can export
screenshot that are screen pixel accurate.

Useful for spectacle to be able to do rectangular selection kind of screenshot.

Test Plan:
Example of a top screen using a 1.25 scale ratio being export in native resolution
{F8255144}
(The top screen has a bigger size than its virtual geometry and next screen doesn't overlap)

Example of the same screen in virtual resolution:
{F8255146}

Reviewers: #kwin, davidedmundson, bport, zzag, apol

Reviewed By: #kwin, davidedmundson

Subscribers: broulik, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29122
2020-04-29 19:16:22 +02:00
Méven Car 66898e7f46 Wayland: Allow to take single screen screenshots using scale factor without loss
Summary:
The screenshot made on screens with scale factor were downscaled by their scale factor making them blurry.
It prevents taking screenshots of missing Hidpi related bugs showing the issues under Wayland.

This fix the case of a single screenshot, but not the rest:
Multiscreen screenshot downscales the screen using scale factor.
Spectacle rectangular selection screenshot is broken as soon as some scale factor different than 1 is used on any screen.

Test Plan:
Under Wayland with a scale factor on a screen, take a screenshot using spectacle.
The output image is not downscaled and has the same size as the screen resolution.

No other change to any other screenshot mode, or under X.

Reviewers: davidedmundson, #kwin

Reviewed By: davidedmundson, #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29010
2020-04-20 16:12:26 +02:00
Albert Astals Cid e144748c7a Add some const &
Summary:
Won't make things go much faster since everything that was
being passed by value is refcounted but still const & is a bit faster
than refcounting

For shared pointers instead of adding const & we move them into the
destination variable saving some cpu usage but at the same time making
clear the pointer is being stored by not being const &

Reviewers: zzag

Reviewed By: zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25022
2019-10-30 19:23:01 +01:00
Vlad Zagorodniy 684b4b635e Use more traditional doxygen style
Summary:
So far we were following a bit unique and rare doxygen comment style:

    /**
     * Contents of the comment.
     **/

Doxygen comments with this style look balanced and neat, but many people
that contribute to KWin don't follow this style. Instead, they prefer
more traditional doxygen comment style, i.e.

    /**
     * Contents of the comment.
     */

Reviewing such changes has been a bit frustrating for me (so selfish!)
and for other contributors.

This change switches doxygen comment style in KWin to a more traditional
style. The main reason for doing this is to make code review process easier
for new contributors as well us.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22812
2019-07-29 22:06:19 +03:00
Vlad Zagorodniy d014f2ab74 [effects/screenshot] Use override keyword
Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16261
2018-10-17 02:39:53 +03:00
Martin Gräßlin d38bce776f Add support for skip close animation to OnScreenMessage
Summary:
This change adds support for marking the OnScreenMessage as it should
skip close animation. The screenshot effect is adjusted to use the
on screen message instead of the custom effect frame.

Test Plan: Message window is not captured when taking screenshot

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D4091
2017-01-25 13:54:34 +01:00
Martin Gräßlin b42eb9a310 [effects] Cleanup screenshot effect
Summary:
This change cleans up the screenshot effect a little bit.
* better check whether a screenshot is already being taken
* proper DBus error messages
* less duplication of error message strings
* don't keep the QDBusConnection around

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3493
2016-11-25 08:52:09 +01:00
Martin Gräßlin f9f7b84cb4 Add interactive position selection to screenshot screen under cursor
Summary:
A second interactive selection mode gets added to select a position on
the screen. This is handled by the same input event filter as for the
window selection. Just that instead of returning a window, it returns a
QPoint.

This allows to pick a point on the screen which we need to screenshot
the screen under the mouse cursor and in future for color picking.

The screenshot effect provides two new dbus methods to (interactively)
select a screen or fullscreen. This allows spectacle to screenshot the
(full) screen with still having the user in control.

Reviewers: #kwin, #plasma_on_wayland, bgupta

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3475
2016-11-25 07:38:37 +01:00
Martin Gräßlin fbab204968 [effects] Add a screenshot dbus method which takes a file descriptor
Summary:
The idea behind this mode is to support applications like spectacle
(see T4458). The calling application passes a file descriptor (created
through e.g. a pipe) and the screenshot effect writes the captured image
into that fd.

The advantage over the existing variant which writes to a file in the
/tmp directory is that this is peer-to-peer between the requesting
application and KWin. No other application can get to that image.

The change also includes setting SIGPIPE to ignore. It showed that when
the reading side already cancelled the read prior to KWin writing out
the image we get a SIGPIPE which results in application termination,
which is not what we want in case of a Wayland compositor. The sigpipe
can be ignored as Qt (and libpng) handles that error just fine at
runtime.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3412
2016-11-22 07:17:57 +01:00
Martin Gräßlin cfdc1acbd3 [effects] Show info message in interactive window screenshot mode
Summary:
While taking an interactive screenshot we should inform the user about
what's going on, how to take the screenshot and how to cancel it.

For this the effect creates an EffectFrame with the required
information.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3403
2016-11-22 07:17:28 +01:00
Martin Gräßlin 27376e39ef [effects] Add interactive window selection mode to ScreenshotEffect
Summary:
EffectsHandler gains a new method to startInteractiveWindowSelection
which just delegates to the one in Platform. That way a window can be
selected and returned to an Effect.

The screenshot effect makes use of this new functionality and provides
an interactive window screenshot mode which saves to a temporary file.
Note that this is not yet the variant intended for use in spectacle.

Test Plan: Took a screenshot on Wayland

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3367
2016-11-17 14:06:01 +01:00
Martin Gräßlin 8c163f2b93 [effects] Support capture cursor image in Screenshot effect
Summary:
The screenshot methods to blit the screen so far did not capture the
cursor image. But sometimes it is useful to also capture the cursor
image.

This change extends the exported methods to take an optional bool
argument whether to capture the screen. The default is not changed and
still not captures the cursor.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3118
2016-11-07 11:42:45 +01:00
Martin Gräßlin eadfcb3d4f [effects] Make screenshot effect work with multiple output rendering
Summary:
Adjusts the screenshot effect to mutliple output rendering. In that case
the blit from framebuffer can only get one output. Thus the effect needs
to blit every output and combine the rendering result.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3059
2016-10-17 09:03:22 +02:00
Martin Gräßlin e9b25f176a [effects] Delay taking screenshot into next rendering cycle
Summary:
For windows the screenshot effect already delayed the rendering into the
next cycle. But for the fullscreen variants which save to a file the
Screenshot effect did try to take the shot directly.

This can be problematic as e.g. the OpenGL context might not be bound at
all. Also this makes it impossible to screenshot multiple screens
together in the Wayland case.

This change delays the DBus replies, schedules the geometry and takes
the screenshot in the next rendering pass. It does not fix the
multiscreen wayland problem yet.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3052
2016-10-14 11:38:08 +02:00
Fredrik Höglund e30b1212b6 screenshot: Use the new matrix API
This makes the screenshot effect work when the scene is using
dynamically generated shaders.
2014-12-04 19:19:30 +01:00
Martin Gräßlin 3bbc9436db [kwin] Add a virtual Effect::requestedEffectChainPosition
This method replaces the X-KDE-ORDERING property in the Effect's desktop
files. This change is a preparation step for integrating the new Effect
Loader which doesn't read the ordering information. Thus it needs to be
provided by the Effect itself so that the EffectsHandler can properly
insert it into the chain.

Also for the built-in Effects on the long run it doesn't make much sense
to install the desktop files. And binary plugin effects will migrate to
json metadata which also doesn't have the KService::Ptr. Thus overall it
simplifies to read this information directly from the Effect.
2014-03-28 14:04:54 +01:00
Martin Gräßlin 1d2c2d5982 Use Q_SLOTS and Q_SIGNALS instead of slots and signals
Fixes compilation with Qt5/KF5 setup.
2013-07-24 09:46:54 +02:00
Martin Gräßlin 98a04893a6 Use mgraesslin@kde.org for my mail address in Copyright and AboutData 2013-03-12 13:17:53 +01:00
Martin Gräßlin b8c6831a1f Port Screenshot effect to XCB
This includes:
* getting cursor image through xcb_xfixes
* using xcb_image_get for reading screen content in xrender case
* using xcb_put_image to upload the generated screenshot into shared xpix

Overall this means that QPixmap as an X Pixmap wrapper is no longer used.
The conversion from xcb_image_t to QImage still needs some code for not
matching byte order. I'm a little bit unsure about adding the code as I
would not be able to test it.

REVIEW: 109076
2013-02-25 13:31:50 +01:00
Martin Gräßlin b7f06b8708 Use window size for offscreen texture size in screenshot effect
Effect used the display size which caused windows being larger than
either width or height not to be captured correctly.

Now it uses the window size for the offscreen texture which also requires
to adjust the modelviewprojection matrix.

As an unrelated change the pointer to GLRenderTarget and GLTexture are
changed to a QScopedPointer and some variables which got moved around
are consted.

BUG: 312851
FIXED-IN: 4.11
REVIEW: 108258
2013-01-15 15:05:43 +01:00
Aleix Pol 73c142fe45 Extend the screenshot effect API.
Makes it possible to take a screenshot for a given window ID.

REVIEW: 104388
2012-04-12 13:13:49 +02:00
Martin Gräßlin 27643f5a9e Drop kephal dependency from KWin
Kephal has turned into not being more than a wrapper around
QDesktopWidget and does not even provide syntax sugar.

REVIEW: 104427
2012-04-01 08:11:57 +02:00
Martin Gräßlin 2007a7eab8 Use namespaced parameters in signals
Required to get scripting bindings working.
2012-03-12 21:37:40 +01:00
Thomas Lübking 0cbe297d84 sanitize closed screenshot windows, ignore deleted
CCBUG: 288271
REVIEW: 103350
2011-12-10 21:25:57 +01:00
Martin Gräßlin fe4329a252 Only call active effects in the effect chain
Each effect is able to declare itself as currently being active,
that is transforming windows or painting or screen or doing anything
during the current rendered frame.

This change eliminates the hottest path inside KWin identified by
callgrind.

REVIEW: 102449
2011-08-29 07:06:58 +02:00
Martin Gräßlin 29e91f9042 Support for fullscreen, screen and region screenshot
Just to have something which uses the blitFramebuffer functionality.
2011-08-20 10:58:43 +02:00
Martin Gräßlin b3a5639967 EffectsHandler and Effect become QObjects
This is in preparation for allowing to connect effects with signals and slots.
2011-02-25 20:25:21 +01:00
Martin Gräßlin 0a7e48f7aa KWin uses kdelibs coding style. 2011-01-31 20:07:03 +01:00
Martin Gräßlin 379e1a268b Screenshot effect provides hooks for KSnapshot.
This adds a DBus slot to capture a window and the pixmap handle
is passed back via a DBus signal.
Previous code using a shortcut and saving to filesystem is dropped
completely in favor for ksnapshot.
See http://reviewboard.kde.org/r/4814/

svn path=/trunk/KDE/kdebase/workspace/; revision=1175353
2010-09-14 19:52:44 +00:00
Martin Gräßlin 49fea7de58 New screenshot effect.
Saves an image of the active window into the home directory when triggered.
It uses an OpenGL FBO and by that can include the alpha channel and the decoration shadows.

svn path=/trunk/KDE/kdebase/workspace/; revision=1157682
2010-07-31 20:55:48 +00:00