MaterialX icon indicating copy to clipboard operation
MaterialX copied to clipboard

Fix double HiDPI scaling in GraphEditor by adding a command line variable

Open virokannas opened this issue 2 years ago • 6 comments

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.

virokannas avatar Oct 26 '23 19:10 virokannas

CLA Signed

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.

kwokcb avatar Oct 27 '23 14:10 kwokcb

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.

virokannas avatar Oct 27 '23 14:10 virokannas

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.

kwokcb avatar Oct 27 '23 14:10 kwokcb

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.

virokannas avatar Nov 08 '23 16:11 virokannas

@kwokcb forgot to tag you in the above message; let me know if there's anything you'd like changed in the merge req.

virokannas avatar Nov 13 '23 20:11 virokannas

@jstone-lucasfilm now it's changed to uiScale

virokannas avatar Jun 28 '24 16:06 virokannas