Commit 5c3bb7d9 authored by Jan Blackquill's avatar Jan Blackquill 🌈 Committed by Jan Blackquill
Browse files

xdgshell: wrap v3 of xdgshell protocol

parent 380b91e4
Pipeline #46534 passed with stage
in 6 minutes and 54 seconds
......@@ -52,7 +52,7 @@ set_package_properties(Wayland PROPERTIES
find_package(WaylandScanner)
find_package(WaylandProtocols 1.18)
find_package(WaylandProtocols 1.19)
set_package_properties(WaylandProtocols PROPERTIES TYPE REQUIRED)
find_package(EGL)
......
......@@ -17,7 +17,7 @@
namespace KWaylandServer
{
static const int s_version = 2;
static const int s_version = 3;
XdgShellInterfacePrivate::XdgShellInterfacePrivate(XdgShellInterface *shell)
: q(shell)
......@@ -705,6 +705,13 @@ void XdgPopupInterfacePrivate::xdg_popup_grab(Resource *resource, ::wl_resource
emit q->grabRequested(seat, serial);
}
void XdgPopupInterfacePrivate::xdg_popup_reposition(Resource *resource, ::wl_resource *positionerResource, uint32_t token)
{
Q_UNUSED(resource)
positioner = XdgPositioner::get(positionerResource);
emit q->repositionRequested(token);
}
XdgPopupInterface::XdgPopupInterface(XdgSurfaceInterface *surface,
SurfaceInterface *parentSurface,
const XdgPositioner &positioner,
......@@ -763,6 +770,12 @@ void XdgPopupInterface::sendPopupDone()
d->send_popup_done();
}
void XdgPopupInterface::sendRepositioned(quint32 token)
{
Q_ASSERT(d->resource()->version() >= XDG_POPUP_REPOSITIONED_SINCE_VERSION);
d->send_repositioned(token);
}
XdgPopupInterface *XdgPopupInterface::get(::wl_resource *resource)
{
if (auto popupPrivate = resource_cast<XdgPopupInterfacePrivate *>(resource)) {
......@@ -852,6 +865,24 @@ void XdgPositionerPrivate::xdg_positioner_set_anchor(Resource *resource, uint32_
}
}
void XdgPositionerPrivate::xdg_positioner_set_parent_size(Resource *resource, int32_t width, int32_t height)
{
Q_UNUSED(resource)
data->parentSize = QSize(width, height);
}
void XdgPositionerPrivate::xdg_positioner_set_reactive(Resource *resource)
{
Q_UNUSED(resource)
data->isReactive = true;
}
void XdgPositionerPrivate::xdg_positioner_set_parent_configure(Resource *resource, uint32_t serial)
{
Q_UNUSED(resource)
data->parentConfigure = serial;
}
void XdgPositionerPrivate::xdg_positioner_set_gravity(Resource *resource, uint32_t gravity)
{
if (gravity > gravity_bottom_right) {
......@@ -1003,6 +1034,21 @@ QPoint XdgPositioner::offset() const
return d->offset;
}
QSize XdgPositioner::parentSize() const
{
return d->parentSize;
}
bool XdgPositioner::isReactive() const
{
return d->isReactive;
}
quint32 XdgPositioner::parentConfigure() const
{
return d->parentConfigure;
}
XdgPositioner XdgPositioner::get(::wl_resource *resource)
{
XdgPositionerPrivate *xdgPositionerPrivate = XdgPositionerPrivate::get(resource);
......
......@@ -453,6 +453,21 @@ public:
*/
QPoint offset() const;
/**
* Returns whether the surface should respond to movements in its parent window.
*/
bool isReactive() const;
/**
* Returns the parent size to use when positioning the popup.
*/
QSize parentSize() const;
/**
* Returns the serial of the configure event for the parent window.
*/
quint32 parentConfigure() const;
/**
* Returns the current state of the xdg positioner object identified by \a resource.
*/
......@@ -521,6 +536,11 @@ public:
*/
void sendPopupDone();
/**
* Sends a popup repositioned event to the client.
*/
void sendRepositioned(quint32 token);
/**
* Returns the XdgPopupInterface for the specified wayland resource object \a resource.
*/
......@@ -533,6 +553,7 @@ Q_SIGNALS:
*/
void initializeRequested();
void grabRequested(SeatInterface *seat, quint32 serial);
void repositionRequested(quint32 token);
private:
QScopedPointer<XdgPopupInterfacePrivate> d;
......
......@@ -56,6 +56,9 @@ public:
QPoint offset;
QSize size;
QRect anchorRect;
bool isReactive;
QSize parentSize;
quint32 parentConfigure;
};
class XdgPositionerPrivate : public QtWaylandServer::xdg_positioner
......@@ -76,6 +79,9 @@ protected:
void xdg_positioner_set_gravity(Resource *resource, uint32_t gravity) override;
void xdg_positioner_set_constraint_adjustment(Resource *resource, uint32_t constraint_adjustment) override;
void xdg_positioner_set_offset(Resource *resource, int32_t x, int32_t y) override;
void xdg_positioner_set_reactive(Resource *resource) override;
void xdg_positioner_set_parent_size(Resource *resource, int32_t width, int32_t height) override;
void xdg_positioner_set_parent_configure(Resource *resource, uint32_t serial) override;
};
class XdgSurfaceInterfacePrivate : public QtWaylandServer::xdg_surface
......@@ -178,6 +184,7 @@ protected:
void xdg_popup_destroy_resource(Resource *resource) override;
void xdg_popup_destroy(Resource *resource) override;
void xdg_popup_grab(Resource *resource, ::wl_resource *seat, uint32_t serial) override;
void xdg_popup_reposition(Resource *resource, struct ::wl_resource *positioner, uint32_t token) override;
};
} // namespace KWaylandServer
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment