Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSLg does not seem to support fractional scaling #23

Open
EndPositive opened this issue Apr 21, 2021 · 77 comments
Open

WSLg does not seem to support fractional scaling #23

EndPositive opened this issue Apr 21, 2021 · 77 comments
Labels
enhancement New feature or request

Comments

@EndPositive
Copy link

Environment

Microsoft Windows [Version 10.0.21364.1] 
kali-linux 2021.1
1.0.17.1]

Steps to reproduce

Set display scaling to 150%. Open a graphical application on that monitor (or move it to that monitor).

Expected behavior

The application scales according to the windows display scaling settings.

Actual behavior

wslg only seems to support 100% and 200% as display scales.

@EndPositive EndPositive added the bug Something isn't working label Apr 21, 2021
@hideyukn88
Copy link
Member

@EndPositive, this is currently disabled by default, it can be enabled by WESTON_RDP_DISABLE_FRACTIONAL_HI_DPI_SCALING=false. This is disabled due to scaling quality in RDP client software.

@r3dlobst3r
Copy link

I am also having this issue on my surface go 2 at 150% scale. I attempted to use WESTON_RDP_DISABLE_FRACTIONAL_HI_DPI_SCALING=false under [wsl2] in my WSL config file and it did not work. I did restart wsl.

@hideyukn88
Copy link
Member

Sorry, I should have put more clearly, please create a file named .wslgconfig at c:\ProgramData\Microsoft\WSL (or /mnt/c/ProgramData/Microsoft/WSL/.wslgconfig from Linux) with contents of below, and restart WSL with wsl --shutdown or wsl --terminate [distro name].

[system-distro-env]
WESTON_RDP_DISABLE_FRACTIONAL_HI_DPI_SCALING=false

@EndPositive EndPositive changed the title wslg does not seem to support fractional scaling WSLg does not seem to support fractional scaling Apr 22, 2021
@spronovo spronovo added enhancement New feature or request and removed bug Something isn't working labels Apr 26, 2021
@ayalon
Copy link

ayalon commented Jun 23, 2021

Is there already a plan when fractional scaling is supported? Almost all new monitors are 4K or more and some text scaling in Windows is very common.

@iongion
Copy link

iongion commented Oct 17, 2021

With both .wslconfig options turned off, there is this strange behavior.

On a 4K monitor - Firefox / Chrome have proper scaling and they look good, even the mouse cursor
image

But gtk 3 apps such as gedit are double the size and the mouse cursor is huge
image

Maybe this reporting helps, thanks, wslg is awesome!

@ghost
Copy link

ghost commented Oct 26, 2021

It seems that if I am at 150% then the Linux app automatically goes to 100%, I want the opposite. Is there any way workaround to have a 150% and obtain a 200% result on the Linux apps?

@hideyukn88
Copy link
Member

hideyukn88 commented Oct 26, 2021

@adelicato, currently that's not possible, unless building custom version of system-distro. If you are interested in, you can modify below line of code, which currently drops fractional part by casting to int, but it can be changed to round it up. Thanks!

https://github.com/microsoft/weston-mirror/blob/working/libweston/backend-rdp/rdpdisp.c#L85

@user9931
Copy link

Any hope that Windows scaling 150% -> wsl 200% will be implemented any time? with option, for example... because WESTON_RDP_DISABLE_FRACTIONAL_HI_DPI_SCALING=false gives very blurry fonts

@ayalon
Copy link

ayalon commented Nov 24, 2021

I have the same issue.

@hjgarcia1
Copy link

same here.

@ThalusA
Copy link

ThalusA commented Dec 22, 2021

Any updates? This is still going from the start of WSLG, and no one ever thinks about fixing this problem at all? Having good quality for graphical desktop inside WSL should be mandatory when you are releasing a product like that, not optional.

@memegauste
Copy link

Any updates? This is still going from the start of WSLG, and no one ever thinks about fixing this problem at all? Having good quality for graphical desktop inside WSL should be mandatory when you are releasing a product like that, not optional.

It still can depends on Linux side, because Linux since years doesn't support Mixed DPI or has great DPI support in general, and I am not sure if Microsoft can do anything about that anyway. But I still have an hope.

@craigloewen-msft
Copy link
Member

Hi folks, we've made an update in the latest version of WSLg that is available with WSL in the Microsoft Store to change the behaviour where 150% Windows scaling will now go up to 200% WSLg scaling. Please try it out and give us any feedback that you have!

@sandain
Copy link

sandain commented Jan 24, 2022

@craiglowewn-msft: Is there anyway to make 150% Windows scaling = 150 WSLg scaling? 200% makes gnome programs (e.g., gedit) and the mouse cursor huge! As noted above, WESTON_RDP_DISABLE_FRACTIONAL_HI_DPI_SCALING=false makes the windows and cursor the proper size, but gives very blurry fonts.

@sandain
Copy link

sandain commented Jan 25, 2022

It looks like fractional scaling doesn't actually work. I found that setting WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=150 either does nothing, or gets rounded to 200%. WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=100 gives me the 100% scaling that I expect (without the blurry fonts the WESTON_RDP_DISABLE_FRACTIONAL_HI_DPI_SCALING options does). Of course I would rather have 150% scaling, but I'll take 100% over 200% any day.

PR #53 should be reverted since it doesn't fix the real problem, and makes things arguable worse.

@khuongduybui
Copy link

All due respect @sandain I believe we are trying to solve the opposite problem. The default experience used to be 150% => 100%, which makes thing too hard to read, so in the latest build they are trying to switch the default to 150% => 200%. Now you are complaining that it's too big haha. I guess we will simply need to wait until non-blurry fractional become a thing.

@khuongduybui
Copy link

Also @EndPositive I saw that you both thumbed up and thumbed down on Craig's post above? lol

@hideyukn88
Copy link
Member

@Laess3r, thanks for being patient on this issue, I think HI-DPI is a bit more complicated in Linux GUI space since its solution is largely dependent on each application framework, such as GTK and Qt, rather than window manager or UI compositor. Thus,, legacy framework such as Xt/Motif has no support for that, and often those applications won't be scaled at all on most of native Linux desktop, while WSLg does the best effort to scale them (but with limitation of scaling quality). For fractional scaling, even Ubuntu Desktop 20.04 LTS does not enable fractional scaling by default. Also, for newer Wayland, its output scaling protocol is still integer base. We will need more time to evaluate the solution, thanks!

@nkrepo
Copy link

nkrepo commented Jan 27, 2023

@hideyukn88 The new wp-fractional-scale-v1 is states that it provides the following:

"This protocols allows for communicating preferred fractional scales to surfaces, which in combination with wp_viewport can be used to render surfaces at fractional scales when applicable."

Since it probably solves the issue you noted with the integer only output scaling protocol, is that a way forward for supporting rendering with fractional scaling also in WSLg?

@hideyukn88
Copy link
Member

@nkrepo, thanks for pointing out that, and I'm aware of that and it's still in "staging". Currently we only consume "stable" protocols, thanks!

@emersion
Copy link

emersion commented Feb 8, 2023

I would recommend implementing "unstable" and "staging" protocol. That only means that new major versions may be added, nothing more. Breaking changes are still forbidden for a given major version.

@luzhkovvv
Copy link

Hi! As far as I can see, wp-fractional-scale-v1 support is already released in KDE 5.27 LTS https://invent.kde.org/plasma/kwin/-/merge_requests/2598 https://kde.org/announcements/changelogs/plasma/5/5.26.5-5.27.0/. I've tested KDE 5.27 in ubuntu 22.10 using backports and in fedora 37 and the scaling works perfectly. Is there any chance we can get that support in WSLg soon? I understand that de facto standard protocols may remain in staging for years.

@hongy19
Copy link

hongy19 commented May 3, 2023

hi all,
i has enabled hidpi and set scale factor=150 in .wslgconfig, but from /mnt/wslg/weston.log, it seems scale are 100. does anyone know why?

;hi-dpi
WESTON_RDP_HI_DPI_SCALING=true
WESTON_RDP_FRACTIONAL_HI_DPI_SCALING=true
;100 to 500
WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=150
[12:32:04.260] RDP backend: use_gfxredir = 1
[12:32:04.260] RDP backend: enable_hi_dpi_support = 1
[12:32:04.260] RDP backend: enable_fractional_hi_dpi_support = 0
[12:32:04.260] RDP backend: enable_fractional_hi_dpi_roundup = 0
[12:32:04.260] RDP backend: debug_desktop_scaling_factor = 0
[12:32:04.260] RDP backend: enable_window_zorder_sync = 1
[12:32:04.260] RDP backend: enable_window_snap_arrange = 1
[12:32:04.260] RDP backend: enable_window_shadow_remoting = 1
[12:32:04.260] RDP backend: enable_display_power_by_screenupdate = 0
[12:32:04.260] RDP backend: enable_distro_name_title = 1
[12:32:04.260] RDP backend: enable_copy_warning_title = 1

@hongy19
Copy link

hongy19 commented May 3, 2023

hi all, i has enabled hidpi and set scale factor=150 in .wslgconfig, but from /mnt/wslg/weston.log, it seems scale are 100. does anyone know why?

;hi-dpi
WESTON_RDP_HI_DPI_SCALING=true
WESTON_RDP_FRACTIONAL_HI_DPI_SCALING=true
;100 to 500
WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=150
[12:32:04.260] RDP backend: use_gfxredir = 1
[12:32:04.260] RDP backend: enable_hi_dpi_support = 1
[12:32:04.260] RDP backend: enable_fractional_hi_dpi_support = 0
[12:32:04.260] RDP backend: enable_fractional_hi_dpi_roundup = 0
[12:32:04.260] RDP backend: debug_desktop_scaling_factor = 0
[12:32:04.260] RDP backend: enable_window_zorder_sync = 1
[12:32:04.260] RDP backend: enable_window_snap_arrange = 1
[12:32:04.260] RDP backend: enable_window_shadow_remoting = 1
[12:32:04.260] RDP backend: enable_display_power_by_screenupdate = 0
[12:32:04.260] RDP backend: enable_distro_name_title = 1
[12:32:04.260] RDP backend: enable_copy_warning_title = 1

i has find the reason for this strange behavior, for .wslgconfig, you need to add ";" at beginning of black line, otherwise configuration line after black line doesn't take effect. Here comes my latest .wslconfig and /mnt/wslg/weston.log
but if i set WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=150 or 125, the font is blurry, so i have to change back to WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=100

[system-distro-env]
;rdp-backend debug level
;level 0 to 5
WESTON_RDP_DEBUG_LEVEL=5
;
;start menu integration (Linux app in Windows start menu)
WESTON_RDP_APPLIST=false
;start menu with distro name
WESTON_RDPRAIL_SHELL_APPEND_DISTRONAME_STARTMENU=false
;
;monitor refresh rate
;60 or 144
;WESTON_RDP_MONITOR_REFRESH_RATE=144
;
;window z-order sync with Windows
WESTON_RDP_WINDOW_ZORDER_SYNC=true
;
;old hiDPI configuraiton and not used anymore
;WESTON_RDP_DISABLE_HI_DPI_SCALING=false
;WESTON_RDP_DISABLE_FRACTIONAL_HI_DPI_SCALING=false
;
;hi-dpi
WESTON_RDP_HI_DPI_SCALING=true
WESTON_RDP_FRACTIONAL_HI_DPI_SCALING=true
;100 to 500
WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=100
;
;restart weston compositor and Xwayland by Left-Ctrl + Left-Atl + Backspace
WESTON_RDPRAIL_SHELL_ALLOW_ZAP=true
[13:45:31.208] RDP backend: use_gfxredir = 1
[13:45:31.208] RDP backend: enable_hi_dpi_support = 1
[13:45:31.208] RDP backend: enable_fractional_hi_dpi_support = 1
[13:45:31.208] RDP backend: enable_fractional_hi_dpi_roundup = 0
[13:45:31.208] RDP backend: debug_desktop_scaling_factor = 100
[13:45:31.208] RDP backend: enable_window_zorder_sync = 1
[13:45:31.208] RDP backend: enable_window_snap_arrange = 1
[13:45:31.208] RDP backend: enable_window_shadow_remoting = 1
[13:45:31.208] RDP backend: enable_display_power_by_screenupdate = 0
[13:45:31.208] RDP backend: enable_distro_name_title = 1
[13:45:31.208] RDP backend: enable_copy_warning_title = 1

@nkrepo
Copy link

nkrepo commented May 3, 2023

@hideyukn88
Since the wp-fractional-scale-v1 got supported in Gnome Mutter and in KDE Plasma.
image
https://wayland.app/protocols/fractional-scale-v1

And since it was merged into wayland's main 5 months already, I think WSLg should support it as soon as possible.

@AseoShen
Copy link

It seems that this issue has been solved officially now. The fractional scaling is now supported by setting export GDK_DPI_SCALE=1.5 or other fractions.
I am using Windows 11 with WSL version: 1.2.5.0, WSLg version: 1.0.51.

@hongy19
Copy link

hongy19 commented May 10, 2023

It seems that this issue has been solved officially now. The fractional scaling is now supported by setting export GDK_DPI_SCALE=1.5 or other fractions. I am using Windows 11 with WSL version: 1.2.5.0, WSLg version: 1.0.51.

This setting is only valid for X11, not valid for Wayland application.

@MamiyaOtaru
Copy link

It seems that this issue has been solved officially now. The fractional scaling is now supported by setting export GDK_DPI_SCALE=1.5 or other fractions. I am using Windows 11 with WSL version: 1.2.5.0, WSLg version: 1.0.51.

This setting is only valid for X11, not valid for Wayland application.

Also wouldn't help with multiple monitors with different scaling settings

@nkrepo
Copy link

nkrepo commented Aug 31, 2023

@hideyukn88 Since the wp-fractional-scale-v1 got supported in Gnome Mutter and in KDE Plasma. image https://wayland.app/protocols/fractional-scale-v1

And since it was merged into wayland's main 5 months already, I think WSLg should support it as soon as possible.

@hideyukn88 is there any progress towards fractional-scale-v1 support ?

@Seven7zip
Copy link

It seems that this issue has been solved officially now. The fractional scaling is now supported by setting export GDK_DPI_SCALE=1.5 or other fractions. I am using Windows 11 with WSL version: 1.2.5.0, WSLg version: 1.0.51.

I did two .wslgconfig file location and it doesn't apply at all, but this solution only works. What should I do?

@viocha
Copy link

viocha commented Jan 19, 2024

Sorry, I should have put more clearly, please create a file named .wslgconfig at c:\ProgramData\Microsoft\WSL (or /mnt/c/ProgramData/Microsoft/WSL/.wslgconfig from Linux) with contents of below, and restart WSL with wsl --shutdown or wsl --terminate [distro name].

[system-distro-env] WESTON_RDP_DISABLE_FRACTIONAL_HI_DPI_SCALING=false

it doesn't work
image

@chrisandrew-dev
Copy link

chrisandrew-dev commented Feb 20, 2024

None of the various suggested configurations work for me in either location (C:\ProgramData\Microsoft\WSL\.wslconfig or C:\Users\user\.wslconfig).

@nkrepo
Copy link

nkrepo commented Feb 20, 2024

@chrisandrew-dev, as I can understand WSLGd launches Weston as Wayland compositor, until Weston gets support for wp_fractional_scale_manager_v1 and the subsequent support in backend_rdp component of WSLGd, there will be no real solution for fractional scaling under wslg.

@chrisandrew-dev
Copy link

@nkrepo, Nevermind fractional, I'd be happy with any scaling. All apps look extremely unpleasant and pixelated.

@xorinzor
Copy link

@chrisandrew-dev that's not the scope of this issue.

@gregonarash
Copy link

It seems that this issue has been solved officially now. The fractional scaling is now supported by setting export GDK_DPI_SCALE=1.5 or other fractions. I am using Windows 11 with WSL version: 1.2.5.0, WSLg version: 1.0.51.

This is working for me on Windows 10, Ubuntu 20, WSL2, without adding any .wslgconfig file. I added the export to my .bashrc file so that is set every time I open terminal.

@Dreamail
Copy link

It seems that this issue has been solved officially now. The fractional scaling is now supported by setting export GDK_DPI_SCALE=1.5 or other fractions. I am using Windows 11 with WSL version: 1.2.5.0, WSLg version: 1.0.51.

This is working for me on Windows 10, Ubuntu 20, WSL2, without adding any .wslgconfig file. I added the export to my .bashrc file so that is set every time I open terminal.

does it work with jetbrains idea?

@dzciemix
Copy link

dzciemix commented Jun 26, 2024

It partially works.

OK scale=1.5
FAIL scale=2

win11

$ wsl.exe --version
WSL version: 2.2.4.0
Kernel version: 5.15.153.1-2
WSLg version: 1.0.61
MSRDC version: 1.2.5326
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26091.1-240325-1447.ge-release
Windows version: 10.0.22631.3737

@ostecke
Copy link

ostecke commented Jun 27, 2024

Completely unrelated, but for Intellij products I recommend the "Zoom IDE" functionality which works fine for me.

@hung-qt
Copy link

hung-qt commented Dec 26, 2024

With this docs from Microsoft, I set both to true and its scale seems fine. The font is still blurry.

WESTON_RDP_HI_DPI_SCALING=true
WESTON_RDP_FRACTIONAL_HI_DPI_SCALING=true

@anatanna
Copy link

Does the issue can be tweaked via Xming or VcXsrv ? (For each of them need to request admin support(company policy) so need to know in a good way that it will work)

@hung-qt Does it work for multiple monitors with different scaling settings?

@hung-qt
Copy link

hung-qt commented Dec 28, 2024

@hung-qt Does it work for multiple monitors with different scaling settings?

I don't test it yet. I have only 2.8K screen laptop with the scale in Windows is 175%.

@ttimasdf
Copy link

ttimasdf commented Jan 16, 2025

There is a hidden undocumented roundup setting WESTON_RDP_FRACTIONAL_HI_DPI_SCALING_ROUNDUP that is definitely worth trying. I strongly recommend everyone test it out!

# C:\ProgramData\Microsoft\WSL\.wslgconfig
[system-distro-env]
WESTON_RDP_HI_DPI_SCALING=true
WESTON_RDP_FRACTIONAL_HI_DPI_SCALING_ROUNDUP=true

The setting is implemented in microsoft/weston-mirror : compositor/main.c#L2858-L2864
and the original WESTON_RDP_FRACTIONAL_HI_DPI_SCALING setting must be removed for roundup to take effect.

A simple comparison with xman from apt install x11-apps, rendered from a 4K monitor with 150% display scale.

the roundup option looks way better than the documented one.

with WESTON_RDP_FRACTIONAL_HI_DPI_SCALING_ROUNDUP=true (and the other two parameters removed)

Image

with WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=150 (and the other two parameters removed)

Image

with WESTON_RDP_FRACTIONAL_HI_DPI_SCALING=true (and the other two parameters removed)

Image


Edit: If some Qt applications (such as Wireshark) still have font blur issues, install the QtWayland plugin.
The packages for Kali Linux:

# for qt6 apps
sudo apt install qt6-wayland
# for qt5 applications
sudo apt install qtwayland5

@abarisain
Copy link

Amazing find, thanks!

@dinhphieu
Copy link

dinhphieu commented Feb 5, 2025

There is a hidden undocumented roundup setting WESTON_RDP_FRACTIONAL_HI_DPI_SCALING_ROUNDUP that is definitely worth trying. I strongly recommend everyone test it out!

@ttimasdf holy s***, after 4 years, this actually worked! Amazing find indeed, thanks!

google-chrome / Electron still has blurry fonts though, but at least the scaling is not all over the place anymore. This is on a 2k monitor with 150% scaling (fonts are slightly blurry if you zoom in):

Image

The google-chrome I'm using is from the docs: https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps#install-google-chrome-for-linux

UPDATE 1: fixed the font blurryness, I followed this https://www.reddit.com/r/gnome/comments/1dqjfft/comment/laog5c0.

UPDATE 2: Chrome crashes because it can't find wayland. Fix: #1032 (comment)

UPDATE 3: the mouse cursor becomes comically large though, like referenced in #1290 and #61

UPDATE 4: large mouse cursor fix with #61 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests