2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2013-06-17 07:35:45 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2019 Roman Gilg <subdiff@gmail.com>
|
|
|
|
SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
|
2013-06-17 07:35:45 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2013-06-17 07:35:45 +00:00
|
|
|
#include "wayland_backend.h"
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
2020-10-06 23:36:18 +00:00
|
|
|
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
#if HAVE_WAYLAND_EGL
|
|
|
|
#include "egl_wayland_backend.h"
|
2020-10-06 23:36:18 +00:00
|
|
|
#include "../drm/gbm_dmabuf.h"
|
|
|
|
#include <gbm.h>
|
|
|
|
#endif
|
2015-05-05 15:27:03 +00:00
|
|
|
#include "logging.h"
|
Introduce RenderLoop
At the moment, our frame scheduling infrastructure is still heavily
based on Xinerama-style rendering. Specifically, we assume that painting
is driven by a single timer, etc.
This change introduces a new type - RenderLoop. Its main purpose is to
drive compositing on a specific output, or in case of X11, on the
overlay window.
With RenderLoop, compositing is synchronized to vblank events. It
exposes the last and the next estimated presentation timestamp. The
expected presentation timestamp can be used by effects to ensure that
animations are synchronized with the upcoming vblank event.
On Wayland, every outputs has its own render loop. On X11, per screen
rendering is not possible, therefore the platform exposes the render
loop for the overlay window. Ideally, the Scene has to expose the
RenderLoop, but as the first step towards better compositing scheduling
it's good as is for the time being.
The RenderLoop tries to minimize the latency by delaying compositing as
close as possible to the next vblank event. One tricky thing about it is
that if compositing is too close to the next vblank event, animations
may become a little bit choppy. However, increasing the latency reduces
the choppiness.
Given that, there is no any "silver bullet" solution for the choppiness
issue, a new option has been added in the Compositing KCM to specify the
amount of latency. By default, it's "Medium," but if a user is not
satisfied with the upstream default, they can tweak it.
2020-11-19 08:52:29 +00:00
|
|
|
#include "renderloop_p.h"
|
2015-05-05 13:13:36 +00:00
|
|
|
#include "scene_qpainter_wayland_backend.h"
|
2021-01-30 13:22:07 +00:00
|
|
|
#include "session.h"
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
#include "wayland_output.h"
|
|
|
|
|
|
|
|
#include "composite.h"
|
|
|
|
#include "cursor.h"
|
|
|
|
#include "input.h"
|
|
|
|
#include "main.h"
|
2021-11-09 10:36:24 +00:00
|
|
|
#include "scene.h"
|
2020-12-17 10:34:04 +00:00
|
|
|
#include "screens.h"
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
#include "pointer_input.h"
|
|
|
|
#include "wayland_server.h"
|
2021-07-08 23:13:24 +00:00
|
|
|
#include "dpmsinputeventfilter.h"
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
2014-09-19 11:59:51 +00:00
|
|
|
#include <KWayland/Client/buffer.h>
|
|
|
|
#include <KWayland/Client/compositor.h>
|
|
|
|
#include <KWayland/Client/connection_thread.h>
|
2014-09-23 11:15:49 +00:00
|
|
|
#include <KWayland/Client/event_queue.h>
|
2014-09-19 11:59:51 +00:00
|
|
|
#include <KWayland/Client/keyboard.h>
|
|
|
|
#include <KWayland/Client/pointer.h>
|
2016-11-24 12:51:15 +00:00
|
|
|
#include <KWayland/Client/pointerconstraints.h>
|
2017-03-15 16:56:08 +00:00
|
|
|
#include <KWayland/Client/pointergestures.h>
|
2014-09-19 11:59:51 +00:00
|
|
|
#include <KWayland/Client/registry.h>
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
#include <KWayland/Client/relativepointer.h>
|
2014-09-19 11:59:51 +00:00
|
|
|
#include <KWayland/Client/seat.h>
|
2015-12-17 14:32:41 +00:00
|
|
|
#include <KWayland/Client/server_decoration.h>
|
2014-09-19 11:59:51 +00:00
|
|
|
#include <KWayland/Client/shm_pool.h>
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
#include <KWayland/Client/subcompositor.h>
|
|
|
|
#include <KWayland/Client/subsurface.h>
|
2014-09-19 11:59:51 +00:00
|
|
|
#include <KWayland/Client/surface.h>
|
2015-03-25 13:50:14 +00:00
|
|
|
#include <KWayland/Client/touch.h>
|
2016-07-11 07:59:05 +00:00
|
|
|
#include <KWayland/Client/xdgshell.h>
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
2015-02-21 08:30:22 +00:00
|
|
|
#include <QMetaMethod>
|
2014-08-13 10:54:02 +00:00
|
|
|
#include <QThread>
|
2013-06-17 07:35:45 +00:00
|
|
|
|
2016-11-24 12:51:15 +00:00
|
|
|
#include <linux/input.h>
|
2020-07-22 17:31:23 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
2016-11-24 12:51:15 +00:00
|
|
|
|
2021-02-11 14:49:05 +00:00
|
|
|
#include <cmath>
|
|
|
|
|
2013-06-17 07:35:45 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
namespace Wayland
|
|
|
|
{
|
|
|
|
|
2014-09-19 11:59:51 +00:00
|
|
|
using namespace KWayland::Client;
|
|
|
|
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
WaylandCursor::WaylandCursor(WaylandBackend *backend)
|
|
|
|
: QObject(backend)
|
|
|
|
, m_backend(backend)
|
|
|
|
{
|
|
|
|
resetSurface();
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandCursor::resetSurface()
|
|
|
|
{
|
|
|
|
delete m_surface;
|
|
|
|
m_surface = backend()->compositor()->createSurface(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandCursor::init()
|
|
|
|
{
|
|
|
|
installImage();
|
|
|
|
}
|
|
|
|
|
|
|
|
WaylandCursor::~WaylandCursor()
|
|
|
|
{
|
|
|
|
delete m_surface;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandCursor::installImage()
|
|
|
|
{
|
2020-04-02 16:18:01 +00:00
|
|
|
const QImage image = Cursors::self()->currentCursor()->image();
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
if (image.isNull() || image.size().isEmpty()) {
|
2020-12-03 08:23:51 +00:00
|
|
|
doInstallImage(nullptr, QSize(), 1);
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-03-15 19:59:29 +00:00
|
|
|
|
|
|
|
auto buffer = m_backend->shmPool()->createBuffer(image).toStrongRef();
|
|
|
|
wl_buffer *imageBuffer = *buffer.data();
|
2020-12-03 08:23:51 +00:00
|
|
|
doInstallImage(imageBuffer, image.size(), image.devicePixelRatio());
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
}
|
|
|
|
|
2020-12-03 08:23:51 +00:00
|
|
|
void WaylandCursor::doInstallImage(wl_buffer *image, const QSize &size, qreal scale)
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
{
|
2021-10-15 19:18:31 +00:00
|
|
|
auto *pointer = m_backend->seat()->pointerDevice()->nativePointer();
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
if (!pointer || !pointer->isValid()) {
|
|
|
|
return;
|
|
|
|
}
|
2020-04-02 16:18:01 +00:00
|
|
|
pointer->setCursor(m_surface, image ? Cursors::self()->currentCursor()->hotspot() : QPoint());
|
2020-12-03 08:23:51 +00:00
|
|
|
drawSurface(image, size, scale);
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
}
|
|
|
|
|
2020-12-03 08:23:51 +00:00
|
|
|
void WaylandCursor::drawSurface(wl_buffer *image, const QSize &size, qreal scale)
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
{
|
|
|
|
m_surface->attachBuffer(image);
|
2021-02-11 08:21:03 +00:00
|
|
|
m_surface->setScale(std::ceil(scale));
|
2020-12-03 08:23:51 +00:00
|
|
|
m_surface->damageBuffer(QRect(QPoint(0, 0), size));
|
2021-09-03 17:56:15 +00:00
|
|
|
m_surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
m_backend->flush();
|
|
|
|
}
|
|
|
|
|
|
|
|
WaylandSubSurfaceCursor::WaylandSubSurfaceCursor(WaylandBackend *backend)
|
|
|
|
: WaylandCursor(backend)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandSubSurfaceCursor::init()
|
|
|
|
{
|
2021-10-15 19:18:31 +00:00
|
|
|
if (auto *pointer = backend()->seat()->pointerDevice()->nativePointer()) {
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
pointer->hideCursor();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
WaylandSubSurfaceCursor::~WaylandSubSurfaceCursor()
|
|
|
|
{
|
|
|
|
delete m_subSurface;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandSubSurfaceCursor::changeOutput(WaylandOutput *output)
|
|
|
|
{
|
|
|
|
delete m_subSurface;
|
|
|
|
m_subSurface = nullptr;
|
|
|
|
m_output = output;
|
|
|
|
if (!output) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
createSubSurface();
|
|
|
|
surface()->commit();
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandSubSurfaceCursor::createSubSurface()
|
|
|
|
{
|
|
|
|
if (m_subSurface) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!m_output) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
resetSurface();
|
|
|
|
m_subSurface = backend()->subCompositor()->createSubSurface(surface(), m_output->surface(), this);
|
|
|
|
m_subSurface->setMode(SubSurface::Mode::Desynchronized);
|
|
|
|
}
|
|
|
|
|
2020-12-03 08:23:51 +00:00
|
|
|
void WaylandSubSurfaceCursor::doInstallImage(wl_buffer *image, const QSize &size, qreal scale)
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
{
|
|
|
|
if (!image) {
|
|
|
|
delete m_subSurface;
|
|
|
|
m_subSurface = nullptr;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
createSubSurface();
|
|
|
|
// cursor position might have changed due to different cursor hot spot
|
|
|
|
move(input()->pointer()->pos());
|
2020-12-03 08:23:51 +00:00
|
|
|
drawSurface(image, size, scale);
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QPointF WaylandSubSurfaceCursor::absoluteToRelativePosition(const QPointF &position)
|
|
|
|
{
|
2020-04-02 16:18:01 +00:00
|
|
|
return position - m_output->geometry().topLeft() - Cursors::self()->currentCursor()->hotspot();
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandSubSurfaceCursor::move(const QPointF &globalPosition)
|
|
|
|
{
|
|
|
|
auto *output = backend()->getOutputAt(globalPosition.toPoint());
|
|
|
|
if (!m_output || (output && m_output != output)) {
|
|
|
|
changeOutput(output);
|
|
|
|
if (!m_output) {
|
|
|
|
// cursor might be off the grid
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
installImage();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!m_subSurface) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// place the sub-surface relative to the output it is on and factor in the hotspot
|
2020-04-02 16:18:01 +00:00
|
|
|
const auto relativePosition = globalPosition.toPoint() - Cursors::self()->currentCursor()->hotspot() - m_output->geometry().topLeft();
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
m_subSurface->setPosition(relativePosition);
|
2021-11-09 10:36:24 +00:00
|
|
|
Compositor::self()->scene()->addRepaintFull();
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
}
|
|
|
|
|
2021-10-15 19:18:31 +00:00
|
|
|
WaylandInputDevice::WaylandInputDevice(KWayland::Client::Keyboard *keyboard, WaylandSeat *seat)
|
|
|
|
: InputDevice(seat)
|
|
|
|
, m_seat(seat)
|
|
|
|
, m_keyboard(keyboard)
|
2013-06-17 07:35:45 +00:00
|
|
|
{
|
2021-10-15 19:18:31 +00:00
|
|
|
connect(keyboard, &Keyboard::keyChanged, this, [this](quint32 key, Keyboard::KeyState nativeState, quint32 time) {
|
|
|
|
InputRedirection::KeyboardKeyState state;
|
|
|
|
switch (nativeState) {
|
|
|
|
case Keyboard::KeyState::Pressed:
|
|
|
|
if (key == KEY_RIGHTCTRL) {
|
|
|
|
m_seat->backend()->togglePointerLock();
|
2014-08-21 09:20:03 +00:00
|
|
|
}
|
2021-10-15 19:18:31 +00:00
|
|
|
state = InputRedirection::KeyboardKeyPressed;
|
|
|
|
break;
|
|
|
|
case Keyboard::KeyState::Released:
|
|
|
|
state = InputRedirection::KeyboardKeyReleased;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Q_UNREACHABLE();
|
2014-08-21 09:20:03 +00:00
|
|
|
}
|
2021-10-15 19:18:31 +00:00
|
|
|
Q_EMIT keyChanged(key, state, time, this);
|
|
|
|
});
|
|
|
|
connect(keyboard, &Keyboard::modifiersChanged, this, [this](quint32 depressed, quint32 latched, quint32 locked, quint32 group) {
|
|
|
|
m_seat->backend()->keyboardModifiers(depressed, latched, locked, group);
|
|
|
|
});
|
|
|
|
connect(keyboard, &Keyboard::keymapChanged, this, [this](int fd, quint32 size) {
|
|
|
|
m_seat->backend()->keymapChange(fd, size);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
WaylandInputDevice::WaylandInputDevice(KWayland::Client::Pointer *pointer, WaylandSeat *seat)
|
|
|
|
: InputDevice(seat)
|
|
|
|
, m_seat(seat)
|
|
|
|
, m_pointer(pointer)
|
|
|
|
{
|
|
|
|
connect(pointer, &Pointer::entered, this, [this](quint32 serial, const QPointF &relativeToSurface) {
|
|
|
|
Q_UNUSED(relativeToSurface)
|
|
|
|
m_enteredSerial = serial;
|
|
|
|
});
|
|
|
|
connect(pointer, &Pointer::motion, this, [this](const QPointF &relativeToSurface, quint32 time) {
|
|
|
|
WaylandOutput *output = m_seat->backend()->findOutput(m_pointer->enteredSurface());
|
|
|
|
Q_ASSERT(output);
|
|
|
|
const QPointF absolutePos = output->geometry().topLeft() + relativeToSurface;
|
|
|
|
Q_EMIT pointerMotionAbsolute(absolutePos, time, this);
|
|
|
|
});
|
|
|
|
connect(pointer, &Pointer::buttonStateChanged, this, [this](quint32 serial, quint32 time, quint32 button, Pointer::ButtonState nativeState) {
|
|
|
|
Q_UNUSED(serial)
|
|
|
|
InputRedirection::PointerButtonState state;
|
|
|
|
switch (nativeState) {
|
|
|
|
case Pointer::ButtonState::Pressed:
|
|
|
|
state = InputRedirection::PointerButtonPressed;
|
|
|
|
break;
|
|
|
|
case Pointer::ButtonState::Released:
|
|
|
|
state = InputRedirection::PointerButtonReleased;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Q_UNREACHABLE();
|
2014-08-21 09:20:03 +00:00
|
|
|
}
|
2021-10-15 19:18:31 +00:00
|
|
|
Q_EMIT pointerButtonChanged(button, state, time, this);
|
|
|
|
});
|
|
|
|
// TODO: Send discreteDelta and source as well.
|
|
|
|
connect(pointer, &Pointer::axisChanged, this, [this](quint32 time, Pointer::Axis nativeAxis, qreal delta) {
|
|
|
|
InputRedirection::PointerAxis axis;
|
|
|
|
switch (nativeAxis) {
|
|
|
|
case Pointer::Axis::Horizontal:
|
|
|
|
axis = InputRedirection::PointerAxisHorizontal;
|
|
|
|
break;
|
|
|
|
case Pointer::Axis::Vertical:
|
|
|
|
axis = InputRedirection::PointerAxisVertical;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Q_UNREACHABLE();
|
2015-03-25 13:50:14 +00:00
|
|
|
}
|
2021-10-15 19:18:31 +00:00
|
|
|
Q_EMIT pointerAxisChanged(axis, delta, 0, InputRedirection::PointerAxisSourceUnknown, time, this);
|
|
|
|
});
|
|
|
|
|
|
|
|
KWayland::Client::PointerGestures *pointerGestures = m_seat->backend()->pointerGestures();
|
|
|
|
if (pointerGestures) {
|
|
|
|
m_pinchGesture.reset(pointerGestures->createPinchGesture(m_pointer.data(), this));
|
|
|
|
connect(m_pinchGesture.data(), &PointerPinchGesture::started, this, [this](quint32 serial, quint32 time) {
|
|
|
|
Q_UNUSED(serial);
|
|
|
|
Q_EMIT pinchGestureBegin(m_pinchGesture->fingerCount(), time, this);
|
|
|
|
});
|
|
|
|
connect(m_pinchGesture.data(), &PointerPinchGesture::updated, this, [this](const QSizeF &delta, qreal scale, qreal rotation, quint32 time) {
|
|
|
|
Q_EMIT pinchGestureUpdate(scale, rotation, delta, time, this);
|
|
|
|
});
|
|
|
|
connect(m_pinchGesture.data(), &PointerPinchGesture::ended, this, [this](quint32 serial, quint32 time) {
|
|
|
|
Q_UNUSED(serial)
|
|
|
|
Q_EMIT pinchGestureEnd(time, this);
|
|
|
|
});
|
|
|
|
connect(m_pinchGesture.data(), &PointerPinchGesture::cancelled, this, [this](quint32 serial, quint32 time) {
|
|
|
|
Q_UNUSED(serial)
|
|
|
|
Q_EMIT pinchGestureCancelled(time, this);
|
|
|
|
});
|
|
|
|
|
|
|
|
m_swipeGesture.reset(pointerGestures->createSwipeGesture(m_pointer.data(), this));
|
|
|
|
connect(m_swipeGesture.data(), &PointerSwipeGesture::started, this, [this](quint32 serial, quint32 time) {
|
|
|
|
Q_UNUSED(serial)
|
|
|
|
Q_EMIT swipeGestureBegin(m_swipeGesture->fingerCount(), time, this);
|
|
|
|
});
|
|
|
|
connect(m_swipeGesture.data(), &PointerSwipeGesture::updated, this, [this](const QSizeF &delta, quint32 time) {
|
|
|
|
Q_EMIT swipeGestureUpdate(delta, time, this);
|
|
|
|
});
|
|
|
|
connect(m_swipeGesture.data(), &PointerSwipeGesture::ended, this, [this](quint32 serial, quint32 time) {
|
|
|
|
Q_UNUSED(serial)
|
|
|
|
Q_EMIT swipeGestureEnd(time, this);
|
|
|
|
});
|
|
|
|
connect(m_swipeGesture.data(), &PointerSwipeGesture::cancelled, this, [this](quint32 serial, quint32 time) {
|
|
|
|
Q_UNUSED(serial)
|
|
|
|
Q_EMIT swipeGestureCancelled(time, this);
|
|
|
|
});
|
2015-02-25 08:35:42 +00:00
|
|
|
}
|
2013-06-17 07:35:45 +00:00
|
|
|
}
|
|
|
|
|
2021-10-15 19:18:31 +00:00
|
|
|
WaylandInputDevice::WaylandInputDevice(KWayland::Client::RelativePointer *relativePointer, WaylandSeat *seat)
|
|
|
|
: InputDevice(seat)
|
|
|
|
, m_seat(seat)
|
|
|
|
, m_relativePointer(relativePointer)
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
{
|
2021-10-15 19:18:31 +00:00
|
|
|
connect(relativePointer, &RelativePointer::relativeMotion, this, [this](const QSizeF &delta, const QSizeF &deltaNonAccelerated, quint64 timestamp) {
|
|
|
|
Q_EMIT pointerMotion(delta, deltaNonAccelerated, timestamp, timestamp * 1000, this);
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-10-15 19:18:31 +00:00
|
|
|
WaylandInputDevice::WaylandInputDevice(KWayland::Client::Touch *touch, WaylandSeat *seat)
|
|
|
|
: InputDevice(seat)
|
|
|
|
, m_seat(seat)
|
|
|
|
, m_touch(touch)
|
2013-06-17 07:35:45 +00:00
|
|
|
{
|
2021-10-15 19:18:31 +00:00
|
|
|
connect(touch, &Touch::sequenceCanceled, this, [this]() {
|
|
|
|
Q_EMIT touchCanceled(this);
|
|
|
|
});
|
|
|
|
connect(touch, &Touch::frameEnded, this, [this]() {
|
|
|
|
Q_EMIT touchFrame(this);
|
|
|
|
});
|
|
|
|
connect(touch, &Touch::sequenceStarted, this, [this](TouchPoint *tp) {
|
|
|
|
Q_EMIT touchDown(tp->id(), tp->position(), tp->time(), this);
|
|
|
|
});
|
|
|
|
connect(touch, &Touch::pointAdded, this, [this](TouchPoint *tp) {
|
|
|
|
Q_EMIT touchDown(tp->id(), tp->position(), tp->time(), this);
|
|
|
|
});
|
|
|
|
connect(touch, &Touch::pointRemoved, this, [this](TouchPoint *tp) {
|
|
|
|
Q_EMIT touchUp(tp->id(), tp->time(), this);
|
|
|
|
});
|
|
|
|
connect(touch, &Touch::pointMoved, this, [this](TouchPoint *tp) {
|
|
|
|
Q_EMIT touchMotion(tp->id(), tp->position(), tp->time(), this);
|
|
|
|
});
|
2013-06-17 07:35:45 +00:00
|
|
|
}
|
|
|
|
|
2021-10-15 19:18:31 +00:00
|
|
|
WaylandInputDevice::~WaylandInputDevice()
|
2013-06-17 07:35:45 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-10-15 19:18:31 +00:00
|
|
|
QString WaylandInputDevice::sysName() const
|
2013-06-17 07:35:45 +00:00
|
|
|
{
|
2021-10-15 19:18:31 +00:00
|
|
|
return QString();
|
2013-06-17 07:35:45 +00:00
|
|
|
}
|
|
|
|
|
2021-10-15 19:18:31 +00:00
|
|
|
QString WaylandInputDevice::name() const
|
2015-03-25 13:50:14 +00:00
|
|
|
{
|
2021-10-15 19:18:31 +00:00
|
|
|
return QString();
|
2015-03-25 13:50:14 +00:00
|
|
|
}
|
|
|
|
|
2021-10-15 19:18:31 +00:00
|
|
|
bool WaylandInputDevice::isEnabled() const
|
2017-03-15 16:56:08 +00:00
|
|
|
{
|
2021-10-15 19:18:31 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandInputDevice::setEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
Q_UNUSED(enabled)
|
|
|
|
}
|
|
|
|
|
|
|
|
LEDs WaylandInputDevice::leds() const
|
|
|
|
{
|
|
|
|
return LEDs();
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandInputDevice::setLeds(LEDs leds)
|
|
|
|
{
|
|
|
|
Q_UNUSED(leds)
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WaylandInputDevice::isKeyboard() const
|
|
|
|
{
|
|
|
|
return m_keyboard;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WaylandInputDevice::isAlphaNumericKeyboard() const
|
|
|
|
{
|
|
|
|
return m_keyboard;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WaylandInputDevice::isPointer() const
|
|
|
|
{
|
|
|
|
return m_pointer || m_relativePointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WaylandInputDevice::isTouchpad() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WaylandInputDevice::isTouch() const
|
|
|
|
{
|
|
|
|
return m_touch;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WaylandInputDevice::isTabletTool() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WaylandInputDevice::isTabletPad() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WaylandInputDevice::isTabletModeSwitch() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool WaylandInputDevice::isLidSwitch() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
KWayland::Client::Pointer *WaylandInputDevice::nativePointer() const
|
|
|
|
{
|
|
|
|
return m_pointer.data();
|
|
|
|
}
|
|
|
|
|
|
|
|
WaylandInputBackend::WaylandInputBackend(WaylandBackend *backend, QObject *parent)
|
|
|
|
: InputBackend(parent)
|
|
|
|
, m_backend(backend)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandInputBackend::initialize()
|
|
|
|
{
|
|
|
|
connect(m_backend, &WaylandBackend::seatCreated, this, &WaylandInputBackend::checkSeat);
|
|
|
|
checkSeat();
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandInputBackend::checkSeat()
|
|
|
|
{
|
|
|
|
if (auto seat = m_backend->seat()) {
|
|
|
|
if (seat->relativePointerDevice()) {
|
|
|
|
Q_EMIT deviceAdded(seat->relativePointerDevice());
|
2017-03-15 16:56:08 +00:00
|
|
|
}
|
2021-10-15 19:18:31 +00:00
|
|
|
if (seat->pointerDevice()) {
|
|
|
|
Q_EMIT deviceAdded(seat->pointerDevice());
|
2017-03-15 16:56:08 +00:00
|
|
|
}
|
2021-10-15 19:18:31 +00:00
|
|
|
if (seat->keyboardDevice()) {
|
|
|
|
Q_EMIT deviceAdded(seat->keyboardDevice());
|
2017-03-15 16:56:08 +00:00
|
|
|
}
|
2021-10-15 19:18:31 +00:00
|
|
|
if (seat->touchDevice()) {
|
|
|
|
Q_EMIT deviceAdded(seat->touchDevice());
|
2017-03-15 16:56:08 +00:00
|
|
|
}
|
|
|
|
|
2021-10-15 19:18:31 +00:00
|
|
|
connect(seat, &WaylandSeat::deviceAdded, this, &InputBackend::deviceAdded);
|
|
|
|
connect(seat, &WaylandSeat::deviceRemoved, this, &InputBackend::deviceRemoved);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
WaylandSeat::WaylandSeat(KWayland::Client::Seat *nativeSeat, WaylandBackend *backend)
|
|
|
|
: QObject(nullptr)
|
|
|
|
, m_seat(nativeSeat)
|
|
|
|
, m_backend(backend)
|
|
|
|
{
|
|
|
|
connect(m_seat, &Seat::hasKeyboardChanged, this, [this](bool hasKeyboard) {
|
|
|
|
if (hasKeyboard) {
|
|
|
|
createKeyboardDevice();
|
|
|
|
} else {
|
|
|
|
destroyKeyboardDevice();
|
2017-03-15 16:56:08 +00:00
|
|
|
}
|
2021-10-15 19:18:31 +00:00
|
|
|
});
|
|
|
|
connect(m_seat, &Seat::hasPointerChanged, this, [this](bool hasPointer) {
|
|
|
|
if (hasPointer && !m_pointerDevice) {
|
|
|
|
createPointerDevice();
|
|
|
|
} else {
|
|
|
|
destroyPointerDevice();
|
2017-03-15 16:56:08 +00:00
|
|
|
}
|
2021-10-15 19:18:31 +00:00
|
|
|
});
|
|
|
|
connect(m_seat, &Seat::hasTouchChanged, this, [this](bool hasTouch) {
|
|
|
|
if (hasTouch && !m_touchDevice) {
|
|
|
|
createTouchDevice();
|
|
|
|
} else {
|
|
|
|
destroyTouchDevice();
|
2017-03-15 16:56:08 +00:00
|
|
|
}
|
2021-10-15 19:18:31 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
WaylandSeat::~WaylandSeat()
|
|
|
|
{
|
|
|
|
destroyPointerDevice();
|
|
|
|
destroyKeyboardDevice();
|
|
|
|
destroyTouchDevice();
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandSeat::createPointerDevice()
|
|
|
|
{
|
|
|
|
m_pointerDevice = new WaylandInputDevice(m_seat->createPointer(), this);
|
|
|
|
Q_EMIT deviceAdded(m_pointerDevice);
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandSeat::destroyPointerDevice()
|
|
|
|
{
|
|
|
|
if (m_pointerDevice) {
|
|
|
|
Q_EMIT deviceRemoved(m_pointerDevice);
|
|
|
|
destroyRelativePointer();
|
|
|
|
delete m_pointerDevice;
|
|
|
|
m_pointerDevice = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandSeat::createRelativePointer()
|
|
|
|
{
|
|
|
|
KWayland::Client::RelativePointerManager *manager = m_backend->relativePointerManager();
|
|
|
|
if (manager) {
|
|
|
|
m_relativePointerDevice = new WaylandInputDevice(manager->createRelativePointer(m_pointerDevice->nativePointer()), this);
|
|
|
|
Q_EMIT deviceAdded(m_relativePointerDevice);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandSeat::destroyRelativePointer()
|
|
|
|
{
|
|
|
|
if (m_relativePointerDevice) {
|
|
|
|
Q_EMIT deviceRemoved(m_relativePointerDevice);
|
|
|
|
delete m_relativePointerDevice;
|
|
|
|
m_relativePointerDevice = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandSeat::createKeyboardDevice()
|
|
|
|
{
|
|
|
|
m_keyboardDevice = new WaylandInputDevice(m_seat->createKeyboard(), this);
|
|
|
|
Q_EMIT deviceAdded(m_keyboardDevice);
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandSeat::destroyKeyboardDevice()
|
|
|
|
{
|
|
|
|
if (m_keyboardDevice) {
|
|
|
|
Q_EMIT deviceRemoved(m_keyboardDevice);
|
|
|
|
delete m_keyboardDevice;
|
|
|
|
m_keyboardDevice = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandSeat::createTouchDevice()
|
|
|
|
{
|
|
|
|
m_touchDevice = new WaylandInputDevice(m_seat->createTouch(), this);
|
|
|
|
Q_EMIT deviceAdded(m_touchDevice);
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandSeat::destroyTouchDevice()
|
|
|
|
{
|
|
|
|
if (m_touchDevice) {
|
|
|
|
Q_EMIT deviceRemoved(m_touchDevice);
|
|
|
|
delete m_touchDevice;
|
|
|
|
m_touchDevice = nullptr;
|
|
|
|
}
|
2017-03-15 16:56:08 +00:00
|
|
|
}
|
|
|
|
|
2015-05-06 07:37:25 +00:00
|
|
|
WaylandBackend::WaylandBackend(QObject *parent)
|
2016-04-07 07:18:10 +00:00
|
|
|
: Platform(parent)
|
2021-01-30 13:22:07 +00:00
|
|
|
, m_session(Session::create(Session::Type::Noop, this))
|
2013-07-03 09:56:05 +00:00
|
|
|
, m_display(nullptr)
|
2014-09-23 11:15:49 +00:00
|
|
|
, m_eventQueue(new EventQueue(this))
|
2014-08-18 12:05:35 +00:00
|
|
|
, m_registry(new Registry(this))
|
2017-09-23 18:21:26 +00:00
|
|
|
, m_compositor(new KWayland::Client::Compositor(this))
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
, m_subCompositor(new KWayland::Client::SubCompositor(this))
|
2014-08-21 05:54:16 +00:00
|
|
|
, m_shm(new ShmPool(this))
|
2015-03-23 11:45:21 +00:00
|
|
|
, m_connectionThreadObject(new ConnectionThread(nullptr))
|
2014-08-13 10:54:02 +00:00
|
|
|
, m_connectionThread(nullptr)
|
2015-05-06 06:32:39 +00:00
|
|
|
{
|
2020-11-09 12:19:15 +00:00
|
|
|
setPerScreenRenderingEnabled(true);
|
2020-07-20 16:11:30 +00:00
|
|
|
supportsOutputChanges();
|
2021-01-30 13:22:07 +00:00
|
|
|
connect(this, &WaylandBackend::connectionFailed, qApp, &QCoreApplication::quit);
|
2020-07-22 17:31:23 +00:00
|
|
|
|
|
|
|
|
2021-11-10 11:41:57 +00:00
|
|
|
#if HAVE_WAYLAND_EGL
|
2020-07-22 17:31:23 +00:00
|
|
|
char const *drm_render_node = "/dev/dri/renderD128";
|
2020-07-22 17:38:57 +00:00
|
|
|
m_drmFileDescriptor = open(drm_render_node, O_RDWR);
|
|
|
|
if (m_drmFileDescriptor < 0) {
|
2020-07-22 17:31:23 +00:00
|
|
|
qCWarning(KWIN_WAYLAND_BACKEND) << "Failed to open drm render node" << drm_render_node;
|
|
|
|
m_gbmDevice = nullptr;
|
|
|
|
return;
|
|
|
|
}
|
2020-07-22 17:38:57 +00:00
|
|
|
m_gbmDevice = gbm_create_device(m_drmFileDescriptor);
|
2020-10-06 23:36:18 +00:00
|
|
|
#endif
|
2015-05-06 06:32:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
WaylandBackend::~WaylandBackend()
|
|
|
|
{
|
2020-12-02 12:12:56 +00:00
|
|
|
if (sceneEglDisplay() != EGL_NO_DISPLAY) {
|
|
|
|
eglTerminate(sceneEglDisplay());
|
|
|
|
}
|
|
|
|
|
2021-10-15 19:18:31 +00:00
|
|
|
if (m_pointerGestures) {
|
|
|
|
m_pointerGestures->release();
|
|
|
|
}
|
2016-11-24 12:51:15 +00:00
|
|
|
if (m_pointerConstraints) {
|
|
|
|
m_pointerConstraints->release();
|
|
|
|
}
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
delete m_waylandCursor;
|
|
|
|
|
2020-03-27 13:18:22 +00:00
|
|
|
m_eventQueue->release();
|
2021-02-10 10:01:18 +00:00
|
|
|
destroyOutputs();
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
2016-07-11 07:59:05 +00:00
|
|
|
if (m_xdgShell) {
|
|
|
|
m_xdgShell->release();
|
|
|
|
}
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
m_subCompositor->release();
|
2015-05-06 06:32:39 +00:00
|
|
|
m_compositor->release();
|
|
|
|
m_registry->release();
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
delete m_seat;
|
2015-05-06 06:32:39 +00:00
|
|
|
m_shm->release();
|
|
|
|
|
|
|
|
m_connectionThread->quit();
|
|
|
|
m_connectionThread->wait();
|
2020-03-27 13:18:22 +00:00
|
|
|
m_connectionThreadObject->deleteLater();
|
2021-11-10 11:41:57 +00:00
|
|
|
#if HAVE_WAYLAND_EGL
|
2020-07-22 17:31:23 +00:00
|
|
|
gbm_device_destroy(m_gbmDevice);
|
2020-07-22 17:38:57 +00:00
|
|
|
close(m_drmFileDescriptor);
|
2020-10-06 23:36:18 +00:00
|
|
|
#endif
|
2015-05-06 06:32:39 +00:00
|
|
|
qCDebug(KWIN_WAYLAND_BACKEND) << "Destroyed Wayland display";
|
|
|
|
}
|
|
|
|
|
2021-01-30 13:22:07 +00:00
|
|
|
bool WaylandBackend::initialize()
|
2013-06-17 07:35:45 +00:00
|
|
|
{
|
2020-12-03 08:23:51 +00:00
|
|
|
connect(m_registry, &Registry::compositorAnnounced, this, [this](quint32 name, quint32 version) {
|
|
|
|
if (version < 4) {
|
|
|
|
qFatal("wl_compositor version 4 or later is required");
|
2014-08-18 12:05:35 +00:00
|
|
|
}
|
2020-12-03 08:23:51 +00:00
|
|
|
m_compositor->setup(m_registry->bindCompositor(name, version));
|
|
|
|
});
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
connect(m_registry, &Registry::subCompositorAnnounced, this,
|
|
|
|
[this](quint32 name) {
|
|
|
|
m_subCompositor->setup(m_registry->bindSubCompositor(name, 1));
|
|
|
|
}
|
|
|
|
);
|
2014-08-21 05:54:16 +00:00
|
|
|
connect(m_registry, &Registry::shmAnnounced, this,
|
|
|
|
[this](quint32 name) {
|
|
|
|
m_shm->setup(m_registry->bindShm(name, 1));
|
|
|
|
}
|
|
|
|
);
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
connect(m_registry, &Registry::relativePointerManagerUnstableV1Announced, this,
|
|
|
|
[this](quint32 name, quint32 version) {
|
|
|
|
if (m_relativePointerManager) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_relativePointerManager = m_registry->createRelativePointerManager(name, version, this);
|
|
|
|
if (m_pointerConstraints) {
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT pointerLockSupportedChanged();
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
2016-11-24 12:51:15 +00:00
|
|
|
connect(m_registry, &Registry::pointerConstraintsUnstableV1Announced, this,
|
|
|
|
[this](quint32 name, quint32 version) {
|
|
|
|
if (m_pointerConstraints) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_pointerConstraints = m_registry->createPointerConstraints(name, version, this);
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
if (m_relativePointerManager) {
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT pointerLockSupportedChanged();
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
}
|
2016-11-24 12:51:15 +00:00
|
|
|
}
|
|
|
|
);
|
2021-10-15 19:18:31 +00:00
|
|
|
connect(m_registry, &Registry::pointerGesturesUnstableV1Announced, this,
|
|
|
|
[this](quint32 name, quint32 version) {
|
|
|
|
if (m_pointerGestures) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_pointerGestures = m_registry->createPointerGestures(name, version, this);
|
|
|
|
}
|
|
|
|
);
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
connect(m_registry, &Registry::interfacesAnnounced, this, &WaylandBackend::createOutputs);
|
2017-03-15 16:56:08 +00:00
|
|
|
connect(m_registry, &Registry::interfacesAnnounced, this,
|
|
|
|
[this] {
|
2021-10-15 19:18:31 +00:00
|
|
|
const auto seatInterface = m_registry->interface(Registry::Interface::Seat);
|
|
|
|
if (seatInterface.name == 0) {
|
2017-03-15 16:56:08 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-10-15 19:18:31 +00:00
|
|
|
|
|
|
|
m_seat = new WaylandSeat(m_registry->createSeat(seatInterface.name, std::min(2u, seatInterface.version), this), this);
|
|
|
|
Q_EMIT seatCreated();
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
|
|
|
m_waylandCursor = new WaylandCursor(this);
|
2017-03-15 16:56:08 +00:00
|
|
|
}
|
|
|
|
);
|
2015-11-17 08:47:46 +00:00
|
|
|
if (!deviceIdentifier().isEmpty()) {
|
|
|
|
m_connectionThreadObject->setSocketName(deviceIdentifier());
|
|
|
|
}
|
2020-04-02 16:18:01 +00:00
|
|
|
connect(Cursors::self(), &Cursors::currentCursorChanged, this,
|
2016-02-23 11:29:05 +00:00
|
|
|
[this] {
|
2021-08-13 11:23:55 +00:00
|
|
|
if (!m_seat || !m_waylandCursor) {
|
2016-02-23 11:29:05 +00:00
|
|
|
return;
|
|
|
|
}
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
m_waylandCursor->installImage();
|
2020-04-02 16:18:01 +00:00
|
|
|
auto c = Cursors::self()->currentCursor();
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT c->rendered(c->geometry());
|
2016-02-23 11:29:05 +00:00
|
|
|
}
|
|
|
|
);
|
2021-10-15 19:18:31 +00:00
|
|
|
connect(Cursors::self(), &Cursors::positionChanged, this,
|
|
|
|
[this](Cursor *cursor, const QPoint &position) {
|
|
|
|
Q_UNUSED(cursor)
|
|
|
|
if (m_waylandCursor) {
|
|
|
|
m_waylandCursor->move(position);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
2020-04-02 16:18:01 +00:00
|
|
|
connect(this, &WaylandBackend::pointerLockChanged, this, [this] (bool locked) {
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
delete m_waylandCursor;
|
|
|
|
if (locked) {
|
|
|
|
m_waylandCursor = new WaylandSubSurfaceCursor(this);
|
|
|
|
m_waylandCursor->move(input()->pointer()->pos());
|
2021-10-15 19:18:31 +00:00
|
|
|
m_seat->createRelativePointer();
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
} else {
|
2021-10-15 19:18:31 +00:00
|
|
|
m_seat->destroyRelativePointer();
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
m_waylandCursor = new WaylandCursor(this);
|
|
|
|
}
|
|
|
|
m_waylandCursor->init();
|
|
|
|
});
|
2013-07-03 09:56:05 +00:00
|
|
|
initConnection();
|
2021-01-30 13:22:07 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
Session *WaylandBackend::session() const
|
|
|
|
{
|
|
|
|
return m_session;
|
2013-06-17 07:35:45 +00:00
|
|
|
}
|
|
|
|
|
2013-07-03 09:56:05 +00:00
|
|
|
void WaylandBackend::initConnection()
|
|
|
|
{
|
2014-08-13 10:54:02 +00:00
|
|
|
connect(m_connectionThreadObject, &ConnectionThread::connected, this,
|
|
|
|
[this]() {
|
|
|
|
// create the event queue for the main gui thread
|
|
|
|
m_display = m_connectionThreadObject->display();
|
2014-09-23 11:15:49 +00:00
|
|
|
m_eventQueue->setup(m_connectionThreadObject);
|
|
|
|
m_registry->setEventQueue(m_eventQueue);
|
2014-08-13 10:54:02 +00:00
|
|
|
// setup registry
|
2014-08-18 12:05:35 +00:00
|
|
|
m_registry->create(m_display);
|
|
|
|
m_registry->setup();
|
2014-08-13 10:54:02 +00:00
|
|
|
},
|
|
|
|
Qt::QueuedConnection);
|
|
|
|
connect(m_connectionThreadObject, &ConnectionThread::connectionDied, this,
|
|
|
|
[this]() {
|
2015-05-05 17:02:52 +00:00
|
|
|
setReady(false);
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT systemCompositorDied();
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
delete m_seat;
|
2014-08-21 05:54:16 +00:00
|
|
|
m_shm->destroy();
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
2021-02-10 10:01:18 +00:00
|
|
|
destroyOutputs();
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
2016-07-11 07:59:05 +00:00
|
|
|
if (m_xdgShell) {
|
|
|
|
m_xdgShell->destroy();
|
|
|
|
}
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
m_subCompositor->destroy();
|
2014-08-21 06:53:00 +00:00
|
|
|
m_compositor->destroy();
|
2014-08-18 12:05:35 +00:00
|
|
|
m_registry->destroy();
|
2014-09-23 11:15:49 +00:00
|
|
|
m_eventQueue->destroy();
|
2014-08-13 10:54:02 +00:00
|
|
|
if (m_display) {
|
|
|
|
m_display = nullptr;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
Qt::QueuedConnection);
|
|
|
|
connect(m_connectionThreadObject, &ConnectionThread::failed, this, &WaylandBackend::connectionFailed, Qt::QueuedConnection);
|
|
|
|
|
|
|
|
m_connectionThread = new QThread(this);
|
|
|
|
m_connectionThreadObject->moveToThread(m_connectionThread);
|
|
|
|
m_connectionThread->start();
|
|
|
|
|
|
|
|
m_connectionThreadObject->initConnection();
|
2013-07-03 09:56:05 +00:00
|
|
|
}
|
|
|
|
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
void WaylandBackend::updateScreenSize(WaylandOutput *output)
|
|
|
|
{
|
2020-09-09 01:46:12 +00:00
|
|
|
auto it = std::find(m_outputs.constBegin(), m_outputs.constEnd(), output);
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
|
|
|
int nextLogicalPosition = output->geometry().topRight().x();
|
2020-09-09 01:46:12 +00:00
|
|
|
while (++it != m_outputs.constEnd()) {
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
const QRect geo = (*it)->geometry();
|
|
|
|
(*it)->setGeometry(QPoint(nextLogicalPosition, 0), geo.size());
|
|
|
|
nextLogicalPosition = geo.topRight().x();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-05 17:06:28 +00:00
|
|
|
KWayland::Client::ServerSideDecorationManager *WaylandBackend::ssdManager()
|
|
|
|
{
|
|
|
|
if (!m_ssdManager) {
|
|
|
|
using namespace KWayland::Client;
|
|
|
|
const auto ssdManagerIface = m_registry->interface(Registry::Interface::ServerSideDecorationManager);
|
|
|
|
m_ssdManager = ssdManagerIface.name == 0 ? nullptr : m_registry->createServerSideDecorationManager(ssdManagerIface.name, ssdManagerIface.version, this);
|
|
|
|
}
|
|
|
|
return m_ssdManager;
|
|
|
|
}
|
|
|
|
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
void WaylandBackend::createOutputs()
|
2013-06-17 07:35:45 +00:00
|
|
|
{
|
2015-12-17 14:32:41 +00:00
|
|
|
using namespace KWayland::Client;
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
|
|
|
|
2019-11-03 16:08:59 +00:00
|
|
|
const auto xdgIface = m_registry->interface(Registry::Interface::XdgShellStable);
|
2016-07-11 07:59:05 +00:00
|
|
|
if (xdgIface.name != 0) {
|
|
|
|
m_xdgShell = m_registry->createXdgShell(xdgIface.name, xdgIface.version, this);
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// we need to multiply the initial window size with the scale in order to
|
|
|
|
// create an output window of this size in the end
|
|
|
|
const int pixelWidth = initialWindowSize().width() * initialOutputScale() + 0.5;
|
|
|
|
const int pixelHeight = initialWindowSize().height() * initialOutputScale() + 0.5;
|
|
|
|
const int logicalWidth = initialWindowSize().width();
|
|
|
|
|
|
|
|
int logicalWidthSum = 0;
|
|
|
|
for (int i = 0; i < initialOutputCount(); i++) {
|
2021-10-05 17:06:28 +00:00
|
|
|
createOutput(QPoint(logicalWidthSum, 0), QSize(pixelWidth, pixelHeight));
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
2021-10-05 17:06:28 +00:00
|
|
|
logicalWidthSum += logicalWidth;
|
|
|
|
}
|
|
|
|
}
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
2021-10-05 17:06:28 +00:00
|
|
|
WaylandOutput *WaylandBackend::createOutput(const QPoint &position, const QSize &size)
|
|
|
|
{
|
|
|
|
auto surface = m_compositor->createSurface(this);
|
|
|
|
if (!surface || !surface->isValid()) {
|
|
|
|
qCCritical(KWIN_WAYLAND_BACKEND) << "Creating Wayland Surface failed";
|
|
|
|
return nullptr;
|
|
|
|
}
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
2021-10-05 17:06:28 +00:00
|
|
|
if (ssdManager()) {
|
|
|
|
auto decoration = ssdManager()->create(surface, this);
|
|
|
|
connect(decoration, &ServerSideDecoration::modeChanged, this, [decoration] {
|
|
|
|
if (decoration->mode() != ServerSideDecoration::Mode::Server) {
|
|
|
|
decoration->requestMode(ServerSideDecoration::Mode::Server);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
2021-10-05 17:06:28 +00:00
|
|
|
WaylandOutput *waylandOutput = nullptr;
|
2013-06-17 07:35:45 +00:00
|
|
|
|
2021-10-05 17:06:28 +00:00
|
|
|
if (m_xdgShell && m_xdgShell->isValid()) {
|
|
|
|
waylandOutput = new XdgShellOutput(surface, m_xdgShell, this, m_nextId++);
|
|
|
|
}
|
2016-07-11 07:59:05 +00:00
|
|
|
|
2021-10-05 17:06:28 +00:00
|
|
|
if (!waylandOutput) {
|
|
|
|
qCCritical(KWIN_WAYLAND_BACKEND) << "Binding to all shell interfaces failed for output";
|
|
|
|
return nullptr;
|
|
|
|
}
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
2021-10-05 17:06:28 +00:00
|
|
|
waylandOutput->init(position, size);
|
2021-08-08 02:30:14 +00:00
|
|
|
|
2021-10-05 17:06:28 +00:00
|
|
|
connect(waylandOutput, &WaylandOutput::sizeChanged, this, [this, waylandOutput](const QSize &size) {
|
|
|
|
Q_UNUSED(size)
|
|
|
|
updateScreenSize(waylandOutput);
|
2021-11-09 10:36:24 +00:00
|
|
|
Compositor::self()->scene()->addRepaintFull();
|
2021-10-05 17:06:28 +00:00
|
|
|
});
|
|
|
|
connect(waylandOutput, &WaylandOutput::frameRendered, this, [waylandOutput]() {
|
|
|
|
waylandOutput->resetRendered();
|
|
|
|
|
|
|
|
// The current time of the monotonic clock is a pretty good estimate when the frame
|
|
|
|
// has been presented, however it will be much better if we check whether the host
|
|
|
|
// compositor supports the wp_presentation protocol.
|
|
|
|
RenderLoopPrivate *renderLoopPrivate = RenderLoopPrivate::get(waylandOutput->renderLoop());
|
|
|
|
renderLoopPrivate->notifyFrameCompleted(std::chrono::steady_clock::now().time_since_epoch());
|
|
|
|
});
|
|
|
|
|
|
|
|
// The output will only actually be added when it receives its first
|
|
|
|
// configure event, and buffers can start being attached
|
|
|
|
m_pendingInitialOutputs++;
|
|
|
|
return waylandOutput;
|
2014-08-20 09:27:09 +00:00
|
|
|
}
|
|
|
|
|
2021-02-10 10:01:18 +00:00
|
|
|
void WaylandBackend::destroyOutputs()
|
|
|
|
{
|
|
|
|
while (!m_outputs.isEmpty()) {
|
|
|
|
WaylandOutput *output = m_outputs.takeLast();
|
2021-06-08 07:02:14 +00:00
|
|
|
Q_EMIT outputDisabled(output);
|
|
|
|
Q_EMIT outputRemoved(output);
|
2021-02-10 10:01:18 +00:00
|
|
|
delete output;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-15 19:18:31 +00:00
|
|
|
InputBackend *WaylandBackend::createInputBackend()
|
|
|
|
{
|
|
|
|
return new WaylandInputBackend(this);
|
|
|
|
}
|
|
|
|
|
2015-03-27 07:51:56 +00:00
|
|
|
OpenGLBackend *WaylandBackend::createOpenGLBackend()
|
|
|
|
{
|
2015-11-30 07:34:52 +00:00
|
|
|
#if HAVE_WAYLAND_EGL
|
2015-03-27 07:51:56 +00:00
|
|
|
return new EglWaylandBackend(this);
|
2015-11-30 07:34:52 +00:00
|
|
|
#else
|
|
|
|
return nullptr;
|
|
|
|
#endif
|
2015-03-27 07:51:56 +00:00
|
|
|
}
|
|
|
|
|
2015-03-27 08:05:03 +00:00
|
|
|
QPainterBackend *WaylandBackend::createQPainterBackend()
|
|
|
|
{
|
|
|
|
return new WaylandQPainterBackend(this);
|
|
|
|
}
|
|
|
|
|
2016-02-23 11:29:05 +00:00
|
|
|
void WaylandBackend::flush()
|
|
|
|
{
|
|
|
|
if (m_connectionThreadObject) {
|
|
|
|
m_connectionThreadObject->flush();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-17 01:11:39 +00:00
|
|
|
WaylandOutput* WaylandBackend::getOutputAt(const QPointF &globalPosition)
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
{
|
|
|
|
const auto pos = globalPosition.toPoint();
|
|
|
|
auto checkPosition = [pos](WaylandOutput *output) {
|
|
|
|
return output->geometry().contains(pos);
|
|
|
|
};
|
2020-09-09 01:46:12 +00:00
|
|
|
auto it = std::find_if(m_outputs.constBegin(), m_outputs.constEnd(), checkPosition);
|
|
|
|
return it == m_outputs.constEnd() ? nullptr : *it;
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
}
|
|
|
|
|
2021-10-15 19:18:31 +00:00
|
|
|
WaylandOutput *WaylandBackend::findOutput(KWayland::Client::Surface *nativeSurface) const
|
|
|
|
{
|
|
|
|
for (WaylandOutput *output : m_outputs) {
|
|
|
|
if (output->surface() == nativeSurface) {
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
bool WaylandBackend::supportsPointerLock()
|
|
|
|
{
|
|
|
|
return m_pointerConstraints && m_relativePointerManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandBackend::togglePointerLock()
|
2016-11-24 12:51:15 +00:00
|
|
|
{
|
|
|
|
if (!m_pointerConstraints) {
|
|
|
|
return;
|
|
|
|
}
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
if (!m_relativePointerManager) {
|
2016-11-24 12:51:15 +00:00
|
|
|
return;
|
|
|
|
}
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
if (!m_seat) {
|
2016-11-24 12:51:15 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-10-15 19:18:31 +00:00
|
|
|
auto pointer = m_seat->pointerDevice()->nativePointer();
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
if (!pointer) {
|
2016-11-24 12:51:15 +00:00
|
|
|
return;
|
|
|
|
}
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
if (m_outputs.isEmpty()) {
|
2016-11-24 12:51:15 +00:00
|
|
|
return;
|
|
|
|
}
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
|
2021-05-13 16:41:39 +00:00
|
|
|
for (auto output : qAsConst(m_outputs)) {
|
2021-10-15 19:18:31 +00:00
|
|
|
output->lockPointer(m_seat->pointerDevice()->nativePointer(), !m_pointerLockRequested);
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
}
|
|
|
|
m_pointerLockRequested = !m_pointerLockRequested;
|
2016-11-24 12:51:15 +00:00
|
|
|
flush();
|
|
|
|
}
|
|
|
|
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
bool WaylandBackend::pointerIsLocked()
|
2016-11-24 12:51:15 +00:00
|
|
|
{
|
2021-05-13 16:41:39 +00:00
|
|
|
for (auto *output : qAsConst(m_outputs)) {
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
if (output->pointerIsLocked()) {
|
|
|
|
return true;
|
2016-11-24 12:51:15 +00:00
|
|
|
}
|
|
|
|
}
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
return false;
|
2016-11-24 12:51:15 +00:00
|
|
|
}
|
|
|
|
|
2017-10-15 20:24:49 +00:00
|
|
|
QVector<CompositingType> WaylandBackend::supportedCompositors() const
|
|
|
|
{
|
2019-02-16 19:50:46 +00:00
|
|
|
if (selectedCompositor() != NoCompositing) {
|
|
|
|
return {selectedCompositor()};
|
|
|
|
}
|
2017-10-15 20:24:49 +00:00
|
|
|
#if HAVE_WAYLAND_EGL
|
|
|
|
return QVector<CompositingType>{OpenGLCompositing, QPainterCompositing};
|
|
|
|
#else
|
|
|
|
return QVector<CompositingType>{QPainterCompositing};
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
[platforms/wayland] Multi output support
Summary:
This patch rewrites large parts of the Wayland platform plugin, in order to
facilitate the testing of multi output behavior in nested KWin sessions.
For that a new class WaylandOutput is introduced, which is based on
AbstractOutput and by that shares functionality with our virtual and DRM
platform plugins.
The EGL/GBM and QPainter backends have been remodelled after the DRM one,
sharing similiarities there as well now.
Pointer grabbing has been rewritten to support multiple outputs, now using
pointer locking instead of confining and drawing in this case onto a sub-
surface, which get dynamically recreated in between the different output
surfaces while the cursor is being moved.
Window resizing is possible if host supports xdg-shell, but currently the
mode size does not yet fill the new window size.
The number of outputs can be set by command line argument `--output-count`,
scaling is also supported by setting the argument `--scale`.
Further steps could be:
* Enabling automatic fill of resized windows via Wayland mode change
* Multiple diverging initial sizes and scale factors for mulitple outputs
**Watch it in action:** https://youtu.be/FYItn1jvkbI
Test Plan: Tested it in live session.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18465
2019-02-22 09:57:07 +00:00
|
|
|
Outputs WaylandBackend::outputs() const
|
|
|
|
{
|
|
|
|
return m_outputs;
|
|
|
|
}
|
|
|
|
|
|
|
|
Outputs WaylandBackend::enabledOutputs() const
|
|
|
|
{
|
|
|
|
// all outputs are enabled
|
|
|
|
return m_outputs;
|
|
|
|
}
|
2017-10-15 20:24:49 +00:00
|
|
|
|
2021-08-08 02:30:14 +00:00
|
|
|
void WaylandBackend::addConfiguredOutput(WaylandOutput *output)
|
|
|
|
{
|
|
|
|
m_outputs << output;
|
|
|
|
Q_EMIT outputAdded(output);
|
|
|
|
Q_EMIT outputEnabled(output);
|
|
|
|
|
|
|
|
m_pendingInitialOutputs--;
|
|
|
|
if (m_pendingInitialOutputs == 0) {
|
|
|
|
// Mark as ready once all the initial set of screens has arrived
|
|
|
|
// (i.e, received their first configure and it is now safe to commit
|
|
|
|
// buffers to them)
|
|
|
|
setReady(true);
|
|
|
|
Q_EMIT screensQueried();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-22 17:31:23 +00:00
|
|
|
DmaBufTexture *WaylandBackend::createDmaBufTexture(const QSize& size)
|
|
|
|
{
|
2021-11-10 11:41:57 +00:00
|
|
|
#if HAVE_WAYLAND_EGL
|
2020-07-22 17:31:23 +00:00
|
|
|
return GbmDmaBuf::createBuffer(size, m_gbmDevice);
|
2020-10-06 23:36:18 +00:00
|
|
|
#else
|
|
|
|
return nullptr;
|
|
|
|
#endif
|
2020-07-22 17:31:23 +00:00
|
|
|
}
|
|
|
|
|
2021-07-08 23:13:24 +00:00
|
|
|
void WaylandBackend::createDpmsFilter()
|
|
|
|
{
|
|
|
|
if (m_dpmsFilter) {
|
|
|
|
// already another output is off
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
m_dpmsFilter.reset(new DpmsInputEventFilter);
|
|
|
|
input()->prependInputEventFilter(m_dpmsFilter.data());
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandBackend::clearDpmsFilter()
|
|
|
|
{
|
|
|
|
m_dpmsFilter.reset();
|
|
|
|
}
|
|
|
|
|
2021-10-05 17:06:28 +00:00
|
|
|
AbstractOutput *WaylandBackend::createVirtualOutput(const QString &name, const QSize &size, double scale)
|
|
|
|
{
|
|
|
|
Q_UNUSED(name);
|
|
|
|
return createOutput(m_outputs.constLast()->geometry().topRight(), size * scale);
|
|
|
|
}
|
|
|
|
|
|
|
|
void WaylandBackend::removeVirtualOutput(AbstractOutput *output)
|
|
|
|
{
|
|
|
|
WaylandOutput *waylandOutput = dynamic_cast<WaylandOutput *>(output);
|
|
|
|
if (waylandOutput && m_outputs.removeAll(waylandOutput)) {
|
|
|
|
Q_EMIT outputDisabled(waylandOutput);
|
|
|
|
Q_EMIT outputRemoved(waylandOutput);
|
|
|
|
delete waylandOutput;
|
|
|
|
}
|
|
|
|
}
|
2013-06-17 07:35:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // KWin
|