winewayland.drv: Read and dispatch Wayland events.
Create a dedicated thread from which we read and dispatch Wayland events (beyond the initial ones).
This commit is contained in:
parent
e352fa19fa
commit
4a69ec6f96
3 changed files with 33 additions and 0 deletions
|
@ -20,8 +20,25 @@
|
|||
|
||||
#include "waylanddrv_dll.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(waylanddrv);
|
||||
|
||||
static DWORD WINAPI wayland_read_events_thread(void *arg)
|
||||
{
|
||||
WAYLANDDRV_UNIX_CALL(read_events, NULL);
|
||||
/* This thread terminates only if an unrecoverable error occurred
|
||||
* during event reading (e.g., the connection to the Wayland
|
||||
* compositor is broken). */
|
||||
ERR("Failed to read events from the compositor, terminating process\n");
|
||||
TerminateProcess(GetCurrentProcess(), 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
|
||||
{
|
||||
DWORD tid;
|
||||
|
||||
if (reason != DLL_PROCESS_ATTACH) return TRUE;
|
||||
|
||||
DisableThreadLibraryCalls(instance);
|
||||
|
@ -30,5 +47,8 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
|
|||
if (WAYLANDDRV_UNIX_CALL(init, NULL))
|
||||
return FALSE;
|
||||
|
||||
/* Read wayland events from a dedicated thread. */
|
||||
CloseHandle(CreateThread(NULL, 0, wayland_read_events_thread, NULL, 0, &tid));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
enum waylanddrv_unix_func
|
||||
{
|
||||
waylanddrv_unix_func_init,
|
||||
waylanddrv_unix_func_read_events,
|
||||
waylanddrv_unix_func_count,
|
||||
};
|
||||
|
||||
|
|
|
@ -49,9 +49,20 @@ err:
|
|||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
static NTSTATUS waylanddrv_unix_read_events(void *arg)
|
||||
{
|
||||
while (wl_display_dispatch_queue(process_wayland.wl_display,
|
||||
process_wayland.wl_event_queue) != -1)
|
||||
continue;
|
||||
/* This function only returns on a fatal error, e.g., if our connection
|
||||
* to the Wayland server is lost. */
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
const unixlib_entry_t __wine_unix_call_funcs[] =
|
||||
{
|
||||
waylanddrv_unix_init,
|
||||
waylanddrv_unix_read_events,
|
||||
};
|
||||
|
||||
C_ASSERT(ARRAYSIZE(__wine_unix_call_funcs) == waylanddrv_unix_func_count);
|
||||
|
@ -61,6 +72,7 @@ C_ASSERT(ARRAYSIZE(__wine_unix_call_funcs) == waylanddrv_unix_func_count);
|
|||
const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
|
||||
{
|
||||
waylanddrv_unix_init,
|
||||
waylanddrv_unix_read_events,
|
||||
};
|
||||
|
||||
C_ASSERT(ARRAYSIZE(__wine_unix_call_wow64_funcs) == waylanddrv_unix_func_count);
|
||||
|
|
Loading…
Add table
Reference in a new issue