According to the spec, the compiler is free to use a signed, unsigned, or even char type for enums, provided all values fit within the type. For example, constructs like `*_FORCE_DWORD` can force an unsigned type using a value like `0xffffffff`. While some headers use this approach, it’s inconsistent and 0x7fffffff is often used instead.
Unfortunately, MSVC and GCC differ in their behavior: GCC always uses an unsigned type, while MSVC uses a signed type when possible. Consequently, Clang’s behavior depends on the mode being used.
Additionally, Clang emits a warning for "useless" checks when building Wine in MinGW mode. For instance:
```
dlls/gdiplus/graphics.c:7337:18: warning: result of comparison of unsigned enum expression < 0 is always false [-WTautological-unsigned-enum-zero-compare]
7337 | src_space < 0 || src_space > CoordinateSpaceDevice)
```
This warning is impractical for code that aims to be portable. The check is not tautological when building in MSVC mode (e.g., in our CI). I considered disabling the warning, but since this is the only place in the codebase where it’s problematic, I believe we can simply adjust the check.
This resolves the last warning in LLVM builds, allowing -Werror to be used in MinGW mode as well.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6949
Tested by running chrome without no-sandbox successfully.
--
v2: ntdll: Force redirect all ARM64EC indirect calls until the JIT is ready.
ntdll: Add arm64ec_get_module_metadata helper.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6877
This MR improves configuration scheme when using clang as cross compiler:
- it fixes test for dwarf (-4) support (current test is failing as ldd emits
a warning when generating the long section names for the dwarf section,
that configure.ac treats as an error),
- it fixes --enable-build-id option with clang (clang linker uses -build-id
option, while gcc uses --build-id /mind the extra '-'/)
- it adds support in winegcc for a generic build-id linker option.
(extracted from draft MR!6715)
--
v3: configure.ac: Don't add -Wl,--build-id linker option to CFLAGS.
configure.ac: Properly detect build-id support for clang.
winegcc: Remap build-id linker option for clang.
configure.ac: Properly test clang for dwarf support.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6922
I know we've had a policy to avoid window manager specific workarounds, I think we could reconsider it. The fix could be unguarded and applied with every window manager, and could very well work, but I think it is ugly enough to justify checking for KWin specifically.
The problem is that as soon as a window configure request is sent to a maximized window, KWin internal state gets bogus and it loses track of the window maximized state. I've described the KWin source details on https://bugs.kde.org/show_bug.cgi?id=496966 and opened https://invent.kde.org/plasma/kwin/-/merge_requests/6854 as a possible fix for it, but the time it will take to land could justify working around it in Wine.
The workaround is to avoid sending configure requests to maximized windows, which sounds sensible and we already avoid resizing maximized windows, but, moving a maximized window to a different monitor *requires* sending a configure request. KWin bug makes no difference to requests with only position changes, and they trigger it all the same. So, the only solution is to temporarily remove the maximized state bits before sending the configure request, putting them back afterwards. This is quite straightforward to do with the new state tracker, but it could very well trigger other problems with other window managers.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57465
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6944
On Mon Dec 2 22:29:18 2024 +0000, Robbert van der Helm wrote:
> Ah I completely missed the assignment there at the end when I was
> grepping for usages of `wm_state_serial`. I still can't reliably get
> Wine to accept configuration events I sent to it though. If I set the
> `WM_STATE` property it does process the next event, but then it gets
> stuck again after that because now `net_wm_state_serial` will be stuck
> on a nonzero value. I could probably figure out a way to get Wine to
> cooperate, but that's almost certainly going to break in a future Wine release.
> To reiterate, my goal isn't necessarily to send `ConfigureNotify` events
> to Wine. I just want a Wine window that's reparented to another window
> to handle mouse events correctly, as otherwise Wine seems to interpret
> pointer events as being relative to the root window. So for example, if
> I have a regular top level X11 window at position 50x50 relative to the
> top left of the root window, and I reparent a Wine window into that
> window, clicking at coordinates 20x20 from the top left of the
> reparented Wine window will cause Wine to register a click at coordinate
> 70x70. Up until now it was possible to work around this by telling Wine
> about its location on screen through `ConfigureNotify` events, but that
> is of course a hack.
> Since you've been working on Wine's X11 driver, what do you think is the
> best way to approach this in a way that isn't likely to break again in
> the future? Would extending Wine's existing tracking of
> reparented/embedded windows so any events related to pointer coordinates
> get translated accordingly make sense?
There has been various changes in the way we handle window positioning, and it's now probably more flexible to arbitrary X11 parent windows, but in any case we still always consider the X root window coordinates as the origin for the Win32 desktop.
If you want to embed all Wine windows into another window and use its position as the Win32 desktop origin, it's basically what the "virtual desktop" mode is doing already. It's an option in winecfg, where we create a dedicated window for the Win32 desktop and every Wine window will be a child of it. You could probably then reparent the desktop window to the window you want?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6569#note_89502
On Mon Dec 2 10:04:22 2024 +0000, Rémi Bernon wrote:
> `wm_state_serial` should be cleared when the window state actually
> changes and the `WM_STATE` PropertyNotify event is received, calling
> `window_wm_state_notify` which clears it.
Ah I completely missed the assignment there at the end when I was grepping for usages of `wm_state_serial`. I still can't reliably get Wine to accept configuration events I sent to it though. If I set the `WM_STATE` property it does process the next event, but then it gets stuck again after that because now `net_wm_state_serial` will be stuck on a nonzero value. I could probably figure out a way to get Wine to cooperate, but that's almost certainly going to break in a future Wine release.
To reiterate, my goal isn't necessarily to send `ConfigureNotify` events to Wine. I just want a Wine window that's reparented to another window to handle mouse events correctly, as otherwise Wine seems to interpret pointer events as being relative to the root window. So for example, if I have a regular top level X11 window at position 50x50 relative to the top left of the root window, and I reparent a Wine window into that window, clicking at coordinates 20x20 from the top left of the reparented Wine window will cause Wine to register a click at coordinate 70x70. Up until now it was possible to work around this by telling Wine about its location on screen through `ConfigureNotify` events, but that is of course a hack.
Since you've been working on Wine's X11 driver, what do you think is the best way to approach this in a way that isn't likely to break again in the future? Would extending Wine's existing tracking of reparented/embedded windows so any events related to pointer coordinates get translated accordingly make sense?
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6569#note_89501