inline unmaplayersurface() into unmaplayersurfacenotify()

unmap signal is guaranted to be emitted before destroy signal
so is useless checking if it is mapped at destroy
This commit is contained in:
Leonardo Hernández Hernández 2022-06-24 15:36:13 -05:00
parent 549335ae54
commit 2aa391361c
Failed to generate hash of commit

14
dwl.c
View file

@ -283,7 +283,6 @@ static void togglefloating(const Arg *arg);
static void togglefullscreen(const Arg *arg); static void togglefullscreen(const Arg *arg);
static void toggletag(const Arg *arg); static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg); static void toggleview(const Arg *arg);
static void unmaplayersurface(LayerSurface *layersurface);
static void unmaplayersurfacenotify(struct wl_listener *listener, void *data); static void unmaplayersurfacenotify(struct wl_listener *listener, void *data);
static void unmapnotify(struct wl_listener *listener, void *data); static void unmapnotify(struct wl_listener *listener, void *data);
static void updatemons(struct wl_listener *listener, void *data); static void updatemons(struct wl_listener *listener, void *data);
@ -1050,8 +1049,6 @@ destroylayersurfacenotify(struct wl_listener *listener, void *data)
{ {
LayerSurface *layersurface = wl_container_of(listener, layersurface, destroy); LayerSurface *layersurface = wl_container_of(listener, layersurface, destroy);
if (layersurface->layer_surface->mapped)
unmaplayersurface(layersurface);
wl_list_remove(&layersurface->link); wl_list_remove(&layersurface->link);
wl_list_remove(&layersurface->destroy.link); wl_list_remove(&layersurface->destroy.link);
wl_list_remove(&layersurface->map.link); wl_list_remove(&layersurface->map.link);
@ -2245,8 +2242,10 @@ toggleview(const Arg *arg)
} }
void void
unmaplayersurface(LayerSurface *layersurface) unmaplayersurfacenotify(struct wl_listener *listener, void *data)
{ {
LayerSurface *layersurface = wl_container_of(listener, layersurface, unmap);
layersurface->layer_surface->mapped = (layersurface->mapped = 0); layersurface->layer_surface->mapped = (layersurface->mapped = 0);
wlr_scene_node_set_enabled(layersurface->scene, 0); wlr_scene_node_set_enabled(layersurface->scene, 0);
if (layersurface->layer_surface->surface == if (layersurface->layer_surface->surface ==
@ -2255,13 +2254,6 @@ unmaplayersurface(LayerSurface *layersurface)
motionnotify(0); motionnotify(0);
} }
void
unmaplayersurfacenotify(struct wl_listener *listener, void *data)
{
LayerSurface *layersurface = wl_container_of(listener, layersurface, unmap);
unmaplayersurface(layersurface);
}
void void
unmapnotify(struct wl_listener *listener, void *data) unmapnotify(struct wl_listener *listener, void *data)
{ {