Make wlr_output_interface.enable optional

This commit is contained in:
emersion 2017-10-31 15:19:55 +01:00
parent d2581eadbc
commit ec22fe7134
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
2 changed files with 11 additions and 10 deletions

View file

@ -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,

View file

@ -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");