Improvements on handling DPI changed situations.

Jon Turney jon.turney@dronecode.org.uk
Sun Oct 20 15:57:08 GMT 2024


On 25/08/2024 15:55, Xun Li via Cygwin wrote:
> After commit 64f8b310 enables the setup to handle DPI changed situation (e.g. Change the zoom of current display or move the window to another display with different zoom level), here is the extra code to better handling it. It is required to make the window size not too big or too small after DPI changed.
> 
>  From c8f8291b90fb538e10bc6b2fa2ddb801da5823fd Mon Sep 17 00:00:00 2001
> From: Li Xun <lixunown@outlook.com>
> Date: Sun, 25 Aug 2024 22:44:54 +0800
> Subject: [PATCH] Handle WM_DPICHANGED
> 
> Since Per Moniter V2 DPI Awareness is declared in manifest,
> we need to handle it to make the size of window being
> correct.
> ---
>   proppage.cc | 20 ++++++++++++++++++++
>   1 file changed, 20 insertions(+)
> 
> diff --git a/proppage.cc b/proppage.cc
> index d177f2d..76ec873 100644
> --- a/proppage.cc
> +++ b/proppage.cc
> @@ -27,6 +27,11 @@
>   #include "Exception.h"
>   #include "LogFile.h"
> 
> +// Old version of Windows SDK doesn't define it.
> +#ifndef WM_DPICHANGED
> +#define WM_DPICHANGED 0x02E0
> +#endif
> +
>   bool PropertyPage::DoOnceForSheet = true;
> 
>   /*
> @@ -361,6 +366,21 @@ PropertyPage::DialogProc (UINT message, WPARAM wParam, LPARAM lParam)
>                  // similar delegation as with WM_MOUSEWHEEL
>           return OnTimerMessage (message, wParam, lParam);
> 
> +      case WM_DPICHANGED:
> +      {

Thanks! I applied this.



More information about the Cygwin mailing list