openframeworks / openframeworks/openFrameworks

Bug / Feature - window sizing doesn't respect monitor scale on Windows

Open
#6,598 0 comments 0 reactions 1 assignee View on GitHub

@danoli3 is already working on this.

Since Nov 5, 2020.

Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

This is a Windows only issue.

If you have a setup with more than one monitor, and the content scale of the main monitor is set differently to the other monitors, additional windows that are created on the other monitors will not have the correct size.

This is particularly common with laptops, where the content scale is set to 2 or 1.75 on the integrated monitor, but additional, larger monitors will scaled at 1:1. It also seems it's only an issue on Windows, and not any of the other platforms.

This can be fixed pretty easily in ofAppGLFWWindow.cpp by adding the GLFW_SCALE_TO_MONITOR hint and setting it to true, as follows-

void ofAppGLFWWindow::setup(const ofGLFWWindowSettings & _settings) {

...
  glfwWindowHint(GLFW_STEREO, settings.stereo);
  glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
#ifdef TARGET_WIN32
  glfwWindowHint(GLFW_SCALE_TO_MONITOR, GL_TRUE);
#endif
#ifndef TARGET_OSX
	glfwWindowHint(GLFW_AUX_BUFFERS, settings.doubleBuffering?1:0);
#endif
...etc
}

I've fixed it locally, I suppose the question is whether it should be an additional option in the ofGLFWWindowSettings class, and whether it should be true by default or not. The documentation from GLFW is here: https://www.glfw.org/docs/3.3/window_guide.html

Thanks in advance,

-Ed

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.