From bb83d665086816f0a409df86bbe1010f77865972 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 9 Dec 2022 17:23:21 +0200 Subject: [PATCH] backends/x11: Move some method implementations to cpp files --- .../x11/windowed/x11_windowed_backend.cpp | 30 ++++++++++++++ .../x11/windowed/x11_windowed_backend.h | 39 +++++-------------- .../x11/windowed/x11_windowed_output.cpp | 20 ++++++++++ .../x11/windowed/x11_windowed_output.h | 20 ++-------- 4 files changed, 64 insertions(+), 45 deletions(-) diff --git a/src/backends/x11/windowed/x11_windowed_backend.cpp b/src/backends/x11/windowed/x11_windowed_backend.cpp index e175a04a7c..190a1a6891 100644 --- a/src/backends/x11/windowed/x11_windowed_backend.cpp +++ b/src/backends/x11/windowed/x11_windowed_backend.cpp @@ -603,6 +603,36 @@ xcb_window_t X11WindowedBackend::windowForScreen(Output *output) const return static_cast(output)->window(); } +xcb_connection_t *X11WindowedBackend::connection() const +{ + return m_connection; +} + +xcb_screen_t *X11WindowedBackend::screen() const +{ + return m_screen; +} + +int X11WindowedBackend::screenNumer() const +{ + return m_screenNumber; +} + +Display *X11WindowedBackend::display() const +{ + return m_display; +} + +bool X11WindowedBackend::hasXInput() const +{ + return m_hasXInput; +} + +QVector X11WindowedBackend::supportedCompositors() const +{ + return QVector{OpenGLCompositing, QPainterCompositing}; +} + xcb_window_t X11WindowedBackend::window() const { return m_outputs.first()->window(); diff --git a/src/backends/x11/windowed/x11_windowed_backend.h b/src/backends/x11/windowed/x11_windowed_backend.h index 7758be1d04..7667024df0 100644 --- a/src/backends/x11/windowed/x11_windowed_backend.h +++ b/src/backends/x11/windowed/x11_windowed_backend.h @@ -96,47 +96,28 @@ class KWIN_EXPORT X11WindowedBackend : public OutputBackend public: explicit X11WindowedBackend(const X11WindowedBackendOptions &options); ~X11WindowedBackend() override; - bool initialize() override; - xcb_connection_t *connection() const - { - return m_connection; - } - xcb_screen_t *screen() const - { - return m_screen; - } - int screenNumer() const - { - return m_screenNumber; - } + Display *display() const; + xcb_connection_t *connection() const; + xcb_screen_t *screen() const; + int screenNumer() const; + xcb_window_t rootWindow() const; + xcb_window_t window() const; xcb_window_t windowForScreen(Output *output) const; - Display *display() const - { - return m_display; - } - xcb_window_t rootWindow() const; - bool hasXInput() const - { - return m_hasXInput; - } + bool hasXInput() const; + bool initialize() override; std::unique_ptr createOpenGLBackend() override; std::unique_ptr createQPainterBackend() override; std::unique_ptr createInputBackend() override; - - QVector supportedCompositors() const override - { - return QVector{OpenGLCompositing, QPainterCompositing}; - } + QVector supportedCompositors() const override; + Outputs outputs() const override; X11WindowedInputDevice *pointerDevice() const; X11WindowedInputDevice *keyboardDevice() const; X11WindowedInputDevice *touchDevice() const; - Outputs outputs() const override; - private: void createOutputs(); void grabKeyboard(xcb_timestamp_t time); diff --git a/src/backends/x11/windowed/x11_windowed_output.cpp b/src/backends/x11/windowed/x11_windowed_output.cpp index c16d8cfee2..d0568e7e02 100644 --- a/src/backends/x11/windowed/x11_windowed_output.cpp +++ b/src/backends/x11/windowed/x11_windowed_output.cpp @@ -136,6 +136,26 @@ SoftwareVsyncMonitor *X11WindowedOutput::vsyncMonitor() const return m_vsyncMonitor.get(); } +X11WindowedBackend *X11WindowedOutput::backend() const +{ + return m_backend; +} + +X11WindowedCursor *X11WindowedOutput::cursor() const +{ + return m_cursor.get(); +} + +xcb_window_t X11WindowedOutput::window() const +{ + return m_window; +} + +QPoint X11WindowedOutput::hostPosition() const +{ + return m_hostPosition; +} + void X11WindowedOutput::init(const QSize &pixelSize, qreal scale) { const int refreshRate = 60000; // TODO: get refresh rate via randr diff --git a/src/backends/x11/windowed/x11_windowed_output.h b/src/backends/x11/windowed/x11_windowed_output.h index 5dbe35c2a8..64ba861d20 100644 --- a/src/backends/x11/windowed/x11_windowed_output.h +++ b/src/backends/x11/windowed/x11_windowed_output.h @@ -57,24 +57,12 @@ public: void init(const QSize &pixelSize, qreal scale); void resize(const QSize &pixelSize); - X11WindowedBackend *backend() const - { - return m_backend; - } - X11WindowedCursor *cursor() const - { - return m_cursor.get(); - } - xcb_window_t window() const - { - return m_window; - } + X11WindowedBackend *backend() const; + X11WindowedCursor *cursor() const; + xcb_window_t window() const; QPoint internalPosition() const; - QPoint hostPosition() const - { - return m_hostPosition; - } + QPoint hostPosition() const; void setHostPosition(const QPoint &pos); void setWindowTitle(const QString &title);