summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-09-10 23:44:19 -0500
committerLeonardo Hernández Hernández <leohdz172@protonmail.com>2022-09-10 23:44:19 -0500
commit77ba8e51276ce94515913091d669db21e856e8cd (patch)
treedafd7e93b47bae24f31c51e5bbdca339bed631a9
parentc50904666334375f50e69e3c030d6a7a67bf8c87 (diff)
use wl_container_of() instead of data in some functions
-rw-r--r--dwl.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/dwl.c b/dwl.c
index 24902bf..bcc0804 100644
--- a/dwl.c
+++ b/dwl.c
@@ -739,8 +739,7 @@ cleanup(void)
void
cleanupkeyboard(struct wl_listener *listener, void *data)
{
- struct wlr_input_device *device = data;
- Keyboard *kb = device->data;
+ Keyboard *kb = wl_container_of(listener, kb, destroy);
wl_list_remove(&kb->link);
wl_list_remove(&kb->modifiers.link);
@@ -752,14 +751,13 @@ cleanupkeyboard(struct wl_listener *listener, void *data)
void
cleanupmon(struct wl_listener *listener, void *data)
{
- struct wlr_output *wlr_output = data;
- Monitor *m = wlr_output->data;
+ Monitor *m = wl_container_of(listener, m, destroy);
int nmons, i = 0;
wl_list_remove(&m->destroy.link);
wl_list_remove(&m->frame.link);
wl_list_remove(&m->link);
- wlr_output->data = NULL;
+ m->wlr_output->data = NULL;
wlr_output_layout_remove(output_layout, m->wlr_output);
wlr_scene_output_destroy(m->scene_output);