@afrantzis Can't seem to be possible to add you as a reviewer, probably you need to request "Access" to the wine/wine project (near the top of the project page).
What do you think of something like that? It is very different from the current winex11 code, but I believe it will match keyboard layouts in a much more accurate way, and it's also IMO much simpler. If that works well with Wayland, I think it could be a good hint that it might work as well in X11 and make a case for my other MR to use that approach there.
I was a bit annoyed that it doesn't seem possible to retrieve the Xkb "layout:variant" string here, but only the layout description, so I had to use xkbregistry to match it back to the known layouts.
It is mostly only there to provide a more accurate HKL value (which should match the layout langid), and scan to vk mapping table, and custom layouts should still work. The lang would be neutral then, and the scan to vk table is QWERTY by default, which is the most common case, and doesn't enforce any vkey -> unicode mapping anyway. So, if the xkbregistry dependency is an issue we could probably make it optional and dynamically loaded, and skip the langid and scan to vk specialized mappings.
--
v2: winewayland.drv: Implement Xkb composition using ImeProcessKey.
winewayland.drv: Translate Xkb keyboard layouts to KBDTABLES.
win32u: Allow KBDTABLES conversion from CTLR + ALT to WCHAR.
win32u: Force US layout in ToUnicode when CTRL is pressed.
win32u: Introduce KbdLayerDescriptor user driver entry.
win32u: Avoid accessing NULL key name string pointer.
winewayland.drv: Enumerate Xkb layouts and create matching HKL.
winewayland.drv: Handle and parse Xkb keymap events.
win32u: Implement opt-in auto-repeat for WM_(SYS)KEYDOWN messages.
winewayland.drv: Configure win32u keyboard repeat delay and speed.
winewayland.drv: Basic handling of Wayland keyboard events.
gitlab: Install libxkbcommon and libxkbregistry dependencies.
https://gitlab.winehq.org/wine/wine/-/merge_requests/4102
Yeah, but this isn't necessarily about not trusting Windows apps, i.e. malice or malware, but rather that they can't be designed around it (since they assume Windows environment), so they would have privacy issues without even wanting to. At the very least maybe use `sd_id128_get_machine_app_specific` with a unique app ID for Wine? Simple and still better than nothing.
Otherwise, it would probably have to be done per-prefix (registry?), since two processes in the same prefix might want the same ID.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/4108#note_49432
--
v6: user32: Pass real argument to NtUserGetClassName in RealGetWindowClass{A/W}.
win32u: Add support for retrieving real window class ID across processes.
user32: Set real window class ID for user32 static controls.
win32u/tests: Add a test for real window class name retrieval.
comctl32/tests: Add tests for RealGetWindowClass.
user32/tests: Add tests for RealGetWindowClass.
https://gitlab.winehq.org/wine/wine/-/merge_requests/4092
This allows *BSDs to also have a fast path similar to futexes for thread-ID alerts.
Also a kevent with `EV_CLEAR` and `NOTE_TRIGGER` maps perfectly to the thread alertable state, fixing the issue of the current mach-semaphore implementation not correctly waiting in the test case below:
```
NtAlertThreadByThreadId((HANDLE)GetCurrentThreadId());
NtAlertThreadByThreadId((HANDLE)GetCurrentThreadId());
NtWaitForAlertByThreadId(NULL, NULL);
NtWaitForAlertByThreadId(NULL, NULL);
```
I took the liberty to remove this mach semaphore implementation, since all versions of OSX have supported kqueue().
--
v6: ntdll: Implement thread-ID alerts using kqueue/kevent.
https://gitlab.winehq.org/wine/wine/-/merge_requests/4049
Using a dedicated exit jmpbuf and removing the need for assembly
routines.
When Wine handles an exception in unix code, we return to user mode by
jumping to the last syscall frame. This can leave some pthread cancel
cleanups registered, in the pthread internal linked list, and at the
same time later overwrite the stack frame they were registered for.
In the same way, jumping to the exit frame on thread exit or abort, can
also leave some cleanup handlers registered for invalid stack frames.
Depending on the implementation, calling pthread_exit will cause all the
registered pthread cleanup handlers to be called, possibly jumping back
to now overwritten stack frames and causing segmentation faults.
Exiting a pthread normally, by returning from its procedure, or calling
exit(0) for the main thread doesn't run pthread_exit and doesn't call
cleanup handlers, avoiding that situation.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52213
### Additional note:
For robustness, we should probably try to execute these cleanup handlers
when unwinding the stack frames, as we would otherwise leave pthread
objects in a potential problematic state (like a mutex locked, etc).
It is however hard to do so when the handlers are registered from some C
code: pthread C implementation is done by calling some internal pthread
functions to register the handlers, and they aren't registered as
standard unwind handlers.
Only pthread_cancel and pthread_exit can unwind and call / unregister
the C handlers, but interrupting that procedure, for instance calling
setjmp / longjmp from withing our own handler isn't supported.
From C++ code, pthread cleanup handlers are registered through C++ class
constructors / destructors, and it would then be possible to partially
unwind and call them at the same time.
--
v10: ntdll: Remove now unnecessary arch-specific exit frame.
ntdll: Avoid calling pthread_exit from abort_thread.
ntdll: Avoid calling abort_thread from the signal stack.
ntdll: Use is_inside_syscall more consistently.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1088