refactor(mac): Window hide, hide_on, hide_scrolling, restore, minimize and unminimize take &self

None of them mutated the window; they read the element and write through
Accessibility, so &mut self only forced callers to hold a mutable binding.
The shared ContainerWindow operations take &self (a stack member is hidden
through a shared reference), so the macOS impl needs these as &self. Six
callers lose a now-unneeded mut. No behaviour change.

Verified: macOS fake-CC type-check (tools/fast-check) PASS with no new
warning. Verified on the Mini: not yet.
This commit is contained in:
LGUG2Z committed 2026-11-05 10:30:05 -08:00
1 parent 6c5731cda4
commit c2ca6847a9
4 files changed
+12 -12

No files matched your search

@@ -211,24 +211,24 @@ impl Backend for MacosBackend {
fn hide(&self, id: WindowId) -> Result<()> {
// a sliver in a corner of the display, observable by the app and the user
let mut window = self.lookup(id)?;
let window = self.lookup(id)?;
window
.hide(self.hiding_position)
.map_err(|e| Self::failed(id, &window, e))
}
fn restore(&self, id: WindowId) -> Result<()> {
let mut window = self.lookup(id)?;
let window = self.lookup(id)?;
window.restore().map_err(|e| Self::failed(id, &window, e))
}
fn minimize(&self, id: WindowId) -> Result<()> {
let mut window = self.lookup(id)?;
let window = self.lookup(id)?;
window.minimize().map_err(|e| Self::failed(id, &window, e))
}
fn unminimize(&self, id: WindowId) -> Result<()> {
let mut window = self.lookup(id)?;
let window = self.lookup(id)?;
window
.unminimize()
.map_err(|e| Self::failed(id, &window, e))
@@ -612,7 +612,7 @@ impl WindowManager {
if create
&& !tabbed_window
&& let Some(element) = window_element
&& let Ok(mut window) = Window::new(element, application.clone())
&& let Ok(window) = Window::new(element, application.clone())
{
window.observe(&self.run_loop, None)?;
let behaviour = self
+6 -6
View File
@@ -639,7 +639,7 @@ impl Window {
/// edge of a display is not always on the display that the lookup by position finds.
#[tracing::instrument(skip_all)]
pub fn hide(
&mut self,
&self,
hiding_position: WindowHidingPosition,
) -> Result<(), AccessibilityError> {
self.hide_on(hiding_position, None)
@@ -653,7 +653,7 @@ impl Window {
/// it is not given it is looked up from where the window is.
#[tracing::instrument(skip_all)]
pub fn hide_on(
&mut self,
&self,
hiding_position: WindowHidingPosition,
screen: Option<CGRect>,
) -> Result<(), AccessibilityError> {
@@ -715,7 +715,7 @@ impl Window {
/// of the screen instead, as with [`Window::hide`].
#[tracing::instrument(skip_all)]
pub fn hide_scrolling(
&mut self,
&self,
hiding_position: WindowHidingPosition,
screen: Option<CGRect>,
) -> Result<(), AccessibilityError> {
@@ -836,13 +836,13 @@ impl Window {
.is_some_and(|b| b.as_bool())
}
pub fn minimize(&mut self) -> Result<(), AccessibilityError> {
pub fn minimize(&self) -> Result<(), AccessibilityError> {
let cf_boolean = CFBoolean::new(true);
let value = &**cf_boolean;
AccessibilityApi::set_attribute_cf_value(&self.element, kAXMinimizedAttribute, value)
}
pub fn unminimize(&mut self) -> Result<(), AccessibilityError> {
pub fn unminimize(&self) -> Result<(), AccessibilityError> {
let cf_boolean = CFBoolean::new(false);
let value = &**cf_boolean;
AccessibilityApi::set_attribute_cf_value(&self.element, kAXMinimizedAttribute, value)
@@ -854,7 +854,7 @@ impl Window {
}
#[tracing::instrument(skip_all)]
pub fn restore(&mut self) -> Result<(), AccessibilityError> {
pub fn restore(&self) -> Result<(), AccessibilityError> {
// waiting for what is on its way to the window is not something to do with a lock held
animator::take_over(self.id);
PARKED_WINDOWS.lock().remove(&self.id);
@@ -3162,7 +3162,7 @@ impl WindowManager {
.get_mut(op.origin_workspace_idx)
.ok_or_eyre("there is no workspace with that index")?;
let mut window = origin_workspace.remove_window(op.window_id)?;
let window = origin_workspace.remove_window(op.window_id)?;
// If it is a floating window move it to the target area
if op.floating {