自动继承 QT_SCALE_FACTOR 以修复 Wayland 下 JavaFX 分数缩放问题#6078
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f86eda904
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Bridge QT_SCALE_FACTOR to JavaFX's GTK UI scale when available. | ||
| if [ "$_HMCL_OS" = "linux" ] && [ "$XDG_SESSION_TYPE" = "wayland" ]; then | ||
| if [ -n "$QT_SCALE_FACTOR" ]; then | ||
| _HMCL_VM_OPTIONS="$_HMCL_VM_OPTIONS -Dglass.gtk.uiScale=$QT_SCALE_FACTOR" |
There was a problem hiding this comment.
Validate QT_SCALE_FACTOR before passing to JavaFX
This forwards QT_SCALE_FACTOR verbatim into -Dglass.gtk.uiScale, but Qt allows non-scalar formats (for example semicolon-separated per-screen values), while JavaFX expects a single scale token; in those environments the launcher will pass an invalid JavaFX scale value and scaling falls back or behaves incorrectly. Adding a format check (or extracting a single numeric factor) before appending the JVM flag would avoid regressions for users with multi-screen Qt scaling configs.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch, thanks.
Qt scaling-related environment variables may indeed contain non-scalar values in some multi-monitor configurations.
I'll add a simple numeric format check before forwarding the value to JavaFX to avoid passing invalid scale factors.
|
#6071 已经在做了。而且这也不应该改 |
fix:#6070
修改内容
在 Linux Wayland 环境下,自动继承
QT_SCALE_FACTOR,并通过:传递给 JavaFX,用于修复 KDE Plasma 分数缩放环境下 HMCL 界面过小的问题。
同时保留原有逻辑:
HMCL_JAVA_OPTS时仍完全覆盖默认参数问题背景
在 KDE Plasma Wayland 环境下启用分数缩放(如 150%、170%)时,HMCL 界面会明显过小。
测试环境:
进一步测试发现:
170% 缩放:界面过小
200% 缩放:显示正常
手动添加:
HMCL_JAVA_OPTS="-Dglass.gtk.uiScale=1.7"后恢复正常
说明 JavaFX 本身支持该缩放,但默认未正确继承 KDE Wayland 的 fractional scaling。
修改后的行为
默认情况下:
Wayland 环境下自动读取
QT_SCALE_FACTOR自动追加:
用户仍可通过:
完全覆盖默认 JVM 参数。