From: Aida Jonikienė aidas957@gmail.com
This fixes segfaults and explorer.exe being stuck when this driver fails to load. --- dlls/winewayland.drv/wayland.c | 20 ++++++++++++++++++ dlls/winewayland.drv/waylanddrv_main.c | 29 +------------------------- 2 files changed, 21 insertions(+), 28 deletions(-)
diff --git a/dlls/winewayland.drv/wayland.c b/dlls/winewayland.drv/wayland.c index c94b35e173c..5fdd8d80712 100644 --- a/dlls/winewayland.drv/wayland.c +++ b/dlls/winewayland.drv/wayland.c @@ -32,6 +32,25 @@
WINE_DEFAULT_DEBUG_CHANNEL(waylanddrv);
+static const struct user_driver_funcs waylanddrv_funcs = +{ + .pClipCursor = WAYLAND_ClipCursor, + .pDesktopWindowProc = WAYLAND_DesktopWindowProc, + .pDestroyWindow = WAYLAND_DestroyWindow, + .pKbdLayerDescriptor = WAYLAND_KbdLayerDescriptor, + .pReleaseKbdTables = WAYLAND_ReleaseKbdTables, + .pSetCursor = WAYLAND_SetCursor, + .pSetWindowText = WAYLAND_SetWindowText, + .pSysCommand = WAYLAND_SysCommand, + .pUpdateDisplayDevices = WAYLAND_UpdateDisplayDevices, + .pWindowMessage = WAYLAND_WindowMessage, + .pWindowPosChanged = WAYLAND_WindowPosChanged, + .pWindowPosChanging = WAYLAND_WindowPosChanging, + .pCreateWindowSurface = WAYLAND_CreateWindowSurface, + .pVulkanInit = WAYLAND_VulkanInit, + .pwine_get_wgl_driver = WAYLAND_wine_get_wgl_driver, +}; + struct wayland process_wayland = { .seat.mutex = PTHREAD_MUTEX_INITIALIZER, @@ -280,6 +299,7 @@ BOOL wayland_process_init(void) return FALSE; }
+ __wine_set_user_driver(&waylanddrv_funcs, WINE_GDI_DRIVER_VERSION); process_wayland.initialized = TRUE;
return TRUE; diff --git a/dlls/winewayland.drv/waylanddrv_main.c b/dlls/winewayland.drv/waylanddrv_main.c index 47c1299dd01..369086fda2c 100644 --- a/dlls/winewayland.drv/waylanddrv_main.c +++ b/dlls/winewayland.drv/waylanddrv_main.c @@ -33,25 +33,6 @@
char *process_name = NULL;
-static const struct user_driver_funcs waylanddrv_funcs = -{ - .pClipCursor = WAYLAND_ClipCursor, - .pDesktopWindowProc = WAYLAND_DesktopWindowProc, - .pDestroyWindow = WAYLAND_DestroyWindow, - .pKbdLayerDescriptor = WAYLAND_KbdLayerDescriptor, - .pReleaseKbdTables = WAYLAND_ReleaseKbdTables, - .pSetCursor = WAYLAND_SetCursor, - .pSetWindowText = WAYLAND_SetWindowText, - .pSysCommand = WAYLAND_SysCommand, - .pUpdateDisplayDevices = WAYLAND_UpdateDisplayDevices, - .pWindowMessage = WAYLAND_WindowMessage, - .pWindowPosChanged = WAYLAND_WindowPosChanged, - .pWindowPosChanging = WAYLAND_WindowPosChanging, - .pCreateWindowSurface = WAYLAND_CreateWindowSurface, - .pVulkanInit = WAYLAND_VulkanInit, - .pwine_get_wgl_driver = WAYLAND_wine_get_wgl_driver, -}; - static void wayland_init_process_name(void) { WCHAR *p, *appname; @@ -82,19 +63,11 @@ static void wayland_init_process_name(void)
static NTSTATUS waylanddrv_unix_init(void *arg) { - /* Set the user driver functions now so that they are available during - * our initialization. We clear them on error. */ - __wine_set_user_driver(&waylanddrv_funcs, WINE_GDI_DRIVER_VERSION); - wayland_init_process_name();
- if (!wayland_process_init()) goto err; + if (!wayland_process_init()) return STATUS_UNSUCCESSFUL;
return 0; - -err: - __wine_set_user_driver(NULL, WINE_GDI_DRIVER_VERSION); - return STATUS_UNSUCCESSFUL; }
static NTSTATUS waylanddrv_unix_read_events(void *arg)
From: Aida Jonikienė aidas957@gmail.com
Some compositors (like Mutter in nested mode) don't support the relative motion protocol (which causes winewayland to fail to load even if it's used for simple apps like winecfg). --- dlls/winewayland.drv/wayland.c | 13 +++++-------- dlls/winewayland.drv/wayland_pointer.c | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/dlls/winewayland.drv/wayland.c b/dlls/winewayland.drv/wayland.c index 5fdd8d80712..537f59c4e24 100644 --- a/dlls/winewayland.drv/wayland.c +++ b/dlls/winewayland.drv/wayland.c @@ -288,16 +288,13 @@ BOOL wayland_process_init(void) ERR("Wayland compositor doesn't support wl_subcompositor\n"); return FALSE; } + + /* Check for optional globals. */ if (!process_wayland.zwp_pointer_constraints_v1) - { - ERR("Wayland compositor doesn't support zwp_pointer_constraints_v1\n"); - return FALSE; - } + ERR("Wayland compositor doesn't support optional zwp_pointer_constraints_v1 (pointer locking/confining won't work)\n"); + if (!process_wayland.zwp_relative_pointer_manager_v1) - { - ERR("Wayland compositor doesn't support zwp_relative_pointer_manager_v1\n"); - return FALSE; - } + ERR("Wayland compositor doesn't support optional zwp_relative_pointer_manager_v1 (relative motion won't work)\n");
__wine_set_user_driver(&waylanddrv_funcs, WINE_GDI_DRIVER_VERSION); process_wayland.initialized = TRUE; diff --git a/dlls/winewayland.drv/wayland_pointer.c b/dlls/winewayland.drv/wayland_pointer.c index 1d8acaeabd2..1a224bd7a68 100644 --- a/dlls/winewayland.drv/wayland_pointer.c +++ b/dlls/winewayland.drv/wayland_pointer.c @@ -778,6 +778,14 @@ static void wayland_pointer_update_constraint(struct wl_surface *wl_surface, { struct wayland_pointer *pointer = &process_wayland.pointer; BOOL needs_relative, needs_lock, needs_confine; + static unsigned int once; + + if (!process_wayland.zwp_pointer_constraints_v1) + { + if (!once++) + ERR("This function requires zwp_pointer_constraints_v1\n"); + return; + }
needs_lock = wl_surface && (confine_rect || covers_vscreen) && !pointer->cursor.wl_surface; @@ -856,6 +864,13 @@ static void wayland_pointer_update_constraint(struct wl_surface *wl_surface, } }
+ if (!process_wayland.zwp_relative_pointer_manager_v1) + { + if (!once++) + ERR("zwp_relative_pointer_manager_v1 isn't supported, skipping relative motion\n"); + return; + } + needs_relative = !pointer->cursor.wl_surface && pointer->constraint_hwnd && pointer->constraint_hwnd == pointer->focused_hwnd;
Rémi Bernon (@rbernon) commented about dlls/winewayland.drv/wayland.c:
return FALSE; }
- __wine_set_user_driver(&waylanddrv_funcs, WINE_GDI_DRIVER_VERSION);
I suspect this will break display device initialization.
Rémi Bernon (@rbernon) commented about dlls/winewayland.drv/wayland.c:
ERR("Wayland compositor doesn't support wl_subcompositor\n"); return FALSE; }
- /* Check for optional globals. */ if (!process_wayland.zwp_pointer_constraints_v1)
I don't mind too much but honestly I don't like the idea of making things optional already when the driver is still not stable and enabled by default.
On Tue Aug 27 13:41:26 2024 +0000, Rémi Bernon wrote:
I suspect this will break display device initialization.
From my quick testing winecfg still works (and both of my monitors are initialized)