Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[osx] Fix window's setVisible(true) #111

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions os/osx/window.mm
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@ - (void)noResponderFor:(SEL)eventSelector
// returns YES).
if (m_nsWindow.canBecomeMainWindow)
[m_nsWindow makeMainWindow];
else
[m_nsWindow setIsVisible:true];
Copy link
Member Author

@martincapello martincapello Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not actually sure if we should call setIsVisible always...if this were the case, then we can just do:

[m_nsWindow setIsVisible:visible]

At the end of WindowOSX::setVisibleand remove the elses.

Just tried and the following seems to work as well:

void WindowOSX::setVisible(bool visible)
{
  if (visible) {
    // The main window can be changed only when the NSWindow
    // is visible (i.e. when NSWindow::canBecomeMainWindow
    // returns YES).
    if (m_nsWindow.canBecomeMainWindow)
      [m_nsWindow makeMainWindow];
  }
  [m_nsWindow setIsVisible:visible];
}

}
else {
[m_nsWindow setIsVisible:false];
Expand Down