[kwin_wayland] Cleanup wayland_backend.[h|cpp]

Remove no longer needed includes, turn one time slot methods into
lambdas, etc.
This commit is contained in:
Martin Gräßlin 2014-08-21 11:30:56 +02:00
parent 46f2b252d8
commit 6ddded0852
3 changed files with 12 additions and 28 deletions

View file

@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Qt // Qt
#include <qplatformdefs.h> #include <qplatformdefs.h>
#include <QCommandLineParser> #include <QCommandLineParser>
#include <QFile>
// system // system
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H

View file

@ -38,7 +38,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QAbstractEventDispatcher> #include <QAbstractEventDispatcher>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDebug> #include <QDebug>
#include <QImage>
#include <QThread> #include <QThread>
// xcb // xcb
#include <xcb/xtest.h> #include <xcb/xtest.h>
@ -370,10 +369,17 @@ WaylandBackend::WaylandBackend(QObject *parent)
); );
connect(m_registry, &Registry::outputAnnounced, this, connect(m_registry, &Registry::outputAnnounced, this,
[this](quint32 name) { [this](quint32 name) {
addOutput(m_registry->bindOutput(name, 2)); Output *output = new Output(this);
output->setup(m_registry->bindOutput(name, 2));
m_outputs.append(output);
connect(output, &Output::changed, this, &WaylandBackend::outputsChanged);
}
);
connect(m_registry, &Registry::seatAnnounced, this,
[this](quint32 name) {
m_seat.reset(new WaylandSeat(m_registry->bindSeat(name, 2), this));
} }
); );
connect(m_registry, &Registry::seatAnnounced, this, &WaylandBackend::createSeat);
connect(m_registry, &Registry::shmAnnounced, this, connect(m_registry, &Registry::shmAnnounced, this,
[this](quint32 name) { [this](quint32 name) {
m_shm->setup(m_registry->bindShm(name, 1)); m_shm->setup(m_registry->bindShm(name, 1));
@ -477,11 +483,6 @@ void WaylandBackend::initConnection()
m_connectionThreadObject->initConnection(); m_connectionThreadObject->initConnection();
} }
void WaylandBackend::createSeat(uint32_t name)
{
m_seat.reset(new WaylandSeat(m_registry->bindSeat(name, 2), this));
}
void WaylandBackend::installCursorImage(Qt::CursorShape shape) void WaylandBackend::installCursorImage(Qt::CursorShape shape)
{ {
if (m_seat.isNull()) { if (m_seat.isNull()) {
@ -525,19 +526,6 @@ void WaylandBackend::createSurface()
} }
} }
void WaylandBackend::addOutput(wl_output *o)
{
Output *output = new Output(this);
output->setup(o);
m_outputs.append(output);
connect(output, &Output::changed, this, &WaylandBackend::outputsChanged);
}
wl_registry *WaylandBackend::registry()
{
return m_registry->registry();
}
QSize WaylandBackend::shellSurfaceSize() const QSize WaylandBackend::shellSurfaceSize() const
{ {
if (m_shellSurface) { if (m_shellSurface) {

View file

@ -22,20 +22,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KWin // KWin
#include <kwinglobals.h> #include <kwinglobals.h>
// Qt // Qt
#include <QDir>
#include <QHash> #include <QHash>
#include <QImage> #include <QImage>
#include <QObject> #include <QObject>
#include <QPoint> #include <QPoint>
#include <QSize> #include <QSize>
// wayland
#include <wayland-client.h>
class QTemporaryFile; class QTemporaryFile;
class QImage;
struct wl_cursor_theme; struct wl_cursor_theme;
struct wl_buffer; struct wl_buffer;
struct wl_display;
struct wl_event_queue; struct wl_event_queue;
struct wl_seat;
namespace KWin namespace KWin
{ {
@ -128,12 +126,9 @@ class KWIN_EXPORT WaylandBackend : public QObject
public: public:
virtual ~WaylandBackend(); virtual ~WaylandBackend();
wl_display *display(); wl_display *display();
wl_registry *registry();
Compositor *compositor(); Compositor *compositor();
void addOutput(wl_output *o);
const QList<Output*> &outputs() const; const QList<Output*> &outputs() const;
ShmPool *shmPool(); ShmPool *shmPool();
void createSeat(uint32_t name);
Surface *surface() const; Surface *surface() const;
QSize shellSurfaceSize() const; QSize shellSurfaceSize() const;