shell: Enforce some minimum resize sizes
This commit is contained in:
parent
0ebcfa24a3
commit
92019b4286
3 changed files with 23 additions and 4 deletions
|
|
@ -86,8 +86,8 @@ impl PointerGrab<State> for ResizeSurfaceGrab {
|
||||||
|
|
||||||
let (min_size, max_size) = (self.window.min_size(), self.window.max_size());
|
let (min_size, max_size) = (self.window.min_size(), self.window.max_size());
|
||||||
|
|
||||||
let min_width = min_size.map(|s| s.w).unwrap_or(1);
|
let min_width = min_size.map(|s| s.w).unwrap_or(360);
|
||||||
let min_height = min_size.map(|s| s.h).unwrap_or(1);
|
let min_height = min_size.map(|s| s.h).unwrap_or(240);
|
||||||
let max_width = max_size.map(|s| s.w).unwrap_or(i32::max_value());
|
let max_width = max_size.map(|s| s.w).unwrap_or(i32::max_value());
|
||||||
let max_height = max_size.map(|s| s.h).unwrap_or(i32::max_value());
|
let max_height = max_size.map(|s| s.h).unwrap_or(i32::max_value());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -305,6 +305,14 @@ impl FloatingLayout {
|
||||||
Some(other) => Some(other.merge(output_geo)),
|
Some(other) => Some(other.merge(output_geo)),
|
||||||
}) else { return true };
|
}) else { return true };
|
||||||
|
|
||||||
|
let (min_size, max_size) = (mapped.min_size(), mapped.max_size());
|
||||||
|
let min_width = min_size.map(|s| s.w).unwrap_or(360);
|
||||||
|
let min_height = min_size.map(|s| s.h).unwrap_or(240);
|
||||||
|
let max_width = max_size.map(|s| s.w).unwrap_or(i32::max_value());
|
||||||
|
let max_height = max_size.map(|s| s.h).unwrap_or(i32::max_value());
|
||||||
|
|
||||||
|
geo.size.w = min_width.max(geo.size.w).min(max_width);
|
||||||
|
geo.size.h = min_height.max(geo.size.h).min(max_height);
|
||||||
geo = geo.intersection(bounding_box).unwrap();
|
geo = geo.intersection(bounding_box).unwrap();
|
||||||
|
|
||||||
*mapped.resize_state.lock().unwrap() = Some(ResizeState::Resizing(ResizeData {
|
*mapped.resize_state.lock().unwrap() = Some(ResizeState::Resizing(ResizeData {
|
||||||
|
|
@ -314,7 +322,13 @@ impl FloatingLayout {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
mapped.set_resizing(true);
|
mapped.set_resizing(true);
|
||||||
mapped.set_geometry(geo);
|
mapped.set_geometry(Rectangle::from_loc_and_size(
|
||||||
|
match mapped.active_window() {
|
||||||
|
CosmicSurface::X11(s) => s.geometry().loc,
|
||||||
|
_ => (0, 0).into(),
|
||||||
|
},
|
||||||
|
geo.size,
|
||||||
|
));
|
||||||
mapped.configure();
|
mapped.configure();
|
||||||
|
|
||||||
true
|
true
|
||||||
|
|
|
||||||
|
|
@ -1536,7 +1536,12 @@ impl TilingLayout {
|
||||||
};
|
};
|
||||||
|
|
||||||
let old_size = sizes[shrink_idx];
|
let old_size = sizes[shrink_idx];
|
||||||
sizes[shrink_idx] = (old_size - amount).max(10);
|
sizes[shrink_idx] =
|
||||||
|
(old_size - amount).max(if orientation == Orientation::Vertical {
|
||||||
|
360
|
||||||
|
} else {
|
||||||
|
240
|
||||||
|
});
|
||||||
let diff = old_size - sizes[shrink_idx];
|
let diff = old_size - sizes[shrink_idx];
|
||||||
sizes[grow_idx] += diff;
|
sizes[grow_idx] += diff;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue