Skip to content

Commit 5041d26

Browse files
userland: add test wayland client
Signed-off-by: Andy-Python-Programmer <[email protected]>
1 parent feb9dee commit 5041d26

File tree

4 files changed

+34
-1
lines changed

4 files changed

+34
-1
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ bx_enh_dbg.ini
1818

1919
# Remove doom port related files:
2020
base-files/doom1.wad
21+
22+
# Wayland test client and server executables: (todo: remove these)
23+
base-files/client
24+
base-files/server

base-files/server.exe

-5.78 KB
Binary file not shown.

userland/client.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// simple wayland test client
2+
//
3+
// ```sh
4+
// sysroot/tools/host-gcc/bin/x86_64-aero-gcc client.c -lwayland-client -o
5+
// ../base-files/client
6+
// ```
7+
8+
#include <errno.h>
9+
#include <stdio.h>
10+
#include <string.h>
11+
#include <wayland-client.h>
12+
13+
void bail(char *msg) {
14+
fprintf(stderr, "%s (error=%s)\n", msg, strerror(errno));
15+
}
16+
17+
int main(int argc, char *argv[]) {
18+
struct wl_display *display = wl_display_connect(NULL);
19+
20+
if (!display) {
21+
bail("client: failed to connect to Wayland display.\n");
22+
return 1;
23+
}
24+
25+
fprintf(stderr, "connection established!\n");
26+
27+
wl_display_disconnect(display);
28+
return 0;
29+
}

userland/server.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// ```sh
44
// sysroot/tools/host-gcc/bin/x86_64-aero-gcc server.c -lwayland-server -o
5-
// ../base-files/server.exe
5+
// ../base-files/server
66
// ```
77

88
#include <errno.h>

0 commit comments

Comments
 (0)