Commit graph

1066 commits

Author SHA1 Message Date
Adrien Faveraux
e12bfaa53c Migrate Fake Input into the new approach 2020-12-07 07:52:54 +00:00
Adrien Faveraux
2780d0557a Move slide interface to the new approach 2020-12-01 12:03:48 +01:00
Bhushan Shah
bfc174ea58 keyboard_interface: remove wrapper methods from the seat_interface
And make them public in th keyboard_interface, there's no point in
wrapping this in seat_interface with new approach

See also: plasma/kwayland-server#13
2020-11-19 06:05:06 +00:00
Aleix Pol
0dffc569ea Notify subsurfaces about output changes
Otherwise they wouldn't notice and wouldn't update to the settings of
the new output, like the new output's scaling.
2020-11-17 14:55:07 +00:00
David Edmundson
f91271b29e Allow small timeout intervals in IdleInterface
A threshold exists to stop users flooding the server for no reason.

However, there is a usecase for small timeouts.

rsibreak has a "please relax for 20 seconds" interface. Here it makes
perfect sense to know if a user is active in small increments. The plan
is to start a 1s timer and wait for that. Then we wait locally for 20s
without a resume event.
2020-11-17 13:10:22 +00:00
David Edmundson
02dd1d45a5 Port PlasmaShellSurface to the new approach
This gets rid of some boiler plate and simplifies some code.
2020-11-16 10:04:40 +00:00
Vlad Zahorodnii
0613e8f4c9 Safely end drag if the source data device gets destroyed
We cannot end a drag after the destroyed() signal for the source data
device is emitted because DataDeviceInterface and its d pointer are gone
by that time.
2020-11-11 16:14:45 +02:00
Vlad Zahorodnii
34982850e2 Destroy all clients before destroying wl_display
One of the most disappointing things when writing autotests is dealing
with a race condition where destructor requests are processed after all
globals have been destroyed.

With this change, the Display object will destroy all clients and their
resources before destroying the wl_display object. The good thing about
doing so is that shut down logic becomes simple. We don't have to assume
that wl_resource objects can outlive their wl_global objects, etc. The
bad thing is that it exposed a couple of pre-existing latent bugs in the
data device and the xdg foreign code.

closes plasma/kwayland-server#2
2020-11-11 09:26:57 +02:00
Vlad Zahorodnii
ed83cea823 Store drag-and-drop focus resource using QPointer
We need to clean up the target data device if it has been destroyed in
the middle of a drag and drop. Weston does a similar thing.

BUG: 425793
2020-11-10 23:54:56 +02:00
Aleix Pol
22bf1087a1 Remove unnecessary SKIP_AUTOMOC call
ecm_add_qtwayland_server_protocol() is already doing this.
2020-11-09 11:06:43 +00:00
Vlad Zahorodnii
794e89c3f8 Get rid of private nested classes in tablet interfaces
With the new design, no private nested classes should be used.
2020-11-06 10:20:38 +00:00
Vlad Zahorodnii
d456214ecc Fix license headers for tablet v2 interfaces
We use SPDX license markers in kwayland-server.
2020-11-05 09:29:05 +02:00
Vlad Zahorodnii
fbda5f9d73 Remove unused includes 2020-11-05 09:26:01 +02:00
Vlad Zahorodnii
0a9351039e Rename tablet interfaces according to the current naming conventions
Tablet interface classes must have "V2" in their names because the
corresponding protocol is still unstable.
2020-11-05 07:09:20 +00:00
Vlad Zahorodnii
426e41f500 Check for subsurface loops
If subsurfaces form a loop, kwin will get stuck in an infinite
recursion while it constructs a window pixmap tree.
2020-11-04 23:41:44 +02:00
Vlad Zahorodnii
0ed0066d74 Port pointer-constraints-v1 to the new design 2020-11-04 06:19:13 +00:00
Vlad Zahorodnii
d0c93b5bc5 Post invalid_positioner error to the right resource
The invalid_positioner error is defined for the xdg_wm_base interface,
not xdg_surface.
2020-11-04 06:17:02 +00:00
Vlad Zahorodnii
9f83741621 Introduce resource_cast<> helper function
Getting the object associated with the particular wl_resource is not
difficult, but it involves a pretty reasonable amount of boilerplate
code.

This change, introduces a helper function with an intend to reduce the
amount of boilerplate code.

It can be used as resource_cast<const ObjectPrivate *>(resource) or
just simply resource_cast<ObjectPrivate *>(resource).
2020-11-04 08:15:31 +02:00
Vlad Zahorodnii
1c412b0f16 Introduce DragAndDropIcon
Every time the icon surface is committed, we need to accumulate the
surface offset. However, this is not easy to do on the compositor side
with the current design.

This change introduces a new class DragAndDropIcon that defines a
surface role as well as accumulates surface offsets on every commit.

This fixes a bug where the dnd icon jumps all of sudden while dragging
an image from Firefox to other applications.
2020-11-03 19:53:12 +00:00
Vlad Zahorodnii
94e3c5a21a Port pointer-gestures-v1 interface to the new design 2020-11-03 19:49:57 +02:00
Vlad Zahorodnii
a7f7a5fb17 Port relative-pointer-v1 interface to the new design 2020-11-03 19:49:54 +02:00
Aleix Pol
9bf4b6b624 Remove double lookups 2020-11-02 16:45:42 +01:00
Vlad Zahorodnii
6c113e1cef Rewrite subsurface wrappers following the new design principles
This change rewrites implementation of subsurfaces with qtwaylandscanner
and fixes various smaller issues, such as proper handling of position
updates for subsurfaces in the desync mode and getting rid of QPointer in
the public API.
2020-11-02 08:26:57 +02:00
Vlad Zahorodnii
17cda4bc9b Introduce SurfaceRole name property
This can be useful for protocol error messages.
2020-10-31 18:10:49 +02:00
David Edmundson
071dd60ab2 [autotests] Keep registry on the stack
Parenting both registry and the client connection to the test leads to a
confusing teardown order. Especially as m_connection is explicitly
deleted in cleanup()

Scoping registry to where it's actually used solves that
2020-10-30 16:12:40 +00:00
Vlad Zahorodnii
454265f4c5 Add missing context object 2020-10-30 17:17:41 +02:00
Vlad Zahorodnii
3a72048547 autotests: Hopefully fix all ASAN issues in DataControlInterfaceTest
In general, the destructor is not needed since cleanup() destroys all
client and server resources.
2020-10-30 13:49:10 +00:00
David Edmundson
a8883c35a5 Don't use Qt::UniqueConnection on a lambda
It won't detect properly, instead the same code is moved into a member
function.
2020-10-29 12:49:36 +00:00
Vlad Zahorodnii
74c1b0f336 Store dnd icon surface in a QPointer
If the drag-and-drop icon has been destroyed, return a nullptr rather
than a dangling pointer.

BUG: 428399
2020-10-29 09:05:06 +02:00
David Edmundson
d5ca50deb3 Only connect to BufferInterface::aboutToBeDestroyed once
It is allowed to call surface_attach multiple times with the same
buffer. We want to only connect once.

Found whilst debugging a freeze, going through the list of
BufferInterface connections I had multiple to the same SurfaceInterface.

CCBUG: 428361
2020-10-28 18:16:46 +00:00
Vlad Zahorodnii
f6e98a34b2 Send a cancelled() event if the dnd data source is not accepted
Currently, Firefox will stuck in "dnd" mode if you try to drag any of
its tabs. The main reason for that is that kwin doesn't send the
wl_data_source.cancelled event if the pointer button has been released
and there is no target surface or if the data source hasn't been
accepted by anyone.

CCBUG: 427528
2020-10-28 17:42:32 +00:00
Vlad Zahorodnii
decfb64ada autotests: Fix TestDragAndDrop
Currently, most of tests in TestDragAndDrop should fail because they
don't specify accepted mime type.
2020-10-28 17:42:32 +00:00
Vlad Zahorodnii
a6e78f9340 Check for protocol errors before converting dnd actions
It kind of makes more sense to check for errors and then start doing
the actual work.
2020-10-28 15:37:29 +02:00
David Edmundson
3c7715ce30 Fix crash on drag and drop from xwayland to wayland clients
During DataDevice migration we moved dataDevicesForSurface away from the
existing template macro due to inheritance reasons at the time.

The SeatInterface::setDragTarget() is used with null surfaces
2020-10-26 18:01:12 +00:00
Aleix Pol
571b7e86a8 OutputDevice: only report the scale when scaleFChanged is emitted
scaleChanged and scaleFChanged are emitted at the same time, there's no
reason to send them twice.
2020-10-21 20:47:36 +02:00
Laurent Montel
026923db94 Remove not implemented method 2020-10-21 08:14:39 +02:00
Adrien Faveraux
68e0604ad7 move keyboard to the new approach and refactor the keyboard_interface
- Get rid of the KF5 deprecated methods related to keymap,
  kwayland-server is not source compatible with kwayland, so we don't
  need to keep the deprecated methods
- Move the key repeat, modifiers and keymap handling fully into the
  KeyboardInterface.
- Get rid of some of the keyboard related code base from the
  seat_interface.

Co-Author: Bhushan Shah <bshah@kde.org>
2020-10-20 20:09:51 +05:30
Vlad Zahorodnii
0561c17552 Simplify how infinite input regions are handled
Some input related code in kwin is mislead by the fact that when the
input region is infinite, SurfaceInterface::input() is going to return
an empty QRegion object.

We cannot really do that because the client could have just set a valid
empty wl_region object to ignore all input events.

This change makes SurfaceInterface assign an actually infinite region
when a NULL input region has been passed to set_input_region().
2020-10-19 08:48:52 +03:00
Bhushan Shah
0117122679 input-method-v1: Fix bug regarding the modifier handling
modifiers request by the input method is supposed to send the raw
modifiers based on the keymap of the keyboard grabbed as result of the
grab_keyboard request. If input method client is not using the keysym
functionality it can decide to not send out the modifiers_map, since it
is already known to compositor as part of keymap event sent by it.

While at it also guard against empty modifiers_map, if this happens
ideally compositor should handle that information based on the keymap
sent out using grab_keyboard function, but since currently, we do not
have the grab_keyboard implemented in here, send out the NoModifier if
that happens.
2020-10-16 17:05:42 +05:30
Sebastian Krzyszkowiak
4da1822100 Send wl_pointer.frame when emulating pointer events out of touch ones
When touching a surface that doesn't register to wl_touch events, KWin
didn't send frame events (which it does for regular pointer and touch
events), causing severe updating issues with some clients.

Test Plan:
Launch a client that doesn't attach to wl_touch (for instance,
rootston) with WAYLAND_DEBUG=client and watch the logs while touching
its window.
2020-10-15 00:53:56 +02:00
Bhushan Shah
e84c1dcac2 input-method-v1: improve the test coverage of the class 2020-10-14 09:34:00 +05:30
Bhushan Shah
65111fcbbd autotests: convert file to use SPDX for license and add my name 2020-10-14 09:34:00 +05:30
Bhushan Shah
afef22a57c input-method-v1: remove unused method InputPanelSurfaceV1Interface::id
This was simply unused
2020-10-14 09:34:00 +05:30
Vlad Zahorodnii
780dba4966 Properly handle destruction of XdgOutputV1Interface
The xdg-output spec omits whether the compositor has to destroy all xdg-
output resources when the associated wl_output global is removed.

This means that no xdg-output resource should be destroyed unless the
client has called the destructor request; otherwise the client may panic
due to protocol errors.

Starting with Qt 5.15.2, it's okay to destroy generated wrapper objects
without destroying associated resources. Destructor requests will be
handled behind the scenes for inert and orphaned resources by code that
is generated by qtwaylandscanner.

BUG: 426293
2020-10-13 08:58:04 +03:00
Aleix Pol
489fc93fcf keystates: use the qtwaylandscanner instead of having the boilerplate 2020-10-09 13:17:30 +00:00
Bhushan Shah
c9c05c3899 input-method-v2: pass the reason state was updated to compositor
This removes the signals the requestReset and stateCommitted and
replaces it with single stateUpdated signal.
2020-10-08 17:50:46 +05:30
Bhushan Shah
30a5cc766c text-input-v3: track commit counts per resource
If we track the commit counts at compositor global, this will fail
horribly for anything other than the first text-input-v3 client, as for
new client the serial count will not be what it expects in the done()
request and it will simply consider events as outdated and will refuse
to accept those events
2020-10-07 11:38:46 +05:30
Vlad Zahorodnii
e3e05d291a Use global static variables to store protocol version
s_version is used only to initialize a global so there is no point for
storing protocol version in a static member field and use funky syntax
in the cpp file to initialize it. This change also simplifies the code.
2020-10-02 16:47:19 +00:00
Vlad Zahorodnii
430aa08714 Improve readability of code that destroys frame callback resources
If a frame callback resource is destroyed, it will unregister itself
from corresponding lists in current, pending, and cached state.

However, this means that we need to be super duper careful when the
compositor wants to destroy all frame callbacks. We need to make a copy
of a frameCallbacks list; otherwise a call to removeOne() will
invalidate iterators and the compositor may crash.

Currently, that copy is made implicitly. Some people may see that code
and add qAsConst() without realizing the consequences it will lead to.

This change improves the readability of that code by making explicit
copies of frameCallbacks in code that shuts down SurfaceInterface.
2020-10-02 09:07:15 +03:00
David Edmundson
096deea9ec Port DataDevice to the new inheritance approach
This was done mostly because I wanted to get rid of the Resource
dependency in AbstractDataSource so I can make our xwl bridge direct,
but this also fixes up some issues with object lifespan present in the
previous version and keeps all our clipboard code in-line.
2020-10-01 14:49:33 +00:00
Bhushan Shah
85d6888504 autotests: fix minor compile time warnings 2020-10-01 12:17:42 +05:30
Vlad Zahorodnii
9707e7c443 Hopefully fix build on FreeBSD 2020-09-29 14:11:32 +03:00
Bhushan Shah
48535b8bc1 server: implement the text-input-unstable-v3
This commit implements the zwp_text_input_v3 in kwayland-server, part of
code is inspired based on the initial patch from Roman at D16735.
2020-09-29 16:16:28 +05:30
adrien faveraux
af16210c95 Migrate Window Management to new approach 2020-09-28 11:40:51 +00:00
Vlad Zahorodnii
feeafa93ed Set focused text input surface before emitting focusedTextInputSurfaceChanged()
When the focusedTextInputSurfaceChanged() signal is emitted, it is
expected that SeatInterface::focusedTextInputSurface() will return
the new focused text input surface.
2020-09-23 13:47:02 +03:00
Bhushan Shah
cff380962c autotests: rename file to reflect that it tests only TextInputV2 now 2020-09-23 08:59:59 +00:00
Adrien Faveraux
52d3e054f0 Migrate zwp_text_input_v2 to new approach
- Drop the v0 support, it is no longer used by anything
- Adapt the text-input related methods in seat interface to include
  versioning, this will be useful for when zwp_text_input_v3 support is
  included in kwayland-server
- Refactor SeatInterface to get rid of globalTextInput, it is no longer
  needed with the new approach
- Refactor out the ContentHints and ContentPurpose enums in separate
  header file which can be shared by zwp_text_input_v2/3 implementation

Co-Author: Bhushan Shah <bshah@kde.org>
2020-09-23 08:59:59 +00:00
Aleix Pol
d7ff3703bc Do not create a temporary QRegion unnecessarily
Just modify the one we are updating in one go
2020-09-23 04:20:17 +02:00
Vlad Zahorodnii
260d6e7a22 Keep unreferenced buffers around
One problem with delaying destruction of buffer objects is that the
compositor may create a shadow that references defunct buffers.

One way to fix that issue is to immediately destroy buffers. However,
there is other way to address the issue - keep released buffers alive.

If a buffer is kept alive by the client, then it will most likely be
used again. It also simplifies buffer management.

BUG: 425233
2020-09-21 13:58:37 +00:00
Vlad Zahorodnii
e727dc2fa9 Untangle SurfaceInterface and BufferInterface
A wl_buffer object can be bound to multiple surfaces or none at all. So
the BufferInterface::surface() property makes very little sense.
2020-09-21 13:58:37 +00:00
David Edmundson
0b3cca4ae0 [DataOffer] Avoid calls on null DataSource
A DataOffer can slightly outlive a DataSource; a client will still be
told it's deleted but could call a method in a race.

DataOfferInterface correctly checks for source being still valid, but
nothing updates it when it gets deleted.

BUG: 396308
2020-09-21 11:02:58 +00:00
Vlad Zahorodnii
456106d749 autotests: Fix ASAN issues in TestWaylandSurface::testStaticAccessor
We need to store surface ids before destroying the corresponding
surfaces in order to avoid heap-use-after-free errors.
2020-09-11 14:01:55 +03:00
Vlad Zahorodnii
4ef47641ed autotests: Fix TestInputMethodInterface
If the underlying wl_surface object has been removed, the input panel
surface will be still alive.

Unfortunately, in order to make the test pass, the input panel surface
interface must have a destructor request.

So, the code that tests the destruction of an input panel surface had
been removed.
2020-09-11 11:34:30 +03:00
Vlad Zahorodnii
f8b9ea5680 Rename screencast wrappers according to unstable protocol naming conventions
Since the screencast protocol is unstable, the ScreencastInterface class
and the ScreencastStreamInterface class must carry version info in their
class names.
2020-09-05 14:45:43 +03:00
Vlad Zahorodnii
c3b9d76d33 Use OutputInterface instead of raw wl_resource objects
Typically, we don't expose wl_output objects as wl_resource objects in
public API. Instead, we use the OutputInterface class for that purpose.
2020-09-04 08:48:30 +00:00
Vlad Zahorodnii
77b7635593 Remove unused things in screencast_interface.h 2020-09-04 06:00:44 +00:00
Vlad Zahorodnii
f8dd1c615b Implement layer-shell v1 protocol 2020-09-03 13:42:36 +03:00
Vlad Zahorodnii
861ea96244 Fix remaining usages of REQUIRED_QT_VERSION and KF5_DEP_VERSION
REQUIRED_QT_VERSION and KF5_DEP_VERSION trace their origin back to KF5.
But in Plasma, we use QT_MIN_VERSION and KF5_MIN_VERSION instead.
2020-09-03 09:19:29 +00:00
Bhushan Shah
8ab656541b textinput: introduce a signal for when the state should be committed
In v1 to v3 of textinput protocol, updates for the text input state
needs to be updated explcitly using commit or update state request, so
send out this information to compositor, which can use it to update the
input method state.
2020-09-03 09:08:02 +00:00
Bhushan Shah
03f5339302 input-method: make sendContentType take the TextInputInterface enums
We need to convert the content hint and content purpose to the
protocol values before passing it to the input method since text-input
v0, v2 and v3 have a different values for some of enums. We need to do
manual translation.
2020-09-03 09:08:02 +00:00
David Edmundson
63d2ab4ee6 Link Wayland::Server as an external dependency
Raw wl_ objects are used throughout the public headers repeatedly.

Exporting the linked library helps clients (kwin) build cleanly.
2020-09-02 17:13:11 +01:00
Vlad Zahorodnii
aebae46fe6 Remove redundant wayland-server include 2020-09-02 16:30:55 +03:00
Vlad Zahorodnii
9b15f97326 Switch to upstream version of FindWaylandProtocols
FindWaylandProtocols has been upstreamed to ECM.
2020-08-27 14:02:37 +00:00
David Edmundson
bef0f305cf Delete resources in XdgOutput teardown
Generated code typically cleans up resource objects when the client
calls the relevant destructor.

In multi-cast mode our wrapper can be deleted at any time, whilst a
client resource exists any existing resources that have a pending
message will then crash the compositor.

Deleting resources ahead of time also resolves this. calls to this
resource will no-op. The zxdg_output_v1::destroy_func will then be
called to delete the Resource object.
2020-08-25 13:45:42 +00:00
Vlad Zahorodnii
9b4e2dbdf8 xdg-shell: Add support for v2 2020-08-23 15:11:57 +03:00
Vlad Zahorodnii
7f7a46563b Post an error if the client attempts to create input panel surface for surface that already has role
If a client attempts to create an input panel surface for a wl_surface
that already has a role assigned, we must post a protocol error or else
the behavior of the input panel surface will be undefined.

Posting an error of 0 is not really correct, but on the other hand the
spec has no any error enums.
2020-08-21 10:54:21 +03:00
David Edmundson
11524da289 Port XdgOutput to the new approach 2020-08-20 11:41:14 +00:00
Vlad Zahorodnii
bda8665389 Remove unused forward declarations 2020-08-19 22:25:13 +03:00
Vlad Zahorodnii
a930e59fcf Revert "Don't flush in SurfaceInterface::frameRendered()"
This reverts commit 3cf004b68e.

Unfortunately, 3cf004b broke a couple of tests in kwin due to Qt not
emitting QAbstractEventDispatcher::aboutToBlock() signal when macros
such as QTRY_VERIFY() or QTRY_COMPARE() spin the event loop.
2020-08-18 13:18:58 +03:00
Vlad Zahorodnii
3cf004b68e Don't flush in SurfaceInterface::frameRendered()
Frame callbacks only indicate when the client can start rendering a new
frame, it's not meant to be precise. If the client wants to do some
black magic with frame scheduling and so on, it needs to use a protocol
such as presentation_time. This change removes the pointless flush to
prevent over-flushing client connections.
2020-08-18 07:28:03 +00:00
Aleix Pol
5efebc3a38 Provide an initial implementation for input-method-unstable-v1
Makes it possible to implement the protocol in your favourite
compositor.
2020-08-17 20:09:21 +02:00
David Edmundson
84337d25f9 Add a workaround to prevent klipper racing with clipboard updates
We have a situation where some clients drop their old offer before
creating a new one. This means klipper tries to fill in the empty
clipboard at the same time the client posts its new real contents.

This adds in a flag (via a hidden mimetype) that klipper is trying to
replace a null clipboard. If this flag is set and our clipboard is not
null because the client has updated it in the meantime we ignore the
klipper update.

It's a workaround, rather than an ideal fix at a data level, but it
solves the problem in the interim.

CCBUG: 424855
2020-08-14 15:01:32 +00:00
David Edmundson
89433eccec [autotests] Cleanup DataControlInterface test
The tests were not fully self-encapsulating and leaky.
2020-08-14 15:01:32 +00:00
Vlad Zahorodnii
89debdef60 Undo pointer-gestures v2 changes
The release request was introduced in v2, which we currently don't support.
2020-08-06 15:42:17 +03:00
Adrien Faveraux
23ef883e84 Fix Build Warning 2020-08-05 12:25:09 +00:00
Xaver Hugl
b7bd93c567 Makes the panelAutoHideHideCallback also handle panels set to "windows can cover" 2020-07-28 23:40:43 +02:00
Vlad Zahorodnii
3407b06c58 Fix build 2020-07-28 17:46:06 +03:00
adrien faveraux
9686a31454 Apply 1 suggestion(s) to 1 file(s) 2020-07-28 13:31:03 +00:00
Adrien Faveraux
2c0f977632 migrate Shadow to new approach 2020-07-28 13:31:03 +00:00
Adrien Faveraux
8e6a525fed Migrate dpms to new approach 2020-07-28 12:07:36 +00:00
Adrien Faveraux
dad8e5a79c migrate Plasma Desktop interface to the new approach 2020-07-28 13:29:32 +02:00
Adrien Faveraux
389aec2156 Migrate Migrate XdgForeign to new approach 2020-07-28 11:23:24 +00:00
Adrien Faveraux
ed264e2c55 migrate idle interface to the new approach 2020-07-28 11:01:31 +00:00
Adrien Faveraux
87abc0e483 move idle Inhibitor to the news approach 2020-07-28 10:46:30 +00:00
Aleix Pol
dfeb71d451 linuxdmabuf: don't leak private implementations
Found when running under ASAN
2020-07-28 10:23:30 +00:00
Vlad Zahorodnii
399560973e Bump plasma window management protocol version 2020-07-28 11:45:57 +03:00
Vlad Zahorodnii
4d1847b13e Drop support for the remote-access protocol
It's been replaced by PipeWire stuff.
2020-07-23 18:16:39 +03:00
Aleix Pol
e089092b54 Implement zkde_screencast_stream_unstable_v1 2020-07-23 12:57:17 +00:00
Aleix Pol
97219ec2d5 PlasmaWindow::internalId was deprecated in favor of ::uuid 2020-07-23 12:57:17 +00:00
David Edmundson
ef539368d9 Emit signal before DataControlSource destruction
SeatInterface cleans up when a data source goes away. However the
cleanup also makes use of metaobjects so needs to run before the leaf
class destructor is run.

All other AbstractDataSource objects emit the unbound signal, which
SeatInterface also connects to do a earlier cleanup. Otherwise we get a
crash if a data control source replaces itself.
2020-07-23 11:58:31 +01:00
Vlad Zahorodnii
3994faff50 Rename the aboutToBeUnbound() signal in SurfaceInterface
Rename the aboutToBeUnbound() signal to aboutToBeDestroyed() in order to
make the usage of the word "destroyed" consistent.
2020-07-16 14:31:41 +00:00
Aleix Pol Gonzalez
c57270fa4a Update surface_interface.cpp 2020-07-15 22:22:40 +00:00
David Edmundson
df9413638d Cache clientConnection in SurfaceInterface
Order of a client teardown is:
 - ClientConnection is removed from the static map
 - All our client owned resources are torn down
 - ClientConnection is deleted (via a previous deleteLater)

The recent refactor led to a behavioural change where ::client could
return a null pointer.

We want the client getter to be valid throughout the lifespan of
SurfaceInterface, by doing the lookup once we achieve that.

BUG: 424255
2020-07-15 22:55:37 +01:00
Vlad Zahorodnii
9a23695bab Use shorter name for variable that holds cached subsurface state 2020-07-15 11:05:59 +03:00
Vlad Zahorodnii
33f4254bd1 Port the wl_compositor wrapper to the new approach 2020-07-15 11:05:59 +03:00
Vlad Zahorodnii
46e4f0948b Port the wl_surface wrapper to the new approach 2020-07-15 11:05:57 +03:00
Vlad Zahorodnii
58cd4825e7 Port the wl_region wrapper to the new approach 2020-07-15 11:04:30 +03:00
Vlad Zahorodnii
c42fc80d33 Fix testServerSideDecoration 2020-07-15 08:20:00 +03:00
Vlad Zahorodnii
551b0dc7e0 Use ssd mode enums generated by qtwaylandscanner 2020-07-14 21:50:55 +03:00
Vlad Zahorodnii
7addf10211 Fix build 2020-07-14 21:28:20 +03:00
Adrien Faveraux
095edbed4c migrate Contrast to new approach 2020-07-14 18:24:24 +00:00
Adrien Faveraux
efdc6e44ee Migrate Server Decoration to new approach 2020-07-14 20:17:46 +02:00
Vlad Zahorodnii
ddac3d14d8 Fix build 2020-07-14 13:15:26 +03:00
Adrien Faveraux
aa2626ee4e move eglstream controler to the new approach 2020-07-14 10:10:04 +00:00
Adrien Faveraux
9ead826465 move server decoration palette to new approach 2020-07-13 15:35:57 +00:00
Vlad Zahorodnii
bd62038ada Drop some tests that matter only for KWayland::Client 2020-07-08 10:35:25 +03:00
Vlad Zahorodnii
ed261e2c5b Remove pointless wl_display_terminate()
Since we don't do wl_display_run(), wl_display_terminate() is pointless.
2020-07-08 07:25:23 +00:00
Vlad Zahorodnii
0d45f15c00 Drop unused method
Display::startLoop() isn't used anywhere and it only adds maintenance
burden, so drop it.
2020-07-08 07:25:23 +00:00
Vlad Zahorodnii
a634ce77c1 Allow creating global objects before Display is started
It can be especially useful if the compositor wants to ensure that all
globals have been created before starting to accept client connections.

Unfortunately, start() and terminate() stuff doesn't align well with it,
so the terminate() method was dropped to ensure that Display always
returns the same wl_display object.
2020-07-08 07:25:23 +00:00
David Edmundson
8792a8d6b8 On bind set stacking order only to newly bound client
sendStackingOrderChanged() iterates though all clients. Only the new
client needs to be send information at this point.
2020-07-06 16:47:05 +01:00
Vlad Zahorodnii
ec0c109f4d Provide an easy way to monitor buffer size changes
The main purpose behind the kwaylandserver library is to provide a set
of re-usable wayland compositor extension implementations. However, it's
worth noting that the design of kwaylandserver is far from perfect at
the moment.

KWaylandServer tries to hide all low level wayland details from the
compositor. But it's not the case with buffers, which diminishes the
whole point behind the library.

Creating OpenGL textures from Wayland buffers is the responsibility of
the compositor. So, when it comes to client buffers, we are one foot in
KWaylandServer, and the other foot in the compositor.

Since the surface size is a logical size, the compositor can't use it
for allocating memory for OpenGL textures. This change adds the buffer
size property in SurfaceInterface that can be used for allocating memory
for textures as well as monitoring buffer size changes.

I must say that the introduction of the buffer size property is a crude
hack because BufferInterface just needs to provide an OpenGL texture for
each plane. The main blocker for that is that it would involve moving
the backend, the compositor, and the wayland bits in the same place, for
example kwayland-server or ultimately kwin.
2020-06-30 09:25:24 +03:00
Vlad Zahorodnii
6adaf7bcc6 Document the buffer transform property
The buffer transform is a pretty confusing thing, so document it in
order to avoid misleading people.
2020-06-24 06:58:46 +00:00
Vlad Zahorodnii
ecca34dea3 Rename buffer-specific surface properties
The buffer scale and the buffer transform property specify transforms
that had been applied to the buffer's contents. Neither one of those
properties apply to the surface, in other words the buffer transform
property doesn't indicate that the surface was rotated or flipped or both.

This change doesn't gain anything in terms of new features, etc. It just
attempts to make things more clear.
2020-06-24 06:58:46 +00:00
David Edmundson
dd825dbfb3 Fix bad merge 2020-06-23 01:03:49 +01:00
David Edmundson
5ca1e73804 Merge branch 'Plasma/5.19' 2020-06-23 00:27:00 +01:00
David Edmundson
a664677051 Scope dragAndDropActionsChanged to source lifespan
The source can have a different lifespan to the offer being made.
If a source is removed and we get a drag actions changed before the
offer is cancelled we don't want to crash.

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

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

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

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

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

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

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

Subscribers: romangg, crossi, kde-frameworks-devel

Tags: #frameworks

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

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

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

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

Reviewers: #kwin

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

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

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

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

Test Plan: Unit test passes

Reviewers: #kwin

Subscribers: zzag

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

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

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

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

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

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

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

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

Reviewers: #kwin

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

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

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

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

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

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: meven, ngraham, zzag

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

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

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

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: ngraham, zzag

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

Reviewers: #kwin, davidedmundson, apol

Reviewed By: #kwin, davidedmundson, apol

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

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

Subscribers: kde-frameworks-devel

Tags: #frameworks

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

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

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

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

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

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

Reviewers: #plasma, apol

Reviewed By: apol

Subscribers: kde-frameworks-devel

Tags: #frameworks

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

Reviewers: #kwin, apol

Reviewed By: apol

Subscribers: apol, kde-frameworks-devel

Tags: #frameworks

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

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

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

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

Test Plan: Ran test :)

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kde-frameworks-devel

Tags: #frameworks

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

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

Remove unused lambda captured variables.

Test Plan: Getting much cleaner build logs

Reviewers: #frameworks, #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D28442
2020-03-30 19:13:27 +02:00
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