surface: rename wlr_surface_state.buffer to buffer_resource
This commit is contained in:
parent
68c133da2f
commit
226306ed45
|
@ -22,7 +22,7 @@ enum wlr_surface_state_field {
|
||||||
struct wlr_surface_state {
|
struct wlr_surface_state {
|
||||||
uint32_t committed; // enum wlr_surface_state_field
|
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
|
int32_t dx, dy; // relative to previous position
|
||||||
pixman_region32_t surface_damage, buffer_damage;
|
pixman_region32_t surface_damage, buffer_damage;
|
||||||
pixman_region32_t opaque, input;
|
pixman_region32_t opaque, input;
|
||||||
|
@ -33,7 +33,7 @@ struct wlr_surface_state {
|
||||||
int width, height; // in surface-local coordinates
|
int width, height; // in surface-local coordinates
|
||||||
int buffer_width, buffer_height;
|
int buffer_width, buffer_height;
|
||||||
|
|
||||||
struct wl_listener buffer_destroy_listener;
|
struct wl_listener buffer_destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_surface {
|
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) {
|
static void surface_state_reset_buffer(struct wlr_surface_state *state) {
|
||||||
if (state->buffer) {
|
if (state->buffer_resource) {
|
||||||
wl_list_remove(&state->buffer_destroy_listener.link);
|
wl_list_remove(&state->buffer_destroy.link);
|
||||||
state->buffer = NULL;
|
state->buffer_resource = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void surface_handle_buffer_destroy(struct wl_listener *listener,
|
static void surface_handle_buffer_destroy(struct wl_listener *listener,
|
||||||
void *data) {
|
void *data) {
|
||||||
struct wlr_surface_state *state =
|
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);
|
surface_state_reset_buffer(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void surface_state_set_buffer(struct wlr_surface_state *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);
|
surface_state_reset_buffer(state);
|
||||||
|
|
||||||
state->buffer = buffer;
|
state->buffer_resource = buffer_resource;
|
||||||
if (buffer) {
|
if (buffer_resource != NULL) {
|
||||||
wl_resource_add_destroy_listener(buffer,
|
wl_resource_add_destroy_listener(buffer_resource,
|
||||||
&state->buffer_destroy_listener);
|
&state->buffer_destroy);
|
||||||
state->buffer_destroy_listener.notify = surface_handle_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,
|
static void surface_state_finalize(struct wlr_surface *surface,
|
||||||
struct wlr_surface_state *state) {
|
struct wlr_surface_state *state) {
|
||||||
if ((state->committed & WLR_SURFACE_STATE_BUFFER)) {
|
if ((state->committed & WLR_SURFACE_STATE_BUFFER)) {
|
||||||
if (state->buffer != NULL) {
|
if (state->buffer_resource != NULL) {
|
||||||
wlr_buffer_get_resource_size(state->buffer, surface->renderer,
|
wlr_buffer_get_resource_size(state->buffer_resource,
|
||||||
&state->buffer_width, &state->buffer_height);
|
surface->renderer, &state->buffer_width, &state->buffer_height);
|
||||||
} else {
|
} else {
|
||||||
state->buffer_width = state->buffer_height = 0;
|
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);
|
surface_state_copy(state, next);
|
||||||
|
|
||||||
if (next->committed & WLR_SURFACE_STATE_BUFFER) {
|
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);
|
surface_state_reset_buffer(next);
|
||||||
next->dx = next->dy = 0;
|
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) {
|
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) {
|
if (resource == NULL) {
|
||||||
// NULL commit
|
// NULL commit
|
||||||
wlr_buffer_unref(surface->buffer);
|
wlr_buffer_unref(surface->buffer);
|
||||||
|
|
Loading…
Reference in New Issue