Fix double HiDPI scaling in GraphEditor by adding a command line variable
The branch has an additional command line variable for MaterialXGraphEditor, --disableScaling, that will bypass the automatic calculation and application of DPI scaling.
Using this flag on MacOS with a retina display, will result in a normal-sized UI.
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: virokannas / name: Simo Virokannas (8c8b52270ac4a0d3e9ae3d5d7ce6b10e5ee15ce5, 58d1ab77855a5f101b6b561aa48e636a371bbb96, 4691987da25a7c99bdc5b4a2e326d1ad890f8e48, 47d5b56c63248917a9fd20a206efda6a15ecb938)
- :white_check_mark: login: jstone-lucasfilm / name: Jonathan Stone (b22e28909e18e26f41ba71ebbda7d02eed7593ab, b74a4b43c09c3a80bd8685144821df5429aa29c8)
Hi @simpassi , I think it would be better if the dpi detection was corrected instead to return the appropriate value for retina displays. Would you have time to look at this? Thanks.
Sure @kwokcb , I can check what all would be involved, but the underlying mechanism causing this is that GLFW needs a special hint to enable full-resolution backing, and at that point DPI scaling will need to be handled per monitor. Also, the situation where a window is moved from one monitor to another needs to be caught and handled.
Right now as the hint isn't enabled, GLFW will just use a logical, not physical, resolution for everything and as a side effect the UI is correct size on any monitor you move it to, as the OS is handling the viewport scaling.
I'm sure there'll still be situations where disabling scaling is desired. Another option is to have a variable to set the scaling factor manually - some UI frameworks like QT make this possible through environment variables.
If this get's too complicated (even just for the single monitor case) than I think your suggestion of allowing a scale factor override is a good alternative and more flexible than an on/off switch.
I changed it to take an optional --scaleFactor float argument. On a retina Mac, 1.0 will yield an acceptable result, but of course now it can be used to simply scale the UI up or down too.
@kwokcb forgot to tag you in the above message; let me know if there's anything you'd like changed in the merge req.
@jstone-lucasfilm now it's changed to uiScale