Revert "various improvements to layer surface"

see https://github.com/djpohly/dwl/issues/289#issuecomment-1231287114

This reverts commit 2260519740.
main
Leonardo Hernández Hernández 2022-08-31 16:05:19 -05:00
parent 2260519740
commit c017916d35
No known key found for this signature in database
GPG Key ID: E538897EE11B9624
1 changed files with 23 additions and 15 deletions

38
dwl.c
View File

@ -783,23 +783,25 @@ commitlayersurfacenotify(struct wl_listener *listener, void *data)
{ {
LayerSurface *layersurface = wl_container_of(listener, layersurface, surface_commit); LayerSurface *layersurface = wl_container_of(listener, layersurface, surface_commit);
struct wlr_layer_surface_v1 *wlr_layer_surface = layersurface->layer_surface; struct wlr_layer_surface_v1 *wlr_layer_surface = layersurface->layer_surface;
struct wlr_output *wlr_output = wlr_layer_surface->output;
if (!layersurface->mon) if (!wlr_output || !(layersurface->mon = wlr_output->data))
return; return;
if (layers[wlr_layer_surface->current.layer] != layersurface->scene) { wlr_scene_node_reparent(layersurface->scene,
wlr_scene_node_reparent(layersurface->scene, layers[wlr_layer_surface->current.layer]);
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 if (wlr_layer_surface->current.committed == 0
&& layersurface->mapped == wlr_layer_surface->mapped) && layersurface->mapped == wlr_layer_surface->mapped)
return; return;
layersurface->mapped = wlr_layer_surface->mapped; 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); arrangelayers(layersurface->mon);
} }
@ -866,13 +868,14 @@ createlayersurface(struct wl_listener *listener, void *data)
LayerSurface *layersurface; LayerSurface *layersurface;
struct wlr_layer_surface_v1_state old_state; 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; wlr_layer_surface->output = selmon->wlr_output;
}
layersurface = ecalloc(1, sizeof(LayerSurface)); layersurface = ecalloc(1, sizeof(LayerSurface));
layersurface->type = LayerShell; layersurface->type = LayerShell;
LISTEN(&wlr_layer_surface->surface->events.commit, LISTEN(&wlr_layer_surface->surface->events.commit,
&layersurface->surface_commit, commitlayersurfacenotify); &layersurface->surface_commit, commitlayersurfacenotify);
LISTEN(&wlr_layer_surface->events.destroy, &layersurface->destroy, LISTEN(&wlr_layer_surface->events.destroy, &layersurface->destroy,
destroylayersurfacenotify); destroylayersurfacenotify);
LISTEN(&wlr_layer_surface->events.map, &layersurface->map, LISTEN(&wlr_layer_surface->events.map, &layersurface->map,
@ -881,8 +884,8 @@ createlayersurface(struct wl_listener *listener, void *data)
unmaplayersurfacenotify); unmaplayersurfacenotify);
layersurface->layer_surface = wlr_layer_surface; layersurface->layer_surface = wlr_layer_surface;
layersurface->mon = wlr_layer_surface->output->data;
wlr_layer_surface->data = layersurface; wlr_layer_surface->data = layersurface;
layersurface->mon = wlr_layer_surface->output->data;
layersurface->scene = wlr_layer_surface->surface->data = layersurface->scene = wlr_layer_surface->surface->data =
wlr_scene_subsurface_tree_create(layers[wlr_layer_surface->pending.layer], wlr_scene_subsurface_tree_create(layers[wlr_layer_surface->pending.layer],
@ -1073,8 +1076,11 @@ destroylayersurfacenotify(struct wl_listener *listener, void *data)
wl_list_remove(&layersurface->unmap.link); wl_list_remove(&layersurface->unmap.link);
wl_list_remove(&layersurface->surface_commit.link); wl_list_remove(&layersurface->surface_commit.link);
wlr_scene_node_destroy(layersurface->scene); wlr_scene_node_destroy(layersurface->scene);
if (layersurface->mon) if (layersurface->layer_surface->output) {
arrangelayers(layersurface->mon); if ((layersurface->mon = layersurface->layer_surface->output->data))
arrangelayers(layersurface->mon);
layersurface->layer_surface->output = NULL;
}
free(layersurface); free(layersurface);
} }
@ -1374,8 +1380,10 @@ killclient(const Arg *arg)
void void
maplayersurfacenotify(struct wl_listener *listener, void *data) maplayersurfacenotify(struct wl_listener *listener, void *data)
{ {
LayerSurface *l = wl_container_of(listener, l, map); LayerSurface *layersurface = wl_container_of(listener, layersurface, map);
wlr_surface_send_enter(l->layer_surface->surface, l->mon->wlr_output); layersurface->mon = layersurface->layer_surface->output->data;
wlr_surface_send_enter(layersurface->layer_surface->surface,
layersurface->mon->wlr_output);
motionnotify(0); motionnotify(0);
} }