From 9e25fd046811963c0baef7c4bb0373062509d225 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 16 Dec 2021 21:07:37 +0200 Subject: [PATCH] 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 --- src/wayland/xdgshell_interface.cpp | 9 ++++++++- src/wayland/xdgshell_interface.h | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/wayland/xdgshell_interface.cpp b/src/wayland/xdgshell_interface.cpp index faf2bd2015..048d44cb75 100644 --- a/src/wayland/xdgshell_interface.cpp +++ b/src/wayland/xdgshell_interface.cpp @@ -16,7 +16,7 @@ namespace KWaylandServer { -static const int s_version = 3; +static const int s_version = 4; XdgShellInterfacePrivate::XdgShellInterfacePrivate(XdgShellInterface *shell) : q(shell) @@ -599,6 +599,13 @@ void XdgToplevelInterface::sendClose() 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) { if (auto toplevelPrivate = resource_cast(resource)) { diff --git a/src/wayland/xdgshell_interface.h b/src/wayland/xdgshell_interface.h index deb4415dd1..6690a78cbe 100644 --- a/src/wayland/xdgshell_interface.h +++ b/src/wayland/xdgshell_interface.h @@ -290,6 +290,12 @@ public: */ 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. */