zigalenarcic / mangl

An enhanced man page viewer for linux and BSD systems based on OpenGL and mandoc libraries
Other
39 stars 7 forks source link

fix fractional scaling #15

Closed minerscale closed 6 months ago

minerscale commented 6 months ago

When a system's fractional scaling is set to any value other than 1, glfwGetWindowSize and glfwGetFramebufferSize disagree (in fact I think glfwGetWindowSize even includes window decorations so it's extra incorrect but I'm not 100% sure). This pull request uses the correct size function and renames the callback to better reflect what is actually happening.

Another fix is calling glfwSwapBuffers() before getting the framebuffer size for the first time, as on some systems for whatever reason it doesn't report the correct size until after the first paint. An unfortunate but seemingly necessary workaround unless there's obviously a better way.

Thanks, Aaron.

zigalenarcic commented 6 months ago

Hi Aaron,

thank you for your contribution. I will have to look into HiDPI GLFW behavior in detail sometime in the future.

Kind regards, Ziga