How to fix a custom software cursor placement for high dpi monitor in PIE?

When I’m trying to use a custom software cursor (with an UMG widget), it’s placed wrong in PIE mode (either inside the editor or in a new window).
Please look for the screenshot (it’s a “Run in a new window” option, not a fullscreen).

With standalone game everything is ok.

If switch off the editor support for High DPI monitors – everything works good.

I have found several similar questions but no real solution (except an advice to set the compatibility mode for the UE4 executable).

My setup:

  • win10 64bit
  • 4k monitor
  • UE4.20.3 (though the bug is reproduced at least since 4.19.2, and I think it was always there since the high dpi option introduced).

UPDATE: just checked the new 4.21.0 preview 1 – and the bug is fixed in it!

Steps to reproduce:

  • create a new project
  • Create an UMG widget (e.g. with a single Image element)
  • open Project Settings
  • Add a custom Software Widget, choose the widget
  • run it in PIE
  • try to move the cursor to the bottom right corner

The issue is fixed in 4.21.0-Preview1.

Here is the very specific cherry-pick of the fix code, it can be applied for the 4.20.* UE4 source (didn’t checked 4.19 or older versions).