x11: Rename X11StandalonePlatform to X11StandaloneBackend

This commit is contained in:
Vlad Zahorodnii 2022-11-10 16:20:15 +02:00
parent b830d408af
commit f1e8ce9456
13 changed files with 69 additions and 70 deletions

View file

@ -1,4 +1,5 @@
set(X11PLATFORM_SOURCES
x11_standalone_backend.cpp
x11_standalone_cursor.cpp
x11_standalone_edge.cpp
x11_standalone_effects.cpp
@ -11,7 +12,6 @@ set(X11PLATFORM_SOURCES
x11_standalone_output.cpp
x11_standalone_overlaywindow.cpp
x11_standalone_placeholderoutput.cpp
x11_standalone_platform.cpp
x11_standalone_screenedges_filter.cpp
x11_standalone_windowselector.cpp
x11_standalone_xfixes_cursor_event_filter.cpp

View file

@ -6,7 +6,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "x11_standalone_platform.h"
#include "x11_standalone_backend.h"
#include <config-kwin.h>
@ -61,15 +61,15 @@ namespace KWin
class XrandrEventFilter : public X11EventFilter
{
public:
explicit XrandrEventFilter(X11StandalonePlatform *backend);
explicit XrandrEventFilter(X11StandaloneBackend *backend);
bool event(xcb_generic_event_t *event) override;
private:
X11StandalonePlatform *m_backend;
X11StandaloneBackend *m_backend;
};
XrandrEventFilter::XrandrEventFilter(X11StandalonePlatform *backend)
XrandrEventFilter::XrandrEventFilter(X11StandaloneBackend *backend)
: X11EventFilter(Xcb::Extensions::self()->randrNotifyEvent())
, m_backend(backend)
{
@ -99,7 +99,7 @@ bool XrandrEventFilter::event(xcb_generic_event_t *event)
return false;
}
X11StandalonePlatform::X11StandalonePlatform(QObject *parent)
X11StandaloneBackend::X11StandaloneBackend(QObject *parent)
: OutputBackend(parent)
, m_updateOutputsTimer(std::make_unique<QTimer>())
, m_x11Display(QX11Info::display())
@ -118,12 +118,12 @@ X11StandalonePlatform::X11StandalonePlatform(QObject *parent)
#endif
m_updateOutputsTimer->setSingleShot(true);
connect(m_updateOutputsTimer.get(), &QTimer::timeout, this, &X11StandalonePlatform::updateOutputs);
connect(m_updateOutputsTimer.get(), &QTimer::timeout, this, &X11StandaloneBackend::updateOutputs);
m_keyboard = std::make_unique<X11Keyboard>();
}
X11StandalonePlatform::~X11StandalonePlatform()
X11StandaloneBackend::~X11StandaloneBackend()
{
if (sceneEglDisplay() != EGL_NO_DISPLAY) {
eglTerminate(sceneEglDisplay());
@ -133,7 +133,7 @@ X11StandalonePlatform::~X11StandalonePlatform()
}
}
bool X11StandalonePlatform::initialize()
bool X11StandaloneBackend::initialize()
{
if (!QX11Info::isPlatformX11()) {
return false;
@ -145,11 +145,11 @@ bool X11StandalonePlatform::initialize()
if (Xcb::Extensions::self()->isRandrAvailable()) {
m_randrEventFilter = std::make_unique<XrandrEventFilter>(this);
}
connect(Cursors::self(), &Cursors::hiddenChanged, this, &X11StandalonePlatform::updateCursor);
connect(Cursors::self(), &Cursors::hiddenChanged, this, &X11StandaloneBackend::updateCursor);
return true;
}
std::unique_ptr<OpenGLBackend> X11StandalonePlatform::createOpenGLBackend()
std::unique_ptr<OpenGLBackend> X11StandaloneBackend::createOpenGLBackend()
{
switch (options->glPlatformInterface()) {
#if HAVE_EPOXY_GLX
@ -170,7 +170,7 @@ std::unique_ptr<OpenGLBackend> X11StandalonePlatform::createOpenGLBackend()
}
}
std::unique_ptr<Edge> X11StandalonePlatform::createScreenEdge(ScreenEdges *edges)
std::unique_ptr<Edge> X11StandaloneBackend::createScreenEdge(ScreenEdges *edges)
{
if (!m_screenEdgesFilter) {
m_screenEdgesFilter = std::make_unique<ScreenEdgesFilter>();
@ -178,7 +178,7 @@ std::unique_ptr<Edge> X11StandalonePlatform::createScreenEdge(ScreenEdges *edges
return std::make_unique<WindowBasedEdge>(edges);
}
void X11StandalonePlatform::createPlatformCursor(QObject *parent)
void X11StandaloneBackend::createPlatformCursor(QObject *parent)
{
auto c = new X11Cursor(parent, m_xinputIntegration != nullptr);
#if HAVE_X11_XINPUT
@ -192,12 +192,12 @@ void X11StandalonePlatform::createPlatformCursor(QObject *parent)
#endif
}
bool X11StandalonePlatform::hasGlx()
bool X11StandaloneBackend::hasGlx()
{
return Xcb::Extensions::self()->hasGlx();
}
PlatformCursorImage X11StandalonePlatform::cursorImage() const
PlatformCursorImage X11StandaloneBackend::cursorImage() const
{
auto c = kwinApp()->x11Connection();
UniqueCPtr<xcb_xfixes_get_cursor_image_reply_t> cursor(
@ -214,7 +214,7 @@ PlatformCursorImage X11StandalonePlatform::cursorImage() const
return PlatformCursorImage(qcursorimg.copy(), QPoint(cursor->xhot, cursor->yhot));
}
void X11StandalonePlatform::updateCursor()
void X11StandaloneBackend::updateCursor()
{
if (Cursors::self()->isCursorHidden()) {
xcb_xfixes_hide_cursor(kwinApp()->x11Connection(), kwinApp()->x11RootWindow());
@ -223,7 +223,7 @@ void X11StandalonePlatform::updateCursor()
}
}
void X11StandalonePlatform::startInteractiveWindowSelection(std::function<void(KWin::Window *)> callback, const QByteArray &cursorName)
void X11StandaloneBackend::startInteractiveWindowSelection(std::function<void(KWin::Window *)> callback, const QByteArray &cursorName)
{
if (!m_windowSelector) {
m_windowSelector = std::make_unique<WindowSelector>();
@ -231,7 +231,7 @@ void X11StandalonePlatform::startInteractiveWindowSelection(std::function<void(K
m_windowSelector->start(callback, cursorName);
}
void X11StandalonePlatform::startInteractivePositionSelection(std::function<void(const QPoint &)> callback)
void X11StandaloneBackend::startInteractivePositionSelection(std::function<void(const QPoint &)> callback)
{
if (!m_windowSelector) {
m_windowSelector = std::make_unique<WindowSelector>();
@ -239,17 +239,17 @@ void X11StandalonePlatform::startInteractivePositionSelection(std::function<void
m_windowSelector->start(callback);
}
std::unique_ptr<OutlineVisual> X11StandalonePlatform::createOutline(Outline *outline)
std::unique_ptr<OutlineVisual> X11StandaloneBackend::createOutline(Outline *outline)
{
return std::make_unique<NonCompositedOutlineVisual>(outline);
}
void X11StandalonePlatform::createEffectsHandler(Compositor *compositor, Scene *scene)
void X11StandaloneBackend::createEffectsHandler(Compositor *compositor, Scene *scene)
{
new EffectsHandlerImplX11(compositor, scene);
}
QVector<CompositingType> X11StandalonePlatform::supportedCompositors() const
QVector<CompositingType> X11StandaloneBackend::supportedCompositors() const
{
QVector<CompositingType> compositors;
#if HAVE_EPOXY_GLX
@ -259,25 +259,25 @@ QVector<CompositingType> X11StandalonePlatform::supportedCompositors() const
return compositors;
}
void X11StandalonePlatform::initOutputs()
void X11StandaloneBackend::initOutputs()
{
doUpdateOutputs<Xcb::RandR::ScreenResources>();
updateRefreshRate();
}
void X11StandalonePlatform::scheduleUpdateOutputs()
void X11StandaloneBackend::scheduleUpdateOutputs()
{
m_updateOutputsTimer->start();
}
void X11StandalonePlatform::updateOutputs()
void X11StandaloneBackend::updateOutputs()
{
doUpdateOutputs<Xcb::RandR::CurrentResources>();
updateRefreshRate();
}
template<typename T>
void X11StandalonePlatform::doUpdateOutputs()
void X11StandaloneBackend::doUpdateOutputs()
{
QVector<Output *> changed;
QVector<Output *> added;
@ -437,7 +437,7 @@ void X11StandalonePlatform::doUpdateOutputs()
Q_EMIT outputsQueried();
}
X11Output *X11StandalonePlatform::findX11Output(const QString &name) const
X11Output *X11StandaloneBackend::findX11Output(const QString &name) const
{
for (Output *output : m_outputs) {
if (output->name() == name) {
@ -447,17 +447,17 @@ X11Output *X11StandalonePlatform::findX11Output(const QString &name) const
return nullptr;
}
Outputs X11StandalonePlatform::outputs() const
Outputs X11StandaloneBackend::outputs() const
{
return m_outputs;
}
X11Keyboard *X11StandalonePlatform::keyboard() const
X11Keyboard *X11StandaloneBackend::keyboard() const
{
return m_keyboard.get();
}
RenderLoop *X11StandalonePlatform::renderLoop() const
RenderLoop *X11StandaloneBackend::renderLoop() const
{
return m_renderLoop.get();
}
@ -492,7 +492,7 @@ static int currentRefreshRate()
return (*syncIt)->refreshRate();
}
void X11StandalonePlatform::updateRefreshRate()
void X11StandaloneBackend::updateRefreshRate()
{
int refreshRate = currentRefreshRate();
if (refreshRate <= 0) {

View file

@ -6,8 +6,9 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef KWIN_X11_PLATFORM_H
#define KWIN_X11_PLATFORM_H
#pragma once
#include "core/outputbackend.h"
#include <kwin_export.h>
@ -35,13 +36,13 @@ class Compositor;
class Scene;
class Window;
class KWIN_EXPORT X11StandalonePlatform : public OutputBackend
class KWIN_EXPORT X11StandaloneBackend : public OutputBackend
{
Q_OBJECT
public:
X11StandalonePlatform(QObject *parent = nullptr);
~X11StandalonePlatform() override;
X11StandaloneBackend(QObject *parent = nullptr);
~X11StandaloneBackend() override;
bool initialize() override;
std::unique_ptr<OpenGLBackend> createOpenGLBackend() override;
@ -93,5 +94,3 @@ private:
};
}
#endif

View file

@ -12,10 +12,10 @@
#include "screenedge.h"
#include "utils/common.h"
#include "workspace.h"
#include "x11_standalone_backend.h"
#include "x11_standalone_effects_keyboard_interception_filter.h"
#include "x11_standalone_effects_mouse_interception_filter.h"
#include "x11_standalone_keyboard.h"
#include "x11_standalone_platform.h"
namespace KWin
{
@ -44,7 +44,7 @@ EffectsHandlerImplX11::~EffectsHandlerImplX11()
bool EffectsHandlerImplX11::doGrabKeyboard()
{
auto keyboard = static_cast<X11StandalonePlatform *>(kwinApp()->outputBackend())->keyboard();
auto keyboard = static_cast<X11StandaloneBackend *>(kwinApp()->outputBackend())->keyboard();
if (!keyboard->xkbKeymap()) {
return false;
}

View file

@ -15,9 +15,9 @@
#include "softwarevsyncmonitor.h"
#include "surfaceitem_x11.h"
#include "workspace.h"
#include "x11_standalone_backend.h"
#include "x11_standalone_logging.h"
#include "x11_standalone_overlaywindow.h"
#include "x11_standalone_platform.h"
#include <QOpenGLContext>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
@ -43,7 +43,7 @@ bool EglLayer::endFrame(const QRegion &renderedRegion, const QRegion &damagedReg
return true;
}
EglBackend::EglBackend(Display *display, X11StandalonePlatform *backend)
EglBackend::EglBackend(Display *display, X11StandaloneBackend *backend)
: EglOnXBackend(kwinApp()->x11Connection(), display, kwinApp()->x11RootWindow())
, m_backend(backend)
, m_overlayWindow(std::make_unique<OverlayWindowX11>())

View file

@ -19,7 +19,7 @@ namespace KWin
class EglPixmapTexturePrivate;
class SoftwareVsyncMonitor;
class X11StandalonePlatform;
class X11StandaloneBackend;
class EglBackend;
class EglLayer : public OutputLayer
@ -39,7 +39,7 @@ class EglBackend : public EglOnXBackend
Q_OBJECT
public:
EglBackend(Display *display, X11StandalonePlatform *platform);
EglBackend(Display *display, X11StandaloneBackend *platform);
~EglBackend() override;
void init() override;
@ -59,7 +59,7 @@ private:
void presentSurface(EGLSurface surface, const QRegion &damage, const QRect &screenGeometry);
void vblank(std::chrono::nanoseconds timestamp);
X11StandalonePlatform *m_backend;
X11StandaloneBackend *m_backend;
std::unique_ptr<SoftwareVsyncMonitor> m_vsyncMonitor;
std::unique_ptr<OverlayWindow> m_overlayWindow;
DamageJournal m_damageJournal;

View file

@ -15,12 +15,12 @@
#include "x11_standalone_glx_backend.h"
#include "../common/kwinxrenderutils.h"
#include "softwarevsyncmonitor.h"
#include "x11_standalone_backend.h"
#include "x11_standalone_glx_context_attribute_builder.h"
#include "x11_standalone_glxconvenience.h"
#include "x11_standalone_logging.h"
#include "x11_standalone_omlsynccontrolvsyncmonitor.h"
#include "x11_standalone_overlaywindow.h"
#include "x11_standalone_platform.h"
#include "x11_standalone_sgivideosyncvsyncmonitor.h"
// kwin
#include "composite.h"
@ -98,7 +98,7 @@ bool SwapEventFilter::event(xcb_generic_event_t *event)
// it's CLOCK_MONOTONIC, so no special conversions are needed.
const std::chrono::microseconds timestamp((uint64_t(swapEvent->ust_hi) << 32) | swapEvent->ust_lo);
const auto platform = static_cast<X11StandalonePlatform *>(kwinApp()->outputBackend());
const auto platform = static_cast<X11StandaloneBackend *>(kwinApp()->outputBackend());
RenderLoopPrivate::get(platform->renderLoop())->notifyFrameCompleted(timestamp);
return true;
@ -120,7 +120,7 @@ bool GlxLayer::endFrame(const QRegion &renderedRegion, const QRegion &damagedReg
return true;
}
GlxBackend::GlxBackend(Display *display, X11StandalonePlatform *backend)
GlxBackend::GlxBackend(Display *display, X11StandaloneBackend *backend)
: OpenGLBackend()
, m_overlayWindow(std::make_unique<OverlayWindowX11>())
, window(None)

View file

@ -29,7 +29,7 @@ namespace KWin
class GlxPixmapTexturePrivate;
class VsyncMonitor;
class X11StandalonePlatform;
class X11StandaloneBackend;
class GlxBackend;
// GLX_MESA_swap_interval
@ -79,7 +79,7 @@ class GlxBackend : public OpenGLBackend
Q_OBJECT
public:
GlxBackend(Display *display, X11StandalonePlatform *backend);
GlxBackend(Display *display, X11StandaloneBackend *backend);
~GlxBackend() override;
std::unique_ptr<SurfaceTexture> createSurfaceTextureX11(SurfacePixmapX11 *pixmap) override;
OutputLayerBeginFrameInfo beginFrame();
@ -131,7 +131,7 @@ private:
bool m_haveEXTSwapControl = false;
bool m_haveSGISwapControl = false;
Display *m_x11Display;
X11StandalonePlatform *m_backend;
X11StandaloneBackend *m_backend;
std::unique_ptr<VsyncMonitor> m_vsyncMonitor;
std::unique_ptr<GlxLayer> m_layer;
friend class GlxPixmapTexturePrivate;

View file

@ -8,12 +8,12 @@
*/
#include "x11_standalone_output.h"
#include "core/colorlut.h"
#include "x11_standalone_platform.h"
#include "x11_standalone_backend.h"
namespace KWin
{
X11Output::X11Output(X11StandalonePlatform *backend, QObject *parent)
X11Output::X11Output(X11StandaloneBackend *backend, QObject *parent)
: Output(parent)
, m_backend(backend)
{

View file

@ -20,7 +20,7 @@
namespace KWin
{
class X11StandalonePlatform;
class X11StandaloneBackend;
/**
* X11 output representation
@ -30,7 +30,7 @@ class KWIN_EXPORT X11Output : public Output
Q_OBJECT
public:
explicit X11Output(X11StandalonePlatform *backend, QObject *parent = nullptr);
explicit X11Output(X11StandaloneBackend *backend, QObject *parent = nullptr);
void updateEnabled(bool enabled);
@ -48,13 +48,13 @@ private:
void setCrtc(xcb_randr_crtc_t crtc);
void setGammaRampSize(int size);
X11StandalonePlatform *m_backend;
X11StandaloneBackend *m_backend;
RenderLoop *m_loop = nullptr;
xcb_randr_crtc_t m_crtc = XCB_NONE;
int m_gammaRampSize;
int m_xineramaNumber = 0;
friend class X11StandalonePlatform;
friend class X11StandaloneBackend;
};
}

View file

@ -5,13 +5,13 @@
*/
#include "x11_standalone_placeholderoutput.h"
#include "x11_standalone_platform.h"
#include "utils/xcbutils.h"
#include "x11_standalone_backend.h"
namespace KWin
{
X11PlaceholderOutput::X11PlaceholderOutput(X11StandalonePlatform *backend, QObject *parent)
X11PlaceholderOutput::X11PlaceholderOutput(X11StandaloneBackend *backend, QObject *parent)
: Output(parent)
, m_backend(backend)
{

View file

@ -11,21 +11,21 @@
namespace KWin
{
class X11StandalonePlatform;
class X11StandaloneBackend;
class X11PlaceholderOutput : public Output
{
Q_OBJECT
public:
explicit X11PlaceholderOutput(X11StandalonePlatform *backend, QObject *parent = nullptr);
explicit X11PlaceholderOutput(X11StandaloneBackend *backend, QObject *parent = nullptr);
RenderLoop *renderLoop() const override;
void updateEnabled(bool enabled);
private:
X11StandalonePlatform *m_backend;
X11StandaloneBackend *m_backend;
};
} // namespace KWin

View file

@ -12,7 +12,7 @@
#include <config-kwin.h>
#include "backends/x11/standalone/x11_standalone_platform.h"
#include "backends/x11/standalone/x11_standalone_backend.h"
#include "core/outputbackend.h"
#include "core/session.h"
#include "outline.h"
@ -200,12 +200,12 @@ void ApplicationX11::setReplace(bool replace)
std::unique_ptr<Edge> ApplicationX11::createScreenEdge(ScreenEdges *parent)
{
return static_cast<X11StandalonePlatform *>(outputBackend())->createScreenEdge(parent);
return static_cast<X11StandaloneBackend *>(outputBackend())->createScreenEdge(parent);
}
void ApplicationX11::createPlatformCursor(QObject *parent)
{
static_cast<X11StandalonePlatform *>(outputBackend())->createPlatformCursor(parent);
static_cast<X11StandaloneBackend *>(outputBackend())->createPlatformCursor(parent);
}
std::unique_ptr<OutlineVisual> ApplicationX11::createOutline(Outline *outline)
@ -214,27 +214,27 @@ std::unique_ptr<OutlineVisual> ApplicationX11::createOutline(Outline *outline)
if (auto outlineVisual = Application::createOutline(outline)) {
return outlineVisual;
}
return static_cast<X11StandalonePlatform *>(outputBackend())->createOutline(outline);
return static_cast<X11StandaloneBackend *>(outputBackend())->createOutline(outline);
}
void ApplicationX11::createEffectsHandler(Compositor *compositor, Scene *scene)
{
static_cast<X11StandalonePlatform *>(outputBackend())->createEffectsHandler(compositor, scene);
static_cast<X11StandaloneBackend *>(outputBackend())->createEffectsHandler(compositor, scene);
}
void ApplicationX11::startInteractiveWindowSelection(std::function<void(KWin::Window *)> callback, const QByteArray &cursorName)
{
static_cast<X11StandalonePlatform *>(outputBackend())->startInteractiveWindowSelection(callback, cursorName);
static_cast<X11StandaloneBackend *>(outputBackend())->startInteractiveWindowSelection(callback, cursorName);
}
void ApplicationX11::startInteractivePositionSelection(std::function<void(const QPoint &)> callback)
{
static_cast<X11StandalonePlatform *>(outputBackend())->startInteractivePositionSelection(callback);
static_cast<X11StandaloneBackend *>(outputBackend())->startInteractivePositionSelection(callback);
}
PlatformCursorImage ApplicationX11::cursorImage() const
{
return static_cast<X11StandalonePlatform *>(outputBackend())->cursorImage();
return static_cast<X11StandaloneBackend *>(outputBackend())->cursorImage();
}
void ApplicationX11::lostSelection()
@ -441,7 +441,7 @@ int main(int argc, char *argv[])
}
a.setSession(KWin::Session::create(KWin::Session::Type::Noop));
a.setOutputBackend(std::make_unique<KWin::X11StandalonePlatform>());
a.setOutputBackend(std::make_unique<KWin::X11StandaloneBackend>());
a.start();
return a.exec();