summaryrefslogtreecommitdiffstats
path: root/tests/auto/client/shared/xdgshell.cpp
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-12-21 14:31:58 +0100
committerJohan Helsing <johan.helsing@qt.io>2019-02-06 15:30:23 +0000
commit60d6d83ea0c43462d5f8e17aaa654ab6f625dd6e (patch)
tree643f3860052c5ee50b3f9ab53481a4f552c025c4 /tests/auto/client/shared/xdgshell.cpp
parent401bdecabb950001ae3294e864ed397d1b76b3f4 (diff)
Client xdg-shell: Add test for tooltips on popupsv5.13.0-alpha1
This used to cause protocol errors. Task-number: QTBUG-71734 Change-Id: Ic937210fc42c93f1d411fb0fb4f269de01f07b5b Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'tests/auto/client/shared/xdgshell.cpp')
-rw-r--r--tests/auto/client/shared/xdgshell.cpp36
1 files changed, 32 insertions, 4 deletions
diff --git a/tests/auto/client/shared/xdgshell.cpp b/tests/auto/client/shared/xdgshell.cpp
index 6bc30302..9437688a 100644
--- a/tests/auto/client/shared/xdgshell.cpp
+++ b/tests/auto/client/shared/xdgshell.cpp
@@ -120,11 +120,11 @@ void XdgSurface::xdg_surface_get_toplevel(Resource *resource, uint32_t id)
void XdgSurface::xdg_surface_get_popup(Resource *resource, uint32_t id, wl_resource *parent, wl_resource *positioner)
{
- Q_UNUSED(parent);
Q_UNUSED(positioner);
QVERIFY(!m_toplevel);
QVERIFY(!m_popup);
- m_popup = new XdgPopup(this, id, resource->version());
+ auto *p = fromResource<XdgSurface>(parent);
+ m_popup = new XdgPopup(this, p, id, resource->version());
}
void XdgSurface::xdg_surface_destroy_resource(Resource *resource)
@@ -135,6 +135,12 @@ void XdgSurface::xdg_surface_destroy_resource(Resource *resource)
delete this;
}
+void XdgSurface::xdg_surface_destroy(QtWaylandServer::xdg_surface::Resource *resource)
+{
+ QVERIFY(m_popups.empty());
+ wl_resource_destroy(resource->handle);
+}
+
void XdgSurface::xdg_surface_set_window_geometry(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
{
Q_UNUSED(resource);
@@ -189,10 +195,14 @@ void XdgToplevel::xdg_toplevel_set_min_size(Resource *resource, int32_t width, i
m_pending.minSize = size;
}
-XdgPopup::XdgPopup(XdgSurface *xdgSurface, int id, int version)
+XdgPopup::XdgPopup(XdgSurface *xdgSurface, XdgSurface *parent, int id, int version)
: QtWaylandServer::xdg_popup(xdgSurface->resource()->client(), id, version)
, m_xdgSurface(xdgSurface)
+ , m_parentXdgSurface(parent)
{
+ Q_ASSERT(m_xdgSurface);
+ Q_ASSERT(m_parentXdgSurface);
+ m_parentXdgSurface->m_popups << this;
}
void XdgPopup::sendConfigure(const QRect &geometry)
@@ -200,14 +210,32 @@ void XdgPopup::sendConfigure(const QRect &geometry)
send_configure(geometry.x(), geometry.y(), geometry.width(), geometry.height());
}
+uint XdgPopup::sendCompleteConfigure(const QRect &geometry)
+{
+ sendConfigure(geometry);
+ return m_xdgSurface->sendConfigure();
+}
+
void XdgPopup::xdg_popup_grab(QtWaylandServer::xdg_popup::Resource *resource, wl_resource *seat, uint32_t serial)
{
Q_UNUSED(resource);
Q_UNUSED(seat); // TODO: verify correct seat as well
- //TODO: verify no other popup has grabbed
QVERIFY(!m_grabbed);
+ QVERIFY(m_parentXdgSurface->isValidPopupGrabParent());
+ m_xdgSurface->m_xdgWmBase->m_topmostGrabbingPopup = this;
m_grabbed = true;
m_grabSerial = serial;
}
+void XdgPopup::xdg_popup_destroy(Resource *resource) {
+ Q_UNUSED(resource);
+ if (m_grabbed) {
+ auto *base = m_xdgSurface->m_xdgWmBase;
+ QCOMPARE(base->m_topmostGrabbingPopup, this);
+ base->m_topmostGrabbingPopup = this->m_parentXdgSurface->m_popup;
+ }
+ m_xdgSurface->m_popup = nullptr;
+ m_parentXdgSurface->m_popups.removeAll(this);
+}
+
} // namespace MockCompositor