[backends/fbdev] Use BaseScreens implementation

This commit is contained in:
Martin Gräßlin 2015-11-17 10:46:32 +01:00
parent 898eefc6be
commit eb81ddfb86
5 changed files with 6 additions and 117 deletions

View file

@ -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})

View file

@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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 <fcntl.h>
@ -51,7 +51,7 @@ FramebufferBackend::~FramebufferBackend()
Screens *FramebufferBackend::createScreens(QObject *parent)
{
return new FramebufferScreens(this, parent);
return new BasicScreens(this, parent);
}
QPainterBackend *FramebufferBackend::createQPainterBackend()

View file

@ -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 {

View file

@ -1,68 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org>
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 <http://www.gnu.org/licenses/>.
*********************************************************************/
#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;
}
}

View file

@ -1,46 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org>
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 <http://www.gnu.org/licenses/>.
*********************************************************************/
#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