issue with DPI awareness

Kimball Thurston kdt3rd at gmail.com
Sat Dec 29 23:43:14 CST 2018


All -

I'm attempting to fix my own bug report (
https://bugs.winehq.org/show_bug.cgi?id=45917), but need someone who knows
this code better to comment. If one sets the process-level DPI awareness to
unaware (DPI_AWARENESS_UNAWARE) (which is what battle.net does), then the
mouse selection (at least) ends up not working, resulting in a scaled /
shifted mouse selection (when you click on something, an item up and to the
left will be selected based on the distance from top left, and scale of
dpi) - it's easiest to see if the window is exactly in the upper left
corner of the screen.

An easy way to see this is set your HCU\Control Panel\Desktop\LogPixels to
161 (the dpi of my 4k monitor), I also have my windows version at 10, then
add

SetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT_UNAWARE );

as the first line of WinMain for something (I am using
programs/regedit/main.c because I know it has child windows, although I
don't believe that is the issue currently, but started w/ that idea). I
presume the same would happen if the dpi awareness were in the app manifest.

When I look at the coordinates of the mouse as they flow through
process_mouse_message in dlls/user32/message.c, the WINPOS_WindowFromPoint
calls find an hwnd, and then the modification point_phys_to_win_dpi seems
plausible. However, the hittest value from WindowFromPoint does not work
(returns HTNOWHERE when it shouldn't). And then the ScreenToClient that
happens when the mouse is in the client area overly shifts the mouse
position before it is put into the lParam of the event. A common theme of
both the hittest and the ScreenToClient is the client_rect. Printing out
the values, it appears like the client_rect is in monitor_dpi instead of
window dpi, at least for the application top level window, or there's a
disconnect because there's a boundary where the desktop window is in
per_monitor, but the app is in unaware.

At this point, if someone could take a look, and advise me whether the
various window rects should be in monitor dpi or in window dpi, then I can
try to track down what needs to change where to make that work, unless by
reading the above it's obvious to someone who knows this code better than
I? I don't have a windows machine to run tests on to validate, but am happy
to try to help write the code if someone can suggest a good type of
conformance test.

thank you in advance,
Kimball
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20181230/8bc222ac/attachment.html>


More information about the wine-devel mailing list