From bb177c6e2c4f70165405034b0d3355affde3c859 Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 4 Jan 2023 20:26:48 +0100 Subject: Implement first connection to Wayland compositor --- Makefile | 2 +- main.c | 13 +++++++++++-- 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 +#include -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; } -- cgit v1.2.3-70-g09d2