Add support for xdg_toplevel.configure_bounds()

xdg_toplevel.configure_bounds() allows to indicate the client the
maximum surface size bounds.

wayland-protocols: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/41
This commit is contained in:
Vlad Zahorodnii 2021-12-16 21:07:37 +02:00
parent 17fc13f100
commit 9e25fd0468
2 changed files with 14 additions and 1 deletions

View file

@ -16,7 +16,7 @@
namespace KWaylandServer namespace KWaylandServer
{ {
static const int s_version = 3; static const int s_version = 4;
XdgShellInterfacePrivate::XdgShellInterfacePrivate(XdgShellInterface *shell) XdgShellInterfacePrivate::XdgShellInterfacePrivate(XdgShellInterface *shell)
: q(shell) : q(shell)
@ -599,6 +599,13 @@ void XdgToplevelInterface::sendClose()
d->send_close(); d->send_close();
} }
void XdgToplevelInterface::sendConfigureBounds(const QSize &size)
{
if (d->resource()->version() >= XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSION) {
d->send_configure_bounds(size.width(), size.height());
}
}
XdgToplevelInterface *XdgToplevelInterface::get(::wl_resource *resource) XdgToplevelInterface *XdgToplevelInterface::get(::wl_resource *resource)
{ {
if (auto toplevelPrivate = resource_cast<XdgToplevelInterfacePrivate *>(resource)) { if (auto toplevelPrivate = resource_cast<XdgToplevelInterfacePrivate *>(resource)) {

View file

@ -290,6 +290,12 @@ public:
*/ */
void sendClose(); void sendClose();
/**
* Sends an event to the client specifying the maximum bounds for the surface size. Must be
* called before sendConfigure().
*/
void sendConfigureBounds(const QSize &size);
/** /**
* Returns the XdgToplevelInterface for the specified wayland resource object \a resource. * Returns the XdgToplevelInterface for the specified wayland resource object \a resource.
*/ */