mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
Update bounds of toplevel windows
This commit is contained in:
+15
-4
@@ -1603,15 +1603,19 @@ impl<W: LayoutElement> Workspace<W> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn toplevel_bounds(&self) -> Size<i32, Logical> {
|
||||||
|
Size::from((
|
||||||
|
max(self.working_area.size.w - self.options.gaps * 2, 1),
|
||||||
|
max(self.working_area.size.h - self.options.gaps * 2, 1),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn configure_new_window(&self, window: &Window) {
|
pub fn configure_new_window(&self, window: &Window) {
|
||||||
let width = ColumnWidth::default().resolve(&self.options, self.working_area.size.w);
|
let width = ColumnWidth::default().resolve(&self.options, self.working_area.size.w);
|
||||||
let height = self.working_area.size.h - self.options.gaps * 2;
|
let height = self.working_area.size.h - self.options.gaps * 2;
|
||||||
let size = Size::from((max(width, 1), max(height, 1)));
|
let size = Size::from((max(width, 1), max(height, 1)));
|
||||||
|
|
||||||
let bounds = Size::from((
|
let bounds = self.toplevel_bounds();
|
||||||
max(self.working_area.size.w - self.options.gaps * 2, 1),
|
|
||||||
max(self.working_area.size.h - self.options.gaps * 2, 1),
|
|
||||||
));
|
|
||||||
|
|
||||||
window.toplevel().with_pending_state(|state| {
|
window.toplevel().with_pending_state(|state| {
|
||||||
state.size = Some(size);
|
state.size = Some(size);
|
||||||
@@ -2071,10 +2075,17 @@ impl<W: LayoutElement> Workspace<W> {
|
|||||||
|
|
||||||
impl Workspace<Window> {
|
impl Workspace<Window> {
|
||||||
fn refresh(&self) {
|
fn refresh(&self) {
|
||||||
|
let bounds = self.toplevel_bounds();
|
||||||
|
|
||||||
for (col_idx, col) in self.columns.iter().enumerate() {
|
for (col_idx, col) in self.columns.iter().enumerate() {
|
||||||
for (win_idx, win) in col.windows.iter().enumerate() {
|
for (win_idx, win) in col.windows.iter().enumerate() {
|
||||||
let active = self.active_column_idx == col_idx && col.active_window_idx == win_idx;
|
let active = self.active_column_idx == col_idx && col.active_window_idx == win_idx;
|
||||||
win.set_activated(active);
|
win.set_activated(active);
|
||||||
|
|
||||||
|
win.toplevel().with_pending_state(|state| {
|
||||||
|
state.bounds = Some(bounds);
|
||||||
|
});
|
||||||
|
|
||||||
win.toplevel().send_pending_configure();
|
win.toplevel().send_pending_configure();
|
||||||
win.refresh();
|
win.refresh();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user