-
Notifications
You must be signed in to change notification settings - Fork 194
Add basic support for per-window DPI awareness v2, remove window flutter #774
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
Conversation
Also (and this is actually one of the reasons of the project's "no unsolicited pull requests" policy), if this were a normal issue, its discussion would be more visible among the public issues. Should this be getting more complex, let's consider to move discussion to another issue. |
Ah, the context menu and the Options dialog scale properly, finally! |
Does this affect any old Windows versions? |
@Biswa96: I've tested it on Windows 7 and Windows XP, no side effects. @v1ne: The names DPI_PROCESS_DPI_AWARE and DPI_PER_WINDOW_AWARE_V2 seem misleading to me. The previous mode (per_monitor_dpi_aware == true) was a per-monitor awareness, not per-process; also, checking https://msdn.microsoft.com/en-us/library/windows/desktop/mt791579%28v=vs.85%29.aspx, this and the new mode are both called PER_MONITOR, not per window. |
Not yet tested, but I assume the shortcut of win_fix_position is not proper; this function serves other purposes than DPI adjustment. |
Did you consider that some of the code you changed is disabled anyway? |
New integration proposal as attached, plus one "bool" -> "int" in winpriv.h |
I misinterpreted the win_fix_position patch, it only returns during the WM_DPICHANGED processing. |
This is my cleaned-up proposal to integrate DPI handling V2. |
@v1ne, last reminder to resubmit the consolidated patch I uploaded, or reveal what I should use for |
This enables the user to drag mintty from one screen to another screen with a different pixel density without any fluttering. Unfortunately, the size of the terminal (rows, cols) still changes when the pixel density changes. The suggested way to fix this properly is to handle WM_GETDPISCALEDSIZE and return the desired window dimensions. This means that we have to compute the new window dimensions in terms of the old dimensions, which requires a way to transform dim -- old dpi -> (rows, cols) -- new dpi --> dim', including the old and new size of the search and scroll bar. But this change already makes the options dialog pop up at the right size. Previously, it was always unscaled on my HiDPI screen.
Hi. Sorry for the late reply. And sorry for the unsolicited PR. I'll stick to the policy in the future, sure! I'm certain that this change fixes #695 and #696, which I experienced on a daily basis in my setup. I'm uncertain about #697. Thank you for your helpful comments! I took your zip file and put it into the single commit. Indeed, this way I don't need to change unrelated files. The benefit of using WM_GETDPISCALEDSIZE is that it allows mintty to maintain its size when the pixel density changes: Currently, if I move a 78×24 character terminal from my HiDPI to my LoDPI screen, it ends up at 81×26 characters. Without this message, it is difficult to achieve this without reintroducing the window flutter. At least from my experience of introducing HiDPI support in a major commercial application on Windows. But there, I have the advantage of not having to support HiDPI on Windows <10. ;) If there's any other change you want, please tell me. |
You had dropped the man page from the commit, I've added that. |
Thanks for merging! I don't use my name here on Github, sorry. 0:-) I tried the following scheme: Also, the size of the window decoration, search bar and maybe scroll bar have to be taken into account when calculating the window dimensions. I'd have to further look into how mintty's scroll and search bar are positioned to give this a second try. |
Released 2.9.0. |
Actually, it's just this change that causes DPI change handling to fail if the DPI of a monitor is changed, |
Can you give me a bit more context? What I referred to is that on DPI changes, the new window size is currently computed only approximately, resulting in the window losing or gaining rows and columns. |
What I saw is: change DPI of the current (or only) monitor, and the terminal size jumps e.g. from 33x80 to 26x63, then after resetting DPI back to 32x79. |
Released 2.9.4. |
See #890 about reintroducing the manifest section |
This change adds basic support for per-window DPI awareness v2, introduced with Windows 10 1703.
In the long run, this enables mintty to use WM_GETDPISCALEDSIZE to resize the window pixel-perfectly when the pixel density changes so that the terminal's size in rows×cols stays constant.
For the moment, the basic support gets rid of mintty's window flipping back and forth between different screens A↔B if I drag it from a screen A onto a screen B with a different pixel density.