aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2023-05-03 23:48:36 -0400
committerSimon Ser <contact@emersion.fr>2023-05-04 11:53:26 +0200
commit394accbe4a4186bba273790bca8cef54d9be21ca (patch)
tree143e42b4b3b674c398ceddae6cbb996424392b7b
parent2dd95490850c9834091c1d679b78a5af6b520890 (diff)
wlr_compositer: Keep track if surface has committed a buffer before.
This would break if you are running with a NULL renderer.
-rw-r--r--include/wlr/types/wlr_compositor.h1
-rw-r--r--types/wlr_compositor.c4
2 files changed, 4 insertions, 1 deletions
diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h
index e4ac7879..3c4f5a4b 100644
--- a/include/wlr/types/wlr_compositor.h
+++ b/include/wlr/types/wlr_compositor.h
@@ -163,6 +163,7 @@ struct wlr_surface {
} previous;
bool opaque;
+ bool has_buffer;
int32_t preferred_buffer_scale;
bool preferred_buffer_transform_sent;
diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c
index df7352b0..7bf4d7c3 100644
--- a/types/wlr_compositor.c
+++ b/types/wlr_compositor.c
@@ -348,6 +348,8 @@ static void surface_state_move(struct wlr_surface_state *state,
}
static void surface_apply_damage(struct wlr_surface *surface) {
+ surface->has_buffer = surface->current.buffer;
+
if (surface->current.buffer == NULL) {
// NULL commit
if (surface->buffer != NULL) {
@@ -723,7 +725,7 @@ struct wlr_texture *wlr_surface_get_texture(struct wlr_surface *surface) {
}
bool wlr_surface_has_buffer(struct wlr_surface *surface) {
- return wlr_surface_get_texture(surface) != NULL;
+ return surface->has_buffer;
}
bool wlr_surface_set_role(struct wlr_surface *surface,