xdg_toplevel: automatically float windows based on xdg-dialog and requested size
This commit is contained in:
parent
149801520a
commit
a75d388e97
1 changed files with 23 additions and 0 deletions
|
|
@ -417,6 +417,29 @@ impl XdgToplevel {
|
|||
}
|
||||
return;
|
||||
}
|
||||
let is_dialog = self.dialog.is_some();
|
||||
let fixed_size = match (
|
||||
self.min_width.get(),
|
||||
self.max_width.get(),
|
||||
self.min_height.get(),
|
||||
self.max_height.get(),
|
||||
) {
|
||||
(Some(min_w), Some(max_w), Some(min_h), Some(max_h)) if min_w == max_w && min_h == max_h => {
|
||||
Some((min_w, min_h))
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
if is_dialog || fixed_size.is_some() {
|
||||
let ws = parent
|
||||
.and_then(|p| p.xdg.workspace.get())
|
||||
.unwrap_or_else(|| self.state.ensure_map_workspace(None));
|
||||
if let Some((w, h)) = fixed_size {
|
||||
self.toplevel_data.float_width.set(w);
|
||||
self.toplevel_data.float_height.set(h);
|
||||
}
|
||||
self.map_floating(&ws, pos.map(|p| (p.1, p.2)));
|
||||
return;
|
||||
}
|
||||
match parent {
|
||||
None => self.map_tiled(),
|
||||
Some(p) => self.map_child(p, pos),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue