aboutsummaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-06-21 16:03:20 -0500
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-06-21 16:03:20 -0500
commitc1578bc14db7822743ffdbde93b2c22b1a0b5f6a (patch)
tree86e266f26525ff3b5644a35308c9cf1675b5a1ab /dwl.c
parent9b84940e37ec84933d1247bbf3eb76d9efe7c589 (diff)
use LayerSurface.mon when possible
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c16
1 files 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);
}