[backends/wayland] Use BasicScreens implementation

This commit is contained in:
Martin Gräßlin 2015-11-17 10:43:10 +01:00
parent 7b12e55857
commit 898eefc6be
5 changed files with 7 additions and 131 deletions

View file

@ -1,7 +1,6 @@
set(WAYLAND_BACKEND_SOURCES
logging.cpp
scene_qpainter_wayland_backend.cpp
screens_wayland.cpp
wayland_backend.cpp
egl_wayland_backend.cpp
)

View file

@ -1,76 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2013 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_wayland.h"
#include "wayland_backend.h"
#include "logging.h"
#include "main.h"
#include <QDebug>
namespace KWin
{
WaylandScreens::WaylandScreens(Wayland::WaylandBackend *backend, QObject* parent)
: Screens(parent)
, m_backend(backend)
{
}
WaylandScreens::~WaylandScreens()
{
}
void WaylandScreens::init()
{
Screens::init();
connect(m_backend, &Wayland::WaylandBackend::shellSurfaceSizeChanged,
this, &WaylandScreens::startChangedTimer);
updateCount();
}
QRect WaylandScreens::geometry(int screen) const
{
if (screen == 0) {
return QRect(QPoint(0, 0), size(screen));
}
return QRect();
}
QSize WaylandScreens::size(int screen) const
{
if (screen == 0) {
return m_backend->shellSurfaceSize();
}
return QSize();
}
int WaylandScreens::number(const QPoint &pos) const
{
Q_UNUSED(pos)
return 0;
}
void WaylandScreens::updateCount()
{
setCount(1);
}
}

View file

@ -1,52 +0,0 @@
/********************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2013 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_WAYLAND_H
#define KWIN_SCREENS_WAYLAND_H
#include "screens.h"
namespace KWin
{
namespace Wayland
{
class WaylandBackend;
}
class WaylandScreens : public Screens
{
Q_OBJECT
public:
explicit WaylandScreens(Wayland::WaylandBackend *backend, QObject *parent);
virtual ~WaylandScreens();
void init() override;
QRect geometry(int screen) const override;
QSize size(int screen) const override;
int number(const QPoint& pos) const override;
protected Q_SLOTS:
void updateCount() override;
private:
Wayland::WaylandBackend *m_backend;
};
}
#endif

View file

@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "logging.h"
#include "main.h"
#include "scene_qpainter_wayland_backend.h"
#include "screens_wayland.h"
#include "screens.h"
#include "wayland_server.h"
#include "wayland_cursor_theme.h"
#include "egl_wayland_backend.h"
@ -279,6 +279,7 @@ WaylandBackend::WaylandBackend(QObject *parent)
, m_connectionThread(nullptr)
{
connect(this, &WaylandBackend::connectionFailed, this, &WaylandBackend::initFailed);
connect(this, &WaylandBackend::shellSurfaceSizeChanged, this, &WaylandBackend::screenSizeChanged);
}
WaylandBackend::~WaylandBackend()
@ -443,7 +444,7 @@ QSize WaylandBackend::shellSurfaceSize() const
Screens *WaylandBackend::createScreens(QObject *parent)
{
return new WaylandScreens(this, parent);
return new BasicScreens(this, parent);
}
OpenGLBackend *WaylandBackend::createOpenGLBackend()

View file

@ -123,6 +123,10 @@ public:
OpenGLBackend *createOpenGLBackend() override;
QPainterBackend *createQPainterBackend() override;
QSize screenSize() const override {
return shellSurfaceSize();
}
Q_SIGNALS:
void shellSurfaceSizeChanged(const QSize &size);
void systemCompositorDied();