Commit graph

60 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Laurent Montel
6f45c74471 Remove qt include prefixx 2018-11-06 07:22:36 +01:00
David Edmundson
1955e15afa [test/xdgtest] Create/destroy popup on click
Summary:
This allows a dev to move the window before creating the popup which
is extremely useful in testing constraints. Also makes it very easy to
mod this code into a grabbing popup for other tests.

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

No library code changes

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

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16294
2018-10-20 16:38:52 +01:00
Kevin Funk
32d4edff51 Minor: Include Qt dirs as SYSTEM includes 2018-09-13 09:38:09 +02:00
Yuri Chornoivan
96df0ea6ae Fix minor EBN issues 2018-09-12 20:49:38 +03:00
Scott Harvey
7d3deb7e68 Add "SkipSwitcher" to API
Summary:
Adding "SkipSwitcher" to API, as a result of discussion in
BUG 375921

Depends on / related to D11924 and D11926.

Reviewers: hein, graesslin

Reviewed By: graesslin

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

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D11925
2018-05-22 10:27:43 -05:00
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
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
Kevin Funk
218631efce Use nullptr everywhere
Differential Revision: https://phabricator.kde.org/D3987
2017-01-16 09:44:16 +01:00
Martin Gräßlin
d92592a291 Support passing generic QIcon through PlasmaWindow interface
Summary:
Especially for Xwayland windows the compositor might not have a themed
icon name. Resulting in a task manager not having dedicated icons for
Xwayland windows.

This change deprecates the way how a compositor is supposed to set the
window icon. Instead of passing the themed icon name, it is now supposed to
pass the QIcon. In case it's a themed icon the existing way to pass to
the client is used.

Otherwise a new event is used to inform the client that there is an icon
- no data is transmitted at this point. The client can then create a
file descriptor and pass it to the compositor. The compositor serializes
the icon into the file descriptor and the client can read from it. This
all happens transparently on client side there is no api change at all.

The writing and reading of the icon is done in a thread. Due to that
Qt5::Concurrent is now a required dependency instead of an optional
dependency.

Reviewers: #plasma_on_wayland, hein

Subscribers: plasma-devel

Tags: #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D3049
2016-10-17 07:35:21 +02:00
Martin Gräßlin
618bebb63b Make linux/input.h compile time optional
Summary:
Instead of hard depending on the include of linux/input.h we check
whether that include file exists and properly ifdef all usages.

Unfortunately there is no replacement for those parts which do mapping
of input event codes.

Reviewers: #plasma_on_wayland

Subscribers: plasma-devel

Tags: #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D2344
2016-08-22 14:36:11 +02:00
Martin Gräßlin
5ae8ac4327 Add a ToolTip role to PlasmaShellSurface
Summary:
As Wayland doesn't have a proper ToolTip window type yet, we add it
to PlasmaShellSurface, so that we can use it for Plasma's tooltips.

Reviewers: #plasma_on_wayland

Subscribers: plasma-devel

Tags: #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D2030
2016-06-29 08:01:26 +02:00
Martin Gräßlin
b612251015 [tests] Add a test application for PlasmaShellSurface
Summary:
Creates a PlasmaShellSurface and allows to set the different roles
through command line argument.

Needed to verify that KWin properly handles the notification type.

Reviewers: #plasma_on_wayland

Subscribers: plasma-devel

Tags: #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D1932
2016-06-27 08:20:43 +02:00
Martin Gräßlin
598896987b [tests] Add a sub-surface test application
The test application creates a sub-surface tree consisting of overall
three surfaces:
* blue main surface
* red sub surface
* green sub surface to the red sub surface

All surfaces are in synchronized mode. There is a timer to turn the
green surface into yellow after five seconds.
2016-03-21 16:03:31 +01:00
Martin Gräßlin
fc37f1a9eb [tests] Use QCoreApplication for ShadowTest 2015-11-18 10:21:36 +01:00
Martin Gräßlin
799d11fdb7 [tests] Add a shadow test application 2015-11-18 09:58:19 +01:00
Martin Gräßlin
efaa5c5233 [tools] Simulate a panel tooltip
On entered on the panel window we show a tooltip at the entered
position and make it follow the mouse.
2015-09-17 11:50:01 +02:00
Martin Gräßlin
23f4a63908 [tests] Add an example for the Dpms interface
Uses QWidgets to render a very small UI.
* lists each Output
* for each output shows whether dpms is supported
* and which dpms mode it's in
* and provides a button to change the mode
2015-09-09 17:46:40 +02:00
Martin Gräßlin
66838ccf33 Fix compiler warnings 2015-09-02 16:20:10 +02:00
Martin Gräßlin
42a1e1e99e Add a themed icon name to PlasmaWindow interface
Server can set a themed icon name, client gets it directly turned into a
QIcon. That only works with QGuiApplications as can be seen in the
adjusted paneltest.
2015-06-20 02:46:56 +02:00
Martin Gräßlin
abf42dfdc3 Add state handling to PlasmaWindow interface
Allows to pass all on/off states from compositor to the PlasmaWindow.
2015-06-18 21:13:58 +02:00
Martin Gräßlin
dcb18dfc46 [client] Create Compositor from QtWayland integration
Adds a new test application qtwayland-integration-test which demonstrates
how one can create a Surface from the Compositor got from QtWayland.
2015-06-18 03:37:58 +02:00
Martin Gräßlin
d6f0ff55bd [tests] Extend paneltest on how to use PlasmaWindow
Debugs out changes to window title.
2015-06-16 06:30:54 +02:00
Martin Gräßlin
fea4b92c92 [tests] Extend paneltest to enable/disable showDesktop mode
* Left button: enable
* Right button: disable
2015-06-13 00:16:48 +02:00
Martin Gräßlin
1c1da06eb1 [tests] Add a test application for PlasmaShellInterface
Creates a panel.

REVIEW: 124053
2015-06-09 20:52:45 +02:00
Martin Gräßlin
bb7065be3d [client] Add Touch
Basic support for handling touch events on Client side.
2015-03-25 12:22:05 +01:00
Martin Gräßlin
b3b4adfe7f [tests] Install eventDispatcher before creating the QGuiApplication
This change demonstrates how one can install a custom event dispatcher
before creating the QGuiApplication and how to process Wayland events
using the event dispatcher to e.g. start an Xwayland server prior to
creating the application.

It also allows to use

--platform wayland

on the test application. The wayland QPA plugin will connect to the
KWayland server started prior to creating the application.
Please note that such a setup will freeze unless QtWayland has commit
1e32e71 [1].

[1] 1e32e71403
2015-02-18 09:43:04 +01:00
Martin Gräßlin
97756ff872 [tests] Improve startup of Xwayland server
Instead of performing dispatchEvents for a hard coded number of
expected events from Xwayland, we use select on the pipe to figure
out whether Xwayland has started writing the display number. As long
as select does not indicate that the pipe is ready we need to dispatch
further events.
2015-02-16 14:32:58 +01:00
Martin Gräßlin
59d90f20c6 [tests] Add option to start rootless Xwayland server to renderingservertest
Will be started after the app is created.
2015-01-09 12:08:23 +01:00
Martin Gräßlin
21d652e993 [tests] Create Output before XWayland is started
This is required to get a proper size in the XWayland server.
Without an output the size is 0,0.
2015-01-07 13:20:04 +01:00
Martin Gräßlin
8d5e14ebfe [tests] Renderingservertest supports maximizing a window 2014-12-15 09:51:28 +01:00
Martin Gräßlin
35e5517c4b Add missing newline at end of file 2014-12-12 08:36:47 +01:00
Martin Gräßlin
66b5c4382a Do not include QtModules 2014-12-12 08:32:01 +01:00
Martin Gräßlin
f4c0930a26 renderingservertest: Proper DPI for the Output
According to Wikipedia:
* screens have a default DPI of 96
* 96 dot/in are 38 dot/cm
* 1024/768 -> 269/202 mm
2014-11-27 19:25:17 +01:00
Martin Gräßlin
3fc96bdabd renderingservertest: Improve focus handling
Properly reset focus when surfaces get added/removed. E.g. when
writing in Kate additional surfaces are created for which we do
not want to pass focus.
2014-11-27 19:24:16 +01:00
Martin Gräßlin
9d2cfd122e pasteclient: read selection in thread 2014-11-27 12:45:42 +01:00
Martin Gräßlin
b016765f6c renderingservertest: each new Surface becomes the seat's focused surface 2014-11-27 11:25:28 +01:00
Martin Gräßlin
d78ed75549 renderingservertest: Create a DataDeviceManagerInterface 2014-11-27 11:25:07 +01:00
Martin Gräßlin
99598167d7 Refactor KeyboardInterface
The KeyboardInterface gets created per wl_resource. For this all
more global information (e.g. key states) is moved into the
SeatInterface.
2014-11-26 15:00:44 +01:00
Martin Gräßlin
d7a9be72ea Get event timestamp from SeatInterface in KeyboardInterface 2014-11-26 13:04:36 +01:00
Martin Gräßlin
d425515a99 Move pointer button handling from PointerInterface to SeatInterface
The button state is a seat-global state and not a per pointer state.
All pressed/released and axis events are moved to the SeatInterface
and just invoke the related method on the focused surface pointer.
2014-11-26 11:50:52 +01:00
Martin Gräßlin
961aaae8f1 [server] Add a SeatInterface::focusedPointer
This method is supposed to return the PointerInterface for the current
focused surface. At the moment it just creates the one global
PointerInterface. The existing SeatInterface::pointer method got
removed as that is actually wrong usage.
2014-11-25 16:04:07 +01:00
Martin Gräßlin
ff806d1657 Move focused pointer surface API to SeatInterface
There can only be one focused surface per Seat, thus the information
should be hold in the seat.

This only adjusts the API, the actual data is still hold in the
PointerInterface. This still needs adjustment.
2014-11-25 15:54:28 +01:00