diff --git a/src/compositor-drm.c b/src/compositor-drm.c index 1bb89294..6b21fca2 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -42,6 +42,10 @@ #include "launcher-util.h" #include "log.h" +enum { + WESTON_PLANE_DRM_CURSOR = 0x100 +}; + struct drm_compositor { struct weston_compositor base; @@ -635,7 +639,6 @@ weston_output_set_cursor(struct weston_output *output, pixman_region32_t *overlap) { pixman_region32_t cursor_region; - int prior_was_hardware; if (seat->sprite == NULL) return; @@ -650,19 +653,18 @@ weston_output_set_cursor(struct weston_output *output, goto out; } - prior_was_hardware = seat->hw_cursor; if (pixman_region32_not_empty(overlap) || drm_output_set_cursor(output, seat) < 0) { - if (prior_was_hardware) { + if (seat->sprite->plane == WESTON_PLANE_DRM_CURSOR) { weston_surface_damage(seat->sprite); drm_output_set_cursor(output, NULL); } - seat->hw_cursor = 0; + seat->sprite->plane = WESTON_PLANE_PRIMARY; } else { - if (!prior_was_hardware) + if (seat->sprite->plane == WESTON_PLANE_PRIMARY) weston_surface_damage_below(seat->sprite); wl_list_remove(&seat->sprite->link); - seat->hw_cursor = 1; + seat->sprite->plane = WESTON_PLANE_DRM_CURSOR; } out: @@ -705,7 +707,7 @@ drm_assign_planes(struct weston_output *output) weston_output_set_cursor(output, seat, &surface_overlap); - if (!seat->hw_cursor) + if (seat->sprite->plane == WESTON_PLANE_PRIMARY) pixman_region32_union(&overlap, &overlap, &es->transform.boundingbox); } else if (!drm_output_prepare_overlay_surface(output, es, diff --git a/src/compositor.c b/src/compositor.c index c93da34a..73fed3e1 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -306,6 +306,9 @@ weston_surface_damage_below(struct weston_surface *surface) struct weston_compositor *compositor = surface->compositor; pixman_region32_t damage; + if (surface->plane != WESTON_PLANE_PRIMARY) + return; + pixman_region32_init(&damage); pixman_region32_subtract(&damage, &surface->transform.boundingbox, &surface->clip); diff --git a/src/compositor.h b/src/compositor.h index 9df19339..22e5eb83 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -222,7 +222,6 @@ struct weston_seat { int32_t hotspot_x, hotspot_y; struct wl_list link; enum weston_keyboard_modifier modifier_state; - int hw_cursor; struct wl_surface *saved_kbd_focus; struct wl_listener saved_kbd_focus_listener; @@ -382,6 +381,10 @@ struct weston_region { * transformation in global coordinates, add it to the tail of the list. */ +enum { + WESTON_PLANE_PRIMARY +}; + struct weston_surface { struct wl_surface surface; struct weston_compositor *compositor; @@ -398,6 +401,7 @@ struct weston_surface { GLfloat opaque_rect[4]; GLfloat alpha; int blend; + int plane; /* Surface geometry state, mutable. * If you change anything, set dirty = 1.