microsoft / wslg

Enabling the Windows Subsystem for Linux to include support for Wayland and X server related scenarios
MIT License
10.15k stars 303 forks source link

HiDPI Scaling #388

Open alterae opened 3 years ago

alterae commented 3 years ago

Environment

Windows build number: 10.0.22000.0
Your Distribution version: Ubuntu 20.04
Your WSLg version: Unknown (cannot seem to find Windows 11 settings)

Steps to reproduce

  1. Have a machine with a HiDPI display (such as 3840x3160p, with the windows display scaling option set to 200%), running any version of Windows and WSL that supports WSLg.
  2. Install GUI-based apps (such as Nautilux, Emacs, Sublime Text, and Alacritty) in WSL
  3. Run those apps

WSL logs:

Expected behavior

All applications should properly scale with regards to system resolution and DPI. They should be the correct size, and should not be pixelated.

Actual behavior

Some apps (such as all GNOME programs, Alacritty, and Sublime Text) scale properly. Others, such as Emacs, lxappearance, and vlc, display at the correct size but are pixelated. Checking the resolution from within a program that does not scale properly reveals that it thinks the resolution of the monitor is 1920x1080p.

crramirez commented 3 years ago

Hello,

I don't know about the other programs but LXAppearance is GTK2 based so it doesn't support high-dpi scaling. You need to adjust the GDK_DPI_SCALE environment variable so this app looks more or less right.

Regards, Carlos

hideyukn88 commented 3 years ago

@Alterae, thanks for reporting the issue. First current WSLg's HI-DPI support is somehow limited and we are aware of some issues.

First, the scaling quality, currently WSLg utilize scaling done by Windows RDP client software, which uses legacy GDI rendering and it doesn't produce the scaling quality we prefer. This is tracked by https://github.com/microsoft/wslg/issues/3.

Second, the native scaling, Linux doesn't have OS-wide HI-DPI support, thus it has to reply on the framework, such as GTK or Qt, so do the scaling as @crramirez mentioned. If this is the case, WSLg side of scaling must be disabled to avoid double-scaling, please refer WESTON_RDP_DISABLE_HI_DPI_SCALING at https://github.com/microsoft/wslg/wiki/WSLg-Configuration-Options-for-Debugging.

Thanks for trying out WSLg!

parrenin commented 2 years ago

I confirm that QT apps are pixelated at 200% scaling. A workaround is to force them to use wayland with: QT_QPA_PLATFORM=wayland But if you do that, the windows of the QT apps apparently have no borders.

drwonky commented 2 years ago

I've tried GDK scaling, and while it produces the desired effect, the window manager scaling is off. The title bar and buttons are not scaled at all. Normally you'd have control over the WM and scaling, but there doesn't appear to be a "normal" window manager associated with WSLg.

tribals commented 7 months ago

I can confirm the same behavior as drwonkey described.