Commit graph

38 commits

Author SHA1 Message Date
Vlad Zahorodnii
7d56aa3687 Merge wayland tests with other tests
This makes wayland tests organization consistent with other kwin tests.
2023-10-06 11:21:00 +00:00
Vlad Zahorodnii
de36fe82e8 wayland: Integrate KWaylandServer classes into KWin namespace 2023-09-15 16:31:15 +03:00
Laurent Montel
86c6238cfa Don't use QtTest => use QTest + missing include 2023-07-04 10:38:21 +00:00
Vlad Zahorodnii
6d3f00e82c autotests: Remove QVERIFY(signalSpy.isValid())
We use the PMF syntax so the isValid() check is unnecessary as the
compiler will notify about wrong signal at compile time. It makes
writing autotests feel less boilerplaty.
2022-09-14 09:21:29 +00:00
Vlad Zahorodnii
98b8a5d4ba autotests: Use PMF syntax in QSignalSpy 2022-09-14 09:21:29 +00:00
Vlad Zahorodnii
eeb701bfe3 Add KWin::Output handle to OutputInterface
That's a necessary change for further output related refactorings. It
also allows us to simplify some OutputInterface to Output mapping code.
2022-08-25 15:08:20 +03:00
Vlad Zahorodnii
5f15f3b47c wayland: Move output-management-v2 implementation in wayland/
Since both output-management-v2 protocol implementation and the rest of
kwin live in the same place and the fact that kde-output-management-v2
is very plasma specific, we can move Platform::requestOutputsChange() to
the implementation of kde-output-management-v2 protocol, it simplifies
the code a bit and improve code encapsulation.

In order to further simplify kde-output-management-v2 protocol, this
change alters the behavior of the protocol so an output configuration
can be applied only once, which is a very reasonable behavior.
2022-08-16 12:18:04 +03:00
Xaver Hugl
8955a2420e replace all uses of QScopedPointer with std::unique_ptr 2022-08-04 12:30:09 +00:00
Vlad Zahorodnii
b64f95b703 Integrate kwaylandserver
This makes KWin switch to in-tree copy of KWaylandServer codebase.

KWaylandServer namespace has been left as is. It will be addressed later
by renaming classes in order to fit in the KWin namespace.
2022-04-22 12:27:33 +03:00
Volker Krause
ccad0066e7 Disambiguate KWaylandServer::Display
This unfortunately clashes with a typedef in a Qt6 header.
2022-03-18 14:34:41 +00:00
Méven Car
a9458fa031 Remove unused code after cee6912d00 2021-09-01 17:20:38 +00:00
Méven Car
cee6912d00 Implement kde-output-device-v2 and kde-output-management-v2 2021-09-01 12:20:21 +02:00
Alexander Lohnau
525d12bee5 Run clang-format
If you want git blame to ignore formatting revisions run:
git config blame.ignoreRevsFile .git-blame-ignore-revs
2021-08-29 07:11:06 +02:00
Adrien Faveraux
d7a1067a7a move output management to the new approach 2021-03-12 11:06:35 +01:00
Vlad Zahorodnii
09e079b78f Remove factory methods in Display
The main reason why we have factory methods is that up to some point,
kwayland had its own signal to indicate when globals have to be removed.

Now that all globals add destroy listeners for the wl_display object,
we don't have that signal. Most factory methods are equivalent to doing
new T(display).

Besides adding unnecessary boilerplate code, another reason to get rid
of the factory methods is to reduce the amount of merge conflicts. If
several persons work on implementing wayland protocols at the same time,
sooner or later someone will have to resolve merge conflicts in Display.
2020-12-14 13:04:59 +00:00
Vlad Zahorodnii
1247a53eba Allow accepting client connections on multiple sockets
libwayland-server allows the wl_display accept client connections on
more than one socket. We currently don't listen on multiple sockets,
but it would be nice if Display supported such operation mode.
2020-12-09 07:20:42 +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
Aleix Pol
306f242ac8 Port namespaces and includes 2020-04-29 16:56:38 +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
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
Laurent Montel
6f45c74471 Remove qt include prefixx 2018-11-06 07:22:36 +01:00
Bhushan Shah
cb5847e726 Fix some of cppcheck warnings
Summary:
- selfInitialization
- memleak

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

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

Reviewers: #frameworks, aacid

Reviewed By: aacid

Subscribers: apol, aacid, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D13559
2018-07-04 15:54:26 +05:30
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
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
Martin Gräßlin
0649c8e51e [server] Use deleteLater when a ClientConnection gets destroyed
Summary:
In the situation that a wl_client gets destroyed while still
wl_resources are around it can happen that one of them calls into the
ClientConnection during the cleanup handling which gets triggered at the
same time. This can then trigger a crash.

This change uses deleteLater for the ClientConnection and sets the hold
wl_client pointer to null instead of deleting directly. So the
ClientConnection is still around while the Resources gets cleaned up.
This is similar to the cleanup of Resource where on unbind the
wl_resource pointer is set to null and the Resource gets delete later.

BUG: 370232
FIXED-IN: 5.28

Reviewers: #plasma, bshah

Subscribers: plasma-devel

Tags: #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D3004
2016-10-11 07:41:17 +02:00
Martin Gräßlin
565c832d39 [server] Expose executable path in ClientConnection
Summary: Convenient API to get the absolute executable path for the pid.

Reviewers: sebas, mart

Subscribers: plasma-devel

Differential Revision: https://phabricator.kde.org/D858
2016-01-25 10:56:16 +01:00
Martin Gräßlin
868282fb08 [server] Add a convenient ClientConnection::destroy
Wrapper around wl_client_destroy. In case the ClientConnection got
created through Display::createClient we need to destroy the
ClientConnection again. The exiting client will not cause it to be
destroyed.

Reviewed-By: Bhushan Shah
2015-11-10 13:31:47 +01:00
Sebastian Kügler
51ad392378 Autotests for outputmanagement and outputdevices protocols
REVIEW:125942
2015-11-04 15:38:41 +01:00
Martin Gräßlin
e8dbd39c60 Display::start takes a StartMode argument
If one passes StartMode::ConnectClientsOnly the socket in
XDG_RUNTIME_DIR is not created and instead one can only connect to
this server using the Display::createClient method. A very nice
solution to just have a Server and one dedicated Client talk to each
other.
2014-11-27 16:42:16 +01:00
Martin Gräßlin
ef810d39f7 ConnectionThread can connect to a socket fd instead of name
This allows connecting a client without going via the socket
name. E.g. to create a socketpair in the server and fork to
exec the client.
2014-11-27 16:38:01 +01:00
Martin Gräßlin
b770cbb140 Expose all ClientConnections in Display 2014-11-17 18:15:50 +01:00
Martin Gräßlin
4a7af2c665 Add test condition in test_display.cpp 2014-11-17 16:21:54 +01:00
Martin Gräßlin
8f11a2b0e5 Adding a new ClientConnection class for wrapping wl_client
The ClientConnection is managed by Display. Whenever one tries to
get a ClientConnection for a wl_client* and it doesn't exist yet a
new one will be created and a clientConnected signal will be emitted.
Also there is a clientDisconnected signal.

ClientConnection provides access to pid, uid and gid. The idea is
to extend it to provide access to all the resources created for the
client.
2014-11-17 16:01:18 +01:00
Martin Gräßlin
eb9e5a178f Switch all auto tests to QTEST_GUILESS_MAIN
We don't need a QGuiApplication in the tests.
2014-09-23 12:00:17 +02:00
Martin Gräßlin
a8c7c16c94 Use namespace KWayland::Server instead of KWin::WaylandServer
It's no longer part of KWin.
2014-09-17 16:10:38 +02:00
Martin Gräßlin
3c87cea7a8 Change to LGPLv2+
I'm the only copyright holder of the code in this repository, thus
I can change from GPL to LGPL!
2014-09-17 15:57:56 +02:00
Martin Gräßlin
e763d9acc0 Add a build system
Framework style build system which generates two libraries:
* KF5WaylandClient
* KF5WaylandServer

autotests are adjusted to compile again. They need to be changed to
use the libraries once the export header gets generated.
2014-09-17 14:35:33 +02:00
Martin Gräßlin
bc93c5c6a8 Move all files to autotests/server 2014-09-17 13:24:51 +02:00
Renamed from src/wayland/test_display.cpp (Browse further)