summaryrefslogtreecommitdiff
path: root/src/wlstate.cc
diff options
context:
space:
mode:
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,
};