Merge pull request #1127 from emersion/surface-precommit

surface: add wlr_surface_role.precommit
This commit is contained in:
Drew DeVault 2018-07-27 13:21:03 -04:00 committed by GitHub
commit f1b65b34a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 70 additions and 13 deletions

View file

@ -654,9 +654,27 @@ static void xwayland_surface_role_commit(struct wlr_surface *wlr_surface) {
}
}
static void xwayland_surface_role_precommit(struct wlr_surface *wlr_surface) {
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_resource == NULL) {
// This is a NULL commit
if (surface->mapped) {
wlr_signal_emit_safe(&surface->events.unmap, surface);
surface->mapped = false;
}
}
}
static const struct wlr_surface_role xwayland_surface_role = {
.name = "wlr_xwayland_surface",
.commit = xwayland_surface_role_commit,
.precommit = xwayland_surface_role_precommit,
};
static void handle_surface_destroy(struct wl_listener *listener, void *data) {