track if a popup has been committed

This commit is contained in:
Christian Meissl 2022-01-13 20:24:18 +01:00
parent 070dc78c11
commit 9cb64b9a7f
1 changed files with 9 additions and 0 deletions

View File

@ -383,6 +383,14 @@ xdg_role!(
/// It is a protocol error to call commit on a wl_surface with /// It is a protocol error to call commit on a wl_surface with
/// the xdg_popup role when no parent is set. /// the xdg_popup role when no parent is set.
pub parent: Option<wl_surface::WlSurface>, pub parent: Option<wl_surface::WlSurface>,
/// Defines if the surface has received at least one commit
///
/// This can be used to check for protocol errors, like
/// checking if a popup requested a grab after it has been
/// mapped.
pub committed: bool,
popup_handle: Option<xdg_popup::XdgPopup> popup_handle: Option<xdg_popup::XdgPopup>
} }
); );
@ -1399,6 +1407,7 @@ impl PopupSurface {
.unwrap() .unwrap()
.lock() .lock()
.unwrap(); .unwrap();
attributes.committed = true;
if attributes.initial_configure_sent { if attributes.initial_configure_sent {
if let Some(state) = attributes.last_acked { if let Some(state) = attributes.last_acked {
if state != attributes.current { if state != attributes.current {