public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: Ken Whitesell <KenWhitesell@comcast.net>,
	The Cygwin Mailing List <cygwin@cygwin.com>
Subject: Re: Cygwin/X with Win10 display scaling corrupting font display of typed characters - Issue identified - "Solution" found
Date: Sun, 14 Aug 2022 12:08:25 +0100	[thread overview]
Message-ID: <efaf327a-1fcb-e269-d7a4-74409c16b04b@dronecode.org.uk> (raw)
In-Reply-To: <b5d8769c-cf7c-e654-83c0-b7f375e5f64b@dronecode.org.uk>

On 05/02/2022 14:25, Jon Turney wrote:
> On 27/01/2022 03:12, Ken Whitesell wrote:
>> First, the bottom line:
>>
>> XWin.exe.manifest, line 21
>>
>> change:
>> <dpiAwareness>PerMonitorV2,PerMonitor</dpiAwareness>
>> to
>> <dpiAwareness>PerMonitor</dpiAwareness>
>>
>> Some details:
>>
>> I managed to get to a point where I could build the packages from 
>> source and install them. I looked at the commit you referred me to, 
>> and started reverting changes, one-by-one - at least in so far as the 
>> change appeared to make sense to me.
>>
>> Anyway, I got to this change, and sure enough, it worked. Removing the 
>> "PerMonitorV2" solved the issue. Also, I confirmed that it's the 
>> "PerMonitorV2" that is causing the issue and not having both of them 
>> by running another test with just the "PerMonitorV2" - and that still 
>> shows the problem.
> 
> Thanks for taking the time to narrow this down.  It's been very helpful.
> 
> Working through the documented effects of that [1], I was able to work 
> out that this mis-rendering is due to the non-client area scaling.
> 
> [1] See under DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 in
> https://docs.microsoft.com/en-us/windows/win32/hidpi/dpi-awareness-context
> 
> If you turn off 'Hide Root Window' from the tray menu, you can kind of 
> see what's going wrong: normally the client area of the X window is 
> exactly aligned with that in the root window, but when the non-client 
> area is rescaled by a DPI change (the title bar changes size 
> significantly), it's misaligned so that part of the X window is outside 
> the client area (and thus clipped in updates).
> 
> I think this is due to the AdjustWindowsRectEx() function not being DPI 
> aware (I guess it's always computing the non-client window rect based on 
> the processes initial DPI)
> 
> Unfortunately, from an initial look, rewriting things to use 
> AdjustWindowRectExForDpi() isn't trivial (since we need to make 'DPI of 
> the monitor this Window is going to end up on' available to it)
> 
> So for the moment, I think I'll apply your reversion (although this 
> probably comes at the cost of not scaling the window frame, the traymenu 
> and About... dialog)

I made this change in xserver 21.1.4-1.

Thanks again for tracking this down.

      reply	other threads:[~2022-08-14 11:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-17 18:29 Cygwin/X with Win10 display scaling corrupting font display of typed characters Ken Whitesell
2022-01-19  0:02 ` Cygwin/X with Win10 display scaling corrupting font display of typed characters - Issue identified Ken Whitesell
2022-01-19 19:28   ` Jon Turney
2022-01-20  1:01     ` Ken Whitesell
2022-01-21 18:26       ` Cygwin/X with Win[10]-^ display scaling corrupting font display of typed characters - Issue [identified]-???? L A Walsh
2022-01-23 20:25         ` Cygwin/X display scaling corrupting font display of typed characters; L A Walsh
2022-01-24 15:02       ` Cygwin/X with Win10 display scaling corrupting font display of typed characters - Issue identified Jon Turney
2022-01-27  3:12         ` Cygwin/X with Win10 display scaling corrupting font display of typed characters - Issue identified - "Solution" found Ken Whitesell
2022-02-05 14:25           ` Jon Turney
2022-08-14 11:08             ` Jon Turney [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=efaf327a-1fcb-e269-d7a4-74409c16b04b@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=KenWhitesell@comcast.net \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).