mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-05 04:31:37 +02:00
fix(wm): restore drag-to-swap window functionality
This commit fixes a regression that was most likely introduced in #678 which changed a bunch of stuff related to window and border dimension calculation. While we could previously assume that the points resize.right and resize.bottom would always be 0 if we were dealing with a move rather than a resize, these two points now depend on the values of BORDER_WIDTH and BORDER_OFFSET. The code has been updated to reflect this and calculate this constant just-in-time.
This commit is contained in:
@@ -1,15 +1,17 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi/v0.1.20/schema.json",
|
"$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi/v0.1.22/schema.json",
|
||||||
"app_specific_configuration_path": "$Env:USERPROFILE/applications.yaml",
|
"app_specific_configuration_path": "$Env:USERPROFILE/applications.yaml",
|
||||||
"window_hiding_behaviour": "Cloak",
|
"window_hiding_behaviour": "Cloak",
|
||||||
"cross_monitor_move_behaviour": "Insert",
|
"cross_monitor_move_behaviour": "Insert",
|
||||||
"default_workspace_padding": 20,
|
"default_workspace_padding": 20,
|
||||||
"default_container_padding": 20,
|
"default_container_padding": 20,
|
||||||
|
"border_padding": 8,
|
||||||
|
"border_offset": -1,
|
||||||
"active_window_border": false,
|
"active_window_border": false,
|
||||||
"active_window_border_colours": {
|
"active_window_border_colours": {
|
||||||
"single": { "r": 66, "g": 165, "b": 245 },
|
"single": "#42a5f5",
|
||||||
"stack": { "r": 256, "g": 165, "b": 66 },
|
"stack": "#00a542",
|
||||||
"monocle": { "r": 255, "g": 51, "b": 153 }
|
"monocle": "#ff3399"
|
||||||
},
|
},
|
||||||
"monitors": [
|
"monitors": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi/v0.1.20/schema.json",
|
"$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi/v0.1.22/schema.json",
|
||||||
"app_specific_configuration_path": "$Env:USERPROFILE/applications.yaml",
|
"app_specific_configuration_path": "$Env:USERPROFILE/applications.yaml",
|
||||||
"window_hiding_behaviour": "Cloak",
|
"window_hiding_behaviour": "Cloak",
|
||||||
"cross_monitor_move_behaviour": "Insert",
|
"cross_monitor_move_behaviour": "Insert",
|
||||||
"default_workspace_padding": 20,
|
"default_workspace_padding": 20,
|
||||||
"default_container_padding": 20,
|
"default_container_padding": 20,
|
||||||
|
"border_padding": 8,
|
||||||
|
"border_offset": -1,
|
||||||
"active_window_border": false,
|
"active_window_border": false,
|
||||||
"active_window_border_colours": {
|
"active_window_border_colours": {
|
||||||
"single": { "r": 66, "g": 165, "b": 245 },
|
"single": "#42a5f5",
|
||||||
"stack": { "r": 256, "g": 165, "b": 66 },
|
"stack": "#00a542",
|
||||||
"monocle": { "r": 255, "g": 51, "b": 153 }
|
"monocle": "#ff3399"
|
||||||
},
|
},
|
||||||
"monitors": [
|
"monitors": [
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-2
@@ -192,7 +192,6 @@ lazy_static! {
|
|||||||
static ref BORDER_RECT: Arc<Mutex<Rect>> =
|
static ref BORDER_RECT: Arc<Mutex<Rect>> =
|
||||||
Arc::new(Mutex::new(Rect::default()));
|
Arc::new(Mutex::new(Rect::default()));
|
||||||
|
|
||||||
static ref BORDER_OFFSET: AtomicI32 = Default::default();
|
|
||||||
|
|
||||||
// Use app-specific titlebar removal options where possible
|
// Use app-specific titlebar removal options where possible
|
||||||
// eg. Windows Terminal, IntelliJ IDEA, Firefox
|
// eg. Windows Terminal, IntelliJ IDEA, Firefox
|
||||||
@@ -212,7 +211,9 @@ pub static BORDER_COLOUR_SINGLE: AtomicU32 = AtomicU32::new(0);
|
|||||||
pub static BORDER_COLOUR_STACK: AtomicU32 = AtomicU32::new(0);
|
pub static BORDER_COLOUR_STACK: AtomicU32 = AtomicU32::new(0);
|
||||||
pub static BORDER_COLOUR_MONOCLE: AtomicU32 = AtomicU32::new(0);
|
pub static BORDER_COLOUR_MONOCLE: AtomicU32 = AtomicU32::new(0);
|
||||||
pub static BORDER_COLOUR_CURRENT: AtomicU32 = AtomicU32::new(0);
|
pub static BORDER_COLOUR_CURRENT: AtomicU32 = AtomicU32::new(0);
|
||||||
pub static BORDER_WIDTH: AtomicI32 = AtomicI32::new(20);
|
pub static BORDER_WIDTH: AtomicI32 = AtomicI32::new(8);
|
||||||
|
pub static BORDER_OFFSET: AtomicI32 = AtomicI32::new(-1);
|
||||||
|
|
||||||
// 0 0 0 aka pure black, I doubt anyone will want this as a border colour
|
// 0 0 0 aka pure black, I doubt anyone will want this as a border colour
|
||||||
pub const TRANSPARENCY_COLOUR: u32 = 0;
|
pub const TRANSPARENCY_COLOUR: u32 = 0;
|
||||||
pub static REMOVE_TITLEBARS: AtomicBool = AtomicBool::new(false);
|
pub static REMOVE_TITLEBARS: AtomicBool = AtomicBool::new(false);
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ use crate::BORDER_COLOUR_STACK;
|
|||||||
use crate::BORDER_ENABLED;
|
use crate::BORDER_ENABLED;
|
||||||
use crate::BORDER_HIDDEN;
|
use crate::BORDER_HIDDEN;
|
||||||
use crate::BORDER_HWND;
|
use crate::BORDER_HWND;
|
||||||
|
use crate::BORDER_OFFSET;
|
||||||
|
use crate::BORDER_WIDTH;
|
||||||
use crate::DATA_DIR;
|
use crate::DATA_DIR;
|
||||||
use crate::HIDDEN_HWNDS;
|
use crate::HIDDEN_HWNDS;
|
||||||
use crate::REGEX_IDENTIFIERS;
|
use crate::REGEX_IDENTIFIERS;
|
||||||
@@ -378,7 +380,14 @@ impl WindowManager {
|
|||||||
|
|
||||||
// If we have moved across the monitors, use that override, otherwise determine
|
// If we have moved across the monitors, use that override, otherwise determine
|
||||||
// if a move has taken place by ruling out a resize
|
// if a move has taken place by ruling out a resize
|
||||||
let is_move = moved_across_monitors || resize.right == 0 && resize.bottom == 0;
|
let right_bottom_constant = ((BORDER_WIDTH.load(Ordering::SeqCst)
|
||||||
|
+ BORDER_OFFSET.load(Ordering::SeqCst))
|
||||||
|
* 2)
|
||||||
|
.abs();
|
||||||
|
|
||||||
|
let is_move = moved_across_monitors
|
||||||
|
|| resize.right.abs() == right_bottom_constant
|
||||||
|
&& resize.bottom.abs() == right_bottom_constant;
|
||||||
|
|
||||||
if is_move {
|
if is_move {
|
||||||
tracing::info!("moving with mouse");
|
tracing::info!("moving with mouse");
|
||||||
|
|||||||
Reference in New Issue
Block a user