Commit 54e68ee
osx: keep window creation on-screen during display reconfiguration (AvaloniaUI#21543)
* osx: anchor new windows to the primary screen origin
WindowBaseImpl::CreateNSWindow anchors the new NSWindow's content rect to the
primary screen's frame.origin. The primary screen is at Cocoa (0,0) on a
healthy Mac, but can be offset (often negative) while the display server is
mid-reconfiguration -- e.g. CGMainDisplayID() briefly returns 0 after
wake-from-sleep -- or on multi-monitor layouts where the primary is not at the
origin. Anchoring keeps the window on a real screen so it is positioned
on-screen and its flipped Position lands inside a Screen.Bounds.
See AvaloniaUI#18895.
Co-authored-by: Cursor <cursoragent@cursor.com>
* osx: keep window construction resilient when no screen contains it
When locating the screen that sizes a new window, fall back to a default size
if AppKit reports no screens -- or none whose bounds contain the last-known
position -- during a display reconfiguration. The window is repositioned on the
next ScreenChanged event once the display server settles.
See AvaloniaUI#18895.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Less verbose comments
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Julien Lebosquain <julien@lebosquain.net>1 parent af3f942 commit 54e68ee
2 files changed
Lines changed: 26 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
450 | 450 | | |
451 | 451 | | |
452 | 452 | | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
453 | 463 | | |
454 | | - | |
| 464 | + | |
455 | 465 | | |
456 | 466 | | |
457 | | - | |
| 467 | + | |
458 | 468 | | |
459 | 469 | | |
460 | 470 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
54 | 56 | | |
55 | 57 | | |
56 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
57 | 69 | | |
58 | | - | |
| 70 | + | |
59 | 71 | | |
60 | 72 | | |
61 | 73 | | |
| |||
0 commit comments