Install cursor again after a ping event

Weston switches to the waiting cursor and does not reset, so we need to
ensure that the correct cursor is used once we sent the pong.
This commit is contained in:
Martin Gräßlin 2013-05-23 08:22:02 +02:00
parent 40cb4f5cd6
commit 01fa261537
2 changed files with 28 additions and 2 deletions

View file

@ -81,8 +81,8 @@ static void registryHandleGlobalRemove(void *data, struct wl_registry *registry,
**/
static void handlePing(void *data, struct wl_shell_surface *shellSurface, uint32_t serial)
{
Q_UNUSED(data)
wl_shell_surface_pong(shellSurface, serial);
Q_UNUSED(shellSurface);
reinterpret_cast<WaylandBackend*>(data)->ping(serial);
}
/**
@ -383,6 +383,14 @@ void X11CursorTracker::setEnteredSerial(uint32_t serial)
m_enteredSerial = serial;
}
void X11CursorTracker::resetCursor()
{
QHash<uint32_t, CursorData>::iterator it = m_cursors.find(m_lastX11Cursor);
if (it != m_cursors.end()) {
installCursor(it.value());
}
}
ShmPool::ShmPool(wl_shm *shm)
: m_shm(shm)
, m_pool(NULL)
@ -505,6 +513,13 @@ void WaylandSeat::pointerEntered(uint32_t serial)
m_cursorTracker->setEnteredSerial(serial);
}
void WaylandSeat::resetCursor()
{
if (!m_cursorTracker.isNull()) {
m_cursorTracker->resetCursor();
}
}
WaylandBackend::WaylandBackend()
: m_display(wl_display_connect(NULL))
, m_registry(wl_display_get_registry(m_display))
@ -591,6 +606,14 @@ void WaylandBackend::createShm(uint32_t name)
}
}
void WaylandBackend::ping(uint32_t serial)
{
wl_shell_surface_pong(m_shellSurface, serial);
if (!m_seat.isNull()) {
m_seat->resetCursor();
}
}
}
EglWaylandBackend::EglWaylandBackend()

View file

@ -62,6 +62,7 @@ public:
explicit X11CursorTracker(wl_pointer *pointer, WaylandBackend *backend, QObject* parent = 0);
virtual ~X11CursorTracker();
void setEnteredSerial(uint32_t serial);
void resetCursor();
private Q_SLOTS:
void cursorChanged(uint32_t serial);
private:
@ -102,6 +103,7 @@ public:
void changed(uint32_t capabilities);
wl_seat *seat();
void pointerEntered(uint32_t serial);
void resetCursor();
private:
void destroyPointer();
void destroyKeyboard();
@ -133,6 +135,7 @@ public:
ShmPool *shmPool();
void createSeat(uint32_t name);
void createShm(uint32_t name);
void ping(uint32_t serial);
bool createSurface();
private: