From ee89f3f34f24c997bcaa39e05b94382e17c45b5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 8 Apr 2016 09:51:06 +0200 Subject: [PATCH] Add a very basic x11/standalone platform plugin The plugin does not much. It's the most basic plugin we can have to be loaded from kwin_x11. Unlike the wayland platform plugins it gets installed to: org.kde.kwin.platforms --- plugins/platforms/x11/CMakeLists.txt | 1 + .../platforms/x11/standalone/CMakeLists.txt | 13 ++++++ plugins/platforms/x11/standalone/x11.json | 8 ++++ .../platforms/x11/standalone/x11_platform.cpp | 44 ++++++++++++++++++ .../platforms/x11/standalone/x11_platform.h | 45 +++++++++++++++++++ 5 files changed, 111 insertions(+) create mode 100644 plugins/platforms/x11/standalone/CMakeLists.txt create mode 100644 plugins/platforms/x11/standalone/x11.json create mode 100644 plugins/platforms/x11/standalone/x11_platform.cpp create mode 100644 plugins/platforms/x11/standalone/x11_platform.h diff --git a/plugins/platforms/x11/CMakeLists.txt b/plugins/platforms/x11/CMakeLists.txt index aa07cfa5c5..dde23c6df5 100644 --- a/plugins/platforms/x11/CMakeLists.txt +++ b/plugins/platforms/x11/CMakeLists.txt @@ -1,3 +1,4 @@ +add_subdirectory(standalone) if(X11_XCB_FOUND) add_subdirectory(windowed) endif() diff --git a/plugins/platforms/x11/standalone/CMakeLists.txt b/plugins/platforms/x11/standalone/CMakeLists.txt new file mode 100644 index 0000000000..43859dbe6f --- /dev/null +++ b/plugins/platforms/x11/standalone/CMakeLists.txt @@ -0,0 +1,13 @@ +set(X11PLATFORM_SOURCES + x11_platform.cpp +) + +add_library(KWinX11Platform MODULE ${X11PLATFORM_SOURCES}) +target_link_libraries(KWinX11Platform kwin Qt5::X11Extras) + +install( + TARGETS + KWinX11Platform + DESTINATION + ${PLUGIN_INSTALL_DIR}/org.kde.kwin.platforms/ +) diff --git a/plugins/platforms/x11/standalone/x11.json b/plugins/platforms/x11/standalone/x11.json new file mode 100644 index 0000000000..dc6b13da23 --- /dev/null +++ b/plugins/platforms/x11/standalone/x11.json @@ -0,0 +1,8 @@ +{ + "KPlugin": { + "Description": "Platform plugin for standalone x11 in kwin_x11.", + "Id": "KWinX11Platform", + "Name": "x11-standalone" + }, + "input": true +} diff --git a/plugins/platforms/x11/standalone/x11_platform.cpp b/plugins/platforms/x11/standalone/x11_platform.cpp new file mode 100644 index 0000000000..bd87a0b1dd --- /dev/null +++ b/plugins/platforms/x11/standalone/x11_platform.cpp @@ -0,0 +1,44 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2016 Martin Gräßlin + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +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 "x11_platform.h" + +#include + +namespace KWin +{ + +X11StandalonePlatform::X11StandalonePlatform(QObject *parent) + : Platform(parent) +{ +} + +X11StandalonePlatform::~X11StandalonePlatform() = default; + +void X11StandalonePlatform::init() +{ + if (!QX11Info::isPlatformX11()) { + emit initFailed(); + return; + } + setReady(true); + emit screensQueried(); +} + +} diff --git a/plugins/platforms/x11/standalone/x11_platform.h b/plugins/platforms/x11/standalone/x11_platform.h new file mode 100644 index 0000000000..a5714fc65f --- /dev/null +++ b/plugins/platforms/x11/standalone/x11_platform.h @@ -0,0 +1,45 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2016 Martin Gräßlin + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +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 . +*********************************************************************/ +#ifndef KWIN_X11STANDALONE_PLATFORM_H +#define KWIN_X11STANDALONE_PLATFORM_H +#include "platform.h" + +#include + +#include + +namespace KWin +{ + +class KWIN_EXPORT X11StandalonePlatform : public Platform +{ + Q_OBJECT + Q_INTERFACES(KWin::Platform) + Q_PLUGIN_METADATA(IID "org.kde.kwin.Platform" FILE "x11.json") +public: + X11StandalonePlatform(QObject *parent = nullptr); + virtual ~X11StandalonePlatform(); + void init() override; + +}; + +} + +#endif