Automatically unmaximize toplevel when it is moved

This commit is contained in:
Poly 2021-07-19 19:12:38 +02:00
parent ace4490b2b
commit bd35dfb4b6
1 changed files with 14 additions and 0 deletions

View File

@ -407,6 +407,20 @@ pub fn init_shell<BackendData: 'static>(display: Rc<RefCell<Display>>, log: ::sl
return;
}
// If surface is maximized then unmaximize it
if let Some(current_state) = surface.current_state() {
if current_state.states.contains(xdg_toplevel::State::Maximized) {
let fs_changed = surface.with_pending_state(|state| {
state.states.unset(xdg_toplevel::State::Maximized);
state.size = None;
});
if fs_changed.is_ok() {
surface.send_configure();
}
}
}
let toplevel = SurfaceKind::Xdg(surface);
let initial_window_location = xdg_window_map.borrow().location(&toplevel).unwrap();