gardesk/ers / 55bd2f9

Browse files

Log NSWindow frame read-back after setFrame

If macOS doesn't accept the requested frame (e.g. cross-screen moves
AppKit silently rejects), set_bounds now shows the actual post-write
frame and a placed_correctly flag — separates 'we computed the wrong
cocoa Y' from 'we computed the right one but NSWindow refused it'.
Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
55bd2f946285704f1b8e4c9b44e8ce84123cf62e
Parents
72f721e
Tree
e76f5f0

1 changed file

StatusFile+-
M src/nswindow_overlay.rs 9 3
src/nswindow_overlay.rsmodified
@@ -213,6 +213,10 @@ impl OverlayWindow {
213213
             CGSize::new(w + 2.0 * self.border_width, h + 2.0 * self.border_width),
214214
         );
215215
         let cocoa_frame = cg_to_cocoa_frame(outer_cg, self.mtm);
216
+        self.window.setFrame_display(cocoa_frame, true);
217
+        let actual = self.window.frame();
218
+        let ok = (actual.origin.x - cocoa_frame.origin.x).abs() < 0.5
219
+            && (actual.origin.y - cocoa_frame.origin.y).abs() < 0.5;
216220
         tracing::debug!(
217221
             cg_x = outer_cg.origin.x,
218222
             cg_y = outer_cg.origin.y,
@@ -220,11 +224,13 @@ impl OverlayWindow {
220224
             cg_h = outer_cg.size.height,
221225
             cocoa_x = cocoa_frame.origin.x,
222226
             cocoa_y = cocoa_frame.origin.y,
223
-            cocoa_w = cocoa_frame.size.width,
224
-            cocoa_h = cocoa_frame.size.height,
227
+            actual_x = actual.origin.x,
228
+            actual_y = actual.origin.y,
229
+            actual_w = actual.size.width,
230
+            actual_h = actual.size.height,
231
+            placed_correctly = ok,
225232
             "set_bounds"
226233
         );
227
-        self.window.setFrame_display(cocoa_frame, true);
228234
         // Update the border path to match new size.
229235
         unsafe {
230236
             let path = objc2_core_graphics::CGPath::with_rounded_rect(