From 9fd9db82aec5cc971ceaa0c52799a71094b6c879 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Mon, 3 Feb 2020 16:22:48 +0300 Subject: [PATCH] anvil.shell: store geometry in SurfaceData --- anvil/src/shell.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/anvil/src/shell.rs b/anvil/src/shell.rs index 9737173..b4057a4 100644 --- a/anvil/src/shell.rs +++ b/anvil/src/shell.rs @@ -270,6 +270,7 @@ pub struct SurfaceData { pub buffer: Option, pub texture: Option, pub dimensions: Option<(i32, i32)>, + pub geometry: Option, pub input_region: Option, } @@ -315,10 +316,15 @@ fn surface_commit( token: CompositorToken, buffer_utils: &BufferUtils, ) { + let geometry = token + .with_role_data(surface, |role: &mut XdgSurfaceRole| role.window_geometry) + .unwrap_or(None); + token.with_surface_data(surface, |attributes| { attributes.user_data.insert_if_missing(SurfaceData::default); let data = attributes.user_data.get_mut::().unwrap(); + data.geometry = geometry; data.input_region = attributes.input_region.clone(); // we retrieve the contents of the associated buffer and copy it