Commit graph

941 commits

Author SHA1 Message Date
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
Aleix Pol
6d606ba393 Remove cppcheck from kwayland
Summary: Like we did on kwin, it doesn't work.

Test Plan: This very patch

Reviewers: #frameworks, davidedmundson

Reviewed By: davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D28309
2020-03-26 15:53:03 +01:00
David Edmundson
3c6e4ac0d1 [autotests/client] Set event queue on registry
Summary: Otherwise events are dispatched from the wrong thread.

Test Plan: Let's see if Jenkins to see if it hits that race condition again

Reviewers: #kwin

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D28263
2020-03-24 22:09:58 +00:00
David Edmundson
dcf03ad241 [xdgoutput] Only send initial name and description if set
Summary:
We hit this if we run an old kwin against new kwayland.

Kwin won't set the name so it's empty, so we'll call
zxdg_output_v1_send_name with an empty string

QtWayland will see that we receive this and update mOutputName to an
empty string which causes client issues.

Reviewers: #kwin

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D28245
2020-03-24 16:32:12 +00:00
David Edmundson
cbc38479d9 Add XdgOutputV1 version 2
Summary:
Will be useful for making plasma widgets not move about
on multi monitor. QtWayland already supports it

Test Plan: Unit test

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: apol, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D27535
2020-03-24 10:50:08 +00:00
Carson Black
148888b569 Broadcast application menu to resources when registering them
Summary:
Previously, KWayland wasn't hanging onto the application menu
to broadcast it when registering a resource. This fixes that.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kde-frameworks-devel, zzag

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D28168
2020-03-20 21:25:24 -04:00
Carson Black
53a0c4faec Add test for application menu in PWM interface
Test Plan: See that the test works as expected.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D28164
2020-03-20 12:59:10 -04:00
Aleix Pol
a20f5db598 Fix testTabletInterface 2020-03-20 01:06:28 +01:00
Aleix Pol
d4dad00b52 Provide an implementation for the tablet interface
Summary:
Implements the necessary classes to have proper support for the tablet and pen.
Doesn't implement yet the ring/slider/totem bits.

Test Plan:
Used it with Plasma and GTK clients, together with the kwin patch I'll submit soon.
https://youtu.be/GGx0TlNJlzs

Also I added a test.

Reviewers: #kwin, #frameworks, zzag, davidedmundson

Reviewed By: #kwin, zzag, davidedmundson

Subscribers: davidedmundson, zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D26858
2020-03-20 00:36:01 +01:00
Vlad Zahorodnii
74edaa85df [server] Don't make assumptions about the order of damage_buffer and attach requests
Summary:
The spec says nothing about the order between damage_buffer and attach
requests.

Test Plan: Firefox doesn't become frozen. Although there are still issues with resizing.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D28147
2020-03-19 22:40:12 +02:00
Vlad Zahorodnii
152d7250a5 Pass a dedicated fd to each keyboard for the xkb keymap
Summary:
To better isolate the clients from each other eachh KeyboardInterface
creates it's own dedicated temporary file and sends the fd for this
temporary file to the client. This means the memory for the keymap is no
longer shared between all clients, every client has an own copy.

To support this the existing API to set the keymap is deprecated and
replaced by a new method setKeymapData which takes the content of the
keymap as a byte array. The now deprecated method which takes a file
descriptor is changed to use the new setKeymapData method. For that it
reads the content of the file.

The implementation in KeyboardInterface to create the file descriptor is
based on the implementation of KWin. As I implemented the change in KWin
(see 3b4c508ee3) it is not a problem from
GPL vs LGPL perspective.

The change includes test cases to verify that the content of the keymap
is properly passed to the client and that the memory is no longer shared.

BUG: 381674

Reviewers: #kwin, #frameworks, davidedmundson, zzag

Reviewed By: #kwin, zzag

Subscribers: plasma-devel, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D14910
2020-03-19 16:04:10 +02:00
Vlad Zahorodnii
f073c773da [server] Introduce SurfaceInterface::boundingRect()
Summary:
The new method provides a convenient way for determining the rectangle
that bounds the given surface and all of its sub-surfaces. This can be
very handy when determining the effective window geometry.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: apol, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D27828
2020-03-18 16:19:49 +02:00
Andreas Cord-Landwehr
9267f146fd KWayland: Convert license headers to SPDX
Summary:
Convert license headers to SPDX expressions and add license files as
required by REUSE specification.

Reviewers: zzag

Reviewed By: zzag

Subscribers: kde-frameworks-devel

Tags: #frameworks

Maniphest Tasks: T11550

Differential Revision: https://phabricator.kde.org/D28058
2020-03-16 19:57:44 +01:00
Carson Black
56e2680122 Add application menu dbus paths to org_kde_plasma_window interface
Summary:
This patch adds an interface allowing a compositor to send
the service name and object path of a PlasmaWindow's application menu
to the client.

Reviewers: #kwin, zzag, davidedmundson

Reviewed By: #kwin, zzag, davidedmundson

Subscribers: davidedmundson, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D27464
2020-03-06 19:50:12 -05:00
Friedrich W. H. Kossebau
b5a08d87b7 Use ecm_qt_install_logging_categories over manual categories file 2020-02-12 23:56:17 +01:00
David Edmundson
ca7ff1ecc1 [surface] Fix buffer offset when attaching buffers to surfaces
Test Plan:
Unit test
Will be tested by hotspots in drag icons

Reviewers: #kwin

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D27190
2020-02-06 12:28:38 +01:00
Vlad Zahorodnii
1608b0d521 Update my last name 2020-01-24 03:06:11 +02:00
Friedrich W. H. Kossebau
6f69a44e2a Use K_DOXYGEN instead of deprecated DOXYGEN_SHOULD_SKIP_THIS
GIT_SILENT
2020-01-23 12:20:45 +01:00
Vlad Zahorodnii
a94443a6ff Update my email address 2020-01-14 18:26:11 +02:00
David Edmundson
6896e96014 [plasmashell] Update docs for panelTakesFocus to make it generic
Summary:
We want surfaces with a notification role to be able to switch ability
to take focus or not on the fly. The semantics are identical as the
panel
taking focus, we may as well re-use what exists and remove the implicit
limitation than re-invent the wheel and complicate things.

Test Plan: Docs

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, apol, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D26175
2019-12-30 15:44:49 +00:00
David Edmundson
95956415c6 [plasmashell] Add signal for panelTakesFocus changing
Test Plan: Attached unit test

Reviewers: apol

Reviewed By: apol

Subscribers: apol, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D25965
2019-12-30 15:44:49 +00:00
David Faure
d18012b50b Make test more tolerant timing-wise
NO_CHANGELOG
2019-12-07 22:10:49 +01:00
Roman Gilg
663d780e71 [server] Do not own dmabuf implementation
Summary:
The dmabuf implementation should be managed by the compositor and not by the
interface which might go away through signals while the implementation goes
away in the compositor simultaneously.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D25576
2019-11-27 21:52:10 +01:00
Vlad Zagorodniy
443721b555 [server] Make double-buffered properties in xdg-shell double-buffered
Summary:
So far all double-buffered properties in our implementation of xdg-shell
weren't actually double-buffered. When a property setter is invoked, we
pray to the God hoping that the client committed associated surface.

This change introduces private SurfaceRole class. The new class provides
a way for SurfaceInterface to commit pending state of associated shell
surface.

The chosen architecture allows us to do more in the future. For example,
we could use SurfaceRole to prevent associating several roles to a single
wl_surface object, e.g. xdg-toplevel to a pointer surface, etc.

Test Plan: This change breaks support for client-side decorated clients in KWin.

Reviewers: #kwin

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D23745
2019-11-26 22:49:04 +02:00
Roman Gilg
19f2fddc0a Add missing include for Qt 5.14 build 2019-11-22 15:26:23 +01:00
Jan Grulich
e8d192433d FakeInput: add support for keyboard key press and release
Summary: Adds support for keyboard button press and release as defined in linux/input-event-codes.h

Reviewers: davidedmundson, apol, #plasma, romangg

Reviewed By: davidedmundson, #plasma

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D23766
2019-10-22 13:23:58 +02:00
Friedrich W. H. Kossebau
75b287fdde Use ECMGenerateExportHeader to manage deprecated API better
Summary:
Allows
* projects linking to KWayland to hide deprecated API up to a
  given version or silence deprecation warnings after a given version,
  using
  * -DKWAYLAND_DISABLE_DEPRECATED_BEFORE_AND_AT
  * -DKWAYLAND_NO_DEPRECATED
  * -DKWAYLAND_DEPRECATED_WARNINGS_SINCE
  * -DKWAYLAND_NO_DEPRECATED_WARNINGS

  or
  * -DKF_DISABLE_DEPRECATED_BEFORE_AND_AT
  * -DKF_NO_DEPRECATED
  * -DKF_DEPRECATED_WARNINGS_SINCE
  * -DKF_NO_DEPRECATED_WARNINGS

No support for "EXCLUDE_DEPRECATED_BEFORE_AND_AT", needs to be done by
someone with detailed knowledge about disabling implementation, if wanted.

Reviewers: #kwin

Subscribers: zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D24663
2019-10-20 03:25:00 +02:00
Friedrich W. H. Kossebau
fe266fbb5f Fix non-integer scale copy on creation of OutputChangeSet
Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D24662
2019-10-15 15:04:13 +02:00
David Faure
31e2f9c5d7 [KWayland] Port away from deprecated API in Qt 5.14
Test Plan: Builds

Reviewers: davidedmundson, zzag

Reviewed By: zzag

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D24014
2019-09-17 14:20:17 +02:00
Frederik Gladhorn
baa1363558 Sort files alphabetically in cmake list
Summary: Adding further files is confusing, since the list is almost alphabetical.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D24002
2019-09-17 09:30:53 +02:00
Friedrich W. H. Kossebau
3e0bbe26fd Use new INCLUDE_DIRS with ecm_add_qch, to have doxygen see more includes
GIT_SILENT
2019-09-16 02:38:59 +02:00
Frederik Gladhorn
c778475f2a Improve documentation
Summary:
Some of the documentation did not say what the purpose of the
respective class was, but rather gave a tautology.
For people new to the code base it helps to mention that
DPMS is power management.

That DataDevice is for copy-and-paste and drag-and-drop is
maybe obvious to people used to X11 API, but not very clear
to most others.

When first reading the KWayland code, some explanations
help getting around.

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D23915
2019-09-15 20:59:53 +02:00
Frederik Gladhorn
f5d371a6bf Use const_iterator
Summary: When trivial, replace iterators with the const version.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D23917
2019-09-14 11:09:16 +02:00
Frederik Gladhorn
a942955b72 Remove capture of this in lambda
Summary: When this is not used, there is no point in capturing it.

Reviewers: #kwin, zzag, broulik

Reviewed By: #kwin, zzag, broulik

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D23916
2019-09-12 22:05:57 +02:00
David Edmundson
6568802c95 [server] Wrap proxyRemoveSurface in smart pointer
Summary:
proxyRemoteSurface is a fake wayland surface created for the drag and
drop between X and wayland clients.

The lifespan is not guaranteed to outlive the DataDevice.

Kwin closes Xwl before the other wayland client connections so it's
technically dangling for a bit when events could be dispatched.

Probably will never happen, but better to guard and be safe.

Test Plan: Compiles

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D22862
2019-08-28 18:38:25 +01:00
Roman Gilg
b8c28c8a85 [server] Use cached current mode more and assert validness
Summary:
We can use the cached current mode in one more case. Additionally make it
more explicit what a valid mode is and when to add them.

Test Plan: Relevant autotests pass. KWin Wayland nested and DRM session work.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D23535
2019-08-28 15:01:24 +02:00
Roman Gilg
77730f7fa7 [server] Cache current mode
Summary:
Instead of looping over all modes for retrieving current mode data copy it
to a separate variable.

Test Plan:
KWin auto tests pass and KScreen in Wayland nested session shows correct
information.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kde-frameworks-devel

Tags: #frameworks

Maniphest Tasks: T11459

Differential Revision: https://phabricator.kde.org/D23493
2019-08-28 13:10:27 +02:00
Roman Gilg
18ec7ff484 Implement zwp_linux_dmabuf_v1
Summary: This interface provides a way for clients to create generic dmabuf-based wl_buffers.

Test Plan: Works with weston-simple-dmabuf-drm and weston-simple-dmabuf-egl in KWin.

Reviewers: #kwin, #plasma, graesslin, davidedmundson, mart, fredrik

Subscribers: zzag, kde-frameworks-devel, romangg, plasma-devel

Tags: #frameworks, #plasma_on_wayland

Maniphest Tasks: T8067

Differential Revision: https://phabricator.kde.org/D10747
2019-08-06 21:44:45 +02:00
Vlad Zagorodniy
280a82844f Use wayland-protocols
Summary:
So far we've been copying protocol specifications from wayland-protocols
repo to kwayland repo. The main issue with copying is that we have to
keep xml files in sync manually. A better approach would be to use xml
specs straight from wayland-protocols package.

Test Plan: Compiles.

Reviewers: #kwin, #frameworks, romangg, davidedmundson

Reviewed By: #kwin, romangg, davidedmundson

Subscribers: davidedmundson, apol, romangg, asturmlechner, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D22216
2019-07-08 10:53:44 +03:00
Aleix Pol
f41fd9b9e4 --verbose 2019-06-22 14:56:52 +02:00
Aleix Pol
0d43606d40 Proof of concept of a wayland protocol to allow the keystate dataengine to work
Test Plan: Tested with both the lock screen and the keyboard indicator plasmoid

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D20191
2019-06-22 12:25:59 +02:00
Vlad Zagorodniy
fdc54a9960 Allow compositors to send discrete axis values
Summary:
So far not all v5 features were implemented because most of them are
optional. But given that XWayland needs axis_discrete event maybe it's
time to implement them.

CCBUG: 404152

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, mthw, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D18933
2019-05-17 11:52:15 +03:00
Laurent Montel
16db84d40b Use QVariant::fromValue directly 2019-05-17 07:25:01 +02:00
David Edmundson
49e0cf53d4 Implement set_window_geometry
Summary:
Used by clients to say where their true window geometry is relative to
the buffer size. Important if a client has client side shadows which
shouldn't be included for positioning tasks.

Technically this should be double buffered, but for consistency with all
other XdgShell properties this will be a task left to ShellClient.

Test Plan: Unit test

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D20595
2019-05-14 12:32:53 +01:00
Roman Gilg
a5c4c32f1c Implement wl_surface::damage_buffer
Summary:
Missing from our surface handling was the damage_buffer call introduced in
version 4 of the wl_compositor interface.

Its only difference to a normal damage call is that the damaged region is
supposed to be defined by the client in buffer coordinates instead of
surface coordinates. This damage must be tracked separately in KWayland
and on commit with the buffer transformation united with the normal damage.

Test Plan: Autotest updated.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15910
2019-05-08 09:50:32 +02:00
Kai Uwe Broulik
5a9df05460 Add CriticalNotification window type to PlasmaShellSurface protocol
Differential Revision: https://phabricator.kde.org/D20628
2019-05-02 10:11:40 +02:00
Erik Kurzinger
840268aa7e Implement wl_eglstream_controller Server Interface
Summary:
This implements a wrapper class for the wl_eglstream_controller Wayland
interface. It allows clients to inform the compositor when a new EGL Stream has
been created with an Wayland surface attached as its producer. The compositor
can then bind a GL texture as the stream's consumer allowing it access to the
surface's buffer contents for presentation. The only client currently expected
to make use of this interface is the NVIDIA EGL driver when running alongside a
compositor supporting EGLStream-based buffer sharing.

Reviewers: #kwin, romangg, davidedmundson

Reviewed By: #kwin, romangg, davidedmundson

Subscribers: kde-frameworks-devel

Tage: #frameworks

Differential Revision: https://phabricator.kde.org/D18824
2019-04-15 07:25:53 -07:00
David Edmundson
6dd0e17759 Hopefully fix flaky remote access test
Summary:
We have 4 events:

buffer1 created
buffer2 created
buffer1 paramters sent
buffer2 paramters sent

Some are batched

We should connect to buffer 1's parameters being sent after the first
buffer is recieved, not in the potential event loop waiting for buffer
2.

Test Plan:
Passes locally
Haven't tested on build.k.o

Reviewers: #kwin

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D19476
2019-03-04 10:22:47 +00:00
David Edmundson
58af3e8200 Only commit XdgOutput::done if changed
Summary:
XdgOutput no-ops if one calls setLogicalSize(someSize)  and someSize
matches the last sent size

However, as we have an explicit done signal, we currently end up sending
this regardless.

This patches tracks if we've made any changes to commit in the done
event.

CCBUG: 400987

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D19255
2019-02-25 14:13:05 +00:00
Jan Grulich
1cb96f6439 FakeInput: add support for pointer move with absolute coordinates
Summary: For remote desktop support, we need to move with the pointer using absolute positin.

Test Plan: I tested this with xdg-desktop-portal-kde and krfb and it worked.

Reviewers: davidedmundson, graesslin, zzag

Reviewed By: davidedmundson, zzag

Subscribers: graesslin, zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D18114
2019-02-14 13:44:36 +01:00
David Edmundson
7de356da21 Add explicit SurfaceInterface::commited signal
Summary:
Whilst some interfaces that are double-buffered against the wl_surface
are proxied through SurfaceInterface, some are not, most notably
XdgShell.

We need some low level signal to know when the surface has been
committed which doesn't rely on their being a damaged buffer.

Test Plan:
Unit test
Used in kwin

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D18582
2019-02-12 14:07:06 +00:00
Roman Gilg
d10ff90865 [server] Add surface data proxy mechanism
Summary:
Allows a compositor to set a proxy surface to handle drag and drop
operations place of the actual surface the drag originated from.

One proxy surface can handle multiple origin surfaces at the same time. These
need to get registered once. The active remote surface gets set when a pointer
button is pressed on the surface.

Test Plan: Manually with KWin's Xwayland DnD patches.

Reviewers: #kwin

Subscribers: davidedmundson, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15421
2019-02-06 10:51:54 +01:00
Roman Gilg
8b99a103b1 [server] Add selectionChanged signal
Summary: This signal notifies a compositor about selection changes on a seat.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15023
2019-02-06 09:30:42 +01:00
Vlad Zagorodniy
ba786ee2ec [server] Generate correct touch ids
Summary:
testWaylandSeat fails because the seat interface generates incorrect id
for the second touch.

Test Plan: testWaylandSeat passes.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D18628
2019-01-31 17:45:46 +02:00
Vlad Zagorodniy
0d170cecb4 [autotests] Stabilize testWindowmanagement
Summary:
In rare cases testWindowmanagement fails because the initial iconChanged
signal gets emitted after setIcon is called.

Reviewers: #kwin

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D18421
2019-01-31 17:45:19 +02:00
David Edmundson
2176e0bc3b Make XdgTest spec compliant
Summary:
Right now it worked in kwin, but was in fact breaking the spec sending
buffers before it was configured.

There also seems to be an unclearly written (but very very sensible)
rule about comitting the surface after initial properties in order to
recieve the configure event.

After these changes it works in Weston too.

Test Plan: Ran test in kwin_wayland and weston

Reviewers: #kwin

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D18577
2019-01-28 12:10:42 +00:00
Fabian Vogt
2184206c8b Add option to use wl_display_add_socket_auto
Summary:
If automaticSocketNaming is enabled, it will use wl_display_add_socket_auto
to allocate the next free socket. The resulting name can be retrieved using
socketName after a successful start afterwards.

Test Plan: Ran the new autotest, passes. kwin_wayland still uses the old behaviour.

Reviewers: #kwin, #plasma, romangg

Reviewed By: #kwin, #plasma, romangg

Subscribers: davidedmundson, zzag, romangg, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D17122
2019-01-25 13:32:03 +01:00
Vlad Zagorodniy
57e1bc0430 [server] Send initial org_kde_plasma_virtual_desktop_management.rows
Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D18521
2019-01-25 14:20:23 +02:00
Marco Martin
ee1e49ad68 Add rows info to the plasma virtual desktop protocol
Summary:
in order for the pager to work correctly and not having to use a weird mix of wayland and dbus apis, the rows
number needs to be in the protocol

Test Plan: new passing autotest

Reviewers: #plasma, #kwin, davidedmundson

Reviewed By: #plasma, #kwin, davidedmundson

Subscribers: zzag, davidedmundson, hein, kde-frameworks-devel

Tags: #frameworks

Maniphest Tasks: T4457

Differential Revision: https://phabricator.kde.org/D17691
2019-01-22 15:22:41 +01:00
Vlad Zagorodniy
5d775a4e28 [client] Wrap wl_shell_surface_set_{class,title}
Summary: We have to wrap these two requests just for convenience.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D18440
2019-01-22 10:54:05 +02:00
David Edmundson
613aeb79c5 Guard resource deletion in OuptutConfiguration::sendApplied
Summary:
A client (kscreen-doctor especially) can disconnect whilst kwin still
has an instance.

Test Plan:
Had reproducible crash on kscreen-doctor.
Now don't.

Reviewers: #kwin

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D18248
2019-01-14 17:02:21 +00:00
David Edmundson
fd4f77d884 Update @since information 2018-12-21 13:10:06 +00:00
David Edmundson
d7f23df9d5 Xdg Decoration Support
Summary:
Usual massive boilerplate.

Should allow us to remove the injection in our QPT, as Qt 5.12 implements
this protocol directly. Will probably be relevant for other toolkits as
it's more standardised than our custom one.

Client is mostly 1:1 with the protocol, server side has some tweaking to
fit with kwayland turning an event based API into a state based one.

Test Plan:
Relevant unit test
Tried in modified kwin with our QPT disabled

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D17498
2018-12-21 13:07:52 +00:00
Roman Gilg
5492ad5dc7 [server] Touch drag support
Summary: Adds functionality to do drag and drop with touch screens.

Test Plan: Manually. Autotest planned.

Reviewers: #kwin, #frameworks, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15464
2018-12-02 21:44:33 +01:00
Roman Gilg
28a9850466 [server] Allow multiple touch interfaces per client
Summary:
The touch related code in the seat interface class has been for no apparent
reason very different to pointer and keyboard code.

This patch makes touch related code more similar and by that allows a client
to receive touch events through multiple interfaces.

Test Plan: Manually and auto tests still pass.

Reviewers: #kwin, #frameworks, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15443
2018-12-02 21:38:07 +01:00
Laurent Montel
34f550970c Autogenerate logging file + fix categories file 2018-11-20 08:13:42 +01:00
Laurent Montel
c52c79ce3f Remove virtual keyword 2018-11-20 08:05:46 +01:00
Alexander Volkov
5259eaed03 Use lambdas instead of std::bind()
Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: bruns, davidedmundson, ivan, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16250
2018-11-19 14:46:16 +03:00
David Edmundson
0a44f73b3e Add VirtualDesktops to PlasmaWindowModel
Summary:
VirtualDesktops with the new plurality was added PlasmaWindowManagement,
but PlasmaWindowModel was left unchanged.

In behavioural changes, setting a window to be on all running desktops
should not mark it as being set on all desktops, they are 2 distinct
pieces of information.

Test Plan: Relevant unit test

Reviewers: #kwin, mart

Reviewed By: #kwin, mart

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16883
2018-11-15 11:56:03 +00:00
David Edmundson
08d4d5172d Update PlasmaWindowModel test to reflect VirtualDesktop changes
Summary:
Before we send the data we don't know what desktop a client is on.

It used to be neither on all desktops nor on any desktop, a corrupt
state.

After the virtual desktop changes the data will will indicate that we're
on all desktops until we're told otherwise, which is at least a valid
state.

Test Plan: Ran test

Reviewers: #kwin, mart

Reviewed By: #kwin, mart

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16880
2018-11-15 11:56:03 +00:00
David Edmundson
310c939570 Cleanup windowInterface in tests before windowManagement is destroyed
Test Plan: Valgrind was quieter on the virtual desktop test

Reviewers: #kwin, mart

Reviewed By: #kwin, mart

Subscribers: mart, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16877
2018-11-15 11:56:03 +00:00
David Edmundson
8dc537ff0a Delete the correct item in removeDesktop
Summary:
QList::erase will move the data underneath where the iterator is
pointing, we want to delete the entry we're about to remove from the
list.

Test Plan: Relevant tests now behave better

Reviewers: #kwin, broulik

Reviewed By: broulik

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16885
2018-11-15 10:19:26 +00:00
David Edmundson
1414e2abcc Cleanup Virtual Desktop Manager list entry in PlasmaVirtualDesktop destructor
Summary:
Current code contains a path to cleanup
PlasmaVirtualDesktopManagementInterface's list of destops if the
PlasmaVirtualDesktop object is destroyed.

However at the time that this is run, the entry in the list is already
dangling and therefore shouldn't be used.

This patch moves the cleanup logic into the destructor of
PlasmaVirtualDesktop, however this means we need to make sure
PlasmaVirtualDesktopManagementInterface outlives the
PlasmaVirtualDesktop by performing an explicit early cleanup instead of
relying on QObject.

Test Plan: Relevant unit test still passes.

Reviewers: #kwin, mart

Reviewed By: #kwin, mart

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16686
2018-11-13 16:16:19 +00:00
David Edmundson
800b0bece7 Correct version of newly added PlasmaVirtualDesktop interface
Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16701
2018-11-07 16:23:59 +00:00
Roman Gilg
5b4a9eeef3 [server] Text input content hint and purpose per protocol version
Summary:
Convert content hint and purpose according to used text-input protocol version.

This way we can use different specifiers, which enables us in the future to use
the default hint of v0 and the pin purpose of v3.

Also code is cleaner when using the correctly versioned specifier names according
to the protocol version.

Test Plan: Compiles, autotest passes.

Reviewers: #kwin, #frameworks, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16708
2018-11-07 14:40:51 +01:00
Roman Gilg
cd53ae5c28 [server] Put text-input (de-)activate, en-/disable callbacks in child classes
Summary:
The activate/deactivate and enable/disable callback functionality was in the
TextInputInterface::Private interface, but these calls are each specific to v0
and v2 of the protocol.

Since v3 will have again a different function signature, put all the callbacks
and their helper functions in the protocol version specific child classes.

Test Plan: Compiles, runs.

Reviewers: #kwin, #frameworks, davidedmundson, zzag

Reviewed By: #kwin, davidedmundson, zzag

Subscribers: zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16676
2018-11-06 13:55:09 +01:00
Roman Gilg
422e7789a6 [server] Put set surrounding text callback with uint in v0 class
Summary:
The set surrounding text request is only in v0 of text-input with uint arguments,
in v2 and v3 the call has the same signature.

To increase readability put the uint version in the v0 class implementation
and rename callbacks.

Test Plan: Compiles

Reviewers: #kwin, #frameworks, zzag

Reviewed By: #kwin, zzag

Subscribers: davidedmundson, zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16675
2018-11-06 13:49:14 +01:00
Laurent Montel
6f45c74471 Remove qt include prefixx 2018-11-06 07:22:36 +01:00
David Edmundson
d14a00b8e1 Cleanup comment typos 2018-11-05 15:05:40 +00:00
Roman Gilg
c27932ea07 [server] Put some text-input v0 exclusive callbacks in v0 class
Summary:
Requests

* reset
* commit_state
* invoke_action

are used in text-input v0 only and neither in v2 and upcoming
v3 of the unstable text-input protocol.

To increase readability put their callbacks in v0 interface class only.

Test Plan: Compiles

Reviewers: #kwin, #frameworks, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16673
2018-11-04 23:28:35 +01:00
Laurent Montel
f552ba47dc normalize signal/slot 2018-11-04 23:20:24 +01:00
Friedrich W. H. Kossebau
8079a195f5 Fix build with Qt <5.10 (no support for QCOMPARE(uint, int) 2018-11-03 19:17:52 +01:00
Marco Martin
f44ff394ba Add KWayland virtual desktop protocol
Summary:
Implement the virtual desktop protocol discussed in
T4457 xml protocol, client and server part.

The PlasmaVirtualDesktopManagement interface manages the desktops
instantiation and layout, each desktop is a PlasmaVirtualDesktop
instance which contains unique id, name and position.

PlasmaWindow has new events: plasmaVirtualDesktopEntered
and plasmaVirtualDesktopLeft when a window enters or leaves a desktop,
and desktops as the list of desktops is in. A window can be on
any subset of desktops, if the list is empty, it's considered on all desktops.

Test Plan: Autotest

Reviewers: #kwin, #plasma, graesslin, hein, davidedmundson

Reviewed By: #kwin, #plasma, davidedmundson

Subscribers: davidedmundson, zzag, bshah, romangg, kde-frameworks-devel

Tags: #frameworks

Maniphest Tasks: T4457

Differential Revision: https://phabricator.kde.org/D12820
2018-11-01 16:34:30 +01:00
David Edmundson
2ba9f0c3ce Add unit test for subsurface input mask detection
Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15900
2018-10-29 10:09:43 +00:00
David Edmundson
bd7acc0ee2 Guard data source being deleted before processing dataoffer receive event
Summary:
A data source can disappear at any moment, it's plausible a client could
have requested data whilst the client was alive and we are processing it
afterwards.

The accept and finish callback guard against the source being deleted,
but recieve did not.

BUG: 400311

Test Plan: Could still copy/paste as before

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16431
2018-10-29 10:09:29 +00:00
Roman Gilg
96967485ba [server] Respect input region of sub-surfaces on pointer surface focus
Summary:
KWayland takes always the top-most child surface at a given position for its
pointer input. But if a sub-surface sets its input region, it should not select
this one when the position is out of its input region, but rather try the
surface below.

Test Plan:
My testing was only on my Xwayland branch. Supposed to also fix a problem
with Firefox native Wayland port.

Reviewers: #frameworks, graesslin, davidedmundson

Reviewed By: davidedmundson

Subscribers: davidedmundson, zzag, kde-frameworks-devel, graesslin, plasma-devel

Tags: #frameworks, #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D7038
2018-10-24 13:57:48 +02:00
David Edmundson
1955e15afa [test/xdgtest] Create/destroy popup on click
Summary:
This allows a dev to move the window before creating the popup which
is extremely useful in testing constraints. Also makes it very easy to
mod this code into a grabbing popup for other tests.

This patch also improve the painted surfaces to show the anchor rect
around where we place the popup which is easier for visual debugging.

No library code changes

Test Plan:
Ran the test
KWin doesn't position the popup according to all constraints
Soon will

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16294
2018-10-20 16:38:52 +01:00
David Edmundson
4bbc085e0e [xdgshell] Add positioner constraint adjustment flag operators
Test Plan: Used in kwin

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16318
2018-10-20 16:38:03 +01:00
David Edmundson
6414100de3 Don't silently error if damage is sent before buffer
Summary:
Firefox sends

wl_surface@37.damage(0, 0, 808, 622)
wl_surface@37.attach(wl_buffer@34, 0, 0)

Which we silently treat as an error.

There's nothing in the spec to forbid this. The only thing that matters
is the state on commit. This moves a check there.

CCBUG: 397834

Test Plan:
Had a debug in there which was being activated
Gets firefox slightly further (but not complete)

Reviewers: #kwin

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15912
2018-10-08 09:15:59 +01:00
Roman Gilg
de6f5a74ff [server] Do not return early on fail in touchDown fall back code
Summary:
Returning early would mean that SeatInterface::Private::touchInterface.ids
does not contain the id. Then the assert would fail in touchUp at some
point later when called by the compositor.

Reviewers: #kwin, #frameworks, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15468
2018-09-18 21:56:43 +02:00
Kevin Funk
29b8d0f258 Minor: Add a few nullptrs 2018-09-13 09:56:34 +02:00
Kevin Funk
32d4edff51 Minor: Include Qt dirs as SYSTEM includes 2018-09-13 09:38:09 +02:00
Kevin Funk
68625a500d Minor: Fix CMake AUTOMOC warning 2018-09-13 09:38:01 +02:00
Yuri Chornoivan
96df0ea6ae Fix minor EBN issues 2018-09-12 20:49:38 +03:00
Roman Gilg
88fde0b4ce [server] Fix remote access buffer handling when output not bound
Summary:
If a client has not bound a certain output do not directly return
but try to deliver the buffer to other clients.

If none of them has requested it, send bufferReleased signal
immediately to let compositor know that the buffer should
be cleaned up.

Test Plan: Manually. Autotest planned.

Reviewers: #kwin, #frameworks, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: jgrulich, davidedmundson, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15422
2018-09-11 17:40:02 +02:00
Vlad Zagorodniy
44f0d3ced0 [autotests] Compare booleans to booleans
Summary:
Compiler errors:

17:06:23 /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/testDataDevice.dir/test_datadevice.cpp.o: in function `TestDataDevice::testDrag()':
17:06:23 /home/jenkins/workspace/Frameworks kwayland kf5-qt5 SUSEQt5.9/autotests/client/test_datadevice.cpp:290: undefined reference to `bool QTest::qCompare<int, bool>(int const&, bool const&, char const*, char const*, char const*, int)'
17:06:23 /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/testDataDevice.dir/test_datadevice.cpp.o: in function `TestDataDevice::testDragInternally()':
17:06:23 /home/jenkins/workspace/Frameworks kwayland kf5-qt5 SUSEQt5.9/autotests/client/test_datadevice.cpp:369: undefined reference to `bool QTest::qCompare<int, bool>(int const&, bool const&, char const*, char const*, char const*, int)'

Test Plan: Ran testDataDevice, still passes.

Reviewers: #kwin, romangg, broulik

Reviewed By: broulik

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15330
2018-09-07 16:01:21 +03:00
Yuri Chornoivan
94b5140b53 Fix minor EBN issues 2018-09-06 22:24:21 +03:00
Roman Gilg
a160143d57 [server] Do not try to create data offers without source
Summary: An internal drag is without data source. Still we tried to create offers.

Test Plan: This change makes the updated autotest in D15072 pass without errors.

Reviewers: #kwin, hein

Reviewed By: hein

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15074
2018-09-06 15:56:15 +02:00
Roman Gilg
c9bac2d41d [server] Abort drag start on correct conditions and without posting error
Summary:
A drag start request should be dismissed when the client does not have an
implicit pointer grab or the currently focused pointer surface is not the
origin. The conditions for that were wrong in the past.

Also just ignore the request and not post directly an error, that potentially
kills the client since by concurrency the client might have send a valid
request, that got invalidated through grab or focus change at the same time
on the server side.

Test Plan: Manually and autotest.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: adridg, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15072
2018-09-06 15:53:26 +02:00
David Edmundson
a225438213 Sync set/send/update methods
Summary:
Currently whenever a single client binds we would incorrectly send an
EDID/uuid/enabled update to every client.

This syncs every property into following the same set/send/update
pattern everywhere.

Test Plan: Existing unit tests

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D14505
2018-08-08 18:37:09 +01:00
Daniel Vrátil
110f896acb Add serial number and EISA ID to OutputDevice interface
Reviewers: graesslin, sebas, #kwin, dvratil, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kde-frameworks-devel, davidedmundson, plasma-devel

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D10040
2018-08-08 18:37:02 +01:00
David Edmundson
84a3330bfc Fix unit test
We now have one extra method so we get one more change event so count in
this test needs updating.

Ideally we should only update once; this test was written hardcoding the
values that currently happen rather than what should happen; but that's
a commit for another day.
2018-08-05 18:04:53 +02:00
Roman Gilg
17832e8adc Output device color curves correction
Summary:
Extends the output device and output configuration interfaces with the
ability
to query and set the RGB color intensity curves (gamma ramps) of the
associated output.

Test Plan: Manually. Auto tests will be added to this diff soon.

Reviewers: #frameworks, graesslin, romangg

Subscribers: kde-frameworks-devel, graesslin, davidedmundson, zzag,
cfeck

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D12388
2018-08-05 18:04:53 +02:00
David Edmundson
fa1b65bb5a Fix memory management in WaylandOutputManagement
Summary:
There was no destructor in the protocol, which meant the auto generated
_destroy function only deletes the wl_proxy object, but doesn't actually
send anything to the server.

Result was OutputConfiguration objects on
the server just linger forever and it's a broken state

Test Plan: Added unit test that objects have the lifespan they should do

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13730
2018-08-05 18:04:53 +02:00
David Edmundson
ec7e16c8b7 Isolate every test within WaylandOutputManagement
Summary:
The current code used the same outputInterface between all tests, with
data and outdated connections slowly accumulating.

This meant most the code didn't work as it was intended, for
example testExampleConfig had the config applied from the connect in the
previous test. It just happened to pass.

This resets everything between each test.

Test Plan:
Can now add a test without going insane
Existing tests still pass

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13729
2018-08-05 18:04:53 +02:00
David Edmundson
961bcbde08 OutputManagement fractional scaling
Summary:
In order to have fractional scaling in kwin, we need to communicate it with
kscreen, which means changing the data type in our config protocols.

This introduces a new method on outputdevice and outputconfiguration
to set/request scale as a float.

wl_output is and should remain unchanged as an int

No urgent rush for reviewing/merging this as it's useless without other changes.

Test Plan: Attached unit tests

Reviewers: #kwin, romangg

Subscribers: romangg, zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13601
2018-08-05 18:04:53 +02:00
David Edmundson
2a3b34ae6a Cleanup RemoteAccess buffers on aboutToBeUnbound instead of object destruction
Summary:
The destructor or Resource::~Resource will delete the d-pointer used by
Resource before we reach QObject::~QObject() of the resource which emits
the destroyed signal. This means this lamba is accessing deleted
contents.

Based on
https://build.kde.org/view/Frameworks/job/Frameworks%20kwayland%20kf5-qt5%20SUSEQt5.10/71/testReport/

aboutToBeUnbound is emitted before object destruction.

Test Plan: Relevant unit test still passes and this lambda is still invoked.

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D14291
2018-07-24 13:36:55 +02:00
Roman Gilg
a2489a4110 Support cursor hints on locked pointer
Summary:
Implement support for locked pointer cursor hints. Cursor hints can be
retrieved by the compositor either continuously by connecting to the
cursorHintChanged signal or only when needed. In the later case the
compositor must connect to the aboutToUnbound signal of the locked pointer
interface in order to fetch the last hint before the interface is unbound.

Test Plan: Autotest added.

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: davidedmundson, kde-frameworks-devel

Tags: #frameworks

Maniphest Tasks: T4692

Differential Revision: https://phabricator.kde.org/D14175
2018-07-23 10:54:54 +02:00
Roman Gilg
7809e83049 Reduce unnecessary long wait times on failing signal spies
Summary:
Several signal spies, which were supposed to fail, were waiting for the
default 5 seconds, which is most often unnecessary long.

This patch sets a time limit of 500ms in suitable cases. Reduces for me
the total test time by 40%.

Test Plan:
Before (with fixed seat and selection tests):
98% tests passed, 1 tests failed out of 45

Total Test time (real) = 173.31 sec

The following tests FAILED:
         19 - kwayland-testWindowmanagement (Failed)

After:
98% tests passed, 1 tests failed out of 45

Total Test time (real) = 102.12 sec

The following tests FAILED:
         19 - kwayland-testWindowmanagement (Failed)

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D14184
2018-07-18 11:03:06 +02:00
Roman Gilg
d544837e91 Fix selection and seat auto tests
Summary:
The seat test is broken since 312298e2f6, because a frame event now
also follows a relative pointer motion.

The selection test is broken since d3f15a5388, because clearing a selection,
which never has been set, is a noop now.

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D14183
2018-07-18 11:01:22 +02:00
David Edmundson
350f572a83 Populate shell version documentation 2018-07-16 16:13:16 +02:00
David Edmundson
2f8be1089c Replace remaining V5 compat global includes 2018-07-16 14:21:30 +02:00
David Edmundson
8af1ec8885 Add XDG WM Base support to our XDGShell API
Summary:
This adds XDG WM Base (essentially XDG Shell v7/stable edition) into our
existing XDGShell classes which wrap v5, v6 and now this.

It's mostly copy and paste from V6 except for the enum types for gravity
and anchor edges on positioners.

There's been no attempt to share code with V6 as realistically that
won't get updates whereas XDGWMBase will; and at some point we will
want to drop V6 without things being too tangled.

Test Plan:
Same test suite as V6 has

Compiled GTK master and ran against suitably modified kwin
running WAYLAND_DEBUG=1 gtk-demo showed we were using this interface
Everything worked as well as V6 does.

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13510
2018-07-16 13:50:51 +02:00
David Edmundson
7442b72b93 Make XDGShellV5 co-compilable with XDGWMBase
Summary:
When we add WMBase (the new name stable XdgShell)  we get a clash with
XDGShellV5. This clash consists of all functions in the generated C file
which clashes at linker time, as well as multiple xdg_blah_interface
structs which would get redefined.

XDGShellV5 in practice is used by literally no-one (Qt never defaulted
to it if wl-shell was available) and has been dropped from GTK when
they added v6. But it's used by some kwin unit tests so breaking
would cause issues for stable kwin release tests... so it's a pain.

We can't mod the XML as we need the strings sent down the wire to remain
the same and we need the same names for our forward declared structs
that the client code can cast to.

This patch copies the generated files and modifies them manually.
Hacky, but we know this code will never change again - and IMHO this
task isn't one worth investing too much time into.

Test Plan:
Finished my XDG WM Base patch (see next phab) and things compile \o/

Unit test still passes

Ran: QT_WAYLAND_SHELL_INTEGRATION=xdg-shell-v5 dolphin --platform wayland and verified it worked

Reviewers: #plasma, romangg

Reviewed By: #plasma, romangg

Subscribers: romangg, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13488
2018-07-16 13:50:51 +02:00
Bhushan Shah
cb5847e726 Fix some of cppcheck warnings
Summary:
- selfInitialization
- memleak

I could probably suppress the selfInitialization warning, but probably
is cleaner this way. Opinions welcome. This also fixes the memleak in
autotest.

Test Plan:
- arc lint --everything
- Fix issues
- build
- run tests

Reviewers: #frameworks, aacid

Reviewed By: aacid

Subscribers: apol, aacid, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13559
2018-07-04 15:54:26 +05:30
Roman Gilg
312298e2f6 [server] Send frame event instead of flush on relative pointer motion
Summary:
This solves for me not working relative pointer motion with grab/lock in
Xwayland applications.

Looking at the Xwayland code it is clear, that it expects a frame event on
wl_pointer versions 5 and above after relative motion events. wl_pointer
version 5 support was added to KWayland in c29035a6.

If the cursor is locked no absolute motion events are sent. In this case to
make sure relative motion events are processed by the client, send the frame
event after every relative motion.

BUG: 395815

Test Plan: Manually with Neverball in Xwayland mode.

Reviewers: #plasma, #kwin, #frameworks, davidedmundson

Reviewed By: #plasma, #kwin, davidedmundson

Subscribers: davidedmundson, kde-frameworks-devel

Tags: #frameworks

Maniphest Tasks: T8923

Differential Revision: https://phabricator.kde.org/D13257
2018-06-26 16:35:48 +02:00
David Edmundson
098fe1b4ca Fix XDGV6 popup test
Summary:
We had a data funciton...then didn't use it, effectively skpping half of
the point of the test.

Test Plan: Ran the test

Reviewers: #kwin, mart

Reviewed By: #kwin, mart

Subscribers: romangg, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13495
2018-06-22 11:49:52 +01:00
Michal Srb
d3f15a5388 Do not cancel old clipboard selection if it is same as the new one.
Summary:
GTK applications seem to call wl_data_device::set_selection multiple times with
the same wl_data_source object, replacing it with itself. If we cancel it, they
will destroy it and the selection will be gone.

With this patch it is again possible to copy from GTK applications.

BUG: 395366

Test Plan: Patch provided by the reporter, he reported success.

Reviewers: #plasma, #frameworks, romangg

Reviewed By: #plasma, romangg

Subscribers: michalsrb, romangg, graesslin, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13535
2018-06-21 16:42:39 +02:00
Bhushan Shah
b8381f3718 Fix some spelling issues suggested by new linter tool
Reviewed-by: romangg
2018-06-15 14:33:34 +05:30
Bhushan Shah
1710d3e02c Add the arclint file in kwayland
Summary:
- xml linter to make sure that we don't add broken protocols
- merge-conflict so that we don't commit merge-conflict markers
- spell check for documentation
- cppcheck to check the code

Test Plan: broke some files manually, and then ran arc lint

Reviewers: #frameworks, mart

Reviewed By: mart

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13533
2018-06-15 14:13:12 +05:30
Vlad Zagorodniy
c6a864f03e Fix 'unused parameter' warnings
Summary:
The warnings:

```
/home/vlad/KDE/src/frameworks/kwayland/src/server/xdgforeign_v2_interface.cpp: In static member function ‘static void
KWayland::Server::XdgExporterUnstableV2Interface::Private::destroyCallback(wl_client*, wl_resource*)’:
/home/vlad/KDE/src/frameworks/kwayland/src/server/xdgforeign_v2_interface.cpp:95:95: warning: unused parameter ‘resource’
[-Wunused-parameter]
 void XdgExporterUnstableV2Interface::Private::destroyCallback(wl_client *client, wl_resource *resource)
                                                                                  ~~~~~~~~~~~~~^~~~~~~~
/home/vlad/KDE/src/frameworks/kwayland/src/server/xdgforeign_v2_interface.cpp: In static member function ‘static void
KWayland::Server::XdgImporterUnstableV2Interface::Private::destroyCallback(wl_client*, wl_resource*)’:
/home/vlad/KDE/src/frameworks/kwayland/src/server/xdgforeign_v2_interface.cpp:237:95: warning: unused parameter ‘resource’
[-Wunused-parameter]
 void XdgImporterUnstableV2Interface::Private::destroyCallback(wl_client *client, wl_resource *resource)
                                                                                  ~~~~~~~~~~~~~^~~~~~~~
/home/vlad/KDE/src/frameworks/kwayland/src/server/xdgforeign_v2_interface.cpp: In static member function ‘static void
KWayland::Server::XdgImportedUnstableV2Interface::Private::setParentOfCallback(wl_client*, wl_resource*, wl_resource*)’:
/home/vlad/KDE/src/frameworks/kwayland/src/server/xdgforeign_v2_interface.cpp:439:78: warning: unused parameter ‘client’
[-Wunused-parameter]
 void XdgImportedUnstableV2Interface::Private::setParentOfCallback(wl_client *client, wl_resource *resource, wl_resource *
surface)
                                                                   ~~~~~~~~~~~^~~~~~

/home/vlad/KDE/src/frameworks/kwayland/src/server/xdgoutput_interface.cpp: In constructor
‘KWayland::Server::XdgOutputManagerInterface::XdgOutputManagerInterface(KWayland::Server::Display*, QObject*)’:
/home/vlad/KDE/src/frameworks/kwayland/src/server/xdgoutput_interface.cpp:88:81: warning: unused parameter ‘parent’
[-Wunused-parameter]
 XdgOutputManagerInterface::XdgOutputManagerInterface(Display *display, QObject *parent)
                                                                        ~~~~~~~~~^~~~~~
```

Test Plan: No more 'unused parameter' warnings.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13501
2018-06-12 23:26:48 +03:00
David Edmundson
3f31115c3c Documentation fix 2018-06-12 12:42:51 +01:00
Roman Gilg
009017c8bd [server] Small code cleanup in SurfaceInterface
Summary:
Use lambda function to reduce code duplication and put
function definitions in the same order as in the header file.

Test Plan: All autotests succeed.

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: davidedmundson, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13191
2018-06-10 18:04:21 +02:00
Fabian Vogt
f3d2ae59ff Fixup @since for skip switcher API
Summary: Not released yet.

Test Plan: No testing performed at all.

Reviewers: #plasma, stikonas

Reviewed By: stikonas

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13377
2018-06-06 09:15:45 +02:00
Roman Gilg
4cc008c9d2 [autotests] Fix surface destroy test
Summary:
Interfaces must be cleaned up correctly and client proxys
destroyed. Otherwise we get a memory corruption.

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13190
2018-05-29 13:51:32 +02:00
Scott Harvey
7d3deb7e68 Add "SkipSwitcher" to API
Summary:
Adding "SkipSwitcher" to API, as a result of discussion in
BUG 375921

Depends on / related to D11924 and D11926.

Reviewers: hein, graesslin

Reviewed By: graesslin

Subscribers: kde-frameworks-devel, lbeltrame, rikmills, davidedmundson, #plasma, graesslin

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D11925
2018-05-22 10:27:43 -05:00
David Edmundson
73cac6211b Set @since version number for XDGOutput 2018-05-17 22:15:55 +01:00
David Edmundson
b2f7c6ea02 Add XDG Output Protocol
Summary:
Done primarily for XWayland which for legacy reasons doesn't assume the
logical size of a display is pixelSize / outputScale. Meaning xwayland
windows that position themselves are wrong in a scaled environment.

It also allows the possibility for us to support fractional scaling
whilst keeping wl_output::scale as an integer.

The protocol is a bit odd as it operates via the FooManager + Foo
pattern rather than using globals like Output so I've wrapped it so it
behaves more like globals.

Test Plan: #plasma

Reviewers: romangg

Subscribers: #frameworks

Tags: #frameworks

Maniphest Tasks: T8501

Differential Revision: https://phabricator.kde.org/D12235
2018-05-15 12:44:54 +01:00
Oleg Chernovskiy
8da9a184ed Add Remote Access interface to KWayland
Summary:
This commit adds an interface bridge from KWin to KRfb. The purpose of
this protocol is to pass a GBM fd of currently displayed buffer from
KWin. The buffer is expected to be fully drawn once it is passed.

Related to D1230

Test Plan:
********* Start testing of RemoteAccessTest *********
Config: Using QtTest library 5.6.0, Qt 5.6.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 6.1.1 20160501)
PASS   : RemoteAccessTest::initTestCase()
QDEBUG : RemoteAccessTest::testSendReleaseSingle() kwayland-client: Connected to Wayland server at: "kwayland-test-remote-access-0"
QDEBUG : RemoteAccessTest::testSendReleaseSingle() kwayland-client: Wayland Interface:  wl_shm / 1 / 1
QDEBUG : RemoteAccessTest::testSendReleaseSingle() kwayland-client: Wayland Interface:  org_kde_kwin_remote_access_manager / 2 / 1
QDEBUG : RemoteAccessTest::testSendReleaseSingle() kwayland-server: Server buffer sent: fd 15
QDEBUG : RemoteAccessTest::testSendReleaseSingle() kwayland-client: Got buffer, server fd: 15
QDEBUG : RemoteAccessTest::testSendReleaseSingle() kwayland-server: Remote buffer returned, client 4 , id 0 , fd 15
QDEBUG : RemoteAccessTest::testSendReleaseSingle() kwayland-server: Buffer released, fd 15
QDEBUG : RemoteAccessTest::testSendReleaseSingle() kwayland-client: Buffer released
PASS   : RemoteAccessTest::testSendReleaseSingle()
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-client: Connected to Wayland server at: "kwayland-test-remote-access-0"
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-client: Wayland Interface:  wl_shm / 1 / 1
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-client: Wayland Interface:  org_kde_kwin_remote_access_manager / 2 / 1
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-server: Server buffer sent: fd 15
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-client: Got buffer, server fd: 15
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-client: Got buffer, server fd: 15
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-server: Remote buffer returned, client 4 , id 0 , fd 15
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-server: Remote buffer returned, client 5 , id 0 , fd 15
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-server: Buffer released, fd 15
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-client: Buffer released
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-client: Buffer released
PASS   : RemoteAccessTest::testSendReleaseMultiple()
QDEBUG : RemoteAccessTest::testSendClientGone() kwayland-client: Connected to Wayland server at: "kwayland-test-remote-access-0"
QDEBUG : RemoteAccessTest::testSendClientGone() kwayland-client: Wayland Interface:  wl_shm / 1 / 1
QDEBUG : RemoteAccessTest::testSendClientGone() kwayland-client: Wayland Interface:  org_kde_kwin_remote_access_manager / 2 / 1
QDEBUG : RemoteAccessTest::testSendClientGone() kwayland-server: Server buffer sent: fd 15
QDEBUG : RemoteAccessTest::testSendClientGone() kwayland-server: Buffer released, fd 15
PASS   : RemoteAccessTest::testSendClientGone()
QDEBUG : RemoteAccessTest::testSendReceiveClientGone() kwayland-client: Connected to Wayland server at: "kwayland-test-remote-access-0"
QDEBUG : RemoteAccessTest::testSendReceiveClientGone() kwayland-client: Wayland Interface:  wl_shm / 1 / 1
QDEBUG : RemoteAccessTest::testSendReceiveClientGone() kwayland-client: Wayland Interface:  org_kde_kwin_remote_access_manager / 2 / 1
QDEBUG : RemoteAccessTest::testSendReceiveClientGone() kwayland-server: Server buffer sent: fd 15
QDEBUG : RemoteAccessTest::testSendReceiveClientGone() kwayland-client: Got buffer, server fd: 15
QDEBUG : RemoteAccessTest::testSendReceiveClientGone() kwayland-client: Buffer released
QDEBUG : RemoteAccessTest::testSendReceiveClientGone() kwayland-server: Buffer released, fd 15
PASS   : RemoteAccessTest::testSendReceiveClientGone()
PASS   : RemoteAccessTest::cleanupTestCase()
Totals: 6 passed, 0 failed, 0 skipped, 0 blacklisted
********* Finished testing of RemoteAccessTest *********

Reviewers: graesslin, davidedmundson, romangg

Reviewed By: davidedmundson, romangg

Subscribers: jtamate, jgrulich, romangg, ngraham, alexeymin, #frameworks, davidedmundson, plasma-devel

Tags: #plasma_on_wayland, #frameworks

Maniphest Tasks: T5653, T7785

Differential Revision: https://phabricator.kde.org/D1231
2018-03-25 20:17:25 +03:00
Martin Flöser
c29035a6f0 [server] Add support for the frame semantics of Pointer version 5
Summary:
This change implements the required changes for wl_seat version 5.
There seem to be applications which require version 5 and refuse to
start if the server doesn't provide it. Thus we need to provide it.

The main difference with version 5 is that pointer need to send a
frame event after each logical group of events. As we don't support the
new events from version 5 yet, we just emit the frame after each event
and implement the suggested semantics for the enter/leave behavior.

To really make use of this, we will have to implement additions in the
API and then in KWin to expose the new API elements. But to just support
the semantics we don't need it.

BUG: 389189
FIXED-IN: 5.45

Test Plan: Extended autotest

Reviewers: #kwin, #plasma, #frameworks

Subscribers: plasma-devel

Tags: #frameworks, #plasma

Differential Revision: https://phabricator.kde.org/D10235
2018-03-04 09:48:39 +01:00
Oleg Chernovskiy
300cd607f0 Implement releasing of client-freed output
Summary:
Previously KWin supported only version 2 of wl_output interface
In third version there was an important addition that allowed clients to
unbind outputs they may previously have bound.

Bumping versions in both client and server part of KWayland to support
this behaviour.

Reviewers: davidedmundson, graesslin

Reviewed By: graesslin

Subscribers: jgrulich, #frameworks

Tags: #frameworks

Maniphest Tasks: T7785

Differential Revision: https://phabricator.kde.org/D10929
2018-03-01 22:13:43 +03:00
Martin Flöser
43e71055d2 [server] Properly handle the situation when the DataSource for a drag gets destroyed
Summary:
This addresses the following situation:
1. Start drag on a QtWayland based window
2. Press escape
3. Release mouse

-> this results in a crash. The main reason for this is that QtWayland
destroys the DataSource in step 2 and KWayland did not expect this at
all. The drag and drop operation continued and results in step 3 in the
drag target to request data from the no longer existing DataSource.

This change addresses the root of the problem by cancelling the drag
operation when the DataSource gets destroyed.

BUG: 389221
FIXED-IN: 5.44

Test Plan:
New test case exposing the problem and manual testing with
kwin_wayland and dolphin (based on bug report)

Reviewers: #frameworks, #kwin, #plasma

Subscribers: plasma-devel

Tags: #frameworks, #plasma

Differential Revision: https://phabricator.kde.org/D10142
2018-02-25 14:14:58 +01:00
Martin Flöser
0d52ce8f9b [server] Don't crash when a subsurface gets commited whose parent surface got destroyed
Summary:
Qt seems to damage and commit child subsurfaces although their parent
got destroyed. This actually doesn't make any sense as without a parent
surface they cannot be shown. But nevertheless we should not crash in
such a situation.

This change guards the places in the commit handling code where the
parent gets accessed.

BUG: 389231

Test Plan: New test case which exposes the problem

Reviewers: #frameworks, #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D10300
2018-02-07 19:41:58 +01:00
Roman Gilg
6d3e7691b5 Fix typo
Summary: Fix a typo

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: plasma-devel, #frameworks

Tags: #frameworks, #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D10053
2018-01-23 17:26:13 +01:00
Laurent Montel
c829817117 Remove obsolete reviewboardrc file 2018-01-05 13:24:48 +01:00
David Edmundson
54e1eb103f Resolve some merge issues 2018-01-03 11:07:32 +00:00
David Edmundson
9ba84e0886 Unit test for Server Decoration Palette 2018-01-03 10:44:15 +00:00
David Edmundson
eb52e81eed Create interface for passing server decoration palettes
Summary:
It's kept separate in case we ever merge the server decoration manager
interface upstream, and this is too kwin specific to have in a
potentially shared spec.

Code is a copy+paste of existing boilerplate.

Replaces use of the deprecated qt extended surface.

I'd like to target 5.42 as otherwise we'll have a regression when we
release Plasma 5.12 as Qt's XDGv6 doesn't have a working qt extended
surface.

Test Plan: Attached unit test

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, #frameworks

Tags: #frameworks, #plasma

Differential Revision: https://phabricator.kde.org/D9599
2018-01-03 10:34:06 +00:00
David Edmundson
231dc9cba5 Explicitly include std::bind functions
Should fix compile
2018-01-02 10:18:38 +00:00
Martin Flöser
1a5762b9d7 [server] Add a method IdleInterface::simulateUserActivity
Summary:
So far only the client was able to simulate user activity. This new
method allows the server to also simulate user activity on all created
idle timeouts. This is required by KWin to prevent idle timeouts when
the user interacts through KDE Connect's virtual touchpad. In that
situation the mouse pointer is used without updating the input time
stamp as it doesn't come from "real" input devices and thus the idle
timeout prevention is not activated.

Reviewers: #frameworks, #plasma, #kwin

Subscribers: plasma-devel

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D9510
2017-12-29 17:41:42 +01:00
Martin Flöser
e087a3666b Fix regression caused by backward compatibility support in data source
We should only enforce the check whether a data source has set the
actions for drag on drop on a selection if it's at least version 3. For
backward compatibility we used to set a default action which would
ensure that a version <3 and >3 client can interact with each other. But
due to that the action was set to a default value which breaks any
selection. Sorry about that.

This change ensures the backward compatibility behavior does not break
selection.

As the regression causes all clients to quit it is a severe regression
which requires fast action. Due to that I'm doing a maintainer push
without review. I encourage everyone to do a post commit review.

Sorry for not noticing the regression before. The backward compatibility
was the last thing I added in that patch set and apparently I did not
run all tests again.
2017-12-26 21:55:11 +01:00
Martin Flöser
072ad10b4b Fix @since version tags 2017-12-26 20:46:38 +01:00
Martin Flöser
42432a14fc Add support for version 3 of data device manager interface
Summary:
The main difference compared to version 2 is additional drag and drop
actions. The source and destination can negotiate whether the data
should be copied or moved or the user should be asked for either or.
This seems to be important for GTK, but is not yet implemented in Qt.

The main motivation for adding support is that it is required by SDL to
launch on Wayland.

BUG: 386993

Test Plan: Extended test case, sdl apps now start

Reviewers: #frameworks, #plasma, #kwin

Subscribers: plasma-devel

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D9136
2017-12-26 20:41:43 +01:00
David Edmundson
e5631f0e7b Scope exported/imported objects to the test
Summary:
m_imported was parented to the TestForeign class, which lasts for all
the tests. This caused an error on teardown.

Test Plan: Ran with ASAN. Finally everything passes!

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, #frameworks

Tags: #frameworks, #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D9407
2017-12-19 15:56:10 +00:00
David Edmundson
d67ce1e86c Fix ASAN warning on TestXdgForeign
Summary:
Internally XdgForeign has some delete laters

If we clean up the connection immediately we delete them after we kill
the connection resulting in an error.

Kwin isn't going to tear down the connection in response to a resource
unbinding so we can just fix the test.

Test Plan:
Compiled with ASAN
Got further

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, #frameworks

Tags: #frameworks, #plasma

Differential Revision: https://phabricator.kde.org/D9406
2017-12-19 15:56:06 +00:00
David Edmundson
9251e894e4 Replace QCOMPARE(nullptr) with QVERIFY
QCOMPARE(T*, nullptr) apparently isn't valid on Qt5.7
2017-12-19 08:10:09 +00:00
David Edmundson
53a8a8e6be Fix error in WaylandSurface::testDisconnect
Summary:
This test deletes the client wayland connection.

We then finish the test and call test cleanup which
releases m_idleInhititManager.
Calling release after the connection is destroyed is an error.

Hence the explicit destroy.

Test Plan:
Built tests with ASAN
No more crash

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, #frameworks

Tags: #frameworks, #plasma

Differential Revision: https://phabricator.kde.org/D9402
2017-12-19 07:28:54 +00:00
David Edmundson
19ade014bc Explicit QCOMPARE(QString,QString)
Hopefully fix CI
2017-12-19 07:28:20 +00:00
David Edmundson
6a14023c36 Add explicit AppMenu protocol
Summary:
A protocol that attaches to a surface and contains two strings which can
change.

The intended use is for clients to link a DBus Appmenu object with a
surface.

This is in preparation for the Qt Extended Surface deprecation which
currently handles this in Kwin.

Test Plan: Attached unit test

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: broulik, graesslin, plasma-devel, #frameworks

Tags: #frameworks, #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D8919
2017-12-18 22:08:31 +00:00
David Edmundson
20c53ee098 Fix ASAN warnings in XDGForeignV2Interface
Summary:
The current code captures a char* from a wayland event in a lambda.
By creating the QString first when we capture that by value we'll
implicitly shallow copy it.

The other issue was
someHash.erase(it);
*it->foo();

Even though where the iterator points to is still valid, the iterator
itself is an object that gets modified in erase which ASAN didn't like.

Test Plan:
Ran test.
Those particular errors went away
Tests passed

Subscribers: plasma-devel, #frameworks

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D9319
2017-12-14 07:31:14 +00:00
Montel Laurent
b18f2b2d7a Fix exlude generated file from automoc feature 2017-12-14 07:49:03 +01:00
Christophe Giboudeaux
d4d32870e6 Fix testWaylandFullscreenShell.
Summary: This test needs the weston executable. Skip the test if the program wasn't found.

Reviewers: graesslin

Reviewed By: graesslin

Subscribers: plasma-devel, #frameworks

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D8858
2017-11-27 17:23:58 +01:00
David Edmundson
ec75361d1f Expose wl_display_set_global_filter as a virtual method
Summary:
This allows a server to filter which globals are visible and bindable by
clients.

Design rationale:
Could be it's own class with Display as an arg, but we need the lifespan
to exactly match Display, and the cardinality to match Display and it
needs to be set after we're started but before clients connect.

Better to enfore rules with code than with documentation.

I'm filtering by interface name as there isn't any other good
identifier of what a wl_global refers to, even if you could assume
you can cast the userdata to a Server::Global.

Test Plan: Attached unit test

Reviewers: #plasma, graesslin, bcooksley

Reviewed By: #plasma, graesslin

Subscribers: bcooksley, graesslin, plasma-devel, #frameworks

Tags: #frameworks, #plasma

Differential Revision: https://phabricator.kde.org/D8050
2017-11-17 08:35:17 +00:00
Christophe Giboudeaux
6cf6a4c72c Fix kwayland-testXdgShellV6. 2017-11-16 23:27:52 +01:00
Martin Flöser
665c0535fe Add support for zwp_idle_inhibit_manager_v1
Summary:
This protocol allows to indicate that a wl_surface should inhibit idle
actions such as DPMS, screen locking if the surface is visible.

The protocol is quite simple: it just creates an IdleInhibitor for a
Surface. If such an IdleInhibitor exists the Surface is considered to
inhibit idle.

On the server side it is also exposed like that through the API. The
IdleInhibitorInterface is private to the library and only
SurfaceInterface is extended to expose whether it currently inhibits
idle.

CCBUG: 385956

Test Plan: New test case added

Reviewers: #frameworks, #kwin, #plasma_on_wayland

Subscribers: plasma-devel

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D8396
2017-11-16 20:22:44 +01:00
Martin Flöser
f5cfe92b8a [server] Support inhibiting the IdleInterface
Summary:
This is a preparation step to support idle_inhibit_unstable_v1 protocol.
As in Plasma powermanagement, screen locking, dpms, etc. is not
controlled by the wayland compositor but by external components through
the IdleTimeout interface the compositor needs a way to inhibit the idle
timeouts. So once idle_inhibit_unstable_v1 is implemented the compositor
can hook this up to the inhibit API in IdleInterface and thus inhibit
powermanagement, etc. as requested by the idle_inhibit_unstable_v1
protocol.

The added API is straight forward:
 * inhibit: inhibits idle timeouts
 * uninhibit: uninhibits again
 * inhibit and uninhibit must be called in pairs, so twice inhibit,
means uninhibit must be called twice
 * isInhibited: whether it's inhibited
 * and a signal that it changed

The signal is mostly used internally to stop the timers.

Test Plan: Test case extended

Reviewers: #frameworks, #kwin, #plasma_on_wayland

Subscribers: plasma-devel

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D8383
2017-11-14 17:44:14 +01:00
Marco Martin
7d53e7998c don't qcompare with nullptr
use QVERIFY(!pointer) instead, clang likes it more apparently
2017-10-13 12:08:47 +02:00
Marco Martin
9feb359676 Wayland foreign protocol
Summary:
Implement the "foreign" wayland protocol.
A client can export a surface with an unique string as handle,
then another client can refer to that surface and set an own surface as
child of that surface.
Potential use cases are out-of-process dialogs, such as file dialogs,
meant to be used by sandboxed processes that may not have the access
it needs to implement such dialogs.
The handle needs to be shared between the processes with other means,
such as dbus or command line paramenters.

The public api of the server side only tracks parent/child relationships as this is the only data kwin would need it for, the rest of the api is not exported so should be safer from eventual protocol changes

Test Plan:
the autotest works, but has a lot of random crashes when deleting surfaces,
unfortunately backtraces don't tell much and the crashes never occur when running into valgrind
behavior may still be wrong, depending on how the protocol is supposed
to work if more clients try to set the same exported surface as parent

Reviewers: #plasma, #kwin, davidedmundson, graesslin

Reviewed By: #plasma, #kwin, graesslin

Subscribers: davidedmundson, graesslin, plasma-devel, #frameworks

Tags: #frameworks, #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D7369
2017-10-13 11:30:13 +02:00
David Edmundson
4abf4183e0 Revert "Expose wl_display_set_global_filter as a virtual method"
This reverts commit 62b9960399.

We need to bump versions on CI first
2017-10-10 18:30:56 +02:00
David Edmundson
62b9960399 Expose wl_display_set_global_filter as a virtual method
Summary:
This allows a server to filter which globals are visible and bindable by
clients.

Design rationale:
Could be it's own class with Display as an arg, but we need the lifespan
to exactly match Display, and the cardinality to match Display and it
needs to be set after we're started but before clients connect.

Better to enfore rules with code than with documentation.

I'm filtering by interface name as there isn't any other good
identifier of what a wl_global refers to, even if you could assume
you can cast the userdata to a Server::Global.

Test Plan: Attached unit test

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: graesslin, plasma-devel, #frameworks

Tags: #frameworks, #plasma

Differential Revision: https://phabricator.kde.org/D8050
2017-10-10 15:00:21 +02:00
David Edmundson
6b460f9a7f Only send OutputConfig sendApplied / sendFailed to the right resource
Summary:
I don't understand the original logic.
s_allResources contains /every/ resource, not just outputconfigurations.

Sending org_kde_kwin_outputconfiguration_send_applied to a wl_surface (for example),
results in an error.

The reason kwin doesn't currently crash is because we don't actually send
applied/failed after setting outputs. (which is another bug)

Test Plan: The existing unit test still passes.

Reviewers: #plasma, sebas

Reviewed By: #plasma, sebas

Subscribers: sebas, plasma-devel, #frameworks

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D7898
2017-09-21 14:11:30 +01:00
David Edmundson
a1cfc8a5f3 Add missing command macro
Seems it was added whilst xdgv6 was in a branch
2017-09-21 12:52:21 +01:00
David Edmundson
01cace30dd Don't crash if a client (legally) uses deleted global contrast manager
Summary:
There is a race condition in the following situation:

    - Server creates a global
    - Client binds to that global (making a new resource for that
global)
    Simultaneously:
    - The client uses this resource
    - The server deletes the global

This was fixed for Blur, but as mention in that commit can also happen here.
Code is effectively a copy and paste from e8850b014c

Test Plan: Unit test. Booted normal session

Reviewers: #plasma

Subscribers: plasma-devel, #frameworks

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D7885
2017-09-20 14:17:46 +01:00
David Edmundson
e8850b014c Don't crash if a client (legally) uses a deleted global
Summary:
There is a race condition in the following situation:

- Server creates a global
- Client binds to that global (making a new resource for that global)
Simultaneously:
- The client uses this resource
- The server deletes the global

We then process an event for a resource linked to a deleted global.

This is noted in the specification, the client documentation says:
"The object remains valid and requests to the object will be
ignored until the client destroys it, to avoid races between the global
going away and a client sending a request to it. "

KWayland does not handle this at all.

The global's user data refer to our C++ wrapper
The resource's user data refer to *the same* C++ wrapper

When the global is deleted the resource user data now refers to garbage.

To fix the issue, instead of setting the resource userdata to the
global, we set it to a smartpointer to the global stored on the heap.

We can then validate if our global is still valid.

Theoretically this applies to every global

Practically there are only 3 globals that don't have the lifespan of the
server. Output (which is read only and doesn't matter), Blur and
BackgroundContrast.

Blur resets it's global when a screen geometry changes.

Unfotunately this exactly at the same time that Plasmashell is
doing a lot of processing and creating some blurs.

Test Plan: See unit test

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: graesslin, anthonyfieroni, plasma-devel, #frameworks

Tags: #frameworks, #plasma

Differential Revision: https://phabricator.kde.org/D7870
2017-09-19 13:50:16 +01:00
David Edmundson
9faa26330c Update @since docs 2017-09-08 12:31:37 +01:00
David Edmundson
f8198b50c8 Missing licenses 2017-09-04 17:21:15 +01:00
David Edmundson
3c67cc1399 Support XDG v6
Summary:

The main clever part that's not just boring boiler plate is how we
handle the structure change
A surface now has an XDGSurface which then has a an Xdg TopLevel or a
Xdg Popup

We need to fit this into the public API which assumes a surface has a
Surface or a Popup.
The old Surface is similar to the new TopLevel.

The shoehorning works by relying on the fact that a surface without a
role is pretty useless.

Clients create the surface implicitly with the toplevel or implicitly
with the popup.
The server only announced it has a new "XdgSurface" when it gets a new
zxdg_surface_get_toplevel.

----

Popup decisions:
- On popup creation the server should copy the current info from the
positioner and then it gets deleted. Given kwaylands job is to keep
state, we expose all these parameter via popup.

- Due to this positioner is not exposed as a resource anywhere.

- Server API is 100% backwards compatiable.
i.e new code will work identically with v5 clients.

- Client API is not.  Grabs are called separately from the constructor,
and the parent surface changed to an xdgsurface, not a raw surface.
V5 code still works as-is, just not with the new constructors.

It seemed better to match the v6 (and what will be the stable v7) than
to try and do hacks and lose functionality.
Given the client needs to change the code to opt into V6 anyway. I don't
think this is a huge problem.

Test Plan: Current test still passes.

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: graesslin, mart, plasma-devel, #frameworks

Tags: #frameworks, #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D6047
2017-09-04 16:56:24 +01:00
David Edmundson
f1491e009e Treat input RGB buffers as premultiplied
Summary:
Currently the server treats incoming buffers as not premultiplied.

KWayland::Client sends data that is ARGB32 and ARGB32_Premultiplied as
the same
WL_SHM_FORMAT_ARGB8888.

According to a post on wayland-devel by Fredrik Höglund, all RGB data
should be treated as premultiplied, which matches what Qt is doing.

Client now performs a conversion rather than sending
mismatched data,

Note: This commit will still breaks a bunch of tests in
kwin as it compares the server output to a fixed
QImage with a format.

Test Plan:
Existing tests pass

Modified surface test to check the pixel data relative to the output
QImage format
not the input format (i.e both input from ARGB32 and
ARGB32_Premultiplied) should
both end up in a QImage with format Premultiplied with premultiplied
values.

The existing test was confirming that data was corrupted, checking that
even though
the output format was not pre-multiplied, the data was.

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, #frameworks

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D7460
2017-08-30 09:58:36 +01:00
David Edmundson
9b564c4069 Update SurfaceInterface outputs when an output global gets destroyed
Summary:
As per existing TODO.

A new signal is added on Global to emit so we can process the result
whist we still have a valid object. The name is overly explicit to try
and logically separate it from QObject::destroyed().

Test Plan: Updated existing unit test.

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: graesslin, anthonyfieroni, plasma-devel, #frameworks

Tags: #frameworks, #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D7531
2017-08-26 11:54:10 +01:00
David Edmundson
ec8887ad27 KWayland::Client::Surface track output destruction
Summary:
A compositor should send left events before deleting an output; however
if it doesn't, we don't want dangly pointers in our list of outputs on
the client surface.

Test Plan: Unit test

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, #frameworks

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D7379
2017-08-18 15:14:36 +01:00
David Edmundson
eac4973697 Avoid sending data offers from an invalid source.
Summary:
A DataDevice will have a source when offers are available, but it can
also be legitimately cleared.

When calling DataDeviceInterface::sendSelection(DataDeviceInterface
*other) if the other data device has no source, we should be setting
that we also have no source.

In addition this also guards against Seat tracking a DataDeviceInterface
with no source when trying to sync x clipboards.

BUG: 383054

Reviewers: #plasma

Subscribers: graesslin, plasma-devel, #frameworks

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D7316
2017-08-16 00:17:32 +01:00
David Faure
cac7d766b1 Make unittest independent from the location of the executable.
Summary:
This fixes the check in the unittest when doing
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
which I intend to do globally at some point.

Turns out it's comparing with its own executable location, so we
can use QCoreApplication to get it generically.

Test Plan: Verified to work with ctest and with "./testWaylandServerDisplay"

Reviewers: graesslin, mart

Reviewed By: graesslin, mart

Subscribers: plasma-devel, #frameworks

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D6974
2017-07-30 01:05:45 +02:00
David Faure
0c42a1bfeb autotests: prepare for CMAKE_RUNTIME_OUTPUT_DIRECTORY being set
Scripted with
perl -pi -e 's/add_test\(([^ ]*) (.*?)\)/add_test(NAME $1 COMMAND $2)/' CMakeLists.txt
2017-07-29 08:27:59 +02:00
David Edmundson
e8ef0ea68f Destroy all kwayland objects created by registry when it is destroyed
Summary:
Currently one has to connect every object manually to connectionDied,
which is something we can do for them.

If the user also has a connection, the second will just no-op.

This fixes objects that linger longer than the QApp.

Reviewers: graesslin

Reviewed By: graesslin

Subscribers: graesslin, plasma-devel, #frameworks

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D6727
2017-07-28 09:51:46 +01:00
Martin Flöser
c6b085f5eb [client] Track all created ConnectionThreads and add API to access them
Summary:
This is change needed by KWin. KWin has the problem that it destroys its
internal Wayland connection (KWin as client for KWin as server) before
shutting down the application. Other external libraries loaded into KWin
(e.g. breeze window decoration) are unloaded later on, then try to clean
up their Wayland resources and crash KWin due to accessing a no longer
valid Wayland connection.

With the help of this new API KWin can access all connections during
the clean up and destroy them before shutting down the Wayland server and
thus exit cleanly.

Reviewers: #frameworks, #plasma, #kwin

Subscribers: plasma-devel

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D6569
2017-07-21 07:14:22 +02:00
Martin Flöser
dd873cb980 [server] Send text input leave if focused surface gets unbound
Summary: As 9266a94400 just for text input.

Test Plan: Adjusted test passes, fails without adjustment

Reviewers: #plasma, #frameworks

Subscribers: plasma-devel

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D6786
2017-07-19 20:17:56 +02:00
Martin Flöser
1b989a0464 [server] Send pointer leave if focused surface gets unbound
Summary: As 9266a94400 just for pointer.

Reviewers: #plasma, #frameworks

Subscribers: plasma-devel

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D6754
2017-07-19 07:13:18 +02:00
Martin Flöser
3db6bd64fe Drop unused variable 2017-07-17 17:03:40 +02:00
Martin Flöser
63102e1215 [client] Properly track enteredSurface in Keyboard
Summary:
ASAN found a heap-use-after-free when deleting the focused keyboard
surface in the client library. Keyboard did not track the lifetime of
the focused surface and thus one can access already freed memory.

Test Plan: Adjusted auto test to verify the variable gets cleared

Reviewers: #frameworks, #plasma

Subscribers: plasma-devel

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D6741
2017-07-16 20:25:12 +02:00
Martin Flöser
9266a94400 [server] Send keyboard leave when client destroys the focused surface
Summary:
This is a change inspired by https://bugreports.qt.io/browse/QTBUG-61930.
When Qt closes a window due to a key press event it starts to repeat the
event as KWayland does not send a keyboard leave event. Weston on the
other hand does send out the keyboard leave. In my opinion it doesn't
make much sense to send out the keyboard leave in this situation and in
my opinion that is a client bug, but if it makes clients happy we can
send them the keyboard leave. Similar this should be done for pointer,
touch, etc.

BUG: 382280

Test Plan: Run the example added to the Qt bug and it worked fine

Reviewers: #frameworks, #plasma

Subscribers: plasma-devel

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D6683
2017-07-16 16:25:25 +02:00
Martin Gräßlin
464ba18321 [autotests/server] Check whether test is run as root
If the test is run as root we cannot compare the user id to not be 0.
Thus let's check for that and expect fail.
2017-07-01 17:01:18 +02:00
Friedrich W. H. Kossebau
ac1a3b8b90 [FEATURE] Option to build & install QCH file with the public API dox
Using the new extra-cmake-modules module ECMAddQch (since 5.36.0)
this adds the option to automatically build and install a file
in QCH format with the docs about the public API, which then can be
used e.g. in Qt Assistant, Qt Creator or KDevelop.

Additionally the installed cmake config files will be extended
with a target KF5Wayland_QCH containing information about how to "link"
into the generated QCH file, which then can be used in the cmake build
system of other libraries building on this library, by
simply listing this target in "LINK_QCHS" of their ecm_add_qch() usage.
And a respective doxygen tag file with all the metadata about the
generated QCH file and used for the "linking" will be created and
installed.

Pass -DBUILD_QCH=ON to cmake to enable this.
2017-06-05 03:03:25 +02:00
Friedrich W. H. Kossebau
c010a9fae0 Autotests: solve warning for QProcess::ProcessState metatype registration 2017-06-03 01:16:11 +02:00
Friedrich W. H. Kossebau
2da0a9428d Fix for TestQtSurfaceExtension in path with spaces
Use the QProcess::start() variant with explicit (empty, in these cases)
arguments, so the program strings are not parsed as shell commands,
thus preserving paths with spaces as such.
2017-06-03 00:16:59 +02:00
Friedrich W. H. Kossebau
43aca8a949 API dox: add some minimal docs to more class to have them covered by doxygen 2017-05-26 18:33:25 +02:00
Friedrich W. H. Kossebau
36fdc9c811 API dox: add some minimal docs to class to have them covered by doxygen 2017-05-26 03:35:03 +02:00
Friedrich W. H. Kossebau
70d23d068a API dox: Use doxygen notation to have comments used 2017-05-26 03:34:55 +02:00
Friedrich W. H. Kossebau
c4ba4bd593 API dox: fix @link usage
@link either needs a matching @endlink tag,
or being used in javadoc style, {@link target [label]}
2017-05-26 02:57:20 +02:00
Marco Martin
7d10af91b1 add requestToggleKeepAbove/below
Summary: client requests to toggle those states, to be used by libtaskmanager

Test Plan: setting keep above from the taskbar works

Reviewers: #plasma, hein, graesslin, #plasma_on_wayland

Reviewed By: #plasma, hein

Subscribers: graesslin, hein, plasma-devel, #frameworks

Tags: #frameworks, #plasma

Differential Revision: https://phabricator.kde.org/D5757
2017-05-24 18:02:22 +02:00
David Edmundson
e182a2cc24 Remove pid changedSignal in Client::PlasmaWindow
Summary: Verified it it send before the initial_state and adjust tests and docs accordingly

Test Plan: All unit tests pass

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: graesslin, plasma-devel, #frameworks

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D5887
2017-05-16 15:54:08 +01:00
Sebastian Kügler
1154b2a6fd add pid to plasma window management protocol
Summary:
This patch adds a pid event to the plasma window management protocol. It
allows the compositor to tell allow a mapping between windows and processes.

Bumps the version number of the interface to 8 to indicate this.

Test Plan: autotest added, passed

Reviewers: #plasma, hein, graesslin

Reviewed By: #plasma, hein, graesslin

Subscribers: apol, davidedmundson, plasma-devel, #frameworks

Tags: #frameworks, #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D5747
2017-05-13 17:09:12 +02:00
David Edmundson
67521b975b Validate surface is valid when sending TextInput leave event
Summary:
It's possible for the surface to be unbound when we send the leave
event; we've called Resource::unbind() of Surface, so the Surface has,
deleteLater called, but it's still a valid object, and the first check
passes.

We get in this situation because when a surface is destroyed, we're
handling text input from the same source event.

Sending a nullpointer is a protocol error, and wayland kindly closes the
connection.

This fixes my constant:
"Did the Wayland server die" error messages when running clients.

Test Plan:
Got errors after setting up qt virtual keyboard.
Had reproducible case.
Restarted kwin after this patch, now doesn't crash.

Reviewers: #plasma, graesslin

Subscribers: apol, graesslin, plasma-devel, #frameworks

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D5712
2017-05-05 18:51:34 +02:00
Adriaan de Groot
6df5c8733e Fix autotests on the FreeBSD CI.
Summary: Include <errno.h> explicitly, for EPROTO.

Reviewers: bcooksley, graesslin, davidedmundson

Reviewed By: davidedmundson

Subscribers: plasma-devel, #frameworks

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D5717
2017-05-05 17:27:24 +02:00
Martin Gräßlin
bccb1f4cba Add support for wl_shell_surface::set_popup and popup_done
Summary:
This extends the client side API to support creating popup ShellSurface
windows and the server side API to send out the popup_done request.

This is needed to properly support popup windows (e.g. context menus)
in KWin.

Reviewers: #plasma_on_wayland, #frameworks, #kwin

Subscribers: plasma-devel

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D5174
2017-03-25 17:43:47 +01:00
Kevin Funk
a1c8ea01d7 Prefer nullptr over Q_NULLPTR 2017-01-16 18:17:33 +01:00
Kevin Funk
218631efce Use nullptr everywhere
Differential Revision: https://phabricator.kde.org/D3987
2017-01-16 09:44:16 +01:00
Sven Brauch
1c6b81f9ce GIT_SILENT add missing include(CMakeFindDependencyMacro) 2017-01-04 00:57:30 +01:00
Martin Gräßlin
49d57b342c [client] Fix nullptr dereference in ConfinedPointer and LockedPointer
The setRegion call allows a null region. This means nullptr is an
allowed value which can be passed to ConfinedPointer::setRegion and
LockedPointer::setRegion.

In that case we crash if we try to convert the Region into a wl_region.
Thus add proper nullptr check, just like in
PointerConstraints::lockPointer and ::confinePointer.

Auto test adjusted to cover the condition.
2016-11-25 13:14:14 +01:00
Martin Gräßlin
a1990e9cc5 [server] Fix regression in SeatInterface::end/cancelPointerPinchGesture
Regression with c72510c932 which removed a
needed source code line.

Thanks build.kde.org!
2016-11-24 09:36:18 +01:00
Martin Gräßlin
b44a8fb556 Implementation of PointerConstraints protcol
Summary:
The pointer constraints protocol is an unstable protocol and thus
the implementation follows the semantics of unstable protocols.

The protocol allows to create a constraint on the pointer - either a
lock or a confinement on a surface. Those are not activated at once, but
when the compositor actively grants it.

During lock no further pointer motion is emitted, during confinement the
pointer is kept in a certain area.

This implements T4451.

Reviewers: #plasma_on_wayland

Subscribers: plasma-devel

Tags: #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D3466
2016-11-24 09:19:36 +01:00
Martin Gräßlin
c72510c932 [server] Reduce overhead of pointersForSurface
Summary:
In SeatInterface we need to get all PointerInterfaces related to a given
Surface (Client) and call a method on it. The implementation we had so
far went through all Pointers and put all PointerInterfaces into a new
temporary QVector. In most cases all we did then was iterating over the
returned vector.

Which means we created a temporary vector for nothing.

This change implements a kind of std::for_each with the constraints of
the previously used pointersForSurface which does the check that Surface
is not null and that the client matches. If a PointerInterface is found
for that, the passed in method is invoked on it.

Reviewers: #plasma_on_wayland

Subscribers: plasma-devel

Tags: #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D3295
2016-11-24 09:19:12 +01:00
David Edmundson
8b3ecf8436 Return SurfaceInterface::size in global compositor space
REVIEW: 129358
2016-11-16 14:50:50 +00:00
Martin Gräßlin
bfbc8b9c54 [tools/generator] Generate enum FooInterfaceVersion on server side
With this change the generator is able to detect whether an interface
follows the unstable semantics. In that case the header file on server
side looks different. An enum needs to be generated containing the
interface version. Each of the generated classes has a new method
interfaceVersion returning that enum. The ctor of the class is protected
instead of private.

So far only the header side is adjusted. The implementation currently
generates not matching code.
2016-11-10 08:25:45 +01:00