use LayerSurface.mon when possible

main
Leonardo Hernández Hernández 2022-06-21 16:03:20 -05:00
parent 9b84940e37
commit c1578bc14d
No known key found for this signature in database
GPG Key ID: E538897EE11B9624
1 changed files with 8 additions and 8 deletions

16
dwl.c
View File

@ -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);
}