From 226306ed45a1bd9491107ff0b870b364eb25ca61 Mon Sep 17 00:00:00 2001 From: emersion Date: Sun, 1 Jul 2018 15:08:30 +0100 Subject: [PATCH] surface: rename wlr_surface_state.buffer to buffer_resource --- include/wlr/types/wlr_surface.h | 4 ++-- types/wlr_surface.c | 30 +++++++++++++++--------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index 76f09cc6..b89da87a 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -22,7 +22,7 @@ enum wlr_surface_state_field { struct wlr_surface_state { uint32_t committed; // enum wlr_surface_state_field - struct wl_resource *buffer; + struct wl_resource *buffer_resource; int32_t dx, dy; // relative to previous position pixman_region32_t surface_damage, buffer_damage; pixman_region32_t opaque, input; @@ -33,7 +33,7 @@ struct wlr_surface_state { int width, height; // in surface-local coordinates int buffer_width, buffer_height; - struct wl_listener buffer_destroy_listener; + struct wl_listener buffer_destroy; }; struct wlr_surface { diff --git a/types/wlr_surface.c b/types/wlr_surface.c index 5c594889..a7ab17e4 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -32,28 +32,28 @@ static int max(int fst, int snd) { } static void surface_state_reset_buffer(struct wlr_surface_state *state) { - if (state->buffer) { - wl_list_remove(&state->buffer_destroy_listener.link); - state->buffer = NULL; + if (state->buffer_resource) { + wl_list_remove(&state->buffer_destroy.link); + state->buffer_resource = NULL; } } static void surface_handle_buffer_destroy(struct wl_listener *listener, void *data) { struct wlr_surface_state *state = - wl_container_of(listener, state, buffer_destroy_listener); + wl_container_of(listener, state, buffer_destroy); surface_state_reset_buffer(state); } static void surface_state_set_buffer(struct wlr_surface_state *state, - struct wl_resource *buffer) { + struct wl_resource *buffer_resource) { surface_state_reset_buffer(state); - state->buffer = buffer; - if (buffer) { - wl_resource_add_destroy_listener(buffer, - &state->buffer_destroy_listener); - state->buffer_destroy_listener.notify = surface_handle_buffer_destroy; + state->buffer_resource = buffer_resource; + if (buffer_resource != NULL) { + wl_resource_add_destroy_listener(buffer_resource, + &state->buffer_destroy); + state->buffer_destroy.notify = surface_handle_buffer_destroy; } } @@ -142,9 +142,9 @@ static void surface_set_input_region(struct wl_client *client, static void surface_state_finalize(struct wlr_surface *surface, struct wlr_surface_state *state) { if ((state->committed & WLR_SURFACE_STATE_BUFFER)) { - if (state->buffer != NULL) { - wlr_buffer_get_resource_size(state->buffer, surface->renderer, - &state->buffer_width, &state->buffer_height); + if (state->buffer_resource != NULL) { + wlr_buffer_get_resource_size(state->buffer_resource, + surface->renderer, &state->buffer_width, &state->buffer_height); } else { state->buffer_width = state->buffer_height = 0; } @@ -258,7 +258,7 @@ static void surface_state_move(struct wlr_surface_state *state, surface_state_copy(state, next); if (next->committed & WLR_SURFACE_STATE_BUFFER) { - surface_state_set_buffer(state, next->buffer); + surface_state_set_buffer(state, next->buffer_resource); surface_state_reset_buffer(next); next->dx = next->dy = 0; } @@ -296,7 +296,7 @@ static void surface_damage_subsurfaces(struct wlr_subsurface *subsurface) { } static void surface_apply_damage(struct wlr_surface *surface) { - struct wl_resource *resource = surface->current.buffer; + struct wl_resource *resource = surface->current.buffer_resource; if (resource == NULL) { // NULL commit wlr_buffer_unref(surface->buffer);