summaryrefslogtreecommitdiff
path: root/src/compositor/wayland_wrapper/qwlshellsurface.cpp
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@digia.com>2013-10-16 09:41:56 +0300
committerAndrew Knight <andrew.knight@digia.com>2013-10-17 12:25:32 +0200
commite75afa46bed68794ff22b9363d35a19c413278ba (patch)
treed508cb26bffa43d169c33ee85846d9d432794eb4 /src/compositor/wayland_wrapper/qwlshellsurface.cpp
parentc5ef3ae2128a38dadeaca7996b78b17ea2cde342 (diff)
downloadqtwayland-e75afa46bed68794ff22b9363d35a19c413278ba.tar.gz
Compositor: Ping/Pong API
Provide a way for the compositor to ping (and receive a pong) from surface clients. Change-Id: Iab594f0357fdfc25fe01ca0b8b9f527149718b44 Reviewed-by: Andy Nichols <andy.nichols@digia.com> Reviewed-by: Jan Arne Petersen <jan.petersen@kdab.com>
Diffstat (limited to 'src/compositor/wayland_wrapper/qwlshellsurface.cpp')
-rw-r--r--src/compositor/wayland_wrapper/qwlshellsurface.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/compositor/wayland_wrapper/qwlshellsurface.cpp b/src/compositor/wayland_wrapper/qwlshellsurface.cpp
index a1e6bb37..62f9c5e0 100644
--- a/src/compositor/wayland_wrapper/qwlshellsurface.cpp
+++ b/src/compositor/wayland_wrapper/qwlshellsurface.cpp
@@ -96,6 +96,13 @@ void ShellSurface::sendConfigure(uint32_t edges, int32_t width, int32_t height)
send_configure(edges, width, height);
}
+void ShellSurface::ping()
+{
+ uint32_t serial = wl_display_next_serial(m_surface->compositor()->wl_display());
+ m_pings.insert(serial);
+ send_ping(serial);
+}
+
Surface *ShellSurface::surface() const
{
return m_surface;
@@ -279,7 +286,10 @@ void ShellSurface::shell_surface_pong(Resource *resource,
uint32_t serial)
{
Q_UNUSED(resource);
- Q_UNUSED(serial);
+ if (m_pings.remove(serial))
+ emit m_surface->waylandSurface()->pong();
+ else
+ qWarning("Received an unexpected pong!");
}
void ShellSurface::shell_surface_set_title(Resource *resource,