From ec22fe713445977c1a122572107495b584117b16 Mon Sep 17 00:00:00 2001 From: emersion Date: Tue, 31 Oct 2017 15:19:55 +0100 Subject: [PATCH] Make wlr_output_interface.enable optional --- backend/wayland/output.c | 2 +- types/wlr_output.c | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/backend/wayland/output.c b/backend/wayland/output.c index c336eeb7..494e0522 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -189,7 +189,7 @@ static struct wlr_output_impl output_impl = { .make_current = wlr_wl_output_make_current, .swap_buffers = wlr_wl_output_swap_buffers, .set_cursor = wlr_wl_output_set_cursor, - .move_cursor = wlr_wl_output_move_cursor + .move_cursor = wlr_wl_output_move_cursor, }; static void xdg_surface_handle_configure(void *data, struct zxdg_surface_v6 *xdg_surface, diff --git a/types/wlr_output.c b/types/wlr_output.c index abfc6d26..44d24ae3 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -136,7 +136,9 @@ static void wlr_output_update_matrix(struct wlr_output *output) { } void wlr_output_enable(struct wlr_output *output, bool enable) { - output->impl->enable(output, enable); + if (output->impl->enable) { + output->impl->enable(output, enable); + } } bool wlr_output_set_mode(struct wlr_output *output, @@ -191,8 +193,7 @@ void wlr_output_set_position(struct wlr_output *output, int32_t lx, void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend, const struct wlr_output_impl *impl) { - assert(impl->enable && impl->make_current && impl->swap_buffers && - impl->transform); + assert(impl->make_current && impl->swap_buffers && impl->transform); output->backend = backend; output->impl = impl; wl_list_init(&output->modes); @@ -337,12 +338,12 @@ bool wlr_output_cursor_set_image(struct wlr_output_cursor *cursor, if (cursor->output->hardware_cursor == NULL && cursor->output->impl->set_cursor) { - // int ok = cursor->output->impl->set_cursor(cursor->output, pixels, - // stride, width, height, hotspot_x, hotspot_y, true); - // if (ok) { - // cursor->output->hardware_cursor = cursor; - // return true; - // } + int ok = cursor->output->impl->set_cursor(cursor->output, pixels, + stride, width, height, hotspot_x, hotspot_y, true); + if (ok) { + cursor->output->hardware_cursor = cursor; + return true; + } } wlr_log(L_INFO, "Falling back to software cursor");