Commit 4a69ec6f authored by Alexandros Frantzis's avatar Alexandros Frantzis Committed by Alexandre Julliard

winewayland.drv: Read and dispatch Wayland events.

Create a dedicated thread from which we read and dispatch Wayland events (beyond the initial ones).
parent e352fa19
...@@ -20,8 +20,25 @@ ...@@ -20,8 +20,25 @@
#include "waylanddrv_dll.h" #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) BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
{ {
DWORD tid;
if (reason != DLL_PROCESS_ATTACH) return TRUE; if (reason != DLL_PROCESS_ATTACH) return TRUE;
DisableThreadLibraryCalls(instance); DisableThreadLibraryCalls(instance);
...@@ -30,5 +47,8 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) ...@@ -30,5 +47,8 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
if (WAYLANDDRV_UNIX_CALL(init, NULL)) if (WAYLANDDRV_UNIX_CALL(init, NULL))
return FALSE; return FALSE;
/* Read wayland events from a dedicated thread. */
CloseHandle(CreateThread(NULL, 0, wayland_read_events_thread, NULL, 0, &tid));
return TRUE; return TRUE;
} }
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
enum waylanddrv_unix_func enum waylanddrv_unix_func
{ {
waylanddrv_unix_func_init, waylanddrv_unix_func_init,
waylanddrv_unix_func_read_events,
waylanddrv_unix_func_count, waylanddrv_unix_func_count,
}; };
......
...@@ -49,9 +49,20 @@ err: ...@@ -49,9 +49,20 @@ err:
return STATUS_UNSUCCESSFUL; 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[] = const unixlib_entry_t __wine_unix_call_funcs[] =
{ {
waylanddrv_unix_init, waylanddrv_unix_init,
waylanddrv_unix_read_events,
}; };
C_ASSERT(ARRAYSIZE(__wine_unix_call_funcs) == waylanddrv_unix_func_count); 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); ...@@ -61,6 +72,7 @@ C_ASSERT(ARRAYSIZE(__wine_unix_call_funcs) == waylanddrv_unix_func_count);
const unixlib_entry_t __wine_unix_call_wow64_funcs[] = const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
{ {
waylanddrv_unix_init, waylanddrv_unix_init,
waylanddrv_unix_read_events,
}; };
C_ASSERT(ARRAYSIZE(__wine_unix_call_wow64_funcs) == waylanddrv_unix_func_count); C_ASSERT(ARRAYSIZE(__wine_unix_call_wow64_funcs) == waylanddrv_unix_func_count);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment