Hey Zhiyi,

I'll give these a try. Thanks! ~ this patchset being a bit older, it probably will line up a bit better with wine-7.5. hopefully, it's mostly trivial stuff to fixup, as you mention with the NtUser* bits. We shall see ;-) (and actually your current iteration isn't that far off, either).

With any luck, tomorrow I should be able to give this code a spin. I appreciate you getting back to me. Super helpful and very much appreciated.

Jordan

On Thu, Jan 5, 2023 at 11:23 PM Zhiyi Zhang <zzhang@codeweavers.com> wrote:
Hi Jordan,

Sorry, I didn't keep an older branch. I did find a older version of the patches around April 2022
that should help you to backport these commits to 7.5. I didn't try if these old patches apply cleanly
7.5 or work at all. They should be use only as reference for backporting. What you mostly need is
to replace NtUser* functions to original user32 functions. So the work shouldn't be too difficult.

Thanks,
Zhiyi

On 1/6/23 11:24, Jordan Johnston wrote:
> Hey Zhiyi,
>
> You mention having originally done this work about a year ago ~ Do you
> happen to have an older iteration of the patchwork? - I ask because
> currently, I am using a somewhat heavily modified version of Wine-7.5 (also
> it also predates the 32on64 work, and various functions being renamed. eg:
> NtUser*, props stuff, etc)... An older iteration may actually apply more
> cleanly, not require as much to do.
>
> Sticking with an older version of wine due to better performance + avoiding
> some regressions for my particular usage.
>
> The bugs sound fairly minor, and your patchwork does seem like what I"m
> probably after most likely. I'm super intrigued. -- Please let me know if
> you can dig up non-rebased (on upstream/8.0-rc2)  patchwork.. I'd be super
> eager to try that out, before trying to rebase/backport to Wine-7.5
>
> Thanks a million!
>
> Jordan
>
> On Thu, Jan 5, 2023 at 9:19 PM Zhiyi Zhang <zzhang@codeweavers.com> wrote:
>
>> Hi Jordan,
>>
>> I did work on GDI unaware scaling for HiDPI support about a year ago. The
>> idea is that
>> winex11.drv scales windows for those applications that doesn't really
>> support HiDPI
>> but the monitor is using a DPI higher than 96. Basically, winex11.drv
>> hides unscaled
>> windows and use XDamage and XRender extension to scale the content to a
>> new X window
>> that will be actually shown.
>>
>> I have a branch at
>> https://github.com/zzhiyi/wine/commits/gdi-unaware-scaling and it doesn't
>> work
>> right now because of the 32on64 work that moves some user32 function into
>> win32u.
>> Specifically, I need to fix the compilation error in
>> is_dpi_unaware_scaling_required(). But maybe
>> you can just hack it to return TRUE to make it work. You also need to set
>> DPI in winecfg to 192 for example.
>> Then things should generally work although there are some bugs need to be
>> fixed. For example,
>> launching application after wine prefix creation somehow hides the cursor.
>> And it breaks some d3d tests.
>>
>> Now that 32on64 work has quite down for winex11.drv, I think I am resume
>> this work.
>> I may revisit this and try to upstream this in the near future.
>>
>> You might want to try https://github.com/kaueraal/run_scaled as well.
>>
>> Thanks,
>> Zhiyi
>>
>> On 1/5/23 23:32, Jordan Johnston wrote:
>>> Hey all,
>>>
>>> I'm looking for some pointers on coming up with a hack to better support
>>> HiDPI with wine on my hi-res display (not something that would be
>> submitted
>>> upstream. "hack" indeed)... As you are all probably aware; while you can
>>> adjust DPI in Winecfg, that only affects Windows UI elements  ~ but It
>> does
>>> not help with anything outside of that... I have some apps that are
>>> basically unusable with HiDPI and i've tried multiple solutions, to no
>>> avail. (and setting my resolution to 1440x900 isn't a viable solution
>>> either).
>>>
>>> I've been poking around dlls/winex11.drv and I'm wondering if anyone
>> might
>>> have pointers on how some of the scale related stuff works? -- I'm
>>> wondering if it may be possible to hack the x11 code to multiply the
>> scale
>>> of the window contents? (and perhaps, I can then wrap it in an env
>> variable
>>> for use)...
>>>
>>> If anyone has any pointers, or if they think something like this could
>> work
>>> -- I'd appreciate your insights (again, I'm just looking for kind of a
>>> one-off hack, not something upstream-able.. I'm sure HiDPI
>>> compatibility-mode will land upstream, at some point (Windows has this)).
>>> While I am familiar with some of Wine's internals - the graphics stack,
>>> window management / x11 code is somewhat alien to me.
>>>
>>> Alternatively, i suppose if someone is working on related code and has a
>>> git branch / patchwork available, I'd be open to try that out too.
>>>
>>> Thanks, and Happy New Year to you all!
>>>
>>> Jordan
>>>
>>>
>>>
>>