goneovim
goneovim copied to clipboard
per-monitor dpi awareness on windows
Hi! This is just a feature request to support dragging goneovim between monitors with different dpi. I have one monitor with 1440p resolution, and the other one with 2160p. When I drag the program from the first to the second one, it becomes blurry as if hidpi wasn't supported at all. neovim-qt works well though. Most likely, goneovim isn't aware about a dpi change because it doesn't use per-monitor v2 awareness mode: https://docs.microsoft.com/en-us/windows/win32/hidpi/dpi-awareness-context
@valignatev hi, Thanks for this report.
Just to confirm, do the following settings change the behavior of this issue?
# Put the following in setting
Cacheddrawing = false
If you are using Windows, place the setting in the following location:
~\.goneovim\settings.toml
no, this setting doesn't affect anything. This is 90% per-monitor dpi awareness issue, because the scaling works if you initially launch goneovim on the second monitor. So the only issue is detecting the dpi change upon dragging over the monitor boundary
@valignatev Thanks for the confirmation!
I've created a trial fix for this issue. Could you please check the reproducibility of the issue with the binary generated by CI as follows? (I do not have different DPI displays and it is difficult to check right away...)
https://github.com/akiyosi/goneovim/actions/runs/1796089670
Hey, thanks for getting onto it! I've tried the job artifact, and now it's not blurry anymore, but the ui doesn't scale properly - so if you launch the program on a hidpi monitor, or if you drag it there everything is very small, because there's no scaling apparently. An expected behavior is that upon launching/dragging the editor to the monitor with different dpi (whether it's higher or lower) there's some mechanism in place that scales all of the UI in a way that it appears to be the desired size and isn't blurry at the same time.
Unfortunately, I don't know how to do that in Qt and how it wraps windows apis, so can't help much. A documentation on QT_AUTO_SCREEN_SCALE_FACTOR says something about point-sized fonts not being scaled, but I'm not sure if it's related or not
@valignatev Thanks for confirming. Hmm, I see that this problem does not occur with Neovim-qt, and I referred to the following code for Neovim-qt, but I may still be missing something.
https://github.com/equalsraf/neovim-qt/blob/3aba40f016f906c2c8ded59cbaf5abacc343d660/src/gui/main.cpp#L21-L32
I will continue to investigate, but I fixed it to also enable Qt::AA_EnableHighDpiScaling as a test. If you have time again, I would appreciate it if you could check if you can reproduce the issue.
https://github.com/akiyosi/goneovim/actions/runs/1806647852
This introduced blurry scaling again
@valignatev Thank you. By the way, in the above test artifact, does the behavior change depending on whether the following goneovim config setting is enabled or disabled?
# Put the following in ~\.goneovim\settings.toml
[Editor]
Cacheddrawing = false
The reason I am concerned about this setting is that when it is enabled, Goneovim stores images internally as a cache of drawn text. I was wondering if images have anything to do with dpi awareness.
Oh I had it set to false
all the way through
@valignatev Hmmm, I have tried to reproduce this problem on 96 and 144 DPI monitors respectively, but could not reproduce it successfully. Maybe there is some additional factor...? I will continue to investigate.
Just to be clear, it works well if you just open the editor on a monitor. The problems start when I try to drag the editor between the two.
I thought I understood that, and in fact I was trying to reproduce the problem by dragging the goneovim editor started in one to the other. However, the display did not appear to be blurred.
By the way, Neovim-qt has reported a similar problem before. Am I correct in understanding that it looks similar to the screenshot as posted in this problem report?
https://github.com/equalsraf/neovim-qt/issues/391
no, not quite. In that neovim-qt issue, the letters got scaled properly, but the spacing got screwed. In goneovim's case, the scaling seemed to just do bitmap stretching resulting in blur. Here you can see goneovim and neovim-qt opened side by side after dragging them from 96 to 200+ dpi monitor:
I hope the difference in how sharp the the font is is noticeable on the picture
And here's how goneovim looks if I open it on the hidpi monitor directly, without dragging it:
Thanks for the screenshots! It's very helpful. Is there any change in the behavior of the following CI artifacts?
https://github.com/akiyosi/goneovim/actions/runs/1809691548
Just tried this exe, now it doesn't scale on hidpi monitor again, and everyting is very small