Move X11CursorTracker from WaylandSeat to WaylandBackend
Allows it to be easily re-used in case we don't have a Seat.
This commit is contained in:
parent
fd0d966652
commit
2fec4d55fc
2 changed files with 13 additions and 20 deletions
|
@ -153,7 +153,6 @@ WaylandSeat::WaylandSeat(wl_seat *seat, WaylandBackend *backend)
|
|||
, m_cursor(NULL)
|
||||
, m_theme(NULL)
|
||||
, m_enteredSerial(0)
|
||||
, m_cursorTracker()
|
||||
, m_backend(backend)
|
||||
{
|
||||
m_seat->setup(seat);
|
||||
|
@ -233,8 +232,7 @@ WaylandSeat::WaylandSeat(wl_seat *seat, WaylandBackend *backend)
|
|||
input()->processPointerAxis(toAxis(), delta, time);
|
||||
}
|
||||
);
|
||||
m_cursorTracker.reset(new X11CursorTracker(m_backend));
|
||||
connect(m_cursorTracker.data(), &X11CursorTracker::cursorImageChanged, this,
|
||||
connect(m_backend->cursorTracker(), &X11CursorTracker::cursorImageChanged, this,
|
||||
[this](Buffer::Ptr image, const QSize &size, const QPoint &hotspot) {
|
||||
if (image.isNull()) {
|
||||
return;
|
||||
|
@ -260,7 +258,6 @@ void WaylandSeat::destroyPointer()
|
|||
{
|
||||
delete m_pointer;
|
||||
m_pointer = nullptr;
|
||||
m_cursorTracker.reset();
|
||||
}
|
||||
|
||||
void WaylandSeat::destroyKeyboard()
|
||||
|
@ -269,13 +266,6 @@ void WaylandSeat::destroyKeyboard()
|
|||
m_keyboard = nullptr;
|
||||
}
|
||||
|
||||
void WaylandSeat::resetCursor()
|
||||
{
|
||||
if (!m_cursorTracker.isNull()) {
|
||||
m_cursorTracker->resetCursor();
|
||||
}
|
||||
}
|
||||
|
||||
void WaylandSeat::installCursorImage(wl_buffer *image, const QSize &size, const QPoint &hotSpot)
|
||||
{
|
||||
if (!m_pointer || !m_pointer->isValid()) {
|
||||
|
@ -352,6 +342,7 @@ WaylandBackend::WaylandBackend(QObject *parent)
|
|||
, m_shellSurface(NULL)
|
||||
, m_seat()
|
||||
, m_shm(new ShmPool(this))
|
||||
, m_cursorTracker()
|
||||
, m_connectionThreadObject(nullptr)
|
||||
, m_connectionThread(nullptr)
|
||||
, m_fullscreenShell(new FullscreenShell(this))
|
||||
|
@ -437,11 +428,13 @@ void WaylandBackend::initConnection()
|
|||
// setup registry
|
||||
m_registry->create(m_display);
|
||||
m_registry->setup();
|
||||
m_cursorTracker.reset(new X11CursorTracker(this, this));
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
connect(m_connectionThreadObject, &ConnectionThread::connectionDied, this,
|
||||
[this]() {
|
||||
emit systemCompositorDied();
|
||||
m_cursorTracker.reset();
|
||||
m_seat.reset();
|
||||
m_shm->destroy();
|
||||
destroyOutputs();
|
||||
|
@ -508,13 +501,7 @@ void WaylandBackend::createSurface()
|
|||
// map the surface as fullscreen
|
||||
m_shellSurface = m_shell->createSurface(m_surface, this);
|
||||
m_shellSurface->setFullscreen();
|
||||
connect(m_shellSurface, &ShellSurface::pinged, this,
|
||||
[this]() {
|
||||
if (!m_seat.isNull()) {
|
||||
m_seat->resetCursor();
|
||||
}
|
||||
}
|
||||
);
|
||||
connect(m_shellSurface, &ShellSurface::pinged, m_cursorTracker.data(), &X11CursorTracker::resetCursor);
|
||||
connect(m_shellSurface, &ShellSurface::sizeChanged, this, &WaylandBackend::shellSurfaceSizeChanged);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,6 @@ public:
|
|||
WaylandSeat(wl_seat *seat, WaylandBackend *backend);
|
||||
virtual ~WaylandSeat();
|
||||
|
||||
void resetCursor();
|
||||
void installCursorImage(wl_buffer *image, const QSize &size, const QPoint &hotspot);
|
||||
void installCursorImage(Qt::CursorShape shape);
|
||||
private Q_SLOTS:
|
||||
|
@ -123,7 +122,6 @@ private:
|
|||
KWayland::Client::Surface *m_cursor;
|
||||
wl_cursor_theme *m_theme;
|
||||
uint32_t m_enteredSerial;
|
||||
QScopedPointer<X11CursorTracker> m_cursorTracker;
|
||||
WaylandBackend *m_backend;
|
||||
};
|
||||
|
||||
|
@ -142,6 +140,7 @@ public:
|
|||
KWayland::Client::Compositor *compositor();
|
||||
const QList<KWayland::Client::Output*> &outputs() const;
|
||||
KWayland::Client::ShmPool *shmPool();
|
||||
X11CursorTracker *cursorTracker();
|
||||
|
||||
KWayland::Client::Surface *surface() const;
|
||||
QSize shellSurfaceSize() const;
|
||||
|
@ -166,6 +165,7 @@ private:
|
|||
KWayland::Client::ShellSurface *m_shellSurface;
|
||||
QScopedPointer<WaylandSeat> m_seat;
|
||||
KWayland::Client::ShmPool *m_shm;
|
||||
QScopedPointer<X11CursorTracker> m_cursorTracker;
|
||||
QList<KWayland::Client::Output*> m_outputs;
|
||||
KWayland::Client::ConnectionThread *m_connectionThreadObject;
|
||||
QThread *m_connectionThread;
|
||||
|
@ -210,6 +210,12 @@ KWayland::Client::ShmPool* WaylandBackend::shmPool()
|
|||
return m_shm;
|
||||
}
|
||||
|
||||
inline
|
||||
X11CursorTracker *WaylandBackend::cursorTracker()
|
||||
{
|
||||
return m_cursorTracker.data();
|
||||
}
|
||||
|
||||
inline
|
||||
KWayland::Client::Surface *WaylandBackend::surface() const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue