aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/dwm/decoration.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/cmd/dwm/decoration.c')
-rw-r--r--sys/cmd/dwm/decoration.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/sys/cmd/dwm/decoration.c b/sys/cmd/dwm/decoration.c
new file mode 100644
index 0000000..af0dc5f
--- /dev/null
+++ b/sys/cmd/dwm/decoration.c
@@ -0,0 +1,52 @@
+#include "dwm.h"
+
+/* internal callbacks */
+static void mode(struct wl_listener *ev, void *arg);
+static void delete(struct wl_listener *ev, void *arg);
+
+// -----------------------------------------------------------------------
+// implementations
+
+void
+ev·newdecoration(struct wl_listener *ev, void *arg)
+{
+ struct wlr_server_decoration *wlr;
+ Deco *deco;
+
+ wlr = arg;
+
+ deco = calloc(1, sizeof(*deco));
+ if (!deco)
+ return;
+
+ deco->wlr = wlr;
+
+ wl_signal_add(&wlr->events.destroy, &deco->ev.free);
+ deco->ev.free.notify = delete;
+
+ wl_signal_add(&wlr->events.mode, &deco->ev.mode);
+ deco->ev.mode.notify = mode;
+
+ wl_list_insert(&dwm.decos, &deco->link);
+}
+
+static
+void
+delete(struct wl_listener *ev, void *arg)
+{
+ Deco *deco;
+
+ deco = wl_container_of(ev, deco, ev.free);
+
+ wl_list_remove(&deco->ev.free.link);
+ wl_list_remove(&deco->ev.mode.link);
+ wl_list_remove(&deco->link);
+ free(deco);
+}
+
+static
+void
+mode(struct wl_listener *ev, void *arg)
+{
+ /* no op */
+}