-
Notifications
You must be signed in to change notification settings - Fork 909
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
Allow changing X11 DPI at runtime #1228
Comments
Looks related to #1377 From testing with alacritty, I can't seem to invoke any At least in X11, I'm leveraging the |
I spent some time digging into this. I managed to cobble together something that works, but is definitely sub-optimal. This is the first Rust I've ever "written" so even getting this to work was a challenge. It uses the existing code to reload monitors and trigger |
I'm interested in working on this, but I have no familiarity with winit code. Could someone on the winit team give me a high-level explanation of what's unacceptable about the above patch so I can start hacking on it? |
Bump? Anyone able to help out with this patch? I've been using frebib@74d5070 for the last 2 years with zero issues, although it seems to stop working after c916eb6 |
Any reason why frebib's patch is not merged? |
It would probably help if they (or someone else) opened a pull request with the patch, it's a bit cumbersome to discuss an implementation otherwise |
This change allows X11 windows to receive ScaleFactorChanged events when using Xft.dpi via the root window PropertyChange event. Subscribe to PropertyChange events on the root window, and reload all available monitors when an XA_RESOURCE_MANAGER change is received. This is a very heavy handed approach to this problem, but it was the least intrustive way I could find to make it work with my limited skill. Load XResources directly via XGetTextProperty on every get_xft_dpi call as XResourceManagerString returns stale cached data and does not reload for the lifetime of the window (?) Fixes: rust-windowing#1228 Signed-off-by: Joe Groocock <me@frebib.net>
This change allows X11 windows to receive ScaleFactorChanged events when using Xft.dpi via the root window PropertyChange event. Subscribe to PropertyChange events on the root window, and reload all available monitors when an XA_RESOURCE_MANAGER change is received. This is a very heavy handed approach to this problem, but it was the least intrustive way I could find to make it work with my limited skill. Load XResources directly via XGetTextProperty on every get_xft_dpi call as XResourceManagerString returns stale cached data and does not reload for the lifetime of the window (?) Fixes: rust-windowing#1228 Signed-off-by: Joe Groocock <me@frebib.net>
This change allows X11 windows to receive ScaleFactorChanged events when using Xft.dpi via the root window PropertyChange event. Subscribe to PropertyChange events on the root window, and reload all available monitors when an XA_RESOURCE_MANAGER change is received. This is a very heavy handed approach to this problem, but it was the least intrustive way I could find to make it work with my limited skill. Load XResources directly via XGetTextProperty on every get_xft_dpi call as XResourceManagerString returns stale cached data and does not reload for the lifetime of the window (?) Fixes: rust-windowing#1228 Signed-off-by: Joe Groocock <me@frebib.net>
This change allows X11 windows to receive ScaleFactorChanged events when using Xft.dpi via the root window PropertyChange event. Subscribe to PropertyChange events on the root window, and reload all available monitors when an XA_RESOURCE_MANAGER change is received. This is a very heavy handed approach to this problem, but it was the least intrustive way I could find to make it work with my limited skill. Load XResources directly via XGetTextProperty on every get_xft_dpi call as XResourceManagerString returns stale cached data and does not reload for the lifetime of the window (?) Fixes: rust-windowing#1228 Signed-off-by: Joe Groocock <me@frebib.net>
This change allows X11 windows to receive ScaleFactorChanged events when using Xft.dpi via the root window PropertyChange event. Subscribe to PropertyChange events on the root window, and reload all available monitors when an XA_RESOURCE_MANAGER change is received. This is a very heavy handed approach to this problem, but it was the least intrustive way I could find to make it work with my limited skill. Load XResources directly via XGetTextProperty on every get_xft_dpi call as XResourceManagerString returns stale cached data and does not reload for the lifetime of the window (?) Fixes: rust-windowing#1228 Signed-off-by: Joe Groocock <me@frebib.net>
This change allows X11 windows to receive ScaleFactorChanged events when using Xft.dpi via the root window PropertyChange event. Subscribe to PropertyChange events on the root window, and reload all available monitors when an XA_RESOURCE_MANAGER change is received. This is a very heavy handed approach to this problem, but it was the least intrustive way I could find to make it work with my limited skill. Load XResources directly via XGetTextProperty on every get_xft_dpi call as XResourceManagerString returns stale cached data and does not reload for the lifetime of the window (?) Fixes: rust-windowing#1228 Signed-off-by: Joe Groocock <me@frebib.net>
Signed-off-by: John Nunley <dev@notgull.net> Fixes #1228.
Signed-off-by: John Nunley <dev@notgull.net> Fixes rust-windowing#1228.
Signed-off-by: John Nunley <dev@notgull.net> Fixes #1228.
This is closed, but at least in Alacritty it doesn't work. Whilst this listens for the correct events, it doesn't actually read the new DPI value, so it still doesn't change scale |
CC @notgull? |
It looks like that it's still re-reading the |
In my hacky original patch, the code reread the X11 resources from X frebib@fb56303#diff-c2d9fcab6774ee66ce076daadd1d1d1a376066dfcc6ab6584e0925c9fe61ca47R55 I shamelessly stole this from dunst. I don't know anything about X11 but I doubt this is the only approach to fix this problem. I would guess the issue with the current implementation is that it doesn't read the updated xft.dpi value from xresources because the application has the xresources from when the window was opened. |
Good catch! I'll file a patch to fix that |
Closes #1228 Signed-off-by: John Nunley <dev@notgull.net>
For the record, this is still not working for me on Alacritty 0.13.1, as already described by @frebib here: #3309 (comment). @notgull @kchibisov, can we (re)-reopen this issue? |
Apparently we are missing some DPI update because the DPI is still not begin updated. See #1228 for details. Therefore, it's best to just reload the DPI every time we need it. Signed-off-by: John Nunley <dev@notgull.net>
This should be fixed as of #3423, unless Qt/KDE has a way of updating DPI that I don't know about. |
Huh, seems like Qt5 uses So I think our bases should be covered, at least for platforms that aren't super weird. |
This has been reported to Alacritty in alacritty/alacritty#2886.
It seems like currently winit does not allow to modify the DPI at runtime, which I can definitely see as desirable for some users. In Alacritty it would be possible to just change the font size, but I feel like it would still be worth it to just change one thing and the whole system properly rescales.
The text was updated successfully, but these errors were encountered: