Repository navigation
fix(xsettings): keep fractional DPI in Gdk/UnscaledDPI #1436
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
Open
LFRon
wants to merge
1
commit into
linuxdeepin:master
Choose a base branch
from
LFRon:fix/xwayland-scale
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+10
−2
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gdk_UnscaledDPI不就是96x1024吗?我没看懂你这个改动的作用
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GNOME 的约定确实如此(我抓了 gsd 源码,
plugins/xsettings/gsd-xsettings-manager.c:670-673):treeland 的
ac2b0abcc就是照这个抄的。但这个约定成立有个前提:合成器自己把 X11 表面整体放大(mutter 的 framebuffer scaling)——分数部分由合成器渲染时放大(略糊),XSETTINGS 只需要表达"整数窗口缩放"。而 treeland/wlroots 没有这个能力:vendored wlroots 的
xwayland/里没有任何 scale 处理、公开头文件无 scale API、waylib 也不缩放 X11 表面(都已 grep 确认)。本机实测也印证:打了补丁后 X11 客户端恰好是 1.25×,如果是"合成器 1.25 + 提示 1.25"会变成 1.5625×。所以在 treeland 上分数缩放只能靠客户端 DPI 提示表达,而 GDK/GTK 的取值顺序是"有
Gdk/UnscaledDPI就优先用它当 DPI"(实测:live 上UnscaledDPI=98304 + Xft/DPI=122880→gtk-xft-dpi=98304;Xvfb 上把 UnscaledDPI 去掉 → 122880),Gdk/WindowScalingFactor只承载整数部分。于是固定 96×1024 会把 0.25 直接丢掉:补丁的策略因此是:整数档完全遵循 GNOME 约定(100% → 98304;200% → 98304 + WSF=2;实测若删掉 UnscaledDPI,GDK 会拿
Xft/DPI=196608当分辨率再乘 WSF=2 → 4.0× 双重放大,所以不能简单删键);只有分数档把分数因子折进Gdk/UnscaledDPI(= 有效 DPI ÷ 整数窗口缩放,125% → 122880)。这正是 treeland 在ac2b0abcc之前的原行为(scale × 98304)——是那个提交把分数档一起改成固定基值才引入了差异。