GUI on high resolution screens

Author: @petrstepanov

Hi all, I’ve recently put my hands on a 2015 Retina MacBook with Intel Iris 6100 graphics card and I’ve been tinkering around the problem on various desktop environments and display servers. Here is what I found:

On Wayland

Interestingly enough, a recent install of Fedora 36 linux with KDE on Wayland provides correct scaling of the old ROOT TBrowser good enough out of the box. Well, window is a little blurry but respects the system-wide scaling setting. Please refer to the screenshot below:

I also tried the GNOME desktop environment on Wayland. However, it did not work out positively. Not sure what the workaround could be here but something about KWin on Wayland just works better. Looks like KDE on Wayland is a clear winner.

On X.Org

It seems that Xorg’s Xft.dpi setting mentioned above may scale the font size. Only if app developers will explicitly account on it in the code. Xlib libraries, that ROOT graphics depend on, do not account on this setting.

The solution that worked for me on is the following:

  1. Install run_scaled script from GitHub with corresponding dependencies xvfb, xpra, xrandr. Copy run_scaled to say ~/.local/bin and make sure it has executable permissions.
  2. Run your ROOT script that utilizes Xlib at 2x scale with your ROOT script with run_scaled root --web=off <>. Same applies to any standalone application, in particular, ROOT-based that uses TCanvas, GUI classes etc.: run_scaled <your-root-based-app>.

Most commonly users may want to run just a TBrowser instance. Standard rootbrowse script unexpectedly quit on me with run_scaled (maybe Python users can comment on that). Therefore, to quickly run an old TBrowser we can create a ROOT script that will launch it:

echo "void browser(){ new TBrowser(); }" > ~/.local/bin/browser.c

And launch it at 2x scale with following command:

run_scaled root --web=off `which browser.c`

Optionally we can create an alias for the above command:

echo "alias rootbrowse2x='run_scaled root --web=off `which browser.c`'" >> ~/.bashrc
source ~/.bashrc

… and simply run it with rootbrowse2x from the Terminal. Attached please find a screenshot that demonstrated the end result.

Hope this is helpful!