On 27/01/2022 03:12, Ken Whitesell wrote:
On 1/24/2022 10:02 AM, Jon Turney wrote:
On 20/01/2022 01:01, Ken Whitesell wrote:
On 1/19/2022 2:28 PM, Jon Turney wrote:
On 19/01/2022 00:02, Ken Whitesell wrote:
On 1/17/2022 1:29 PM, Ken Whitesell wrote:

Is there a known solution for this? (Or is it known that there is no solution?)

Thanks for reporting this.

Any guidance, pointers, suggestions of avenues for further research, or other information, will all be greatly appreciated.

After more research and experimentation, it appears to be related to one of xorg-server, xorg-server-common, or xorg-server-xorg.

Installing the older version 1.20.12-1 of these packages allows the windows to be moved between monitors without any issues. Upgrading to the current version 21.1.3-1 creates the problems. I'm able to replicate this behavior on two different laptops with two different external monitors.

It seems likely that this is an unintended effect of changes in xorg-server 21.1.0-1, trying to fix problems in this area (See [1])

Thanks for the references. I've read all the messages in the thread - I was particularly intrigued by this comment:

wrt the font scaling issue, looking at the source, it seems that we
don't re-consider the display dpi after a WM_DISPLAYCHANGE message, but
keep on using the value determined at startup.  This is probably a bug.

I'm curious enough to want to take a look at the code, but I've got no belief that I'm going to be able to find an answer. (I'm *not* a C++ programmer. I can read it and write a little of it, but that's about it.) I was going to start by comparing the last known-working version to the first known-non-working version, but given that it's a major release change, that's not likely going to be a useful approach. (I'm way out of my league here. It's probably going to take me a long time just to get to the point where I can even begin to explore this.)

The relevant change, which tries to fix the issue identified in that comment, and probably introduces this issue is:

https://gitlab.freedesktop.org/jturney/xserver/-/commit/b19b6266d33f2b911dc1826ad5c03da135a39957

[...]
[...]

But, the real reason for my reply at this point is to report that I have found a solution for _my_ issue.

I make no guarantees about any problems anyone else may be facing, nor can I make any statement about whether or not this causes other problems.

Obligatory disclaimer: I don't really know what I'm doing here. I'm not a Windows developer, and I know just enough about cygwin to muddle my way through doing what I want to do with the help of the mailing lists and other resources. I'm not in a position to _explain_ anything. This works for me, but that's as far as I can go.

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)


--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to