From 18939e17ed1f0f4ae4baed12c95b74a1e1f7f5b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 8 Apr 2016 10:32:37 +0200 Subject: [PATCH] Move XRandrScreens to the x11/standalone plugin By moving XRandrScreens the creation of screens gets simplified a lot as there is no need to have windowing system specific init code. It all just goes through the platform. This also marks the point where the first X11 specific code is removed from kwin_wayland. Reviewers: #plasma, sebas Subscribers: plasma-devel Projects: #plasma Differential Revision: https://phabricator.kde.org/D1355 --- CMakeLists.txt | 1 - autotests/CMakeLists.txt | 2 +- autotests/test_xrandr_screens.cpp | 2 +- plugins/platforms/x11/standalone/CMakeLists.txt | 1 + .../platforms/x11/standalone/screens_xrandr.cpp | 0 .../platforms/x11/standalone/screens_xrandr.h | 0 plugins/platforms/x11/standalone/x11_platform.cpp | 6 ++++++ plugins/platforms/x11/standalone/x11_platform.h | 2 ++ screens.cpp | 8 +------- x11eventfilter.h | 4 +++- 10 files changed, 15 insertions(+), 11 deletions(-) rename screens_xrandr.cpp => plugins/platforms/x11/standalone/screens_xrandr.cpp (100%) rename screens_xrandr.h => plugins/platforms/x11/standalone/screens_xrandr.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index ad033f13bc..00d086e5cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -348,7 +348,6 @@ set(kwin_KDEINIT_SRCS killwindow.cpp geometrytip.cpp screens.cpp - screens_xrandr.cpp shadow.cpp sm.cpp group.cpp diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index df918a872a..9ce4e161b3 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -237,7 +237,7 @@ set( testXRandRScreens_SRCS mock_screens.cpp mock_workspace.cpp ../screens.cpp - ../screens_xrandr.cpp + ../plugins/platforms/x11/standalone/screens_xrandr.cpp ../xcbutils.cpp # init of extensions ../x11eventfilter.cpp ) diff --git a/autotests/test_xrandr_screens.cpp b/autotests/test_xrandr_screens.cpp index 3f0246ec10..c76bdd9852 100644 --- a/autotests/test_xrandr_screens.cpp +++ b/autotests/test_xrandr_screens.cpp @@ -17,7 +17,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ -#include "../screens_xrandr.h" +#include "../plugins/platforms/x11/standalone/screens_xrandr.h" #include "../cursor.h" #include "../xcbutils.h" #include "mock_workspace.h" diff --git a/plugins/platforms/x11/standalone/CMakeLists.txt b/plugins/platforms/x11/standalone/CMakeLists.txt index 43859dbe6f..d5f842e9e1 100644 --- a/plugins/platforms/x11/standalone/CMakeLists.txt +++ b/plugins/platforms/x11/standalone/CMakeLists.txt @@ -1,5 +1,6 @@ set(X11PLATFORM_SOURCES x11_platform.cpp + screens_xrandr.cpp ) add_library(KWinX11Platform MODULE ${X11PLATFORM_SOURCES}) diff --git a/screens_xrandr.cpp b/plugins/platforms/x11/standalone/screens_xrandr.cpp similarity index 100% rename from screens_xrandr.cpp rename to plugins/platforms/x11/standalone/screens_xrandr.cpp diff --git a/screens_xrandr.h b/plugins/platforms/x11/standalone/screens_xrandr.h similarity index 100% rename from screens_xrandr.h rename to plugins/platforms/x11/standalone/screens_xrandr.h diff --git a/plugins/platforms/x11/standalone/x11_platform.cpp b/plugins/platforms/x11/standalone/x11_platform.cpp index bd87a0b1dd..ec41c956fc 100644 --- a/plugins/platforms/x11/standalone/x11_platform.cpp +++ b/plugins/platforms/x11/standalone/x11_platform.cpp @@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ #include "x11_platform.h" +#include "screens_xrandr.h" #include @@ -41,4 +42,9 @@ void X11StandalonePlatform::init() emit screensQueried(); } +Screens *X11StandalonePlatform::createScreens(QObject *parent) +{ + return new XRandRScreens(parent); +} + } diff --git a/plugins/platforms/x11/standalone/x11_platform.h b/plugins/platforms/x11/standalone/x11_platform.h index a5714fc65f..a194e39335 100644 --- a/plugins/platforms/x11/standalone/x11_platform.h +++ b/plugins/platforms/x11/standalone/x11_platform.h @@ -38,6 +38,8 @@ public: virtual ~X11StandalonePlatform(); void init() override; + Screens *createScreens(QObject *parent = nullptr) override; + }; } diff --git a/screens.cpp b/screens.cpp index 062e52039a..3ffb22d6ee 100644 --- a/screens.cpp +++ b/screens.cpp @@ -25,7 +25,6 @@ along with this program. If not, see . #include "settings.h" #include #include -#include "screens_xrandr.h" #include "platform.h" #include "wayland_server.h" #ifdef KWIN_UNIT_TEST @@ -42,12 +41,7 @@ Screens *Screens::create(QObject *parent) #ifdef KWIN_UNIT_TEST s_self = new MockScreens(parent); #else - if (kwinApp()->shouldUseWaylandForCompositing()) { - s_self = kwinApp()->platform()->createScreens(parent); - } - if (kwinApp()->operationMode() == Application::OperationModeX11) { - s_self = new XRandRScreens(parent); - } + s_self = kwinApp()->platform()->createScreens(parent); #endif Q_ASSERT(s_self); s_self->init(); diff --git a/x11eventfilter.h b/x11eventfilter.h index 88d225d0d7..0a25ec896d 100644 --- a/x11eventfilter.h +++ b/x11eventfilter.h @@ -23,10 +23,12 @@ along with this program. If not, see . #include +#include + namespace KWin { -class X11EventFilter +class KWIN_EXPORT X11EventFilter { public: /**