diff options
author | Leonardo Hernández Hernández <leohdz172@protonmail.com> | 2022-07-24 17:18:44 -0500 |
---|---|---|
committer | Leonardo Hernández <leohdz172@protonmail.com> | 2022-08-29 21:32:59 -0500 |
commit | 226051974060746d02d787ac1ef70b6267ee51b4 (patch) | |
tree | 71013abbd802abb9e1961c7e4d0a7a5abe3157b7 | |
parent | 0e993b5fb1820189b78bed9fc2eb642230b47a58 (diff) |
various improvements to layer surface
- remove various useless assignments of layersurface->mon
- styles changes
- do not set wlr_layer_surface->output to NULL at destroy
-rw-r--r-- | dwl.c | 38 |
1 files changed, 15 insertions, 23 deletions
@@ -783,25 +783,23 @@ 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; - if (!wlr_output || !(layersurface->mon = wlr_output->data)) + if (!layersurface->mon) return; - wlr_scene_node_reparent(layersurface->scene, - layers[wlr_layer_surface->current.layer]); + if (layers[wlr_layer_surface->current.layer] != layersurface->scene) { + wlr_scene_node_reparent(layersurface->scene, + layers[wlr_layer_surface->current.layer]); + wl_list_remove(&layersurface->link); + wl_list_insert(&layersurface->mon->layers[wlr_layer_surface->current.layer], + &layersurface->link); + } if (wlr_layer_surface->current.committed == 0 && layersurface->mapped == wlr_layer_surface->mapped) return; - layersurface->mapped = wlr_layer_surface->mapped; - if (layers[wlr_layer_surface->current.layer] != layersurface->scene) { - wl_list_remove(&layersurface->link); - wl_list_insert(&layersurface->mon->layers[wlr_layer_surface->current.layer], - &layersurface->link); - } arrangelayers(layersurface->mon); } @@ -868,14 +866,13 @@ createlayersurface(struct wl_listener *listener, void *data) LayerSurface *layersurface; struct wlr_layer_surface_v1_state old_state; - if (!wlr_layer_surface->output) { + if (!wlr_layer_surface->output) wlr_layer_surface->output = selmon->wlr_output; - } layersurface = ecalloc(1, sizeof(LayerSurface)); layersurface->type = LayerShell; LISTEN(&wlr_layer_surface->surface->events.commit, - &layersurface->surface_commit, commitlayersurfacenotify); + &layersurface->surface_commit, commitlayersurfacenotify); LISTEN(&wlr_layer_surface->events.destroy, &layersurface->destroy, destroylayersurfacenotify); LISTEN(&wlr_layer_surface->events.map, &layersurface->map, @@ -884,8 +881,8 @@ createlayersurface(struct wl_listener *listener, void *data) unmaplayersurfacenotify); layersurface->layer_surface = wlr_layer_surface; - wlr_layer_surface->data = layersurface; layersurface->mon = wlr_layer_surface->output->data; + wlr_layer_surface->data = layersurface; layersurface->scene = wlr_layer_surface->surface->data = wlr_scene_subsurface_tree_create(layers[wlr_layer_surface->pending.layer], @@ -1076,11 +1073,8 @@ destroylayersurfacenotify(struct wl_listener *listener, void *data) wl_list_remove(&layersurface->unmap.link); wl_list_remove(&layersurface->surface_commit.link); wlr_scene_node_destroy(layersurface->scene); - if (layersurface->layer_surface->output) { - if ((layersurface->mon = layersurface->layer_surface->output->data)) - arrangelayers(layersurface->mon); - layersurface->layer_surface->output = NULL; - } + if (layersurface->mon) + arrangelayers(layersurface->mon); free(layersurface); } @@ -1380,10 +1374,8 @@ killclient(const Arg *arg) 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->mon->wlr_output); + LayerSurface *l = wl_container_of(listener, l, map); + wlr_surface_send_enter(l->layer_surface->surface, l->mon->wlr_output); motionnotify(0); } |