Skip to content

Commit

Permalink
for non-main screen coordinates, initWithContentRect is not working a…
Browse files Browse the repository at this point in the history
…s expected, introducing workaround

fixes #22614
  • Loading branch information
csomor committed Aug 5, 2022
1 parent 1391e83 commit 5c5d5f5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/osx/cocoa/nonownedwnd.mm
Original file line number Diff line number Diff line change
Expand Up @@ -844,16 +844,21 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
if ( ( style & wxPOPUP_WINDOW ) )
level = NSPopUpMenuWindowLevel;

NSRect r = wxToNSRect( NULL, wxRect( pos, size) );
NSRect frameRect = wxToNSRect( NULL, wxRect( pos, size) );

r = [NSWindow contentRectForFrameRect:r styleMask:windowstyle];
NSRect contentRect = [NSWindow contentRectForFrameRect:frameRect styleMask:windowstyle];

[m_macWindow initWithContentRect:r
[m_macWindow initWithContentRect:contentRect
styleMask:windowstyle
backing:NSBackingStoreBuffered
defer:NO
];


if (!NSEqualRects([m_macWindow frame], frameRect))
{
[m_macWindow setFrame:frameRect display:NO];
}

// if we just have a title bar with no buttons needed, hide them
if ( (windowstyle & NSTitledWindowMask) &&
!(style & wxCLOSE_BOX) && !(style & wxMAXIMIZE_BOX) && !(style & wxMINIMIZE_BOX) )
Expand Down

0 comments on commit 5c5d5f5

Please sign in to comment.