V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
sky96111
V2EX  ›  Linux

Gnome 是如何在 Xwayland 不支持缩放的情况下实现缩放的?

  •  
  •   sky96111 · 2021-11-09 16:46:19 +08:00 · 4158 次点击
    这是一个创建于 870 天前的主题,其中的信息可能已经有所发展或是发生改变。
    从 Gnome 迁移到 KDE ,目前最大的问题是,KDE 下没有 Wayland 原生支持的应用在高分屏下不能缩放,只能比例放大导致模糊。而 Gnome40 开始已经对 wayland 支持非常优秀了,即使是通过 Xwayland 运行的应用,Gnome 也能正确缩放不模糊
    https://forum.kde.org/viewtopic.php?f=289&t=170776

    但是查资料发现 Xwayland 的高分屏缩放方案还在讨论阶段,在修复之前通过 Xwayland 运行的应用都会模糊。那 Gnome 是如何处理这个问题的呢? Reddit 上只找到一条没有实际意义的回答
    https://www.reddit.com/r/swaywm/comments/n1vhzi/how_come_hidpi_scaling_works_fine_in_gnome_but/

    没有能力阅读 Gnome 的源码,想问一下有没有知道原因的 V 友?
    9 条回复    2021-11-09 21:18:00 +08:00
    zjsxwc
        1
    zjsxwc  
       2021-11-09 16:59:26 +08:00
    这个
    https://wiki.archlinux.org/title/HiDPI#Wayland
    不是说 gnome 下老 gtk 程序也会缩放模糊吗?
    >Note: Enabling fractional scaling can result in blur for legacy applications using XWayland, even if only integer scales are used, because the rendering method changes.
    sky96111
        2
    sky96111  
    OP
       2021-11-09 17:52:48 +08:00
    @zjsxwc 不太能理解这个问题和分数缩放有什么联系...只是因为 KDE 默认启用了分数缩放吗?
    Austaras
        3
    Austaras  
       2021-11-09 18:01:32 +08:00
    并不能,Gnome 在 XWayland 下分数缩放依然会糊
    sky96111
        4
    sky96111  
    OP
       2021-11-09 18:09:05 +08:00 via Android
    @Austaras 这确实,但是关闭分数缩放是正常的,KDE 即使整数缩放也糊
    riotdandy
        5
    riotdandy  
       2021-11-09 18:42:35 +08:00
    lz 是多个显示器吗?
    sky96111
        6
    sky96111  
    OP
       2021-11-09 20:09:35 +08:00 via Android
    @riotdandy 不是,是单 4K 显示器
    imlk
        7
    imlk  
       2021-11-09 20:50:01 +08:00   ❤️ 1
    @sky96111 前几天刚试过,GNOME 40.0 ,双显示器,非整数缩放,因为两个显示器的缩放不同,所以用的 wayland ,现在的状态是:

    qt 程序默认 xwayland ,是糊的。QT_QPA_PLATFORM=wayland 开 native wayland 后不糊,但是主题变得不统一,鼠标指针被截断。
    gtk3/4 默认 native wayland ,不糊; gtk2 用的 xwayland ,糊

    另外 chrome/electron APP 似乎也是 xwayland ,用 ozone 能开 wayland ,但是 gnome 上对 fcitx5 的支持还有问题,无法调出 IME 。似乎正在修复 https://bugs.chromium.org/p/chromium/issues/detail?id=1183262&q=ime%20wayland&can=2

    125%缩放的屏幕上:
    konsole (qt/xwayland)和 gnome-terminal (gtk4/native wayland) 的对比: https://i.loli.net/2021/11/09/TXmkiqlanDLUzuB.png

    gtk2/3/4 demo 程序的比较:
    https://i.loli.net/2021/11/09/8xLydpacRbHnm7Q.png
    yanqiyu
        8
    yanqiyu  
       2021-11-09 20:56:08 +08:00   ❤️ 1
    https://www.csslayer.info/wordpress/linux/linux-hidpi-configuration/
    想要清晰的缩放只有程序来支持内部缩放,KDE 即使整数缩放也糊说明可能在可以交给程序缩放的地方 KDE 用了修改分辨率的土办法
    riotdandy
        9
    riotdandy  
       2021-11-09 21:18:00 +08:00   ❤️ 1
    @imlk

    > gtk2 用的 xwayland ,糊

    这个是因为多个显示器并且因为设置 DPI 不同:
    https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/733

    electorn wayland 的问题还差这个: https://github.com/electron/electron/pull/29618
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1002 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 22:19 · PVG 06:19 · LAX 15:19 · JFK 18:19
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.