From 0beae99188d7885bed15eef548acf6b2a9fb9f79 Mon Sep 17 00:00:00 2001 From: emersion Date: Tue, 31 Oct 2017 18:00:33 +0100 Subject: Apply output transformation to pointer events in Wayland backend --- backend/drm/drm.c | 44 +++++++++++--------------------------------- backend/wayland/wl_seat.c | 23 ++++++++++++++++------- 2 files changed, 27 insertions(+), 40 deletions(-) (limited to 'backend') diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 6cbb0535..cfaaae21 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -558,39 +558,17 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output, } } - switch (output->transform) { - case WL_OUTPUT_TRANSFORM_90: - plane->cursor_hotspot_x = hotspot_x; - plane->cursor_hotspot_y = -plane->surf.height + hotspot_y; - break; - case WL_OUTPUT_TRANSFORM_180: - plane->cursor_hotspot_x = plane->surf.width - hotspot_x; - plane->cursor_hotspot_y = plane->surf.height - hotspot_y; - break; - case WL_OUTPUT_TRANSFORM_270: - plane->cursor_hotspot_x = -plane->surf.height + hotspot_x; - plane->cursor_hotspot_y = hotspot_y; - break; - case WL_OUTPUT_TRANSFORM_FLIPPED: - plane->cursor_hotspot_x = plane->surf.width - hotspot_x; - plane->cursor_hotspot_y = hotspot_y; - break; - case WL_OUTPUT_TRANSFORM_FLIPPED_90: - plane->cursor_hotspot_x = hotspot_x; - plane->cursor_hotspot_y = -hotspot_y; - break; - case WL_OUTPUT_TRANSFORM_FLIPPED_180: - plane->cursor_hotspot_x = hotspot_x; - plane->cursor_hotspot_y = plane->surf.height - hotspot_y; - break; - case WL_OUTPUT_TRANSFORM_FLIPPED_270: - plane->cursor_hotspot_x = -plane->surf.height + hotspot_x; - plane->cursor_hotspot_y = plane->surf.width - hotspot_y; - break; - default: // WL_OUTPUT_TRANSFORM_NORMAL - plane->cursor_hotspot_x = hotspot_x; - plane->cursor_hotspot_y = hotspot_y; - } + struct wlr_box hotspot_box = { + .width = plane->surf.width, + .height = plane->surf.height, + .x = hotspot_x, + .y = hotspot_y, + }; + struct wlr_box transformed_hotspot_box; + wlr_output_transform_apply_to_box(output->transform, + &hotspot_box, &transformed_hotspot_box); + plane->cursor_hotspot_x = transformed_hotspot_box.x; + plane->cursor_hotspot_y = transformed_hotspot_box.y; if (!update_pixels) { // Only update the cursor hotspot diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c index 0d8e5b1f..deed215e 100644 --- a/backend/wayland/wl_seat.c +++ b/backend/wayland/wl_seat.c @@ -42,21 +42,30 @@ static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer, uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) { struct wlr_input_device *dev = data; assert(dev && dev->pointer); - struct wlr_wl_pointer *wlr_wl_pointer = (struct wlr_wl_pointer *)dev->pointer; + struct wlr_wl_pointer *wlr_wl_pointer = + (struct wlr_wl_pointer *)dev->pointer; if (!wlr_wl_pointer->current_output) { wlr_log(L_ERROR, "pointer motion event without current output"); return; } - int width, height; + + struct wlr_box box; wl_egl_window_get_attached_size(wlr_wl_pointer->current_output->egl_window, - &width, &height); + &box.width, &box.height); + box.x = wl_fixed_to_int(surface_x); + box.y = wl_fixed_to_int(surface_y); + struct wlr_box transformed; + wlr_output_transform_apply_to_box( + wlr_wl_pointer->current_output->wlr_output.transform, &box, + &transformed); + struct wlr_event_pointer_motion_absolute wlr_event; wlr_event.device = dev; wlr_event.time_msec = time; - wlr_event.width_mm = width; - wlr_event.height_mm = height; - wlr_event.x_mm = wl_fixed_to_double(surface_x); - wlr_event.y_mm = wl_fixed_to_double(surface_y); + wlr_event.width_mm = transformed.width; + wlr_event.height_mm = transformed.height; + wlr_event.x_mm = transformed.x; + wlr_event.y_mm = transformed.y; wl_signal_emit(&dev->pointer->events.motion_absolute, &wlr_event); } -- cgit v1.2.3 From 60c018c01760bef047d156a60e9ab32799a26f14 Mon Sep 17 00:00:00 2001 From: emersion Date: Wed, 1 Nov 2017 14:25:41 +0100 Subject: Fix hidden software cursors, fix cursor transformations on DRM backend --- backend/drm/drm.c | 65 ++++++++++++++++++------------------- backend/wayland/output.c | 1 + include/wlr/interfaces/wlr_output.h | 1 + rootston/config.c | 4 ++- types/wlr_output.c | 17 +++++++--- 5 files changed, 50 insertions(+), 38 deletions(-) (limited to 'backend') diff --git a/backend/drm/drm.c b/backend/drm/drm.c index cfaaae21..137ca85e 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -558,17 +558,28 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output, } } - struct wlr_box hotspot_box = { - .width = plane->surf.width, - .height = plane->surf.height, - .x = hotspot_x, - .y = hotspot_y, - }; - struct wlr_box transformed_hotspot_box; - wlr_output_transform_apply_to_box(output->transform, - &hotspot_box, &transformed_hotspot_box); - plane->cursor_hotspot_x = transformed_hotspot_box.x; - plane->cursor_hotspot_y = transformed_hotspot_box.y; + switch (output->transform) { + case WL_OUTPUT_TRANSFORM_NORMAL: + case WL_OUTPUT_TRANSFORM_FLIPPED_90: + plane->cursor_hotspot_x = hotspot_x; + plane->cursor_hotspot_y = hotspot_y; + break; + case WL_OUTPUT_TRANSFORM_90: + case WL_OUTPUT_TRANSFORM_FLIPPED_180: + plane->cursor_hotspot_x = hotspot_x; + plane->cursor_hotspot_y = -plane->surf.height + hotspot_y; + break; + case WL_OUTPUT_TRANSFORM_180: + case WL_OUTPUT_TRANSFORM_FLIPPED_270: + plane->cursor_hotspot_x = -plane->surf.width + hotspot_x; + plane->cursor_hotspot_y = -plane->surf.height + hotspot_y; + break; + case WL_OUTPUT_TRANSFORM_FLIPPED: + case WL_OUTPUT_TRANSFORM_270: + plane->cursor_hotspot_x = -plane->surf.width + hotspot_x; + plane->cursor_hotspot_y = hotspot_y; + break; + } if (!update_pixels) { // Only update the cursor hotspot @@ -621,30 +632,18 @@ static bool wlr_drm_connector_move_cursor(struct wlr_output *output, x -= plane->cursor_hotspot_x; y -= plane->cursor_hotspot_y; - int width, height, tmp; - wlr_output_effective_resolution(output, &width, &height); + struct wlr_box box; + box.x = x; + box.y = y; + wlr_output_effective_resolution(output, &box.width, &box.height); - switch (output->transform) { - case WL_OUTPUT_TRANSFORM_NORMAL: - case WL_OUTPUT_TRANSFORM_FLIPPED: - case WL_OUTPUT_TRANSFORM_FLIPPED_180: - // nothing to do - break; - case WL_OUTPUT_TRANSFORM_270: - case WL_OUTPUT_TRANSFORM_FLIPPED_270: - tmp = x; - x = y; - y = -(tmp - width); - break; - case WL_OUTPUT_TRANSFORM_90: - case WL_OUTPUT_TRANSFORM_FLIPPED_90: - tmp = x; - x = -(y - height); - y = tmp; - break; - } + enum wl_output_transform transform = + wlr_output_transform_invert(output->transform); + struct wlr_box transformed_box; + wlr_output_transform_apply_to_box(transform, &box, &transformed_box); - return drm->iface->crtc_move_cursor(drm, conn->crtc, x, y); + return drm->iface->crtc_move_cursor(drm, conn->crtc, transformed_box.x, + transformed_box.y); } static void wlr_drm_connector_destroy(struct wlr_output *output) { diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 494e0522..fd20b3e3 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -59,6 +59,7 @@ static bool wlr_wl_output_set_cursor(struct wlr_output *_output, (struct wlr_wl_backend_output *)_output; struct wlr_wl_backend *backend = output->backend; + // TODO: use output->wlr_output.transform to transform pixels and hotpot output->cursor.hotspot_x = hotspot_x; output->cursor.hotspot_y = hotspot_y; diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index 1f6c60eb..b4f39d35 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -34,5 +34,6 @@ void wlr_output_destroy_global(struct wlr_output *wlr_output); void wlr_output_transform_apply_to_box(enum wl_output_transform transform, struct wlr_box *box, struct wlr_box *dest); +enum wl_output_transform wlr_output_transform_invert(enum wl_output_transform); #endif diff --git a/rootston/config.c b/rootston/config.c index b3fd4f01..d72c1284 100644 --- a/rootston/config.c +++ b/rootston/config.c @@ -228,7 +228,9 @@ static int config_ini_handler(void *user, const char *section, const char *name, } else if (strcmp(name, "y") == 0) { oc->y = strtol(value, NULL, 10); } else if (strcmp(name, "rotate") == 0) { - if (strcmp(value, "90") == 0) { + if (strcmp(value, "normal") == 0) { + oc->transform = WL_OUTPUT_TRANSFORM_NORMAL; + } else if (strcmp(value, "90") == 0) { oc->transform = WL_OUTPUT_TRANSFORM_90; } else if (strcmp(value, "180") == 0) { oc->transform = WL_OUTPUT_TRANSFORM_180; diff --git a/types/wlr_output.c b/types/wlr_output.c index 08d32963..6e36ae12 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -267,8 +267,8 @@ static void output_cursor_render(struct wlr_output_cursor *cursor) { struct wlr_box output_box; output_box.x = output_box.y = 0; - output_box.width = cursor->output->width; - output_box.height = cursor->output->height; + wlr_output_effective_resolution(cursor->output, &output_box.width, + &output_box.height); struct wlr_box cursor_box; output_cursor_get_box(cursor, &cursor_box); @@ -294,7 +294,7 @@ void wlr_output_swap_buffers(struct wlr_output *output) { struct wlr_output_cursor *cursor; wl_list_for_each(cursor, &output->cursors, link) { if (output->hardware_cursor == cursor) { - continue; + //continue; // TODO } output_cursor_render(cursor); } @@ -342,7 +342,7 @@ bool wlr_output_cursor_set_image(struct wlr_output_cursor *cursor, stride, width, height, hotspot_x, hotspot_y, true); if (ok) { cursor->output->hardware_cursor = cursor; - return true; + //return true; // TODO } } @@ -546,3 +546,12 @@ void wlr_output_transform_apply_to_box(enum wl_output_transform transform, break; } } + +enum wl_output_transform wlr_output_transform_invert( + enum wl_output_transform transform) { + if ((transform & WL_OUTPUT_TRANSFORM_90) && + !(transform & WL_OUTPUT_TRANSFORM_FLIPPED)) { + transform ^= WL_OUTPUT_TRANSFORM_180; + } + return transform; +} -- cgit v1.2.3 From a15b35aa105048fa01ac76eefcf0919cad29df20 Mon Sep 17 00:00:00 2001 From: emersion Date: Wed, 1 Nov 2017 14:36:58 +0100 Subject: Remove mysterious hotspot switch in DRM backend --- backend/drm/drm.c | 57 +++++++++++++++++++++++++----------------------------- types/wlr_output.c | 4 ++-- 2 files changed, 28 insertions(+), 33 deletions(-) (limited to 'backend') diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 137ca85e..08e6296b 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -533,13 +533,14 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output, return false; } - if (!wlr_drm_surface_init(&plane->surf, renderer, w, h, GBM_FORMAT_ARGB8888, 0)) { + if (!wlr_drm_surface_init(&plane->surf, renderer, w, h, + GBM_FORMAT_ARGB8888, 0)) { wlr_log(L_ERROR, "Cannot allocate cursor resources"); return false; } - plane->cursor_bo = gbm_bo_create(renderer->gbm, w, h, GBM_FORMAT_ARGB8888, - GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE); + plane->cursor_bo = gbm_bo_create(renderer->gbm, w, h, + GBM_FORMAT_ARGB8888, GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE); if (!plane->cursor_bo) { wlr_log_errno(L_ERROR, "Failed to create cursor bo"); return false; @@ -552,34 +553,26 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output, // TODO the image needs to be rotated depending on the output rotation - plane->wlr_tex = wlr_render_texture_create(plane->surf.renderer->wlr_rend); + plane->wlr_tex = + wlr_render_texture_create(plane->surf.renderer->wlr_rend); if (!plane->wlr_tex) { return false; } } - switch (output->transform) { - case WL_OUTPUT_TRANSFORM_NORMAL: - case WL_OUTPUT_TRANSFORM_FLIPPED_90: - plane->cursor_hotspot_x = hotspot_x; - plane->cursor_hotspot_y = hotspot_y; - break; - case WL_OUTPUT_TRANSFORM_90: - case WL_OUTPUT_TRANSFORM_FLIPPED_180: - plane->cursor_hotspot_x = hotspot_x; - plane->cursor_hotspot_y = -plane->surf.height + hotspot_y; - break; - case WL_OUTPUT_TRANSFORM_180: - case WL_OUTPUT_TRANSFORM_FLIPPED_270: - plane->cursor_hotspot_x = -plane->surf.width + hotspot_x; - plane->cursor_hotspot_y = -plane->surf.height + hotspot_y; - break; - case WL_OUTPUT_TRANSFORM_FLIPPED: - case WL_OUTPUT_TRANSFORM_270: - plane->cursor_hotspot_x = -plane->surf.width + hotspot_x; - plane->cursor_hotspot_y = hotspot_y; - break; - } + struct wlr_box hotspot = { + .width = plane->surf.width, + .height = plane->surf.height, + .x = hotspot_x, + .y = hotspot_y, + }; + enum wl_output_transform transform = + wlr_output_transform_invert(output->transform); + struct wlr_box transformed_hotspot; + wlr_output_transform_apply_to_box(transform, &hotspot, + &transformed_hotspot); + plane->cursor_hotspot_x = transformed_hotspot.x; + plane->cursor_hotspot_y = transformed_hotspot.y; if (!update_pixels) { // Only update the cursor hotspot @@ -609,11 +602,13 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output, float matrix[16]; wlr_texture_get_matrix(plane->wlr_tex, &matrix, &plane->matrix, 0, 0); - wlr_render_with_matrix(plane->surf.renderer->wlr_rend, plane->wlr_tex, &matrix); + wlr_render_with_matrix(plane->surf.renderer->wlr_rend, plane->wlr_tex, + &matrix); glFinish(); glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, bo_stride); - glReadPixels(0, 0, plane->surf.width, plane->surf.height, GL_BGRA_EXT, GL_UNSIGNED_BYTE, bo_data); + glReadPixels(0, 0, plane->surf.width, plane->surf.height, GL_BGRA_EXT, + GL_UNSIGNED_BYTE, bo_data); glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0); wlr_drm_surface_swap_buffers(&plane->surf); @@ -627,10 +622,7 @@ static bool wlr_drm_connector_move_cursor(struct wlr_output *output, int x, int y) { struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend; - struct wlr_drm_plane *plane = conn->crtc->cursor; - x -= plane->cursor_hotspot_x; - y -= plane->cursor_hotspot_y; struct wlr_box box; box.x = x; @@ -642,6 +634,9 @@ static bool wlr_drm_connector_move_cursor(struct wlr_output *output, struct wlr_box transformed_box; wlr_output_transform_apply_to_box(transform, &box, &transformed_box); + transformed_box.x -= plane->cursor_hotspot_x; + transformed_box.y -= plane->cursor_hotspot_y; + return drm->iface->crtc_move_cursor(drm, conn->crtc, transformed_box.x, transformed_box.y); } diff --git a/types/wlr_output.c b/types/wlr_output.c index 6e36ae12..93d4de93 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -294,7 +294,7 @@ void wlr_output_swap_buffers(struct wlr_output *output) { struct wlr_output_cursor *cursor; wl_list_for_each(cursor, &output->cursors, link) { if (output->hardware_cursor == cursor) { - //continue; // TODO + continue; } output_cursor_render(cursor); } @@ -342,7 +342,7 @@ bool wlr_output_cursor_set_image(struct wlr_output_cursor *cursor, stride, width, height, hotspot_x, hotspot_y, true); if (ok) { cursor->output->hardware_cursor = cursor; - //return true; // TODO + return true; } } -- cgit v1.2.3 From f451ea36393e8cedf29fd9877689b33ae770a8dc Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Wed, 1 Nov 2017 19:34:17 +0100 Subject: rootston exit: fix drm destroy wlr_drm_connector were being freed without removing them from the drm->outputs list, segfaulting on destroy --- backend/drm/backend.c | 4 ++-- backend/drm/drm.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'backend') diff --git a/backend/drm/backend.c b/backend/drm/backend.c index af2619ff..87a4f708 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -29,8 +29,8 @@ static void wlr_drm_backend_destroy(struct wlr_backend *backend) { wlr_drm_restore_outputs(drm); - struct wlr_drm_connector *conn; - wl_list_for_each(conn, &drm->outputs, link) { + struct wlr_drm_connector *conn, *next; + wl_list_for_each_safe(conn, next, &drm->outputs, link) { wlr_output_destroy(&conn->output); } diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 08e6296b..dd247998 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -645,6 +645,7 @@ static void wlr_drm_connector_destroy(struct wlr_output *output) { struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; wlr_drm_connector_cleanup(conn); wl_event_source_remove(conn->retry_pageflip); + wl_list_remove(&conn->link); free(conn); } @@ -823,6 +824,7 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) { drmModeFreeCrtc(conn->old_crtc); wl_event_source_remove(conn->retry_pageflip); + wl_list_remove(&conn->link); free(conn); } } -- cgit v1.2.3 From e3ee2cd9c7e9abe6614dded927787f8138f739f4 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Wed, 1 Nov 2017 19:35:39 +0100 Subject: rootston exit: fix libinput destroy The wlr_list -> wl_list rework changed 'wlr_devices' to wl_list, but missed its use on destroy. --- backend/libinput/backend.c | 7 +++---- backend/libinput/events.c | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'backend') diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 781314a3..7e4d5700 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -99,13 +99,12 @@ static void wlr_libinput_backend_destroy(struct wlr_backend *_backend) { } struct wlr_libinput_backend *backend = (struct wlr_libinput_backend *)_backend; for (size_t i = 0; i < backend->wlr_device_lists->length; i++) { - struct wlr_list *wlr_devices = backend->wlr_device_lists->items[i]; - for (size_t j = 0; j < wlr_devices->length; j++) { - struct wlr_input_device *wlr_dev = wlr_devices->items[j]; + struct wl_list *wlr_devices = backend->wlr_device_lists->items[i]; + struct wlr_input_device *wlr_dev, *next; + wl_list_for_each_safe(wlr_dev, next, wlr_devices, link) { wl_signal_emit(&backend->backend.events.input_remove, wlr_dev); wlr_input_device_destroy(wlr_dev); } - wlr_list_free(wlr_devices); } wlr_list_free(backend->wlr_device_lists); wl_event_source_remove(backend->input_event); diff --git a/backend/libinput/events.c b/backend/libinput/events.c index 053cab02..5da45c67 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -26,6 +26,7 @@ struct wlr_input_device *get_appropriate_device( static void wlr_libinput_device_destroy(struct wlr_input_device *_dev) { struct wlr_libinput_input_device *dev = (struct wlr_libinput_input_device *)_dev; libinput_device_unref(dev->handle); + wl_list_remove(&dev->wlr_input_device.link); free(dev); } -- cgit v1.2.3 From 43cd3c7aea4c8171412a6822bf2c8308ee890b5e Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Wed, 1 Nov 2017 20:14:52 +0100 Subject: Indentation fix Some space sneaked in. tabtabtab. --- backend/libinput/backend.c | 2 +- backend/wayland/output.c | 2 +- backend/wayland/registry.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'backend') diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 7e4d5700..07c6da13 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -101,7 +101,7 @@ static void wlr_libinput_backend_destroy(struct wlr_backend *_backend) { for (size_t i = 0; i < backend->wlr_device_lists->length; i++) { struct wl_list *wlr_devices = backend->wlr_device_lists->items[i]; struct wlr_input_device *wlr_dev, *next; - wl_list_for_each_safe(wlr_dev, next, wlr_devices, link) { + wl_list_for_each_safe(wlr_dev, next, wlr_devices, link) { wl_signal_emit(&backend->backend.events.input_remove, wlr_dev); wlr_input_device_destroy(wlr_dev); } diff --git a/backend/wayland/output.c b/backend/wayland/output.c index fd20b3e3..90f8b39a 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -223,7 +223,7 @@ static void xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v6 *x static void xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel) { struct wlr_wl_backend_output *output = data; - assert(output && output->xdg_toplevel == xdg_toplevel); + assert(output && output->xdg_toplevel == xdg_toplevel); wl_display_terminate(output->backend->local_display); } diff --git a/backend/wayland/registry.c b/backend/wayland/registry.c index d6f61aa7..0dec0ec5 100644 --- a/backend/wayland/registry.c +++ b/backend/wayland/registry.c @@ -9,11 +9,11 @@ static void xdg_shell_handle_ping(void *data, struct zxdg_shell_v6 *shell, uint32_t serial) { - zxdg_shell_v6_pong(shell, serial); + zxdg_shell_v6_pong(shell, serial); } static const struct zxdg_shell_v6_listener xdg_shell_listener = { - xdg_shell_handle_ping, + xdg_shell_handle_ping, }; -- cgit v1.2.3 From 844b166c1bed117ef654de3f9ad68eebad67f6be Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Wed, 1 Nov 2017 20:59:28 +0100 Subject: multi_backend_destroy: fix trivial use-after-free --- backend/multi/backend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'backend') diff --git a/backend/multi/backend.c b/backend/multi/backend.c index a7ee648c..c35303e0 100644 --- a/backend/multi/backend.c +++ b/backend/multi/backend.c @@ -30,8 +30,8 @@ static bool multi_backend_start(struct wlr_backend *_backend) { static void multi_backend_destroy(struct wlr_backend *_backend) { struct wlr_multi_backend *backend = (struct wlr_multi_backend *)_backend; - struct subbackend_state *sub; - wl_list_for_each(sub, &backend->backends, link) { + struct subbackend_state *sub, *next; + wl_list_for_each_safe(sub, next, &backend->backends, link) { wlr_backend_destroy(sub->backend); free(sub); } -- cgit v1.2.3 From b53db8c39e33c340214827097e26ccacbbcb5c08 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Wed, 1 Nov 2017 21:08:59 +0100 Subject: libinput backend destroy: fix small leak --- backend/libinput/backend.c | 1 + 1 file changed, 1 insertion(+) (limited to 'backend') diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 07c6da13..45b4e368 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -105,6 +105,7 @@ static void wlr_libinput_backend_destroy(struct wlr_backend *_backend) { wl_signal_emit(&backend->backend.events.input_remove, wlr_dev); wlr_input_device_destroy(wlr_dev); } + free(wlr_devices); } wlr_list_free(backend->wlr_device_lists); wl_event_source_remove(backend->input_event); -- cgit v1.2.3