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

Multiple screens with different resolutions cause render bugs #103

Open
RockyF opened this issue Jul 4, 2023 · 1 comment
Open

Multiple screens with different resolutions cause render bugs #103

RockyF opened this issue Jul 4, 2023 · 1 comment
Labels
bug Something isn't working macOS

Comments

@RockyF
Copy link

RockyF commented Jul 4, 2023

It works fine on a MacBook Pro Retina Screen, but shrinks on an external monitor, as shown here:
image

@joaodasilva joaodasilva added bug Something isn't working macOS labels Jul 17, 2023
@joaodasilva
Copy link
Contributor

Thanks for the report; this should be easy to reproduce.

The problem is likely a mismatch between the devicePixelRatio in the retina screen (probably 2x) vs the external monitor (1x). The native window is getting scaled, but the backing rendering canvas isn't.

This is because windowjs looks only at the main monitor and doesn't update its internal state for multiple monitors.

The scaling to use is loaded once here:

retina_scale_ = (float) width_ / window_width;

GLFW has an API to get the GLFWWindow's monitor:

https://www.glfw.org/docs/latest/window_guide.html#window_monitor

So we could check if the monitor has changed whenever the window moves or gets resized, and fix the scaling factor when that happens.

Even better, GLFW has a callback when the scaling factor has been updated due to moving the window across monitors:

https://www.glfw.org/docs/latest/group__window.html#gaf2832ebb5aa6c252a2d261de002c92d6

I'd be happy to have a look at patches for this :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working macOS
Projects
None yet
Development

No branches or pull requests

2 participants