From eb81ddfb861f1a72a806687122fd56bd1b3ee70e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 17 Nov 2015 10:46:32 +0100 Subject: [PATCH] [backends/fbdev] Use BaseScreens implementation --- backends/fbdev/CMakeLists.txt | 1 - backends/fbdev/fb_backend.cpp | 4 +-- backends/fbdev/fb_backend.h | 4 +++ backends/fbdev/screens_fb.cpp | 68 ----------------------------------- backends/fbdev/screens_fb.h | 46 ------------------------ 5 files changed, 6 insertions(+), 117 deletions(-) delete mode 100644 backends/fbdev/screens_fb.cpp delete mode 100644 backends/fbdev/screens_fb.h diff --git a/backends/fbdev/CMakeLists.txt b/backends/fbdev/CMakeLists.txt index f0c1b54ebe..1bad7108e0 100644 --- a/backends/fbdev/CMakeLists.txt +++ b/backends/fbdev/CMakeLists.txt @@ -2,7 +2,6 @@ set(FBDEV_SOURCES fb_backend.cpp logging.cpp scene_qpainter_fb_backend.cpp - screens_fb.cpp ) add_library(KWinWaylandFbdevBackend MODULE ${FBDEV_SOURCES}) diff --git a/backends/fbdev/fb_backend.cpp b/backends/fbdev/fb_backend.cpp index e6f2b58676..c22314569a 100644 --- a/backends/fbdev/fb_backend.cpp +++ b/backends/fbdev/fb_backend.cpp @@ -22,7 +22,7 @@ along with this program. If not, see . #include "logging.h" #include "logind.h" #include "scene_qpainter_fb_backend.h" -#include "screens_fb.h" +#include "screens.h" #include "virtual_terminal.h" // system #include @@ -51,7 +51,7 @@ FramebufferBackend::~FramebufferBackend() Screens *FramebufferBackend::createScreens(QObject *parent) { - return new FramebufferScreens(this, parent); + return new BasicScreens(this, parent); } QPainterBackend *FramebufferBackend::createQPainterBackend() diff --git a/backends/fbdev/fb_backend.h b/backends/fbdev/fb_backend.h index 99de9ad32e..ef0232f49e 100644 --- a/backends/fbdev/fb_backend.h +++ b/backends/fbdev/fb_backend.h @@ -39,6 +39,10 @@ public: Screens *createScreens(QObject *parent = nullptr) override; QPainterBackend *createQPainterBackend() override; + QSize screenSize() const override { + return m_resolution; + } + void init() override; bool isValid() const { diff --git a/backends/fbdev/screens_fb.cpp b/backends/fbdev/screens_fb.cpp deleted file mode 100644 index 8b5ceeb601..0000000000 --- a/backends/fbdev/screens_fb.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2015 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 "screens_fb.h" -#include "fb_backend.h" - -namespace KWin -{ - -FramebufferScreens::FramebufferScreens(FramebufferBackend *backend, QObject *parent) - : Screens(parent) - , m_backend(backend) -{ -} - -FramebufferScreens::~FramebufferScreens() = default; - -void FramebufferScreens::init() -{ - KWin::Screens::init(); - updateCount(); - emit changed(); -} - -QRect FramebufferScreens::geometry(int screen) const -{ - if (screen == 0) { - return QRect(QPoint(0, 0), size(screen)); - } - return QRect(); -} - -QSize FramebufferScreens::size(int screen) const -{ - if (screen == 0) { - return m_backend->size(); - } - return QSize(); -} - -void FramebufferScreens::updateCount() -{ - setCount(1); -} - -int FramebufferScreens::number(const QPoint &pos) const -{ - Q_UNUSED(pos) - return 0; -} - -} diff --git a/backends/fbdev/screens_fb.h b/backends/fbdev/screens_fb.h deleted file mode 100644 index a50d03ae42..0000000000 --- a/backends/fbdev/screens_fb.h +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2015 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_SCREENS_FRAMEBUFFER_H -#define KWIN_SCREENS_FRAMEBUFFER_H -#include "screens.h" - -namespace KWin -{ -class FramebufferBackend; - -class FramebufferScreens : public Screens -{ - Q_OBJECT -public: - FramebufferScreens(FramebufferBackend *backend, QObject *parent = nullptr); - virtual ~FramebufferScreens(); - void init() override; - QRect geometry(int screen) const override; - int number(const QPoint &pos) const override; - QSize size(int screen) const override; - void updateCount() override; - -private: - FramebufferBackend *m_backend; -}; - -} - -#endif