summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-01-04 20:26:48 +0100
committerxengineering <me@xengineering.eu>2023-01-06 14:22:53 +0100
commitbb177c6e2c4f70165405034b0d3355affde3c859 (patch)
tree4ebe5a1f88b6466d37a59417fa1bcd5f6d2ad8e4
parent29af5d65bc753adf3edad3028c7473124a0b000d (diff)
downloadphonelock-bb177c6e2c4f70165405034b0d3355affde3c859.tar
phonelock-bb177c6e2c4f70165405034b0d3355affde3c859.tar.zst
phonelock-bb177c6e2c4f70165405034b0d3355affde3c859.zip
Implement first connection to Wayland compositor
-rw-r--r--Makefile2
-rw-r--r--main.c13
2 files changed, 12 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index da9db8c..d56dc56 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
all: build/phonelock
build/phonelock: build main.c wayland-client.h wayland-protocol.c
- gcc -Wall -o build/phonelock main.c
+ gcc -Wall -o build/phonelock main.c -lwayland-client
build:
mkdir -p build
diff --git a/main.c b/main.c
index 5663924..1bbc885 100644
--- a/main.c
+++ b/main.c
@@ -1,9 +1,18 @@
#include <stdio.h>
+#include <wayland-client.h>
-int main(void) {
- printf("Hello world!\n");
+int main(void)
+{
+ struct wl_display *display = wl_display_connect(NULL);
+ if (!display) {
+ fprintf(stderr, "Failed to connect to Wayland display.\n");
+ return 1;
+ }
+ fprintf(stderr, "Connection established!\n");
+
+ wl_display_disconnect(display);
return 0;
}