The server's idea of the cursor position is never really initialized. Normally that's not a problem, since the first mouse movement and a number of other X events will update it. But in the case where the user never moves the mouse, it can remain out of sync. That manifests as `GetCursorPos` bouncing between the server's incorrect value and the real one from the user driver, depending on the age of the position on the server.
I've marked this as a draft for two reasons:
1. I don't quite know where this belongs. We want to do it early in the lifespan of a user driver but after there's a desktop, so I've put it behind a `pthread_once` called from `get_desktop_window`.
2. I'm calling `NtUserSetCursorPos` to update the server, rather than a direct `set_cursor` request, because it contains some DPI logic. That has the side effect of potentially warping the cursor. That's not desirable or necessary, but it shouldn't be a problem. It's easily factored around if we want to avoid it.
Any guidance would be greatly appreciated!
--
v2: win32u: Initialize the server's cursor position from the user driver's.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1250
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53741
--
v2: ntdll: Implement RtlSetUserFlagsHeap.
ntdll: Check block user flags in RtlGetUserInfoHeap.
ntdll: Check block user flags in RtlSetUserValueHeap.
ntdll: Store the user flags in the heap block flags.
ntdll: Introduce a new heap block_set_flags helper.
kernel32/tests: Test (Global|Local)Handle with heap allocated pointers.
kernel32/tests: Test more Global/Local functions with invalid pointers.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1312
Performance hit measured on a few games (with esync and wined3d), CPU% is the time spent in the syscall dispatcher as measured with `perf top -K` while the game is running, the measured scene is usually right after starting a new game:
* Brink (32-bit, GL, id Tech 4): 550 fps, 3% CPU -> 480 fps, 12% CPU
* Shadow Warrior 2 (64-bit, d3d11): 75 fps, 2% CPU -> 50 fps, 20% CPU
* Hat in Time (64-bit, d3d9, UE3): 220 fps, 5% CPU -> 215 fps, 10% CPU
* Control (64-bit, d3d11): 25 fps, 0% CPU -> 25 fps, 3% CPU
* Obduction (64-bit, d3d11, UE4): 85 fps, 30% CPU -> 80 fps, 30% CPU
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1322