From 36b4465eb988621847bc8e83490e7a3b26ea34be Mon Sep 17 00:00:00 2001 From: emersion Date: Wed, 11 Oct 2017 08:38:32 +0200 Subject: [PATCH 01/11] Do not release buffer before emitting commit event --- types/wlr_surface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/wlr_surface.c b/types/wlr_surface.c index 9e38d701..1432c120 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -391,8 +391,6 @@ static void wlr_surface_flush_damage(struct wlr_surface *surface, release: pixman_region32_clear(&surface->current->surface_damage); pixman_region32_clear(&surface->current->buffer_damage); - - wlr_surface_state_release_buffer(surface->current); } static void wlr_surface_commit_pending(struct wlr_surface *surface) { @@ -428,6 +426,8 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) { // TODO: add the invalid bitfield to this callback wl_signal_emit(&surface->events.commit, surface); + + wlr_surface_state_release_buffer(surface->current); } static bool wlr_subsurface_is_synchronized(struct wlr_subsurface *subsurface) { From 67f0c3ca427343fab26a8340296c3f95b062916f Mon Sep 17 00:00:00 2001 From: emersion Date: Wed, 11 Oct 2017 14:02:41 +0200 Subject: [PATCH 02/11] Rename release label --- types/wlr_surface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/wlr_surface.c b/types/wlr_surface.c index 1432c120..4c433184 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -359,7 +359,7 @@ static void wlr_surface_flush_damage(struct wlr_surface *surface, if (wlr_renderer_buffer_is_drm(surface->renderer, surface->current->buffer)) { wlr_texture_upload_drm(surface->texture, surface->current->buffer); - goto release; + goto clear_damage; } else { wlr_log(L_INFO, "Unknown buffer handle attached"); return; @@ -372,7 +372,7 @@ static void wlr_surface_flush_damage(struct wlr_surface *surface, } else { pixman_region32_t damage = surface->current->buffer_damage; if (!pixman_region32_not_empty(&damage)) { - goto release; + goto clear_damage; } int n; pixman_box32_t *rects = pixman_region32_rectangles(&damage, &n); @@ -388,7 +388,7 @@ static void wlr_surface_flush_damage(struct wlr_surface *surface, } } -release: +clear_damage: pixman_region32_clear(&surface->current->surface_damage); pixman_region32_clear(&surface->current->buffer_damage); } From 5c6a93389023f8f31e81d34cad618137b0483487 Mon Sep 17 00:00:00 2001 From: emersion Date: Wed, 11 Oct 2017 20:29:21 +0200 Subject: [PATCH 03/11] Do not call wlr_surface_state_release_buffer anymore --- types/wlr_output.c | 8 +++----- types/wlr_surface.c | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/types/wlr_output.c b/types/wlr_output.c index 13a6adbd..0b3f3842 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -238,10 +238,6 @@ void wlr_output_set_cursor_surface(struct wlr_output *output, output->cursor.hotspot_x = hotspot_x; output->cursor.hotspot_y = hotspot_y; - if (surface && output->cursor.surface == surface) { - return; - } - if (output->cursor.surface) { wl_list_remove(&output->cursor.surface_commit.link); wl_list_remove(&output->cursor.surface_destroy.link); @@ -252,7 +248,9 @@ void wlr_output_set_cursor_surface(struct wlr_output *output, if (surface != NULL) { wl_signal_add(&surface->events.commit, &output->cursor.surface_commit); - wl_signal_add(&surface->events.destroy, &output->cursor.surface_destroy); + wl_signal_add(&surface->events.destroy, + &output->cursor.surface_destroy); + commit_cursor_surface(output, surface); } else { set_cursor(output, NULL, 0, 0, 0, hotspot_x, hotspot_y); } diff --git a/types/wlr_surface.c b/types/wlr_surface.c index 4c433184..654b5f1c 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -427,7 +427,8 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) { // TODO: add the invalid bitfield to this callback wl_signal_emit(&surface->events.commit, surface); - wlr_surface_state_release_buffer(surface->current); + // TODO: call this + //wlr_surface_state_release_buffer(surface->current); } static bool wlr_subsurface_is_synchronized(struct wlr_subsurface *subsurface) { From 92daa790bb4ac1b15eedd91e02ab65b340e8f2a5 Mon Sep 17 00:00:00 2001 From: emersion Date: Thu, 12 Oct 2017 09:40:51 +0200 Subject: [PATCH 04/11] Allow to update the cursor hotspot without its pixels --- backend/drm/drm.c | 10 ++++++++-- backend/wayland/output.c | 9 ++++++++- include/wlr/interfaces/wlr_output.h | 10 +++++----- types/wlr_output.c | 11 ++++++++++- types/wlr_surface.c | 5 +++-- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 9e5346a1..ff4dc7f6 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -470,7 +470,7 @@ static void wlr_drm_connector_transform(struct wlr_output *output, static bool wlr_drm_connector_set_cursor(struct wlr_output *output, const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height, - int32_t hotspot_x, int32_t hotspot_y) { + int32_t hotspot_x, int32_t hotspot_y, bool update_pixels) { struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_backend *drm = conn->drm; struct wlr_drm_renderer *renderer = &drm->renderer; @@ -478,7 +478,8 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output, struct wlr_drm_crtc *crtc = conn->crtc; struct wlr_drm_plane *plane = crtc->cursor; - if (!buf) { + if (!buf && update_pixels) { + // Hide the cursor return drm->iface->crtc_set_cursor(drm, crtc, NULL); } @@ -566,6 +567,11 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output, break; } + if (!update_pixels) { + // Only update the cursor hotspot + return true; + } + struct gbm_bo *bo = plane->cursor_bo; uint32_t bo_width = gbm_bo_get_width(bo); uint32_t bo_height = gbm_bo_get_height(bo); diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 03b43b35..2616b347 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -54,11 +54,18 @@ static void wlr_wl_output_transform(struct wlr_output *_output, static bool wlr_wl_output_set_cursor(struct wlr_output *_output, const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height, - int32_t hotspot_x, int32_t hotspot_y) { + int32_t hotspot_x, int32_t hotspot_y, bool update_pixels) { struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output; struct wlr_wl_backend *backend = output->backend; + if (!update_pixels) { + // Update hotspot without changing cursor image + wlr_wl_output_update_cursor(output, output->enter_serial, hotspot_x, + hotspot_y); + return true; + } if (!buf) { + // Hide cursor wl_pointer_set_cursor(output->backend->pointer, output->enter_serial, NULL, 0, 0); return true; diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index 7d2821e0..b7927569 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -8,16 +8,16 @@ struct wlr_output_impl { void (*enable)(struct wlr_output *output, bool enable); bool (*set_mode)(struct wlr_output *output, struct wlr_output_mode *mode); void (*transform)(struct wlr_output *output, - enum wl_output_transform transform); + enum wl_output_transform transform); bool (*set_cursor)(struct wlr_output *output, const uint8_t *buf, - int32_t stride, uint32_t width, uint32_t height, - int32_t hotspot_x, int32_t hotspot_y); + int32_t stride, uint32_t width, uint32_t height, + int32_t hotspot_x, int32_t hotspot_y, bool update_pixels); bool (*move_cursor)(struct wlr_output *output, int x, int y); void (*destroy)(struct wlr_output *output); void (*make_current)(struct wlr_output *output); void (*swap_buffers)(struct wlr_output *output); void (*set_gamma)(struct wlr_output *output, - uint16_t size, uint16_t *r, uint16_t *g, uint16_t *b); + uint16_t size, uint16_t *r, uint16_t *g, uint16_t *b); uint16_t (*get_gamma_size)(struct wlr_output *output); }; @@ -25,6 +25,6 @@ void wlr_output_init(struct wlr_output *output, const struct wlr_output_impl *im void wlr_output_free(struct wlr_output *output); void wlr_output_update_matrix(struct wlr_output *output); struct wl_global *wlr_output_create_global( - struct wlr_output *wlr_output, struct wl_display *display); + struct wlr_output *wlr_output, struct wl_display *display); #endif diff --git a/types/wlr_output.c b/types/wlr_output.c index 0b3f3842..568ea093 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -127,7 +127,7 @@ static bool set_cursor(struct wlr_output *output, const uint8_t *buf, int32_t hotspot_y) { if (output->impl->set_cursor && output->impl->set_cursor(output, buf, stride, width, height, - hotspot_x, hotspot_y)) { + hotspot_x, hotspot_y, true)) { output->cursor.is_sw = false; return true; } @@ -238,6 +238,15 @@ void wlr_output_set_cursor_surface(struct wlr_output *output, output->cursor.hotspot_x = hotspot_x; output->cursor.hotspot_y = hotspot_y; + if (surface && surface == output->cursor.surface) { + if (output->impl->set_cursor && !output->cursor.is_sw) { + // Only update the hotspot + output->impl->set_cursor(output, NULL, 0, 0, 0, hotspot_x, + hotspot_y, false); + } + return; + } + if (output->cursor.surface) { wl_list_remove(&output->cursor.surface_commit.link); wl_list_remove(&output->cursor.surface_destroy.link); diff --git a/types/wlr_surface.c b/types/wlr_surface.c index 654b5f1c..a5760d67 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -427,8 +427,9 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) { // TODO: add the invalid bitfield to this callback wl_signal_emit(&surface->events.commit, surface); - // TODO: call this - //wlr_surface_state_release_buffer(surface->current); + // Release the buffer after calling commit, because some listeners + // might need it (e.g. for cursor surfaces) + wlr_surface_state_release_buffer(surface->current); } static bool wlr_subsurface_is_synchronized(struct wlr_subsurface *subsurface) { From 19860c03f7567bd85ffd735ce2ccc90c454dd5b1 Mon Sep 17 00:00:00 2001 From: emersion Date: Thu, 12 Oct 2017 13:25:29 +0200 Subject: [PATCH 05/11] Better handling of hidden cursors in wayland backend, add TODOs --- backend/wayland/output.c | 10 +++++++--- types/wlr_output.c | 4 +++- types/wlr_surface.c | 3 ++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 2616b347..d308b907 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -66,8 +66,12 @@ static bool wlr_wl_output_set_cursor(struct wlr_output *_output, } if (!buf) { // Hide cursor - wl_pointer_set_cursor(output->backend->pointer, output->enter_serial, - NULL, 0, 0); + wl_surface_destroy(output->cursor_surface); + munmap(output->cursor_data, output->cursor_buf_size); + output->cursor_surface = NULL; + output->cursor_buf_size = 0; + wlr_wl_output_update_cursor(output, output->enter_serial, hotspot_x, + hotspot_y); return true; } @@ -160,7 +164,7 @@ static void wlr_wl_output_destroy(struct wlr_output *_output) { void wlr_wl_output_update_cursor(struct wlr_wl_backend_output *output, uint32_t serial, int32_t hotspot_x, int32_t hotspot_y) { - if (output->cursor_surface && output->backend->pointer && serial) { + if (output->backend->pointer && serial) { wl_pointer_set_cursor(output->backend->pointer, serial, output->cursor_surface, hotspot_x, hotspot_y); } diff --git a/types/wlr_output.c b/types/wlr_output.c index 568ea093..b416f9de 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -259,7 +259,9 @@ void wlr_output_set_cursor_surface(struct wlr_output *output, wl_signal_add(&surface->events.commit, &output->cursor.surface_commit); wl_signal_add(&surface->events.destroy, &output->cursor.surface_destroy); - commit_cursor_surface(output, surface); + // TODO: doing it breaks GTK apps + // TODO: not doing it breaks weston-subsurfaces + //commit_cursor_surface(output, surface); } else { set_cursor(output, NULL, 0, 0, 0, hotspot_x, hotspot_y); } diff --git a/types/wlr_surface.c b/types/wlr_surface.c index a5760d67..b3cdb809 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -429,7 +429,8 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) { // Release the buffer after calling commit, because some listeners // might need it (e.g. for cursor surfaces) - wlr_surface_state_release_buffer(surface->current); + // TODO: breaks weston-subsurfaces + //wlr_surface_state_release_buffer(surface->current); } static bool wlr_subsurface_is_synchronized(struct wlr_subsurface *subsurface) { From 29abf93bb6a52101a53ece0b23e3b24c593a737e Mon Sep 17 00:00:00 2001 From: emersion Date: Thu, 12 Oct 2017 14:28:37 +0200 Subject: [PATCH 06/11] Check pointer focused surface instead of view at cursor --- include/rootston/input.h | 2 +- rootston/cursor.c | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/include/rootston/input.h b/include/rootston/input.h index fbabbdb6..516104a7 100644 --- a/include/rootston/input.h +++ b/include/rootston/input.h @@ -79,7 +79,7 @@ struct roots_input { struct wlr_xcursor_theme *theme; struct wlr_xcursor *xcursor; struct wlr_seat *wl_seat; - struct roots_view *client_cursor_view; + struct wl_client *cursor_client; enum roots_cursor_mode mode; struct roots_view *active_view, *last_active_view; diff --git a/rootston/cursor.c b/rootston/cursor.c index eeb657ad..4c3a9947 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -80,10 +80,16 @@ void cursor_update_position(struct roots_input *input, uint32_t time) { case ROOTS_CURSOR_PASSTHROUGH: view = view_at(desktop, input->cursor->x, input->cursor->y, &surface, &sx, &sy); - if (view != input->client_cursor_view) { + bool set_compositor_cursor = !view && input->cursor_client; + if (view) { + struct wl_client *view_client = + wl_resource_get_client(view->wlr_surface->resource); + set_compositor_cursor = view_client != input->cursor_client; + } + if (set_compositor_cursor) { wlr_log(L_DEBUG, "Switching to compositor cursor"); cursor_set_xcursor_image(input, input->xcursor->images[0]); - input->client_cursor_view = NULL; + input->cursor_client = NULL; } if (view) { wlr_seat_pointer_notify_enter(input->wl_seat, surface, sx, sy); @@ -298,10 +304,8 @@ static void handle_request_set_cursor(struct wl_listener *listener, request_set_cursor); struct wlr_seat_pointer_request_set_cursor_event *event = data; - struct wlr_surface *focused_surface = NULL; - double sx, sy; - struct roots_view *focused_view = view_at(input->server->desktop, - input->cursor->x, input->cursor->y, &focused_surface, &sx, &sy); + struct wlr_surface *focused_surface = + event->seat_handle->wlr_seat->pointer_state.focused_surface; bool ok = focused_surface != NULL; if (focused_surface != NULL) { struct wl_client *focused_client = @@ -309,7 +313,7 @@ static void handle_request_set_cursor(struct wl_listener *listener, ok = event->client == focused_client; } if (!ok) { - wlr_log(L_DEBUG, "Denying request to set cursor outside view"); + wlr_log(L_DEBUG, "Denying request to set cursor from unfocused client"); return; } @@ -321,7 +325,7 @@ static void handle_request_set_cursor(struct wl_listener *listener, event->hotspot_x, event->hotspot_y); } - input->client_cursor_view = focused_view; + input->cursor_client = event->client; } void cursor_initialize(struct roots_input *input) { From 8fd4ae5de86b62e482e338113e94f23ee183d28d Mon Sep 17 00:00:00 2001 From: emersion Date: Sat, 14 Oct 2017 12:21:36 +0200 Subject: [PATCH 07/11] Fix cursor role name, fix segfault when surface->resource is NULL --- rootston/cursor.c | 4 ++-- types/wlr_output.c | 2 +- types/wlr_seat.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rootston/cursor.c b/rootston/cursor.c index 4c3a9947..03189587 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -306,8 +306,8 @@ static void handle_request_set_cursor(struct wl_listener *listener, struct wlr_surface *focused_surface = event->seat_handle->wlr_seat->pointer_state.focused_surface; - bool ok = focused_surface != NULL; - if (focused_surface != NULL) { + bool ok = focused_surface != NULL && focused_surface->resource != NULL; + if (ok) { struct wl_client *focused_client = wl_resource_get_client(focused_surface->resource); ok = event->client == focused_client; diff --git a/types/wlr_output.c b/types/wlr_output.c index b416f9de..bd4799c4 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -231,7 +231,7 @@ static void handle_cursor_surface_destroy(struct wl_listener *listener, void wlr_output_set_cursor_surface(struct wlr_output *output, struct wlr_surface *surface, int32_t hotspot_x, int32_t hotspot_y) { - if (surface && strcmp(surface->role, "cursor") != 0) { + if (surface && strcmp(surface->role, "wl_pointer-cursor") != 0) { return; } diff --git a/types/wlr_seat.c b/types/wlr_seat.c index ef81655c..aea4196b 100644 --- a/types/wlr_seat.c +++ b/types/wlr_seat.c @@ -28,7 +28,7 @@ static void wl_pointer_set_cursor(struct wl_client *client, if (surface_resource != NULL) { surface = wl_resource_get_user_data(surface_resource); - if (wlr_surface_set_role(surface, "cursor", resource, + if (wlr_surface_set_role(surface, "wl_pointer-cursor", resource, WL_POINTER_ERROR_ROLE) < 0) { return; } From dd5114a5143b1594340dcbd91279c325f1c5e776 Mon Sep 17 00:00:00 2001 From: emersion Date: Sat, 14 Oct 2017 12:44:25 +0200 Subject: [PATCH 08/11] Fix client cursors when software cursors are used --- types/wlr_output.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/types/wlr_output.c b/types/wlr_output.c index bd4799c4..f47896d5 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -179,6 +179,11 @@ static inline int64_t timespec_to_msec(const struct timespec *a) { static void commit_cursor_surface(struct wlr_output *output, struct wlr_surface *surface) { + if (!output->impl->set_cursor) { + output->cursor.is_sw = true; + return; + } + struct wl_shm_buffer *buffer = wl_shm_buffer_get(surface->current->buffer); if (buffer == NULL) { return; @@ -342,10 +347,20 @@ void wlr_output_swap_buffers(struct wlr_output *output) { glViewport(0, 0, output->width, output->height); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - float matrix[16]; - wlr_texture_get_matrix(output->cursor.texture, &matrix, &output->transform_matrix, - output->cursor.x, output->cursor.y); - wlr_render_with_matrix(output->cursor.renderer, output->cursor.texture, &matrix); + + struct wlr_texture *texture = output->cursor.texture; + struct wlr_renderer *renderer = output->cursor.renderer; + if (output->cursor.surface) { + texture = output->cursor.surface->texture; + renderer = output->cursor.surface->renderer; + } + + if (texture && renderer) { + float matrix[16]; + wlr_texture_get_matrix(texture, &matrix, &output->transform_matrix, + output->cursor.x, output->cursor.y); + wlr_render_with_matrix(renderer, texture, &matrix); + } } wl_signal_emit(&output->events.swap_buffers, &output); From 6dc0517bb163b4ee38602d8955b9994e5928d739 Mon Sep 17 00:00:00 2001 From: emersion Date: Sat, 14 Oct 2017 13:24:29 +0200 Subject: [PATCH 09/11] Fix software cursor when setting committed cursor surface --- types/wlr_output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/wlr_output.c b/types/wlr_output.c index f47896d5..0026678e 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -179,8 +179,7 @@ static inline int64_t timespec_to_msec(const struct timespec *a) { static void commit_cursor_surface(struct wlr_output *output, struct wlr_surface *surface) { - if (!output->impl->set_cursor) { - output->cursor.is_sw = true; + if (output->cursor.is_sw) { return; } @@ -258,6 +257,7 @@ void wlr_output_set_cursor_surface(struct wlr_output *output, output->cursor.surface = NULL; } + output->cursor.is_sw = output->impl->set_cursor == NULL; output->cursor.surface = surface; if (surface != NULL) { From 08720db01db302246c9e0a15c0cde7120af3e1d8 Mon Sep 17 00:00:00 2001 From: emersion Date: Sat, 14 Oct 2017 13:33:34 +0200 Subject: [PATCH 10/11] Release buffer in wlr_surface_flush_damage --- types/wlr_output.c | 4 +--- types/wlr_surface.c | 13 +++++-------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/types/wlr_output.c b/types/wlr_output.c index 0026678e..5f3820bc 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -264,9 +264,7 @@ void wlr_output_set_cursor_surface(struct wlr_output *output, wl_signal_add(&surface->events.commit, &output->cursor.surface_commit); wl_signal_add(&surface->events.destroy, &output->cursor.surface_destroy); - // TODO: doing it breaks GTK apps - // TODO: not doing it breaks weston-subsurfaces - //commit_cursor_surface(output, surface); + commit_cursor_surface(output, surface); } else { set_cursor(output, NULL, 0, 0, 0, hotspot_x, hotspot_y); } diff --git a/types/wlr_surface.c b/types/wlr_surface.c index b3cdb809..9e38d701 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -359,7 +359,7 @@ static void wlr_surface_flush_damage(struct wlr_surface *surface, if (wlr_renderer_buffer_is_drm(surface->renderer, surface->current->buffer)) { wlr_texture_upload_drm(surface->texture, surface->current->buffer); - goto clear_damage; + goto release; } else { wlr_log(L_INFO, "Unknown buffer handle attached"); return; @@ -372,7 +372,7 @@ static void wlr_surface_flush_damage(struct wlr_surface *surface, } else { pixman_region32_t damage = surface->current->buffer_damage; if (!pixman_region32_not_empty(&damage)) { - goto clear_damage; + goto release; } int n; pixman_box32_t *rects = pixman_region32_rectangles(&damage, &n); @@ -388,9 +388,11 @@ static void wlr_surface_flush_damage(struct wlr_surface *surface, } } -clear_damage: +release: pixman_region32_clear(&surface->current->surface_damage); pixman_region32_clear(&surface->current->buffer_damage); + + wlr_surface_state_release_buffer(surface->current); } static void wlr_surface_commit_pending(struct wlr_surface *surface) { @@ -426,11 +428,6 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) { // TODO: add the invalid bitfield to this callback wl_signal_emit(&surface->events.commit, surface); - - // Release the buffer after calling commit, because some listeners - // might need it (e.g. for cursor surfaces) - // TODO: breaks weston-subsurfaces - //wlr_surface_state_release_buffer(surface->current); } static bool wlr_subsurface_is_synchronized(struct wlr_subsurface *subsurface) { From 786f4bdd4d79f5aaa9fd4f7872553a5f3afe98f9 Mon Sep 17 00:00:00 2001 From: emersion Date: Tue, 17 Oct 2017 00:04:33 +0200 Subject: [PATCH 11/11] Disable hardware cursors for now --- types/wlr_output.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/types/wlr_output.c b/types/wlr_output.c index 5f3820bc..d3b37d65 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -257,7 +257,15 @@ void wlr_output_set_cursor_surface(struct wlr_output *output, output->cursor.surface = NULL; } - output->cursor.is_sw = output->impl->set_cursor == NULL; + // Disable hardware cursor + // TODO: support hardware cursors + output->cursor.is_sw = true; + if (output->impl->set_cursor) { + output->impl->set_cursor(output, NULL, 0, 0, 0, hotspot_x, hotspot_y, + true); + } + + //output->cursor.is_sw = output->impl->set_cursor == NULL; output->cursor.surface = surface; if (surface != NULL) {