Problems with 2 monitor setup in GLFW

I have a problem running a GLFW application on a Windows 10 PC with two monitors. Monitor 1 is 1920x1080 and monitor 2 is 1920x1200. The application starts in monitor 1 and everything is fine. When I drag the application to the second monitor, once it’s half way across, the window resizes to be smaller and is too small to fit the content. Also, the mouse no longer works properly. It gets a wrong offset, causing it to click in the wrong position.

Is this a known problem with GLFW?

1 Like

This could be due to the monitors having a different content scale, along with how the application is coded. Can you check if either of your monitors Scale is set in the Display settings to anything other than 100%?

Additionally do you have GLFW_SCALE_TO_MONITOR window hint set?

Yeah, one of them is on 120%.
what does the GLFW_SCALE_TO_MONITOR flag do?

See the documentation on GLFW Window Hints.

Which of the monitors do you have at 120% and do you have GLFW_SCALE_TO_MONITOR set?

Also are you checking your framebuffer size and resizing content appropriately? If you’re just assuming one set framebuffer size and it changes this could cause the issues you mention.

No, I don’t check framebuffer size, but anyway I set the scaling to 100% and the problem went away. Thanks for the answer :wink: