• Alexandros Frantzis's avatar
    winewayland.drv: Track and apply latest window cursor on pointer enter. · fe1f3e27
    Alexandros Frantzis authored
    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.
    fe1f3e27
wayland_pointer.c 30.6 KB