refactor(mac): name the Window set-frame operation set_rect, as the shared Backend does

Renames Window::set_position(&Rect) to Window::set_rect (window.rs and its 9
callers in workspace.rs, window_manager.rs, scrolling.rs, settle.rs and
macos_backend.rs). Body untouched: the direct path (set_point, set_size) or
the animator, as before; nothing changes at runtime. The animator's own free
function set_position, set_point and set_size stay as they are (they are the
AX writes, not the Window operation).

Verified: macOS fake-CC type-check (tools/fast-check) PASS. Not verified:
cannot run or unit-test on Linux.
This commit is contained in:
LGUG2Z committed 2026-10-31 10:00:03 -07:00
1 parent 7c2e1bea8a
commit 49a6dbdabb
6 files changed
+14 -14

No files matched your search

@@ -194,11 +194,11 @@ impl Backend for MacosBackend {
} }
fn set_rect(&self, id: WindowId, rect: &Rect) -> Result<()> { fn set_rect(&self, id: WindowId, rect: &Rect) -> Result<()> {
// `Window::set_position` writes directly (two Accessibility writes) or hands the move to // `Window::set_rect` writes directly (two Accessibility writes) or hands the move to
// the animator, depending on the animation settings; both are requests // the animator, depending on the animation settings; both are requests
let window = self.lookup(id)?; let window = self.lookup(id)?;
window window
.set_position(rect) .set_rect(rect)
.map_err(|e| Self::failed(id, &window, e)) .map_err(|e| Self::failed(id, &window, e))
} }
+2 -2
View File
@@ -303,7 +303,7 @@ impl Workspace {
for window in container.windows_mut() { for window in container.windows_mut() {
let result = match placement.visibility { let result = match placement.visibility {
Visibility::Visible => window Visibility::Visible => window
.set_position(&rect) .set_rect(&rect)
.map(|()| window.note_arrival(&rect, resized)), .map(|()| window.note_arrival(&rect, resized)),
Visibility::Clipped => { Visibility::Clipped => {
// part of it is in view and the rest is past the edge of the screen, // part of it is in view and the rest is past the edge of the screen,
@@ -315,7 +315,7 @@ impl Workspace {
} }
window window
.set_position(&target) .set_rect(&target)
.map(|()| window.note_arrival(&target, resized)) .map(|()| window.note_arrival(&target, resized))
} }
Visibility::OffLeft => { Visibility::OffLeft => {
+1 -1
View File
@@ -207,7 +207,7 @@ impl WindowManager {
let _snapping = Snapping::end(); let _snapping = Snapping::end();
for (window, layout) in &off { for (window, layout) in &off {
if let Err(error) = window.set_position(layout) { if let Err(error) = window.set_rect(layout) {
tracing::debug!( tracing::debug!(
"live resize: could not send window {} again: {error}", "live resize: could not send window {} again: {error}",
window.id window.id
+5 -5
View File
@@ -917,7 +917,7 @@ impl Window {
)) ))
} }
pub fn set_position(&self, rect: &Rect) -> Result<(), AccessibilityError> { pub fn set_rect(&self, rect: &Rect) -> Result<(), AccessibilityError> {
match snap() { match snap() {
Snap::Step(dragged) => return self.set_position_for_step(dragged, rect), Snap::Step(dragged) => return self.set_position_for_step(dragged, rect),
Snap::End => { Snap::End => {
@@ -1204,7 +1204,7 @@ impl Window {
let x = work_area.left + ((work_area.right - target_width) / 2); let x = work_area.left + ((work_area.right - target_width) / 2);
let y = work_area.top + ((work_area.bottom - target_height) / 2); let y = work_area.top + ((work_area.bottom - target_height) / 2);
self.set_position(&Rect { self.set_rect(&Rect {
left: x, left: x,
top: y, top: y,
right: target_width, right: target_width,
@@ -1255,7 +1255,7 @@ impl Window {
// let anim_count = ANIMATION_MANAGER // let anim_count = ANIMATION_MANAGER
// .lock() // .lock()
// .count_in_progress(MovementRenderDispatcher::PREFIX); // .count_in_progress(MovementRenderDispatcher::PREFIX);
// self.set_position(&new_rect, true)?; // self.set_rect(&new_rect, true)?;
// let hwnd = self.hwnd; // let hwnd = self.hwnd;
// // Wait for the animation to finish before maximizing the window again, otherwise // // Wait for the animation to finish before maximizing the window again, otherwise
// // we would be maximizing the window on the current monitor anyway // // we would be maximizing the window on the current monitor anyway
@@ -1274,11 +1274,11 @@ impl Window {
// windows_api::WindowsApi::maximize_window(hwnd); // windows_api::WindowsApi::maximize_window(hwnd);
// }); // });
// } else { // } else {
// self.set_position(&new_rect, true)?; // self.set_rect(&new_rect, true)?;
// windows_api::WindowsApi::maximize_window(self.hwnd); // windows_api::WindowsApi::maximize_window(self.hwnd);
// } // }
// } else { // } else {
self.set_position(&new_rect)?; self.set_rect(&new_rect)?;
// } // }
Ok(()) Ok(())
@@ -787,7 +787,7 @@ impl WindowManager {
} }
} }
window.set_position(&rect)?; window.set_rect(&rect)?;
if mouse_follows_focus { if mouse_follows_focus {
MacosApi::center_cursor_in_rect(&rect)?; MacosApi::center_cursor_in_rect(&rect)?;
@@ -1750,7 +1750,7 @@ impl WindowManager {
} }
} }
window.set_position(&rect)?; window.set_rect(&rect)?;
if mouse_follows_focus { if mouse_follows_focus {
MacosApi::center_cursor_in_rect(&rect)?; MacosApi::center_cursor_in_rect(&rect)?;
+2 -2
View File
@@ -1476,7 +1476,7 @@ impl Workspace {
adjusted_work_area.add_padding(container_padding); adjusted_work_area.add_padding(container_padding);
adjusted_work_area.add_padding(border_offset); adjusted_work_area.add_padding(border_offset);
adjusted_work_area.add_padding(border_width); adjusted_work_area.add_padding(border_width);
window.set_position(&adjusted_work_area)?; window.set_rect(&adjusted_work_area)?;
}; };
} else if !self.containers().is_empty() { } else if !self.containers().is_empty() {
if self.is_scrolling() { if self.is_scrolling() {
@@ -1503,7 +1503,7 @@ impl Workspace {
layout.add_padding(border_width); layout.add_padding(border_width);
for window in container.windows_mut() { for window in container.windows_mut() {
if let Err(error) = window.set_position(layout) { if let Err(error) = window.set_rect(layout) {
tracing::warn!("failed to set window position: {error}") tracing::warn!("failed to set window position: {error}")
} }
} }