Fixes Indiana Jones and the Great Circle showing system mouse cursor along with its own one after alt-tabbing out and in.
The game hides the cursor and sets up rawinput w/RIDEV_NOLEGACY in WM_ACTIVATE handling. Then, whenever it receives WM_SETCURSORPOS it shows the cursor back. WM_SETCURSORPOS is triggered by WM_MOUSEMOVE in DefWIndowProc; WM_MOUSEMOVE is not queued with rawinput/RIDEV_NOLEGACY but prior hardware messages and system messages from set_cursor_pos are present in the queue.
That's not the case on Windows. That corresponds to the fact that Windows generates those system WM_MOUSEMOVE message "on demand", that is, when Peek or GetMessage is called (see, e. g., [1]). While Wine generates and queues those in internal messages queue in server/queue.c:set_cursor_pos(). My test confirm Windows behaviour. There are corner case specifics which my patch ignores:
- If PeekMesage( PM_NOREMOVE) got the message it will be then delivered even after setting up rawinput;
- Delivery of SendInput() under these conditions depends on MOUSEEVENTF_MOVE_NOCOALESCE flag (which we currently don't support at all); my patch just drops any hardware WM_MOUSEMOVE messages under these conditions (which corresponds to Windows behaviour without MOUSEEVENTF_MOVE_NOCOALESCE).
1. https://devblogs.microsoft.com/oldnewthing/20130523-00/?p=4273
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7321#note_94406
This fixes https://bugs.winehq.org/show_bug.cgi?id=52094.
For reference, here's how current_modref is being passed around (before this patch):
```mermaid
graph TB
fii["fixup_imports_ilonly<br><em style='color:#ff0'>(directly sets current_modref)</em>"]
fi["fixup_imports<br><em style='color:#ff0'>(directly sets current_modref)</em>"]
pa["process_attach<br><em style='color:#ff0'>(directly sets current_modref)</em>"]
ld[load_dll]
id["import_dll<br><em style='color:#0f0'>(directly uses current_modref)</em>"]
bin["build_import_name<br><em style='color:#0f0'>(directly uses current_modref)</em>"]
foe["find_ordinal_export<br><em style='color:#0f0'>(uses current_modref for relay)</em>"]
ffe["find_forwarded_export<br><em style='color:#0f0'>(directly uses current_modref)</em>"]
fne[find_named_export]
MI[MODULE_InitDLL]
fii --> ld
fi --> id
pa --> MI -.-> DllMain
id --> bin
id --> ld
id --> foe
id --> fne --> foe --> ffe --> foe
ffe --> fne
ffe --> bin
style DllMain color:red;
```
--
v10: ntdll: Remove superflous NULL check for importer.
ntdll: Properly track refcount on dynamic imports of export forwarders.
ntdll: Explicitly ignore dynamic (GetProcAddress) importers as relay/snoop user module.
ntdll: Properly track refcount on static imports of export forwarders.
ntdll: Register module dependency for export forwarders regardless of whether the dependency is already loaded.
ntdll: Don't re-add a module dependency if it already exists.
ntdll: Register module dependency for export forwarders only after successful resolution.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7