Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Failure to detect scale factor change on macOS #175

Open
nicoburns opened this issue Nov 22, 2023 · 1 comment
Open

Failure to detect scale factor change on macOS #175

nicoburns opened this issue Nov 22, 2023 · 1 comment
Labels
backend:mac bug Something isn't working

Comments

@nicoburns
Copy link

Tested on: macOS

Tested with:

  • Glazier shello example
  • Xilem example

Dragging a window between monitors with different scale factors causes the rendering to mess up (either scale too large or too small depending on which direction the window was dragged). And this is not corrected by forcing a repaint via resizing the window.

I added a scale function yo the implementation of WinHandler in Xilem, and it is not being called when I drag the window between screens.

@nicoburns nicoburns added bug Something isn't working backend:mac labels Nov 22, 2023
@nicoburns
Copy link
Author

nicoburns commented Nov 22, 2023

I am able to react to the scale factor change event by registering a callback for windowDidChangeBackingProperties: (https://developer.apple.com/documentation/appkit/nswindowdelegate/1419517-windowdidchangebackingproperties) in the window delegate similar to https://github.com/rust-windowing/winit/blob/master/src/platform_impl/macos/window_delegate.rs#L156C18-L156C50.

I am also able to retrieve the correct scale factor after this point. But unfortunately rendering still seems to be messed up.

Correct rendering:

Screenshot 2023-11-22 at 16 39 22

After dragging from HiDPI (scale factor 2.0)-> Regular DPI (scale factor 1.0):

Screenshot 2023-11-22 at 16 38 59

After dragging from Regular DPI (scale factor 1.0) -> HiDPI (scale factor 2.0):

Screenshot 2023-11-22 at 16 39 11

The correct rendering is "anchored" to whichever screen the app first launched on and always shows correctly on that screen.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backend:mac bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant