xwayland: support HiDPI scale
Describe your PR, what does it fix/add?
This supports the xorg-xwayland patch at https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/733
Ported from https://gitlab.freedesktop.org/lilydjwg/wlroots/-/commit/5a7c65cab11c9f3c3dc79f9c4cfb8a6acf6cbaae
See #6281 for motivation.
AUR package hyprland-hidpi-xprop-git applies this patch on top of hyprland mainline. After installing, do the following to enable (scaling factor 2 in this example):
- Add
exec-once = systemctl --user start xsettingsd.service && echo "Xft.dpi: 192" | xrdb -merge && xprop -root -format _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2to hyprland configuration. - Add the following to
~/.config/xsettingsd/xsettingsd.confGdk/UnscaledDPI 98304 Gdk/WindowScalingFactor 2 - Remove
GDK_SCALE,QT_SCALE_FACTOR, and other per-application scaling options.
Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)
N/A
Is it ready for merging, or does it need work?
No, for cherry-pick only
what advantages does this have over force_zero_scaling?
what advantages does this have over force_zero_scaling?
Quoting from my description in #6281:
The official Xwayland scaling solution
xwayland:force_zero_scalingdoes not support multi-monitor with different scale factors. Specifically, when having two monitors of scale factors 2 and 1, Xwayland apps look good on the one of scale factor 2, but 2x larger on the one of scale factor 1.
What is required to get this into a state where it can be merged? I would love to see this feature merged into Hyprland.
It's broken on latest Hyprland. XWayland appliacations squeezed to left top cornor of their window frame.
It's broken on latest Hyprland. XWayland appliacations squeezed to left top cornor of their window frame.
I'm on vacation and don't have a hyprland device on hand to investigate the fix.
It's broken on latest Hyprland. XWayland appliacations squeezed to left top cornor of their window frame.
I'm on vacation and don't have a hyprland device on hand to investigate the fix.
fixed
Thank you for your work. I noticed that this PR has caused issue #5561 to reappear. Would you mind also taking a look at this issue?
Thank you for your work. I noticed that this PR has caused issue #5561 to reappear. Would you mind also taking a look at this issue?
does this work for you? patch.txt
It works! Thank you!
The cursor is a little odd on Sober (roblox thingy for linux, it's a flatpak) I only experience this issue ingame and not in the game browser menus or guis
xwayland windows have cursors size smaller than when on wayland but not tiny as 24 pixel on a unscaled 4k screen.
~~Font cracking and the mouse input was in a wrong position. I pick your commit base on the last Hyprland.~~
~~EDIT: same problem with your repo builds~~
Fixed. I was not add the patched xwayland package into the system. And the nixpkgs seems to have some bug in overriding pkgs. ~~But the font is still cracking.~~
Fixed again with xwayland:use_nearest_neighbor = false
xwayland windows have cursors size smaller than when on wayland but not tiny as 24 pixel on a unscaled 4k screen.
fixed by installed hyprcursor and set xcursor env correctly.
After applying the 86a7f12 patch to Hyprland 0.52.0, the XWayland application menu positions are all messed up. It worked fine with the previous patch in version 0.51.1. Did I apply something incorrectly?
@xskj4 fixed, thanks for reporting!
@moetayuko Thank you very much for the fix and update, but there's still one question I’d like to ask. Why do I need to set the xcursor to twice the size of hyprcursor in order to get the same cursor size? For example, env = HYPRCURSOR_SIZE,24 and env = XCURSOR_SIZE,48?
@moetayuko Thank you very much for the fix and update, but there's still one question I’d like to ask. Why do I need to set the xcursor to twice the size of hyprcursor in order to get the same cursor size? For example, env = HYPRCURSOR_SIZE,24 and env = XCURSOR_SIZE,48?
In most cases, the cursor is rendered by the xwayland apps instead of hyprland, and they are not aware of the scaling. However, the size is correct in Qt apps that support client-side cursor rendering.