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

MacOS: When initializing an openGL view with an existing window, call finishInit #1759

Closed
jkeller51 opened this issue Mar 19, 2021 · 1 comment

Comments

@jkeller51
Copy link
Contributor

I had some long-standing bugs in my software dealing with SFML not receiving certain window notifications. I had worked around them outside of SFML but during a recent dig through the code I found the cause. When creating an sf::RenderWindow with a frame size (e.g. telling SFML to make its own window), it makes its SFOpenGLView receive certain window notifications, including NSWindowDidChangeScreenNotification and NSWindowDidChangeScreenProfileNotification.

But when instantiating an sf::RenderWindow inside of an existing window, the SFOpenGLView is never set up to receive these notifications, so certain events are "missed" by SFML. For DPI-aware applications, this can cause unexpected behavior.

I'm not sure if there was a reason for leaving this out, but adding it back in makes more sense to me and more cleanly solves the problems I was having.

Your environment

Steps to reproduce

Create an NSWindow manually, then create an sf::RenderWindow by passing the NSWindow handle.

Expected behavior

When DPI scaling changes occur (e.g. passing between windows or changing display scaling), the sf::RenderWindow should receive an event. Currently this is supposed to be passed to the Event::Resized event.

Actual behavior

When the sf::RenderWindow is instantiated inside of an existing NSWindow, this notification is not received.

@eXpl0it3r eXpl0it3r added this to Discussion in SFML 2.6.0 via automation Mar 19, 2021
@eXpl0it3r eXpl0it3r added this to the 2.6 milestone Mar 19, 2021
@eXpl0it3r eXpl0it3r moved this from Discussion to Review & Testing in SFML 2.6.0 Mar 19, 2021
@eXpl0it3r
Copy link
Member

Fixed with #1760

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
SFML 2.6.0
  
Done
Development

No branches or pull requests

2 participants