mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 21:05:58 +01:00
layer-shell: track surface init state
This commit is contained in:
parent
f750c7445d
commit
d8515b3446
2 changed files with 17 additions and 0 deletions
|
@ -88,6 +88,11 @@ struct wlr_layer_surface_v1 {
|
||||||
|
|
||||||
struct wlr_layer_surface_v1_state current, pending;
|
struct wlr_layer_surface_v1_state current, pending;
|
||||||
|
|
||||||
|
// Whether the surface is ready to receive configure events
|
||||||
|
bool initialized;
|
||||||
|
// Whether the latest commit is an initial commit
|
||||||
|
bool initial_commit;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
/**
|
/**
|
||||||
* The destroy signal indicates that the struct wlr_layer_surface is
|
* The destroy signal indicates that the struct wlr_layer_surface is
|
||||||
|
|
|
@ -33,6 +33,7 @@ static void layer_surface_configure_destroy(
|
||||||
|
|
||||||
static void layer_surface_reset(struct wlr_layer_surface_v1 *surface) {
|
static void layer_surface_reset(struct wlr_layer_surface_v1 *surface) {
|
||||||
surface->configured = false;
|
surface->configured = false;
|
||||||
|
surface->initialized = false;
|
||||||
|
|
||||||
struct wlr_xdg_popup *popup, *popup_tmp;
|
struct wlr_xdg_popup *popup, *popup_tmp;
|
||||||
wl_list_for_each_safe(popup, popup_tmp, &surface->popups, link) {
|
wl_list_for_each_safe(popup, popup_tmp, &surface->popups, link) {
|
||||||
|
@ -290,6 +291,11 @@ static const struct zwlr_layer_surface_v1_interface layer_surface_implementation
|
||||||
|
|
||||||
uint32_t wlr_layer_surface_v1_configure(struct wlr_layer_surface_v1 *surface,
|
uint32_t wlr_layer_surface_v1_configure(struct wlr_layer_surface_v1 *surface,
|
||||||
uint32_t width, uint32_t height) {
|
uint32_t width, uint32_t height) {
|
||||||
|
if (!surface->initialized) {
|
||||||
|
wlr_log(WLR_ERROR, "A configure is sent to an uninitialized wlr_layer_surface_v1 %p",
|
||||||
|
surface);
|
||||||
|
}
|
||||||
|
|
||||||
struct wl_display *display =
|
struct wl_display *display =
|
||||||
wl_client_get_display(wl_resource_get_client(surface->resource));
|
wl_client_get_display(wl_resource_get_client(surface->resource));
|
||||||
struct wlr_layer_surface_v1_configure *configure = calloc(1, sizeof(*configure));
|
struct wlr_layer_surface_v1_configure *configure = calloc(1, sizeof(*configure));
|
||||||
|
@ -351,6 +357,12 @@ static void layer_surface_role_commit(struct wlr_surface *wlr_surface) {
|
||||||
|
|
||||||
if (surface->surface->unmap_commit) {
|
if (surface->surface->unmap_commit) {
|
||||||
layer_surface_reset(surface);
|
layer_surface_reset(surface);
|
||||||
|
|
||||||
|
assert(!surface->initialized);
|
||||||
|
surface->initial_commit = false;
|
||||||
|
} else {
|
||||||
|
surface->initial_commit = !surface->initialized;
|
||||||
|
surface->initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->current = surface->pending;
|
surface->current = surface->pending;
|
||||||
|
|
Loading…
Reference in a new issue