From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winewayland.drv/wayland.c | 5 +++ dlls/winewayland.drv/wayland_pointer.c | 16 ++++----- dlls/winewayland.drv/wayland_surface.c | 49 +++++++++++--------------- 3 files changed, 34 insertions(+), 36 deletions(-)
diff --git a/dlls/winewayland.drv/wayland.c b/dlls/winewayland.drv/wayland.c index c94b35e173c..35dbcb5f0ef 100644 --- a/dlls/winewayland.drv/wayland.c +++ b/dlls/winewayland.drv/wayland.c @@ -269,6 +269,11 @@ BOOL wayland_process_init(void) ERR("Wayland compositor doesn't support wl_subcompositor\n"); return FALSE; } + if (!process_wayland.wp_viewporter) + { + ERR("Wayland compositor doesn't support wp_viewporter\n"); + return FALSE; + } if (!process_wayland.zwp_pointer_constraints_v1) { ERR("Wayland compositor doesn't support zwp_pointer_constraints_v1\n"); diff --git a/dlls/winewayland.drv/wayland_pointer.c b/dlls/winewayland.drv/wayland_pointer.c index 1d8acaeabd2..456176e25c7 100644 --- a/dlls/winewayland.drv/wayland_pointer.c +++ b/dlls/winewayland.drv/wayland_pointer.c @@ -611,13 +611,16 @@ static void wayland_pointer_update_cursor_surface(double scale) } }
- if (!cursor->wp_viewport && process_wayland.wp_viewporter) + if (!cursor->wp_viewport) { cursor->wp_viewport = wp_viewporter_get_viewport(process_wayland.wp_viewporter, cursor->wl_surface); if (!cursor->wp_viewport) - WARN("Failed to create wp_viewport for cursor\n"); + { + ERR("Failed to create wp_viewport for cursor\n"); + goto clear_cursor; + } }
/* Commit the cursor buffer to the cursor surface. */ @@ -631,12 +634,9 @@ static void wayland_pointer_update_cursor_surface(double scale) * scale. Note that setting the viewport destination overrides * the buffer scale, so it's fine to set both. */ wl_surface_set_buffer_scale(cursor->wl_surface, round(scale)); - if (cursor->wp_viewport) - { - wp_viewport_set_destination(cursor->wp_viewport, - round(cursor->shm_buffer->width / scale), - round(cursor->shm_buffer->height / scale)); - } + wp_viewport_set_destination(cursor->wp_viewport, + round(cursor->shm_buffer->width / scale), + round(cursor->shm_buffer->height / scale)); wl_surface_commit(cursor->wl_surface);
return; diff --git a/dlls/winewayland.drv/wayland_surface.c b/dlls/winewayland.drv/wayland_surface.c index a2699d66e51..906b33dd358 100644 --- a/dlls/winewayland.drv/wayland_surface.c +++ b/dlls/winewayland.drv/wayland_surface.c @@ -163,11 +163,13 @@ struct wayland_surface *wayland_surface_create(HWND hwnd) } wl_surface_set_user_data(surface->wl_surface, hwnd);
- if (process_wayland.wp_viewporter) + surface->wp_viewport = + wp_viewporter_get_viewport(process_wayland.wp_viewporter, + surface->wl_surface); + if (!surface->wp_viewport) { - surface->wp_viewport = - wp_viewporter_get_viewport(process_wayland.wp_viewporter, - surface->wl_surface); + ERR("Failed to create wp_viewport Wayland surface\n"); + goto err; }
surface->window.scale = 1.0; @@ -474,13 +476,10 @@ static void wayland_surface_reconfigure_size(struct wayland_surface *surface, { TRACE("hwnd=%p size=%dx%d\n", surface->hwnd, width, height);
- if (surface->wp_viewport) - { - if (width != 0 && height != 0) - wp_viewport_set_destination(surface->wp_viewport, width, height); - else - wp_viewport_set_destination(surface->wp_viewport, -1, -1); - } + if (width != 0 && height != 0) + wp_viewport_set_destination(surface->wp_viewport, width, height); + else + wp_viewport_set_destination(surface->wp_viewport, -1, -1); }
/********************************************************************** @@ -511,19 +510,11 @@ static void wayland_surface_reconfigure_client(struct wayland_surface *surface)
wl_subsurface_set_position(surface->client->wl_subsurface, x, y);
- if (surface->client->wp_viewport) - { - if (width != 0 && height != 0) - { - wp_viewport_set_destination(surface->client->wp_viewport, - width, height); - } - else - { - /* We can't have a 0x0 destination, use 1x1 instead. */ - wp_viewport_set_destination(surface->client->wp_viewport, 1, 1); - } - } + if (width != 0 && height != 0) + wp_viewport_set_destination(surface->client->wp_viewport, + width, height); + else /* We can't have a 0x0 destination, use 1x1 instead. */ + wp_viewport_set_destination(surface->client->wp_viewport, 1, 1);
wl_surface_commit(surface->client->wl_surface);
@@ -823,11 +814,13 @@ struct wayland_client_surface *wayland_surface_get_client(struct wayland_surface /* Present contents independently of the parent surface. */ wl_subsurface_set_desync(surface->client->wl_subsurface);
- if (process_wayland.wp_viewporter) + surface->client->wp_viewport = + wp_viewporter_get_viewport(process_wayland.wp_viewporter, + surface->client->wl_surface); + if (!surface->client->wp_viewport) { - surface->client->wp_viewport = - wp_viewporter_get_viewport(process_wayland.wp_viewporter, - surface->client->wl_surface); + ERR("Failed to create client wp_viewport\n"); + goto err; }
wayland_surface_reconfigure_client(surface);