summaryrefslogtreecommitdiff
path: root/src/wlstate.cc
diff options
context:
space:
mode:
authorFabrice <fabrice@schaub-dev.xyz>2026-02-10 09:32:35 +0100
committerFabrice <fabrice@schaub-dev.xyz>2026-02-10 09:32:35 +0100
commitccab86b21825ebc41f0887ea633ea28906b32a8e (patch)
tree60f378c3629c139f412d41a85142d1b48518e54f /src/wlstate.cc
parent86c09e193ed66420da48a7fd62678286b89dace2 (diff)
adding vector and eventloop implementation
Diffstat (limited to 'src/wlstate.cc')
-rw-r--r--src/wlstate.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/wlstate.cc b/src/wlstate.cc
index 4b1a65f..68846fb 100644
--- a/src/wlstate.cc
+++ b/src/wlstate.cc
@@ -47,8 +47,9 @@ static void wayc_registry_add(void *data, struct wl_registry *registry,
static void wayc_registry_remove(void *data, struct wl_registry *registry,
u32 name) {
- wayc_assert(data != NULL);
- wayc_assert(registry != NULL);
+ wayc_notnull(data);
+ wayc_notnull(registry);
+
wayc_panic("Registry global removed: name=%u", name);
}
@@ -58,7 +59,7 @@ static struct wl_registry_listener WAYC_REGISTRY_LISTENER = {
};
bool wayc_wlstate_init(struct wlstate_s *state) {
- wayc_assert(state != NULL);
+ wayc_notnull(state);
wl_display_t display = wl_display_connect(NULL);
if (display == NULL)
@@ -87,16 +88,24 @@ bool wayc_wlstate_init(struct wlstate_s *state) {
}
void wayc_wlstate_deinit(struct wlstate_s *state) {
- wayc_assert(state != NULL);
+ wayc_notnull(state);
+
+ if (state->display == nullptr)
+ return;
wl_display_disconnect(state->display);
+ state->display = nullptr;
+ state->registry = nullptr;
+ state->compositor = nullptr;
+ state->wm_base = nullptr;
+ state->eventfd = -1;
}
void wayc_wlstate_update(struct wlstate_s *state) {
- wayc_assert(state != NULL);
+ wayc_notnull(state);
struct pollfd pfd = {
- (i32)state->eventfd,
+ state->eventfd,
POLLIN,
0,
};