From 076f82443112eb5d9b946d8a8ce9d5f0cfcaa518 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Tue, 9 Nov 2021 22:42:15 +0100 Subject: [PATCH] Add version method to ToplevelSurface Currently the `shell_surface` is not accessible to the outside, meaning there is no way to query for the XDG shell protocol version supported by the client. Adding a `version` method fixes that problem, which allows compositors to act differently based on the supported protocol version. As an example this allows setting the state to `State::Maximized` if the tiling states are not available. --- src/wayland/shell/xdg/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wayland/shell/xdg/mod.rs b/src/wayland/shell/xdg/mod.rs index 4a0205c..34beb6e 100644 --- a/src/wayland/shell/xdg/mod.rs +++ b/src/wayland/shell/xdg/mod.rs @@ -903,6 +903,11 @@ impl ToplevelSurface { self.shell_surface.as_ref().is_alive() && self.wl_surface.as_ref().is_alive() } + /// Supported XDG shell protocol version. + pub fn version(&self) -> u32 { + self.shell_surface.as_ref().version() + } + /// Retrieve the shell client owning this toplevel surface /// /// Returns `None` if the surface does actually no longer exist.