aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-12-29 10:08:46 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-12-30 20:12:37 +0300
commit744955ba69176a0e2937f18958908274583223d4 (patch)
treecf4ecd45fde0aa2aadb03f551be002dcec4c5f80 /src
parent7af33f9e6a1bd8c71ca6c09c174a5b83abca501c (diff)
downloadniri-744955ba69176a0e2937f18958908274583223d4.tar.gz
niri-744955ba69176a0e2937f18958908274583223d4.tar.bz2
niri-744955ba69176a0e2937f18958908274583223d4.zip
floating: Remove initial offset when always-centering
Diffstat (limited to 'src')
-rw-r--r--src/layout/workspace.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs
index 9b362eaf..e67b4e76 100644
--- a/src/layout/workspace.rs
+++ b/src/layout/workspace.rs
@@ -2,7 +2,7 @@ use std::cmp::max;
use std::rc::Rc;
use std::time::Duration;
-use niri_config::{OutputName, PresetSize, Workspace as WorkspaceConfig};
+use niri_config::{CenterFocusedColumn, OutputName, PresetSize, Workspace as WorkspaceConfig};
use niri_ipc::{PositionChange, SizeChange};
use smithay::backend::renderer::gles::GlesRenderer;
use smithay::desktop::{layer_map_for_output, Window};
@@ -1124,10 +1124,14 @@ impl<W: LayoutElement> Workspace<W> {
// Come up with a default floating position close to the tile position.
if removed.tile.floating_pos.is_none() {
- let pos = self.floating.clamp_within_working_area(
- render_pos + Point::from((50., 50.)),
- removed.tile.tile_size(),
- );
+ let offset = if self.options.center_focused_column == CenterFocusedColumn::Always {
+ Point::from((0., 0.))
+ } else {
+ Point::from((50., 50.))
+ };
+ let pos = render_pos + offset;
+ let size = removed.tile.tile_size();
+ let pos = self.floating.clamp_within_working_area(pos, size);
let pos = self.floating.logical_to_size_frac(pos);
removed.tile.floating_pos = Some(pos);
}