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