aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/types/wlr_xdg_shell.h3
-rw-r--r--include/wlr/types/wlr_compositor.h3
-rw-r--r--types/wlr_compositor.c8
-rw-r--r--types/wlr_layer_shell_v1.c6
-rw-r--r--types/wlr_subcompositor.c6
-rw-r--r--types/xdg_shell/wlr_xdg_surface.c6
-rw-r--r--xwayland/xwm.c6
7 files changed, 20 insertions, 18 deletions
diff --git a/include/types/wlr_xdg_shell.h b/include/types/wlr_xdg_shell.h
index 509b1d2c..8b2c66cc 100644
--- a/include/types/wlr_xdg_shell.h
+++ b/include/types/wlr_xdg_shell.h
@@ -20,7 +20,8 @@ void unmap_xdg_surface(struct wlr_xdg_surface *surface);
void reset_xdg_surface(struct wlr_xdg_surface *xdg_surface);
void destroy_xdg_surface(struct wlr_xdg_surface *surface);
void handle_xdg_surface_commit(struct wlr_surface *wlr_surface);
-void handle_xdg_surface_precommit(struct wlr_surface *wlr_surface);
+void handle_xdg_surface_precommit(struct wlr_surface *wlr_surface,
+ const struct wlr_surface_state *state);
void create_xdg_positioner(struct wlr_xdg_client *client, uint32_t id);
struct wlr_xdg_positioner_resource *get_xdg_positioner_from_resource(
diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h
index 0146a8ab..071610b8 100644
--- a/include/wlr/types/wlr_compositor.h
+++ b/include/wlr/types/wlr_compositor.h
@@ -73,7 +73,8 @@ struct wlr_surface_state {
struct wlr_surface_role {
const char *name;
void (*commit)(struct wlr_surface *surface);
- void (*precommit)(struct wlr_surface *surface);
+ void (*precommit)(struct wlr_surface *surface,
+ const struct wlr_surface_state *state);
};
struct wlr_surface_output {
diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c
index 96122c1c..6c4eb61b 100644
--- a/types/wlr_compositor.c
+++ b/types/wlr_compositor.c
@@ -399,6 +399,10 @@ static void surface_commit_state(struct wlr_surface *surface,
struct wlr_surface_state *next) {
assert(next->cached_state_locks == 0);
+ if (surface->role && surface->role->precommit) {
+ surface->role->precommit(surface, next);
+ }
+
bool invalid_buffer = next->committed & WLR_SURFACE_STATE_BUFFER;
surface->sx += next->dx;
@@ -509,10 +513,6 @@ static void surface_handle_commit(struct wl_client *client,
wlr_signal_emit_safe(&surface->events.client_commit, NULL);
- if (surface->role && surface->role->precommit) {
- surface->role->precommit(surface);
- }
-
if (surface->pending.cached_state_locks > 0 || !wl_list_empty(&surface->cached)) {
surface_cache_pending(surface);
} else {
diff --git a/types/wlr_layer_shell_v1.c b/types/wlr_layer_shell_v1.c
index 983f2186..b2c82955 100644
--- a/types/wlr_layer_shell_v1.c
+++ b/types/wlr_layer_shell_v1.c
@@ -375,15 +375,15 @@ static void layer_surface_role_commit(struct wlr_surface *wlr_surface) {
}
}
-static void layer_surface_role_precommit(struct wlr_surface *wlr_surface) {
+static void layer_surface_role_precommit(struct wlr_surface *wlr_surface,
+ const struct wlr_surface_state *state) {
struct wlr_layer_surface_v1 *surface =
wlr_layer_surface_v1_from_wlr_surface(wlr_surface);
if (surface == NULL) {
return;
}
- if (wlr_surface->pending.committed & WLR_SURFACE_STATE_BUFFER &&
- wlr_surface->pending.buffer == NULL) {
+ if (state->committed & WLR_SURFACE_STATE_BUFFER && state->buffer == NULL) {
// This is a NULL commit
if (surface->configured && surface->mapped) {
layer_surface_unmap(surface);
diff --git a/types/wlr_subcompositor.c b/types/wlr_subcompositor.c
index 8a9e6207..397baf8c 100644
--- a/types/wlr_subcompositor.c
+++ b/types/wlr_subcompositor.c
@@ -280,15 +280,15 @@ static void subsurface_role_commit(struct wlr_surface *surface) {
subsurface_consider_map(subsurface, true);
}
-static void subsurface_role_precommit(struct wlr_surface *surface) {
+static void subsurface_role_precommit(struct wlr_surface *surface,
+ const struct wlr_surface_state *state) {
struct wlr_subsurface *subsurface =
wlr_subsurface_from_wlr_surface(surface);
if (subsurface == NULL) {
return;
}
- if (surface->pending.committed & WLR_SURFACE_STATE_BUFFER &&
- surface->pending.buffer == NULL) {
+ if (state->committed & WLR_SURFACE_STATE_BUFFER && state->buffer == NULL) {
// This is a NULL commit
subsurface_unmap(subsurface);
}
diff --git a/types/xdg_shell/wlr_xdg_surface.c b/types/xdg_shell/wlr_xdg_surface.c
index c45baabb..d54c058e 100644
--- a/types/xdg_shell/wlr_xdg_surface.c
+++ b/types/xdg_shell/wlr_xdg_surface.c
@@ -338,15 +338,15 @@ void handle_xdg_surface_commit(struct wlr_surface *wlr_surface) {
}
}
-void handle_xdg_surface_precommit(struct wlr_surface *wlr_surface) {
+void handle_xdg_surface_precommit(struct wlr_surface *wlr_surface,
+ const struct wlr_surface_state *state) {
struct wlr_xdg_surface *surface =
wlr_xdg_surface_from_wlr_surface(wlr_surface);
if (surface == NULL) {
return;
}
- if (wlr_surface->pending.committed & WLR_SURFACE_STATE_BUFFER &&
- wlr_surface->pending.buffer == NULL) {
+ if (state->committed & WLR_SURFACE_STATE_BUFFER && state->buffer == NULL) {
// This is a NULL commit
if (surface->configured && surface->mapped) {
unmap_xdg_surface(surface);
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index f0a010d9..0c199269 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -852,15 +852,15 @@ static void xwayland_surface_role_commit(struct wlr_surface *wlr_surface) {
}
}
-static void xwayland_surface_role_precommit(struct wlr_surface *wlr_surface) {
+static void xwayland_surface_role_precommit(struct wlr_surface *wlr_surface,
+ const struct wlr_surface_state *state) {
assert(wlr_surface->role == &xwayland_surface_role);
struct wlr_xwayland_surface *surface = wlr_surface->role_data;
if (surface == NULL) {
return;
}
- if (wlr_surface->pending.committed & WLR_SURFACE_STATE_BUFFER &&
- wlr_surface->pending.buffer == NULL) {
+ if (state->committed & WLR_SURFACE_STATE_BUFFER && state->buffer == NULL) {
// This is a NULL commit
if (surface->mapped) {
wlr_signal_emit_safe(&surface->events.unmap, surface);