Keep track of a pending window swap

Prevents windows from getting swapped a bunch of times in one motion causing them not to actually swap
This commit is contained in:
Ottatop 2024-03-21 20:55:02 -05:00
parent 005c787f39
commit 39bf58b41c
2 changed files with 8 additions and 0 deletions

View file

@ -87,6 +87,10 @@ impl PointerGrab<State> for MoveSurfaceGrab {
.cloned();
if let Some(window_under) = window_under {
if state.layout_state.pending_swap {
return;
}
if window_under == self.window {
return;
}

View file

@ -146,6 +146,7 @@ impl State {
if let Some(output) = win1.output(self) {
self.request_layout(&output);
}
self.layout_state.pending_swap = true;
}
}
}
@ -157,6 +158,7 @@ pub struct LayoutRequestId(pub u32);
#[derive(Debug, Default)]
pub struct LayoutState {
pub layout_request_sender: Option<UnboundedSender<Result<LayoutResponse, Status>>>,
pub pending_swap: bool,
id_maps: HashMap<Output, LayoutRequestId>,
pending_requests: HashMap<Output, Vec<(LayoutRequestId, Vec<WindowElement>)>>,
old_requests: HashMap<Output, HashSet<LayoutRequestId>>,
@ -297,6 +299,8 @@ impl State {
self.schedule_render(&output);
self.layout_state.pending_swap = false;
Ok(())
}
}