mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-30 14:12:21 +02:00
fix(wm): correct float window move/resize
This commit fixes an issue where the move/resize functions for floating windows weren't properly taking into account the coordinates of secondary monitors and were only working correctly on the main monitor where top/left was 0/0.
This commit is contained in:
@@ -1415,10 +1415,10 @@ impl WindowManager {
|
||||
focused_monitor_work_area.left += border_width;
|
||||
focused_monitor_work_area.top += border_offset;
|
||||
focused_monitor_work_area.top += border_width;
|
||||
focused_monitor_work_area.right -= border_offset;
|
||||
focused_monitor_work_area.right -= border_width;
|
||||
focused_monitor_work_area.bottom -= border_offset;
|
||||
focused_monitor_work_area.bottom -= border_width;
|
||||
focused_monitor_work_area.right -= border_offset * 2;
|
||||
focused_monitor_work_area.right -= border_width * 2;
|
||||
focused_monitor_work_area.bottom -= border_offset * 2;
|
||||
focused_monitor_work_area.bottom -= border_width * 2;
|
||||
|
||||
for window in workspace.floating_windows().iter() {
|
||||
if window.hwnd == focused_hwnd {
|
||||
@@ -1436,9 +1436,12 @@ impl WindowManager {
|
||||
}
|
||||
(OperationDirection::Right, Sizing::Increase) => {
|
||||
if rect.left + rect.right + delta * 2
|
||||
> focused_monitor_work_area.right
|
||||
> focused_monitor_work_area.left
|
||||
+ focused_monitor_work_area.right
|
||||
{
|
||||
rect.right = focused_monitor_work_area.right - rect.left;
|
||||
rect.right = focused_monitor_work_area.left
|
||||
+ focused_monitor_work_area.right
|
||||
- rect.left;
|
||||
} else {
|
||||
rect.right += delta * 2;
|
||||
}
|
||||
@@ -1458,9 +1461,12 @@ impl WindowManager {
|
||||
}
|
||||
(OperationDirection::Down, Sizing::Increase) => {
|
||||
if rect.top + rect.bottom + delta * 2
|
||||
> focused_monitor_work_area.bottom
|
||||
> focused_monitor_work_area.top
|
||||
+ focused_monitor_work_area.bottom
|
||||
{
|
||||
rect.bottom = focused_monitor_work_area.bottom - rect.top;
|
||||
rect.bottom = focused_monitor_work_area.top
|
||||
+ focused_monitor_work_area.bottom
|
||||
- rect.top;
|
||||
} else {
|
||||
rect.bottom += delta * 2;
|
||||
}
|
||||
@@ -2175,10 +2181,10 @@ impl WindowManager {
|
||||
focused_monitor_work_area.left += border_width;
|
||||
focused_monitor_work_area.top += border_offset;
|
||||
focused_monitor_work_area.top += border_width;
|
||||
focused_monitor_work_area.right -= border_offset;
|
||||
focused_monitor_work_area.right -= border_width;
|
||||
focused_monitor_work_area.bottom -= border_offset;
|
||||
focused_monitor_work_area.bottom -= border_width;
|
||||
focused_monitor_work_area.right -= border_offset * 2;
|
||||
focused_monitor_work_area.right -= border_width * 2;
|
||||
focused_monitor_work_area.bottom -= border_offset * 2;
|
||||
focused_monitor_work_area.bottom -= border_width * 2;
|
||||
|
||||
let focused_workspace = self.focused_workspace()?;
|
||||
let delta = self.resize_delta;
|
||||
@@ -2196,8 +2202,12 @@ impl WindowManager {
|
||||
}
|
||||
}
|
||||
OperationDirection::Right => {
|
||||
if rect.left + delta + rect.right > focused_monitor_work_area.right {
|
||||
rect.left = focused_monitor_work_area.right - rect.right;
|
||||
if rect.left + delta + rect.right
|
||||
> focused_monitor_work_area.left + focused_monitor_work_area.right
|
||||
{
|
||||
rect.left = focused_monitor_work_area.left
|
||||
+ focused_monitor_work_area.right
|
||||
- rect.right;
|
||||
} else {
|
||||
rect.left += delta;
|
||||
}
|
||||
@@ -2210,8 +2220,12 @@ impl WindowManager {
|
||||
}
|
||||
}
|
||||
OperationDirection::Down => {
|
||||
if rect.top + delta + rect.bottom > focused_monitor_work_area.bottom {
|
||||
rect.top = focused_monitor_work_area.bottom - rect.bottom;
|
||||
if rect.top + delta + rect.bottom
|
||||
> focused_monitor_work_area.top + focused_monitor_work_area.bottom
|
||||
{
|
||||
rect.top = focused_monitor_work_area.top
|
||||
+ focused_monitor_work_area.bottom
|
||||
- rect.bottom;
|
||||
} else {
|
||||
rect.top += delta;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user