2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2015-05-05 13:13:36 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2019 Roman Gilg <subdiff@gmail.com>
|
|
|
|
SPDX-FileCopyrightText: 2013, 2015 Martin Gräßlin <mgraesslin@kde.org>
|
2015-05-05 13:13:36 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2015-05-05 13:13:36 +00:00
|
|
|
#ifndef KWIN_SCENE_QPAINTER_WAYLAND_BACKEND_H
|
|
|
|
#define KWIN_SCENE_QPAINTER_WAYLAND_BACKEND_H
|
|
|
|
|
2017-08-11 19:40:49 +00:00
|
|
|
#include <platformsupport/scenes/qpainter/backend.h>
|
2015-05-05 13:13:36 +00:00
|
|
|
|
|
|
|
#include <QObject>
|
2017-08-11 19:40:49 +00:00
|
|
|
#include <QImage>
|
|
|
|
#include <QWeakPointer>
|
2015-05-05 13:13:36 +00:00
|
|
|
|
|
|
|
namespace KWayland
|
|
|
|
{
|
|
|
|
namespace 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
|
|
|
class ShmPool;
|
2015-05-05 13:13:36 +00:00
|
|
|
class Buffer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
namespace Wayland
|
|
|
|
{
|
|
|
|
class WaylandBackend;
|
[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
|
|
|
class WaylandOutput;
|
|
|
|
class WaylandQPainterBackend;
|
|
|
|
|
|
|
|
class WaylandQPainterOutput : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
WaylandQPainterOutput(WaylandOutput *output, QObject *parent = nullptr);
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
~WaylandQPainterOutput() override;
|
[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 init(KWayland::Client::ShmPool *pool);
|
|
|
|
void updateSize(const QSize &size);
|
|
|
|
void remapBuffer();
|
|
|
|
|
|
|
|
void prepareRenderingFrame();
|
|
|
|
void present(const QRegion &damage);
|
|
|
|
|
2020-11-09 13:35:15 +00:00
|
|
|
bool needsFullRepaint() const;
|
|
|
|
void setNeedsFullRepaint(bool set);
|
|
|
|
|
|
|
|
QRegion mapToLocal(const QRegion ®ion) const;
|
|
|
|
|
[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
|
|
|
private:
|
|
|
|
WaylandOutput *m_waylandOutput;
|
|
|
|
KWayland::Client::ShmPool *m_pool;
|
|
|
|
|
|
|
|
QWeakPointer<KWayland::Client::Buffer> m_buffer;
|
|
|
|
QImage m_backBuffer;
|
2020-11-09 13:35:15 +00:00
|
|
|
bool m_needsFullRepaint = true;
|
[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
|
|
|
|
|
|
|
friend class WaylandQPainterBackend;
|
|
|
|
};
|
2015-05-05 13:13:36 +00:00
|
|
|
|
|
|
|
class WaylandQPainterBackend : public QObject, public QPainterBackend
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
[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
|
|
|
explicit WaylandQPainterBackend(WaylandBackend *b);
|
Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.
The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.
Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.
A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!
The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.
The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, apol, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 16:52:26 +00:00
|
|
|
~WaylandQPainterBackend() override;
|
2015-05-05 13:13:36 +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
|
|
|
QImage *bufferForScreen(int screenId) override;
|
|
|
|
|
2020-11-09 14:31:26 +00:00
|
|
|
void endFrame(int screenId, int mask, const QRegion& damage) override;
|
|
|
|
void beginFrame(int screenId) override;
|
[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-11-09 13:35:15 +00:00
|
|
|
bool needsFullRepaint(int screenId) const override;
|
[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 perScreenRendering() const override;
|
|
|
|
|
2015-05-05 13:13:36 +00:00
|
|
|
private:
|
[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 createOutput(WaylandOutput *waylandOutput);
|
|
|
|
void frameRendered();
|
|
|
|
|
|
|
|
WaylandBackend *m_backend;
|
|
|
|
QVector<WaylandQPainterOutput*> m_outputs;
|
2015-05-05 13:13:36 +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
|
|
|
}
|
2015-05-05 13:13:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|