Skip to content

Commit

Permalink
fix: cursor jump to correct target monitor (#744)
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-berger authored Sep 29, 2024
1 parent f7ece4c commit a368285
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
3 changes: 2 additions & 1 deletion packages/wm/src/common/commands/platform_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,10 @@ fn jump_cursor(
let cursor_monitor =
state.monitor_at_position(&Platform::mouse_position()?);

// Jump to the target monitor if the cursor is not already on it.
cursor_monitor
.filter(|monitor| monitor.id() != target_monitor.id())
.map(Into::into)
.map(|_| target_monitor.into())
}
};

Expand Down
10 changes: 0 additions & 10 deletions packages/wm/src/common/vec_deque_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ where
///
/// Inserts at index if value doesn't already exist in the `VecDeque`.
fn shift_to_index(&mut self, target_index: usize, item: T);

/// Replaces the first occurrence of a value with a new value in a
/// `VecDeque`.
fn replace(&mut self, old_value: &T, new_value: T);
}

impl<T> VecDequeExt<T> for VecDeque<T>
Expand All @@ -27,10 +23,4 @@ where
self.insert(target_index.clamp(0, self.len()), value);
}
}

fn replace(&mut self, old_value: &T, new_value: T) {
if let Some(index) = self.iter().position(|e| e == old_value) {
self[index] = new_value;
}
}
}

0 comments on commit a368285

Please sign in to comment.