use the current xdg_toplevel state to check...

...if we are resizing. The configure message
is the result from telling the client that resizing
has stopped and therefore not include the resizing
state. The current state is safe to use because
AckConfigure will move the state to last_acked
and the current state will be set on the next surface commit.
This commit is contained in:
Christian Meissl 2021-06-30 20:57:29 +02:00 committed by Victor Berger
parent 5cfb05cde8
commit da317bfc5d
1 changed files with 23 additions and 8 deletions

View File

@ -452,15 +452,30 @@ pub fn init_shell<BackendData: 'static>(display: &mut Display, log: ::slog::Logg
.unwrap(); .unwrap();
if let Some(serial) = waiting_for_serial { if let Some(serial) = waiting_for_serial {
if configure.serial > serial { // When the resize grab is released the surface
// TODO: huh, we have missed the serial somehow. // resize state will be set to WaitingForFinalAck
// this should not happen, but it may be better to handle // and the client will receive a configure request
// this case anyway // without the resize state to inform the client
} // resizing has finished. Here we will wait for
// the client to acknowledge the end of the
// resizing. To check if the surface was resizing
// before sending the configure we need to use
// the current state as the received acknowledge
// will no longer have the resize state set
let is_resizing = with_states(&surface, |states| {
states
.data_map
.get::<Mutex<XdgToplevelSurfaceRoleAttributes>>()
.unwrap()
.lock()
.unwrap()
.current
.states
.contains(xdg_toplevel::State::Resizing)
})
.unwrap();
if serial == configure.serial if configure.serial >= serial && is_resizing {
&& configure.state.states.contains(xdg_toplevel::State::Resizing)
{
with_states(&surface, |states| { with_states(&surface, |states| {
let mut data = states let mut data = states
.data_map .data_map