Commit graph

670 commits

Author SHA1 Message Date
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