From c1578bc14db7822743ffdbde93b2c22b1a0b5f6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Tue, 21 Jun 2022 16:03:20 -0500 Subject: use LayerSurface.mon when possible --- dwl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dwl.c b/dwl.c index 0eb8fdb..3ccf9bc 100644 --- a/dwl.c +++ b/dwl.c @@ -759,14 +759,13 @@ commitlayersurfacenotify(struct wl_listener *listener, void *data) LayerSurface *layersurface = wl_container_of(listener, layersurface, surface_commit); struct wlr_layer_surface_v1 *wlr_layer_surface = layersurface->layer_surface; struct wlr_output *wlr_output = wlr_layer_surface->output; - Monitor *m; + + if (!wlr_output || !(layersurface->mon = wlr_output->data)) + return; wlr_scene_node_reparent(layersurface->scene, layers[wlr_layer_surface->current.layer]); - if (!wlr_output || !(m = wlr_output->data)) - return; - if (wlr_layer_surface->current.committed == 0 && layersurface->mapped == wlr_layer_surface->mapped) return; @@ -775,10 +774,10 @@ commitlayersurfacenotify(struct wl_listener *listener, void *data) if (layers[wlr_layer_surface->current.layer] != layersurface->scene) { wl_list_remove(&layersurface->link); - wl_list_insert(&m->layers[wlr_layer_surface->current.layer], + wl_list_insert(&layersurface->mon->layers[wlr_layer_surface->current.layer], &layersurface->link); } - arrangelayers(m); + arrangelayers(layersurface->mon); } void @@ -1055,7 +1054,7 @@ destroylayersurfacenotify(struct wl_listener *listener, void *data) wl_list_remove(&layersurface->surface_commit.link); wlr_scene_node_destroy(layersurface->scene); if (layersurface->layer_surface->output) { - if (layersurface->mon) + if ((layersurface->mon = layersurface->layer_surface->output->data)) arrangelayers(layersurface->mon); layersurface->layer_surface->output = NULL; } @@ -1361,8 +1360,9 @@ void maplayersurfacenotify(struct wl_listener *listener, void *data) { LayerSurface *layersurface = wl_container_of(listener, layersurface, map); + layersurface->mon = layersurface->layer_surface->output->data; wlr_surface_send_enter(layersurface->layer_surface->surface, - layersurface->layer_surface->output); + layersurface->mon->wlr_output); motionnotify(0); } -- cgit v1.2.3