surface: rename wlr_surface_state.buffer to buffer_resource

master
emersion 6 years ago
parent 68c133da2f
commit 226306ed45
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

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

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

Loading…
Cancel
Save