You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
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 itsSFOpenGLView
receive certain window notifications, includingNSWindowDidChangeScreenNotification
andNSWindowDidChangeScreenProfileNotification
.But when instantiating an
sf::RenderWindow
inside of an existing window, theSFOpenGLView
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 ansf::RenderWindow
by passing theNSWindow
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.The text was updated successfully, but these errors were encountered: