Bug 477676 - Fractional scaling below 100% breaks Chromium/Electron apps running in native Wayland mode
Summary: Fractional scaling below 100% breaks Chromium/Electron apps running in native...
Status: RESOLVED DOWNSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 6.0.2
Platform: Other Linux
: NOR major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-28 14:21 UTC by ryu.ketsueki
Modified: 2024-04-04 21:15 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Bug demonstrated using Chromium in native wayland (692.39 KB, image/png)
2023-11-28 14:21 UTC, ryu.ketsueki
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ryu.ketsueki 2023-11-28 14:21:52 UTC
Created attachment 163572 [details]
Bug demonstrated using Chromium in native wayland

I'm marking this as a major bug because it may be considered as a wayland showstopper. But it is also related to a previous bug I reported about Spectacle, which has a similar effect.

I am running KDE Plasma 5.27 on a laptop with max resolution being 1366x768. This is important to understand how to reproduce this bug. I scaled down to 70% in order to have the whole UI and windows on a good size for this resolution, or else everything looks too big. I am yet to see a Low DPI/Low Resolution setting.

Previously I reported a bug about how this messes up Spectacle when in the rectacle selection mode, making the static background shrink and stick to the top left of the screen. At first I thought it was only a Spectacle issue but after seeing a similar effect happening with chromium/electron windows also running in native Wayland, such as Chromium, Visual Studio Code, Opera and others, it appears the issue is not on Spectacle side but Wayland scaling side.

I could not test this with scaling up, like to 125%, only when scaling down to 70%. It may have a similar effect but I could not verify it. But I am attaching a screenshot demonstrating the issue. There are apps that don't have this issue, like Discord, likely because of the outdated electron version. But newer electron versions all seem to have this issue.

So when these windows are running in native wayland mode, the scaling is wrong, with them appearing much smaller than they should, and the window is also cropped, even when maximized.

STEPS TO REPRODUCE
1.  Set wayland fractional scaling below 100%, like to 75%
2.  Open any chromium/electron application in native wayland with the flags --enable-features=UseOzonePlatform --ozone-platform=wayland

OBSERVED RESULT
See attached screenshot for better understanding. Basically, the window is not correctly rendered, even when maximized, messing up the scaling of hte window and the cropping is also wrong.

EXPECTED RESULT
Scaling to be correct and no cropping.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20231022
KDE Plasma Version: 5.27.9
KDE Frameworks Version: 5.111.0
Qt Version: 5.15.11
Kernel Version: 6.5.8-1-default (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i3-7020U CPU @ 2.30GHz
Memory: 11.5 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 620
Manufacturer: LENOVO
Product Name: 81FE
System Version: Lenovo ideapad 330-15IKB

ADDITIONAL INFORMATION
I prefer to run applications in native wayland whenever I'm given the option for the boost of speed. XWayland is often very sluggish with me.
Comment 1 Nate Graham 2023-11-30 22:23:46 UTC
`chromium --enable-features=UseOzonePlatform --ozone-platform=wayland` seems to do the right thing at 70% scale on Wayland in Plasma 6; I guess it's already been fixed!
Comment 2 ryu.ketsueki 2023-12-02 17:59:14 UTC
(In reply to Nate Graham from comment #1)
> `chromium --enable-features=UseOzonePlatform --ozone-platform=wayland` seems
> to do the right thing at 70% scale on Wayland in Plasma 6; I guess it's
> already been fixed!

Then I have even more reasons to love Plasma 6 when it comes! Loving the new feautres so far.
Comment 3 ryu.ketsueki 2024-03-30 19:50:27 UTC
I'm sorry but this issue still persists. I have recorded a quick video showing the issue in case it was not clear before:

https://youtu.be/U-poT2q7AmY

It is still happening for me but on Plasma 6.0.2, fractional scaling on 65%.
Comment 4 Nate Graham 2024-04-01 15:34:59 UTC
Can reproduce again in Plasma 6, yeah.
Comment 5 almaplatass 2024-04-03 10:51:20 UTC
Can confirm it still happens in Plasma 6. Electron windows will render and behave wrong when placed on any screen with a scale under 100%.
If using 
> --force-device-scale-factor=1.0
with any given value, the actual border of the window will be different than the one seen, even at monitor scales above 100%, so that's neither an option.

Strangely though, until a few days ago it was behaving correctly, i don't know what exactly has been updated in the last week (I'm on Arch), but it has to be what causes this again.
Comment 6 David Edmundson 2024-04-04 21:15:08 UTC
Please report this to Chromium developers, there's nothing we can do our side. Sorry