webots icon indicating copy to clipboard operation
webots copied to clipboard

Scaling issue in simulation UI R2022b

Open FrederikBark opened this issue 3 years ago • 15 comments

Describe the Bug I hope this isn't a duplication, but I didn't find a fix or something related. It might also be an issue with 4k displays. Since the update to R2022b, the simulation window fills only a quarter of the given screen space.

The mouse movements and clicks are measured at the whole screen though, making it additionally hard to click on objects.

Steps to Reproduce

  1. Installing webots from source origin/master (make -j8)
  2. Launching with ./webots

Expected behavior Normal screen scaling as seen in 2nd Screenshot

Screenshots R2022b webots r2022b

R2022a webots

System

  • Operating System: Ubuntu 20.04
  • Graphics Card: Intel HD Graphics & Rtx 3070 (only tested on intel currently though)
  • Display Settings: 4k (3840x2160)
  • Window-Manager: i3

Additional context Add any other context about the problem here.

FrederikBark avatar Aug 08 '22 11:08 FrederikBark

That's is strange... Can you try to to set export QT_USE_PHYSICAL_DPI=1 and run Webots again? Alternatively, can you also try export QT_SCALE_FACTOR=2? Also can you try to remove QT_ENABLE_HIGHDPI_SCALING from https://github.com/cyberbotics/webots/blob/master/src/webots/launcher/webots-linux.sh#L74?

Let me know your findings.

omichel avatar Aug 08 '22 13:08 omichel

Okay so the 1st and 3rd option didn't change anything, but the 2nd option looked like that option2 . Also it seems like this bug doesn't happen in Gnome for me and only i3, but i3 was working correctly with R2022a. Maybe some variable is incorrectly provided by the X-Server?

FrederikBark avatar Aug 08 '22 13:08 FrederikBark

Maybe this one broke it? Can you try to revert it?

omichel avatar Aug 08 '22 13:08 omichel

Sadly this doesn't seem to change it.

FrederikBark avatar Aug 08 '22 13:08 FrederikBark

Or removing these lines?

omichel avatar Aug 08 '22 13:08 omichel

Sadly nothing as well.

FrederikBark avatar Aug 08 '22 13:08 FrederikBark

Unfortunately, I am running out of ideas... That's strange the bug doesn't show up with R2022a... A big change we did between R2022a and R2022b is the upgrade to Qt6. To find the problem, we could revert back in the github history to some commit before the upgrade to Qt6 and rebuild Webots to try to identify if problem was introduced here...

omichel avatar Aug 08 '22 13:08 omichel

Thank you very much for your help. Maybe there is a general change in how qt6 handles scaling and that makes problems with my display config. I'll check it and if I find a solution, I'll post an update.

FrederikBark avatar Aug 08 '22 14:08 FrederikBark

Interestingly using a QT_SCALE_FACTOR of 0.5 fixes the screen scaling, although the rest of the ui is pretty small. Is there a way to increase the ui size (other than with QT_SCALE_FACTOR)? Screenshot_20220809_100026

FrederikBark avatar Aug 09 '22 08:08 FrederikBark

We are progressing... Did you check all the different environment variables documented here: https://doc.qt.io/qt-6/highdpi.html#environment-variable-reference?

omichel avatar Aug 09 '22 08:08 omichel

Alternatively, you may want to try to change the font sizes in the styling sheet: https://github.com/cyberbotics/webots/blob/master/resources/stylesheet.linux.qss

omichel avatar Aug 09 '22 08:08 omichel

Explicitely disabling the QT_ENABLE_HIGHDPI_SCALING with QT_ENABLE_HIGHDPI_SCALING=0 makes the Ui small, but working. I somehow forgot to check disabling it yesterday and tried just not to enable it. In combination with a SCALE_FACTOR of 2 and a FONT_DPI of 80 it looks good again.

Thank you very much for your help! Screenshot_20220809_101423

FrederikBark avatar Aug 09 '22 08:08 FrederikBark

Could we integrate this in https://github.com/cyberbotics/webots/blob/master/src/webots/launcher/webots-linux.sh? If we can detect that we are in a high DPI i3wm environment, the launcher script could set these environment variables automatically?

omichel avatar Aug 09 '22 08:08 omichel

That sounds like a good option. I used the parameters

export QT_ENABLE_HIGHDPI_SCALING=0 export QT_SCALE_FACTOR=2 export QT_FONT_DPI=80

to fix my scaling. The Environment variable $XDG_CURRENT_DESKTOP returns i3 for me. I might be able to adapt the script later today and test it.

FrederikBark avatar Aug 09 '22 10:08 FrederikBark

That would be great.

omichel avatar Aug 09 '22 10:08 omichel