This implements some events related to document/window load and unload / visibility changes. The latter is related in that native partially implements it, and only sends it when it is minimized or restored from being minimized, not on navigation or anything else.
The main issue for me is the visibilitychange patch. Since we don't control the container hwnd, and it can even be in another process, there is no way to be notified cleanly when it changes its minimization state. We can't subclass it either, as the tests show, it's not subclassed.
I implemented it now using an internal timer that polls for that, since it was the least invasive and works in all cases, including other process hwnd. Hooks wouldn't be able to do that, and are also more invasive IMO. I'm hoping for better ideas, though.
--
v2: mshtml: Implement pagehide event.
mshtml: Implement unload event.
mshtml: Implement pageshow event.
mshtml: Add visibilitychange event stub.
https://gitlab.winehq.org/wine/wine/-/merge_requests/1373
There are cases in StructConversionFunction.definition where we will
generate copy code for extension struct members, without emitting the
definition of the "in_ext" variable used in the copy code.
This issue is triggered by mismatches in the condition that guards the
generation of the "in_ext" definition, and the condition(s) that govern
the generation of the member copy code (e.g., in
StructConversionFunction.member_needs_copy and
VkMember.needs_conversion).
In order to avoid such mismatches and the burden of having to keep the
conditions in sync, this commit generates the definition on demand, by
checking if it's actually needed by the member copy code.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis(a)collabora.com>
--
Some more details in case a different solution becomes apparent.
An example of the aforementioned issue can be triggered if we make VK_EXT_image_drm_format_modifier an UNEXPOSED extension in `make_vulkan`:
```
../wine/dlls/winevulkan/vulkan_thunks.c: In function ‘convert_VkFormatProperties2_win32_to_host’:
../wine/dlls/winevulkan/vulkan_thunks.c:10214:119: error: ‘in_ext’ undeclared (first use in this function); did you mean ‘index’?
10214 | out_ext->pDrmFormatModifierProperties = convert_VkDrmFormatModifierPropertiesEXT_array_win32_to_host(ctx, in_ext->pDrmFormatModifierProperties, in_ext->drmFormatModifierCount);
| ^~~~~~
| index
```
In this particular case the mismatch happens because for the `VkDrmFormatModifierPropertiesListEXT` (returnedonly=true) struct in the INPUT direction the current check doesn't emit `in_ext`:
```
if self.direction == Direction.OUTPUT or not ext.returnedonly: # Not triggered
body += ident + "{0} *in_ext = ({0} *)in_header;\n".format(in_type)
```
but `self.member_needs_copy(ext, m)` below for the "pDrmFormatModifierProperties" member returns `True`, requiring `in_ext`. The flow is:
```
* self.member_needs_copy(ext, m) => True
if m.name != "sType" and struct.returnedonly and not m.needs_conversion(self.conv, self.unwrap, Direction.INPUT, self.const): # Not triggered
return False
return True
* m.needs_conversion(self.conv, self.unwrap, Direction.INPUT, self.const) => True
# if pointer member needs output conversion, it also needs input conversion
# to allocate the pointer
if direction == Direction.INPUT and self.is_pointer() and \
self.needs_conversion(conv, unwrap, Direction.OUTPUT, struct_const):
return True
```
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/1390
Based on [a patch](https://www.winehq.org/mailman3/hyperkitty/list/wine-devel@winehq.or… by Jinoh Kang (@iamahuman) from February 2022.
I removed the need for the event object and implemented fast paths for Linux.
On macOS 10.14+ `thread_get_register_pointer_values` is used on every thread of the process.
On Linux 4.14+ `membarrier(MEMBARRIER_CMD_GLOBAL_EXPEDITED, ...)` is used.
On x86 Linux <= 4.13 `madvise(..., MADV_DONTNEED)` is used, which sends IPIs to all cores causing them to do a memory barrier.
On non-x86 Linux <= 4.2 and on other platforms the fallback path using APCs is used.
--
v7: ntdll: Add thread_get_register_pointer_values-based fast path for NtFlushProcessWriteBuffers.
ntdll: Add sys_membarrier-based fast path to NtFlushProcessWriteBuffers.
ntdll: Add MADV_DONTNEED-based fast path for NtFlushProcessWriteBuffers.
ntdll: Implement NtFlushProcessWriteBuffers.
https://gitlab.winehq.org/wine/wine/-/merge_requests/741