PnP device notifications/events are currently sent and received from the `plugplay` service as the raw-bytes for the `DBT_DEVTYP_DEVICEINTERFACE` struct that needs to be sent from the PnP code in `ntoskrnl.exe`. While simple, it does not support sending `DBT_DEVTYP_HANDLE` events, as they also include a `HANDLE` to the device the event comes from, which cannot simply be sent as raw bytes. This MR reworks how notifications are sent and received from the `plugplay` service, by:
1. Introducing new structs `DEVICE_BROADCAST_HANDLE` and `DEVICE_BROADCAST_DEVICEINTERFACE` in `plugplay.idl`. The structs are similar to their counterparts in `dbt.h` without the `devicetype` and `size` fields added for the header.
2. Re-write `plugplay_{send,get}_event` to use the newly added union `DEVICE_BROADCAST`, which uses the `devicetype` value as the discriminant. A deep copy of this union is then appended to the event queue of every registered listener.
3. Re-write `I_ScRegisterDeviceNotification` and `device_notify_proc` in `sechost/service.c` to use the newly added types instead. Additionally, add support for registering for `DBT_DEVTYPE_HANDLE` notifications, for which the `OBJECT_NAME_INFORMATION` value for the device `HANDLE` is used to filter notifications in order to correctly dispatch them to their registered callbacks.
4. Re-write the callbacks in `user32/input.c` to accept the `DEVICE_BROADCAST` union instead, and construct the appropriate `DEV_BROADCAST_*` struct from it, which gets sent to `SendMessageTimeoutW` as usual.
Support for `DBT_DEVTYP_HANDLE` is needed for the Bluetooth driver stack I have been working on recently, which uses `DBT_DEVTYP_HANDLE` events to notify userspace about newly found Bluetooth devices during discovery and incoming authentication requests, as documented by MS [here](https://learn.microsoft.com/en-us/windows/win32/bluetooth/bluetooth-a….
--
v18: plugplay: Broadcast PnP events on a dedicated thread.
plugplay: Rewrite RPC interface to send and receive events using the newly introduced DEVICE_BROADCAST types.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6315
Tested with win32 ffmpeg.
This merge request basically passes video.xml (and its parsed form) as an extra
argument where vk.xml is passed. While this is ad-hoc and not very future-proof,
there is no indication that Khronos will fragment its XMLs any further, and it
does not seem worthwhile to me to try to generalize the parsing logic in that
respect as long as only two XMLs are used. However, if the maintainers feel
differently, I will endeavour to do so.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6328
--
v3: winewayland: Use subsurfaces for unmanaged windows.
winewayland: Introduce a new update_wayland_surface_state_toplevel helper.
winewayland: Introduce a new wayland_surface_reconfigure_xdg helper.
winewayland: Introduce a new wayland_surface role enumeration.
winewayland: Call wayland_surface_clear_role in wayland_surface_destroy.
winewayland: Move surface title change to wayland_surface_make_toplevel.
winewayland: Attach client client surfaces to their toplevel surface.
winewayland: Use WindowPosChanged swp_flags to decide if a window is visible.
winewayland: Use the wayland_win_data client rect for child GL windows.
winewayland: Split wayland_win_data_update_wayland_surface helper.
winewayland: Call ensure_window_surface_contents with the toplevel window.
win32u: Update children window state when the parent state changes.
winewayland: Get rid of window_surface reference from wayland_win_data.
winewayland: Move client surface to wayland_win_data struct.
winewayland: Get rid of the window surface individual locks.
winewayland: Introduce a new wayland_client_surface_create helper.
winewayland: Get rid of wayland_surface reference from window_surface.
winewayland: Move window contents buffer to wayland_win_data struct.
winewayland: Reset the buffer damage region immediately after copy.
winewayland: Introduce a new get_window_surface_contents helper.
winewayland: Introduce a new set_window_surface_contents helper.
winewayland: Introduce a new ensure_window_surface_contents helper.
winewayland: Post WM_WAYLAND_CONFIGURE outside of the surface lock.
winewayland: Store all window rects in wayland_win_data.
This merge request has too many patches to be relayed via email.
Please visit the URL below to see the contents of the merge request.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6323
PnP device notifications/events are currently sent and received from the `plugplay` service as the raw-bytes for the `DBT_DEVTYP_DEVICEINTERFACE` struct that needs to be sent from the PnP code in `ntoskrnl.exe`. While simple, it does not support sending `DBT_DEVTYP_HANDLE` events, as they also include a `HANDLE` to the device the event comes from, which cannot simply be sent as raw bytes. This MR reworks how notifications are sent and received from the `plugplay` service, by:
1. Introducing new structs `DEVICE_BROADCAST_HANDLE` and `DEVICE_BROADCAST_DEVICEINTERFACE` in `plugplay.idl`. The structs are similar to their counterparts in `dbt.h` without the `devicetype` and `size` fields added for the header.
2. Re-write `plugplay_{send,get}_event` to use the newly added union `DEVICE_BROADCAST`, which uses the `devicetype` value as the discriminant. A deep copy of this union is then appended to the event queue of every registered listener.
3. Re-write `I_ScRegisterDeviceNotification` and `device_notify_proc` in `sechost/service.c` to use the newly added types instead. Additionally, add support for registering for `DBT_DEVTYPE_HANDLE` notifications, for which the `OBJECT_NAME_INFORMATION` value for the device `HANDLE` is used to filter notifications in order to correctly dispatch them to their registered callbacks.
4. Re-write the callbacks in `user32/input.c` to accept the `DEVICE_BROADCAST` union instead, and construct the appropriate `DEV_BROADCAST_*` struct from it, which gets sent to `SendMessageTimeoutW` as usual.
Support for `DBT_DEVTYP_HANDLE` is needed for the Bluetooth driver stack I have been working on recently, which uses `DBT_DEVTYP_HANDLE` events to notify userspace about newly found Bluetooth devices during discovery and incoming authentication requests, as documented by MS [here](https://learn.microsoft.com/en-us/windows/win32/bluetooth/bluetooth-a….
--
v14: plugplay: Broadcast PnP events on a dedicated thread.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6315
Using a new GetWindowStyleMasks driver entry to get the style masks to be used to mask out non-client decorations which are hidden by the host decorations.
This is done after WindowPosChanging, as winex11 needs to update its managed flag before computing the visible rect, this means that the visible rect might change between WindowPosChanging and WindowPosChanged. It should hopefully be fine.
--
v2: winex11: Use the driver rects to convert from host visible to window rect.
winex11: Keep a window_rects struct in the driver window data.
win32u: Move visible rect computation out of the drivers.
win32u: Keep SetIMECompositionWindowPos with other IME entries.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6332
Signed-off-by: Joel Holdsworth <joel(a)airwebreathe.org.uk>
--
v2: ntdll: Add support for FILE_{RENAME,LINK}_POSIX_SEMANTICS.
ntdll: Factor out get_inode_open_sharing.
ntdll/test: Add tests for FILE_LINK_POSIX_SEMANTICS.
ntdll/test: Add tests for FILE_RENAME_POSIX_SEMANTICS.
https://gitlab.winehq.org/wine/wine/-/merge_requests/4457
Thanks for the proposal! I have made [a couple of additional changes](https://gitlab.winehq.org/afrantzis/wine/-/commits/wip/wayland-chi… to this branch, to improve the behavior in some nested and visibility scenarios.
The locking simplification changes look very nice, and perhaps it would be good to land them independently of whatever child accel. rendering design we go with.
Concerning the child. accel design proposed, I am not sure if I find it less complex, but rather differently complex. !6107 centralizes the complexity in the `wayland_surface` update logic, but then other parts of the code can just use it without caring about most of the details. This MR has simpler parts, but then spreads out the complexity, since other parts need to care about `wayland_surface` vs `wayland_client_surface` etc. I am sure this perception about complexity is affected by my mind being used to the other design, though, and there are certainly benefits to this MR (e.g., avoiding an intermediate `wl_surface` when doing child accel. rendering).
However, note that a big part of the design and complexity of !6107 is due to wanting to provide a more general mechanism for using subsurfaces for any kind of window. This makes is very easy to support popup positioning over !6107, doing something like https://gitlab.winehq.org/afrantzis/wine/-/commit/63baaec4379fb3222a08aae01….
This MR doesn't deal with that (which is fine), but then it's not clear to me how an approach based on this design would evolve and how complex it would become to support the popup positioning scenarios we want (and whether it would then be worth it over !6107). I think this may need a bit more exploration to get a more complete picture (or perhaps you already have a good idea of how this would look like?).
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6323#note_79403
Native msi deletes strings if no longer used. It's possible to create string table with empty slots this way. In such case we may add new row at incorrect index causing the table to be not sorted by primary key. This affects 3ds Max 2024 installers that contain such string table.
I don't see how to add a test case for that without adding precreated MSI file. In order to create such file in tests we will need to implement strings refcounting (that is currently mostly missing). It looks like a big task that will likely introduce regressions.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6326
Using a new GetWindowStyleMasks driver entry to get the style masks to be used to mask out non-client decorations which are hidden by the host decorations.
This is done after WindowPosChanging, as winex11 needs to update its managed flag before computing the visible rect, this means that the visible rect might change between WindowPosChanging and WindowPosChanged. It should hopefully be fine.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/6332
Right now this should not do anything because all windows are per-monitor DPI aware. When this is changed this will automatically fall back to window surface scaling through `NtGdiStretchBlt` in win32u.
This has the disadvantage that `NtGdiStretchBlt` is doing an absolutely terrible job at upscaling. This then adds a way for drivers to opt-in and do their own surface scaling before falling back to win32u. Alternatively and perhaps better, we could pull libcairo and use it to scale the surface contents with high quality filtering instead of using GDI.
--
v2: win32u: Implement DPI scaled window surface.
win32u: Move window_surface creation helper to dce.c.
win32u: Map window rects DPI before calling into the drivers.
win32u: Map window region DPI before calling into the drivers.
winex11: Use the driver rects to convert from host visible to window rect.
winex11: Keep a window_rects struct in the driver window data.
win32u: Move visible rect computation out of the drivers.
win32u: Keep SetIMECompositionWindowPos with other IME entries.
https://gitlab.winehq.org/wine/wine/-/merge_requests/6331