Line saver: follow "local = wlr->data = obj" pattern

There were still a couple of places where we could use this handy
multiple assignment to save a line.

ΔSLOC = -3
This commit is contained in:
Devin J. Pohly 2023-07-03 17:48:45 -05:00 committed by Leonardo Hernández
parent 9dd3f230c0
commit a01e402c5d

12
dwl.c
View file

@ -847,7 +847,7 @@ createlayersurface(struct wl_listener *listener, void *data)
return; return;
} }
layersurface = ecalloc(1, sizeof(LayerSurface)); layersurface = wlr_layer_surface->data = 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);
@ -860,8 +860,6 @@ createlayersurface(struct wl_listener *listener, void *data)
layersurface->layer_surface = wlr_layer_surface; layersurface->layer_surface = wlr_layer_surface;
layersurface->mon = wlr_layer_surface->output->data; layersurface->mon = wlr_layer_surface->output->data;
wlr_layer_surface->data = layersurface;
layersurface->scene_layer = wlr_scene_layer_surface_v1_create(l, wlr_layer_surface); layersurface->scene_layer = wlr_scene_layer_surface_v1_create(l, wlr_layer_surface);
layersurface->scene = layersurface->scene_layer->tree; layersurface->scene = layersurface->scene_layer->tree;
layersurface->popups = wlr_layer_surface->surface->data = wlr_scene_tree_create(l); layersurface->popups = wlr_layer_surface->surface->data = wlr_scene_tree_create(l);
@ -1497,13 +1495,12 @@ locksession(struct wl_listener *listener, void *data)
wlr_session_lock_v1_destroy(session_lock); wlr_session_lock_v1_destroy(session_lock);
return; return;
} }
lock = ecalloc(1, sizeof(*lock)); lock = session_lock->data = ecalloc(1, sizeof(*lock));
focusclient(NULL, 0); focusclient(NULL, 0);
lock->scene = wlr_scene_tree_create(layers[LyrBlock]); lock->scene = wlr_scene_tree_create(layers[LyrBlock]);
cur_lock = lock->lock = session_lock; cur_lock = lock->lock = session_lock;
locked = 1; locked = 1;
session_lock->data = lock;
LISTEN(&session_lock->events.new_surface, &lock->new_surface, createlocksurface); LISTEN(&session_lock->events.new_surface, &lock->new_surface, createlocksurface);
LISTEN(&session_lock->events.destroy, &lock->destroy, destroysessionlock); LISTEN(&session_lock->events.destroy, &lock->destroy, destroysessionlock);
@ -1529,12 +1526,11 @@ mapnotify(struct wl_listener *listener, void *data)
int i; int i;
/* Create scene tree for this client and its border */ /* Create scene tree for this client and its border */
c->scene = wlr_scene_tree_create(layers[LyrTile]); c->scene = client_surface(c)->data = wlr_scene_tree_create(layers[LyrTile]);
wlr_scene_node_set_enabled(&c->scene->node, c->type != XDGShell); wlr_scene_node_set_enabled(&c->scene->node, c->type != XDGShell);
c->scene_surface = c->type == XDGShell c->scene_surface = c->type == XDGShell
? wlr_scene_xdg_surface_create(c->scene, c->surface.xdg) ? wlr_scene_xdg_surface_create(c->scene, c->surface.xdg)
: wlr_scene_subsurface_tree_create(c->scene, client_surface(c)); : wlr_scene_subsurface_tree_create(c->scene, client_surface(c));
client_surface(c)->data = c->scene;
c->scene->node.data = c->scene_surface->node.data = c; c->scene->node.data = c->scene_surface->node.data = c;
/* Handle unmanaged clients first so we can return prior create borders */ /* Handle unmanaged clients first so we can return prior create borders */
@ -2393,7 +2389,7 @@ startdrag(struct wl_listener *listener, void *data)
if (!drag->icon) if (!drag->icon)
return; return;
drag->icon->data = icon = wlr_scene_drag_icon_create(&scene->tree, drag->icon); icon = drag->icon->data = wlr_scene_drag_icon_create(&scene->tree, drag->icon);
wlr_scene_node_place_below(&icon->node, &layers[LyrBlock]->node); wlr_scene_node_place_below(&icon->node, &layers[LyrBlock]->node);
motionnotify(0); motionnotify(0);
wl_signal_add(&drag->icon->events.destroy, &drag_icon_destroy); wl_signal_add(&drag->icon->events.destroy, &drag_icon_destroy);