Commit graph

762 commits

Author SHA1 Message Date
David Edmundson
dd825dbfb3 Fix bad merge 2020-06-23 01:03:49 +01:00
David Edmundson
5ca1e73804 Merge branch 'Plasma/5.19' 2020-06-23 00:27:00 +01:00
David Edmundson
a664677051 Scope dragAndDropActionsChanged to source lifespan
The source can have a different lifespan to the offer being made.
If a source is removed and we get a drag actions changed before the
offer is cancelled we don't want to crash.

Couldn't reproduce locally, but the trace was good.

BUG: 423127
2020-06-23 00:23:53 +01:00
Vlad Zahorodnii
ac66d25364 Drop SurfaceInterface::inputIsInfitine
Since we don't guarantee SC and BC in KWaylandServer, we can drop
SurfaceInterface::inputIsInfitine().
2020-06-19 16:12:00 +00:00
David Edmundson
b332cb4d1f Assume enabled if DPMS is not supported
This fixes several unit tests in kwin where the virtual output is not
considered enabled causing behavioural changes.
2020-06-19 08:26:47 +00:00
Vlad Zahorodnii
45812785cf Introduce surface-to-buffer and buffer-to-surface matrices
The compositor needs to monitor changes in the mapping between the
surface local coordinates and the buffer coordinates because texture
coordinates correspond to the latter. One way to do it is to monitor
things such as the surface size, the buffer size, the buffer scale,
etc. The main problem with doing so is that there are so many factors
that contribute to how mapping between the surface local coordinate
space and the buffer coordinate space is performed.

In order to provide a generic way for monitoring changes in the mapping
between the surface local coordinate space and the buffer coordinate
space, this patch introduces two new matrices. The first one specifies
how the surface-local coordinates are mapped to buffer coordinates, and
the other one specifies how to map the buffer coordinates to surface
local coordinates.

With the new two matrices, the compositor has a generic way to get
notified when it has to re-compute texture coordinates.
2020-06-19 06:43:31 +00:00
David Edmundson
aa3f0f53c7 Add some hopefully useful documentation for people creating new interfaces
The generated classes don't really have documentation for the generated
methods. This hopes to provide some context.
2020-06-17 17:01:53 +01:00
Vlad Zahorodnii
0c8b77edc0 Drop unnecessary emptiness check
If a buffer is attached to the surface, its width or height cannot be 0.
2020-06-17 06:48:20 +00:00
David Edmundson
562a57945b Port AppMenu Interface to use autogenerated classes
Public API is identical except the now uneeded explit create on the
global.
2020-06-15 07:28:02 +00:00
David Edmundson
e712c5db2b Introduce API round primary-selection-unstable-v1.xml AKA middle-click paste
It's mostly a copy-paste of DataDevice.
2020-06-03 14:45:30 +01:00
Vlad Zahorodnii
963551d775 Add support for the wp_viewporter protocol
The wp_viewporter compositor extension allows clients to crop and scale
their surface. It can be useful for applications such as video players
because it may potentially reduce their power usage.
2020-06-02 15:33:00 +03:00
Vlad Zahorodnii
99ef521e6d Add methods for converting buffer and surface coordinates
Unfortunately, in order to map a point from the surface-local coordinate
space to the buffer pixel coordinate space, one cannot divide the point
by the scale factor since the buffer might be rotated or flipped.

This change introduces a couple of helper methods for converting points,
regions, and rectangles from the surface-local coordinates to the buffer
pixel coordinates and vice versa.
2020-06-01 17:04:50 +03:00
Vlad Zahorodnii
8651045c4b Mark the buffer transform as committed
We need to mark the buffer transform as committed or else it won't be
ever applied.
2020-06-01 17:04:50 +03:00
Vlad Zahorodnii
238f59365f Simplify code that emits mapped() and unmapped() 2020-06-01 17:04:50 +03:00
Vlad Zahorodnii
6bdd20d47b Introduce methods for retrieving individual buffer dimensions
The new methods can be useful when one wants to get the size of the
buffer along some specific dimension, e.g. width or height.

Of course, size() could be used for this purpose, but with the new
helper methods, one has to type less.
2020-06-01 17:04:50 +03:00
Vlad Zahorodnii
85161bb644 xdg-shell: Reset xdg_toplevel and xdg_popup on unmap 2020-06-01 14:48:51 +03:00
Vlad Zahorodnii
e3ad23ccd8 xdg-shell: Rewrite wrappers for the xdg-shell protocol
The current xdg-shell wrappers don't match existing abstractions in the
xdg-shell protocol well, which makes it more difficult to refactor code
that is responsible for managing configure events and geometry in kwin.

Given that the xdg_decoration and the xdg_shell protocols are tightly
coupled together, I had to rewrite our wrappers for the xdg_decoration
protocol as well.
2020-06-01 14:48:51 +03:00
Vlad Zahorodnii
5955d0486d xdg-shell: Drop support for v6
It's been deprecated for quite a while and all major toolkit already
support xdg_wm_base.
2020-06-01 14:48:51 +03:00
Vlad Zahorodnii
775dd4e134 xdg-shell: Drop support for v5
It's been deprecated for quite a while and all major toolkits already
support xdg_wm_base.
2020-06-01 14:48:51 +03:00
Adriaan de Groot
8715e441a7 Fix test-building on FreeBSD
This is the same change as
	https://invent.kde.org/frameworks/kwayland/-/merge_requests/2
and removes an unneeded #include
2020-05-31 22:40:11 +02:00
Benjamin Port
9ffee262f7 Fix class names for keyboard shortcuts inhibit 2020-05-29 11:30:10 +02:00
Benjamin Port
a452ff1642 Add keyboard_shortcuts_inhibit protocol
Reviewers: zzag, davidedmundson, apol

Subscribers: romangg, crossi, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D29231
2020-05-29 10:46:47 +02:00
Vlad Zahorodnii
ca210bf2b4 Add missing parameter name 2020-05-28 11:09:27 +03:00
Vlad Zahorodnii
6fd661bba9 Add some boring documentation for data control wrappers
This change adds some documentation that describes the purpose of data
control wrappers in a few words.
2020-05-28 11:09:27 +03:00
Vlad Zahorodnii
fc38e55547 No auto
"auto r" implies that it's a resource, but it's not.
2020-05-28 11:09:27 +03:00
Vlad Zahorodnii
1c3059c74b Fix class names for data control wrappers
The data control protocol is unstable. Therefore, class names must have
"V1" suffix.
2020-05-28 11:09:02 +03:00
Vlad Zahorodnii
c3094c686e Pedantic whitespace changes 2020-05-28 10:48:06 +03:00
David Edmundson
6156f86548 Add DataControl iface
Summary:
This patch makes use of wlroot's DataControl interface to support
clipboard management.

Unlike wl_data_device clipboards are sent on every change to all
watchers.
If the data device has a selection set it updates immediately.

Because it was started a year ago it uses the existing style of
wrapping objects. The unit test uses the new approach.

Test Plan:
Updated kwin
used wlroot's wl-copy, wl-paste which are xclip replacements to
show that the clipboard updated correctly

Reviewers: #kwin

Differential Revision: https://phabricator.kde.org/D29330
2020-05-26 13:32:56 +01:00
David Edmundson
149b836d43 Introduce AbstractDataSource round the DataSourceInterface
Summary:
Clipboard managers and middle click paste are new protocols.

We want to be able to copy from a clipboard manager to a regular
clipboard and vice versa without duplicating loads of code.

If we support kliper's "syncronise contents of the clipboard and
selection" inside the compositor that would become an unmanageable amount
of combinations.

It also potentially allows the idea of our XWayland bridge not being a
wayland client and simplifying that code.

Test Plan: Unit test passes

Reviewers: #kwin

Subscribers: zzag

Differential Revision: https://phabricator.kde.org/D29329
2020-05-26 12:49:01 +01:00
David Edmundson
395cc4f945 Manage active selection as active DataSource than DataDevice
Summary:
A DataDevice will have zero or one active DataSource as the seclection.

In the existing code we track the current data device then update it to
the newest data device
when the source inside a data device changes.

If we store the active data source inside Seat instead of the device
everything becomes
somewhat simpler and safer.

An entire unit test vanishes as that case of an externally set
DataDevice with no source
can no longer happen.

There's also a lot of duplication that's been merged in this patch so we
have one path.

There are some technical behavioural changes in particular we do cleanup
when the
source vanishes rather than the data device, but if anything that seems
safer and more correct.

It's a precursor for introducing an abstraction class round the source
without needing to meddle
with too much code.

Test Plan: Relevant unit tests passed, ran with it for a while with no
issue.

Reviewers: #kwin

Differential Revision: https://phabricator.kde.org/D29328
2020-05-26 09:31:03 +01:00
David Edmundson
81f9b8f0ff [BlurInterface] Port to the new approach
BlurInterface always used to be my go-to template when starting a new
protocol, we may as well make it up-to-date with the generation.

Code is reduced by a third.
2020-05-26 08:13:09 +00:00
Méven Car
286b68ea05 Add OutputInterface::isEnabled 2020-05-25 14:00:39 +02:00
Vlad Zahorodnii
4f4f425538 Drop support for wl_shell_surface
wl_shell_surface has been deprecated for quite a long time. Nowadays
most clients use the xdg-shell protocol to create desktop-style user
interface elements.
2020-05-20 16:09:30 +03:00
Méven Car
0e70af208c Fix test after OutputInterface: Initialize output in Off state
ctest passes again
2020-05-20 12:22:23 +02:00
Vlad Zahorodnii
15dd855ef9 GIT_SILENT: Remove .arcconfig and .arclint
KDE has switched to GitLab.
2020-05-20 12:02:43 +03:00
Méven Car
0f1bc5e8ca OutputInterface: Initialize output in Off state 2020-05-20 08:56:11 +02:00
David Edmundson
f7d9dd411c Drop deprecated QtSurfaceExtensionInterface
Summary: This isn't used by kwin or Qt anymore

Differential Revision: https://phabricator.kde.org/D29338
2020-05-18 16:20:57 +01:00
David Edmundson
07369dfee0 Support mulitple data devices on a single client
Summary:
Firefox has two wl_data_devices. One in firefox code one in GTK code.
Both need to get data offers.

I've left handling the case for multiple data devices and drags to make
this patch feasible to put into 5.19 and I didn't want to make this
patch invasive.

Test Plan:
Firefox in wayland
WAYLAND_DEBUG=1 firefox |& grep data
Shows now both created devices get offers
Also I can paste

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: meven, ngraham, zzag

Differential Revision: https://phabricator.kde.org/D29720
2020-05-18 13:05:48 +01:00
David Edmundson
9454421ff7 Support mulitple data devices on a single client
Summary:
Firefox has two wl_data_devices. One in firefox code one in GTK code.
Both need to get data offers.

I've left handling the case for multiple data devices and drags to make
this patch feasible to put into 5.19 and I didn't want to make this
patch invasive.

Test Plan:
Firefox in wayland
WAYLAND_DEBUG=1 firefox |& grep data
Shows now both created devices get offers
Also I can paste

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: ngraham, zzag

Differential Revision: https://phabricator.kde.org/D29720
2020-05-18 09:44:57 +01:00
Vlad Zahorodnii
7c7d9a117b [server] Introduce mapped() signal
Summary:
In KWin, we need to know when a sub-surface becomes mapped or unmapped
so we can generate or filter out window quads for the sub-surface.

Reviewers: #kwin, davidedmundson, apol

Reviewed By: #kwin, davidedmundson, apol

Differential Revision: https://phabricator.kde.org/D29256
2020-05-04 14:55:15 +03:00
David Edmundson
9ef8ce53ce Revert "Add wrapper for wl_global_remove"
This reverts commit 78a8b6877c.

Despite being a useful fix for an important crash it forces a dependency on
libwayland 1.8, which some distros don't have.
2020-04-30 13:32:18 +02:00
Aleix Pol
768de2aac4 Don't include the KWaylandServer namespace on includes 2020-04-30 12:01:30 +02:00
Aleix Pol
306f242ac8 Port namespaces and includes 2020-04-29 16:56:38 +02:00
Aleix Pol
5d4cd7dcd3 Fix build 2020-04-29 15:59:23 +02:00
Aleix Pol
d65c19cf4b Build standalone 2020-04-28 16:21:09 +02:00
Benjamin Port
129e2526b7 [Wayland] Add to PlasmaWindowManagement protocol windows stacking order
Reviewers: zzag, davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D29054
2020-04-27 17:22:05 +02:00
David Edmundson
78a8b6877c Add wrapper for wl_global_remove
Summary:
Removes the Global from the registry, but does not delete the underlying
wl_global

Removal of a global is racey in wayland.
A client could be trying to bind at that moment.

Typically globals are static for the lifespan of the compositor, however
there are exceptions

For those cases this call will can remove the global from the registry,
but still keep the wl_global instance alive
and handling bind requests.

The compositor can then remove the Global wrapper (this object) deleting
the wl_global after an arbitrary delay or
keep it around for re-use for the duration of the compositor.

Test Plan:
Unit test
Made blur global outlive BlurEffect - no longer disconnects plasma on config changes

Reviewers: #plasma, apol

Reviewed By: apol

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D28883
2020-04-24 15:45:39 +01:00
Vlad Zahorodnii
ad44b0f08c [server] Add some sub-surface life cycle signals
Summary:
These signals can be very useful when one wants to monitor changes in a
sub-surface tree.

Reviewers: #kwin, apol

Reviewed By: apol

Subscribers: apol, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D27860
2020-04-22 15:10:14 +03:00
David Edmundson
4967a1b507 [autotests] Optimistic attempt to fix RemoteAccessTest reilability
Summary:
In this test we are waiting on 4 events. 2 things via 2 threads. It was
unstable.

This patch avoids hardcoding a bunch of ifs() handling recieving
different orders, by waiting for both events.

We can't use QTRY_COMPARE as ConnectionThread does magic things with
QCoreApplication::eventDispatcher which don't work quite the same.

This is a bit of a shot in the dark. It passes 100% of the time locally,
lets see what CI manages to do :)

Test Plan: Ran test :)

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D28892
2020-04-17 15:01:55 +01:00
Aleix Pol
fb81fe7a10 Fix warnings
Summary:
Remove unused variables and members.
We were often storing the q of classes without ever needing them. I'd
just do it when it's useful. We do it in the private class so it can
always be added, removes boilerplate code.

Don't use std::move when returning temporary QImage. The compiler is
smart enough to know to do it but produces the warning "moving a
temporary object prevents copy elision".

Remove unused lambda captured variables.

Test Plan: Getting much cleaner build logs

Reviewers: #frameworks, #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D28442
2020-03-30 19:13:27 +02:00