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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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.
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
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
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
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
Summary:
This extends the client side API to support creating popup ShellSurface
windows and the server side API to send out the popup_done request.
This is needed to properly support popup windows (e.g. context menus)
in KWin.
Reviewers: #plasma_on_wayland, #frameworks, #kwin
Subscribers: plasma-devel
Tags: #plasma_on_wayland, #frameworks
Differential Revision: https://phabricator.kde.org/D5174
The setRegion call allows a null region. This means nullptr is an
allowed value which can be passed to ConfinedPointer::setRegion and
LockedPointer::setRegion.
In that case we crash if we try to convert the Region into a wl_region.
Thus add proper nullptr check, just like in
PointerConstraints::lockPointer and ::confinePointer.
Auto test adjusted to cover the condition.
Summary:
The pointer constraints protocol is an unstable protocol and thus
the implementation follows the semantics of unstable protocols.
The protocol allows to create a constraint on the pointer - either a
lock or a confinement on a surface. Those are not activated at once, but
when the compositor actively grants it.
During lock no further pointer motion is emitted, during confinement the
pointer is kept in a certain area.
This implements T4451.
Reviewers: #plasma_on_wayland
Subscribers: plasma-devel
Tags: #plasma_on_wayland
Differential Revision: https://phabricator.kde.org/D3466
Summary:
In SeatInterface we need to get all PointerInterfaces related to a given
Surface (Client) and call a method on it. The implementation we had so
far went through all Pointers and put all PointerInterfaces into a new
temporary QVector. In most cases all we did then was iterating over the
returned vector.
Which means we created a temporary vector for nothing.
This change implements a kind of std::for_each with the constraints of
the previously used pointersForSurface which does the check that Surface
is not null and that the client matches. If a PointerInterface is found
for that, the passed in method is invoked on it.
Reviewers: #plasma_on_wayland
Subscribers: plasma-devel
Tags: #plasma_on_wayland
Differential Revision: https://phabricator.kde.org/D3295
With this change the generator is able to detect whether an interface
follows the unstable semantics. In that case the header file on server
side looks different. An enum needs to be generated containing the
interface version. Each of the generated classes has a new method
interfaceVersion returning that enum. The ctor of the class is protected
instead of private.
So far only the header side is adjusted. The implementation currently
generates not matching code.
* static void fooCallback definitions added to Private class
* static const foo_listener s_lister added to Private class
* Private::setup generates the foo_add_listner call
* implementation of s_listener added
* base implementation with a TODO marker added for the callbacks