Keep track of the window cursor set for each surface and apply it when the pointer enters the corresponding surface. This fixes a problem where due to transient disagreements between win32 pointer focus and Wayland pointer focus a cursor update may be lost. For example:
1. Assume existing cursor C1. 2. Window is created beneath cursor. 3. The SetCursor(hwnd, C2) driver callback is called, but because the wl_pointer hasn't entered the Wayland surface yet we don't update the wl_pointer cursor. 4. wl_pointer enters the surface, we apply the latest cursor we know about, which is C1. 5. Since no change in cursor window occurs, we don't get any further SetCursor(hwnd, C2) callbacks, so we get stuck with C1.
This commit fixes the problem by tracking the per-surface HCURSOR in step 3, regardless of whether the cursor is actually applied. So, in step 4 we can use that HCURSOR for the surface.
This change also fixes some cases of our mouselook heuristics not kicking in properly due to missing a SetCursor(hwnd, NULL) in the manner described above.
From: Alexandros Frantzis alexandros.frantzis@collabora.com
Keep track of the window cursor set for each surface and apply it when the pointer enters the corresponding surface. This fixes a problem where due to transient disagreements between win32 pointer focus and Wayland pointer focus a cursor update may be lost. For example:
1. Assume existing cursor C1. 2. Window is created beneath cursor. 3. The SetCursor(hwnd, C2) driver callback is called, but because the wl_pointer hasn't entered the Wayland surface yet we don't update the wl_pointer cursor. 4. wl_pointer enters the surface, we apply the latest cursor we know about, which is C1. 5. Since no change in cursor window occurs, we don't get any further SetCursor(hwnd, C2) callbacks, so we get stuck with C1.
This commit fixes the problem by tracking the per-surface HCURSOR in step 3, regardless of whether the cursor is actually applied. So, in step 4 we can use that HCURSOR for the surface.
This change also fixes some cases of our mouselook heuristics not kicking in properly due to missing a SetCursor(hwnd, NULL) in the manner described above. --- dlls/winewayland.drv/wayland_pointer.c | 3 +++ dlls/winewayland.drv/waylanddrv.h | 1 + 2 files changed, 4 insertions(+)
diff --git a/dlls/winewayland.drv/wayland_pointer.c b/dlls/winewayland.drv/wayland_pointer.c index fad75c8506c..54dd7931b6e 100644 --- a/dlls/winewayland.drv/wayland_pointer.c +++ b/dlls/winewayland.drv/wayland_pointer.c @@ -670,6 +670,9 @@ static void wayland_set_cursor(HWND hwnd, HCURSOR hcursor, BOOL use_hcursor) if ((surface = wayland_surface_lock_hwnd(hwnd))) { scale = surface->window.scale; + if (use_hcursor) surface->hcursor = hcursor; + else hcursor = surface->hcursor; + use_hcursor = TRUE; pthread_mutex_unlock(&surface->mutex); } else diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index 0883c43f1ff..f030f6fc6a0 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -201,6 +201,7 @@ struct wayland_surface struct wayland_window_config window; struct wayland_client_surface *client; int buffer_width, buffer_height; + HCURSOR hcursor; };
struct wayland_shm_buffer
This merge request was approved by Rémi Bernon.