From ed838b50b657ed64e0915d93ae84f5e1a0533c61 Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Tue, 7 Jan 2025 04:17:54 +0100 Subject: [PATCH] A few fixes --- Makefile | 2 +- unlocker.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 173b16c..e31a0fb 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ CFLAGS:=-lwayland LDFLAGS:=-lwayland-client wl_unlocker: unlocker.o session-lock.o - gcc $(LDFLAGS) unlocker.o session-lock.o -o wl_unlocker + gcc -o wl_unlocker unlocker.o session-lock.o $(LDFLAGS) unlocker.o: unlocker.c session-lock.h diff --git a/unlocker.c b/unlocker.c index de8f8f2..3dfbbeb 100644 --- a/unlocker.c +++ b/unlocker.c @@ -52,6 +52,10 @@ static void lock_finished_handler(void * data, struct ext_session_lock_v1 * lock int main(void) { // get wl_display, the core object wl = wl_display_connect(NULL); + if (wl == NULL) { + fprintf(stderr, "Cannot connect to compositor, no wayland?\n"); + return 1; + } // prepare listeners for wl_registry.global struct wl_registry_listener reg_listener = { @@ -89,7 +93,7 @@ int main(void) { fprintf(stderr, "BUG!\n"); return 1; } else if (lock_state == FINISHED) { - printf("Not locked.\n"); + printf("Cannot get lock – either another lock is running or not lockable.\n"); // nothing to do, just destroy stuff ext_session_lock_v1_destroy(lock); } else if (lock_state == LOCKED) {