]> git.mdlowis.com Git - proto/labwc.git/commit
ssd: unify struct ssd_part with struct node_descriptor
authorJohn Lindgren <john@jlindgren.net>
Wed, 3 Sep 2025 09:32:44 +0000 (05:32 -0400)
committerJohn Lindgren <john@jlindgren.net>
Sat, 6 Sep 2025 20:00:20 +0000 (16:00 -0400)
commitf12957177923153c2f611814abb5a8bd32270eaa
treeff40599dc2ebc8491a39e1129e559f5bf207d72d
parentba426e2271771dd95528aa93511143a3aabfa31d
ssd: unify struct ssd_part with struct node_descriptor

struct ssd_part and struct node_descriptor seem to have essentially the
same purpose: tag a wlr_scene_node with some extra data indicating what
we're using it for.

Also, as with enum ssd_part_type (now lab_node_type), ssd_part is used
for several types of nodes that are not part of SSD.

So instead of the current chaining (node_descriptor -> ssd_part), let's
flatten/unify the two structs.

In detail:

- First, merge node_descriptor_type into lab_node_type.
- Add a separate view pointer in node_descriptor, since in the case of
  SSD buttons we need separate view and button data pointers.
- Rename ssd_part_button to simply ssd_button. It no longer contains
  an ssd_part as base.
- Add node_try_ssd_button_from_node() which replaces
  node_ssd_part_from_node() + button_try_from_ssd_part().
- Factor out ssd_button_free() to be called in node descriptor destroy.
- Finally, get_cursor_context() needs a little reorganization to handle
  the unified structs.

Overall, this simplifies the code a bit, and in my opinion makes it
easier to understand. No functional change intended.
22 files changed:
include/common/node-type.h
include/labwc.h
include/node.h
include/ssd-internal.h
include/ssd.h
src/desktop.c
src/edges.c
src/input/cursor.c
src/input/ime.c
src/layers.c
src/menu/menu.c
src/node.c
src/output.c
src/scaled-buffer/scaled-buffer.c
src/session-lock.c
src/ssd/meson.build
src/ssd/ssd-button.c [moved from src/ssd/ssd-part.c with 61% similarity]
src/ssd/ssd-titlebar.c
src/ssd/ssd.c
src/xdg-popup.c
src/xdg.c
src/xwayland.c