Finish 5.1 part
This commit is contained in:
parent
d441d856d7
commit
67c20d47dd
2 changed files with 28 additions and 1 deletions
|
@ -24,5 +24,5 @@ ninja -C build
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./build/wayland_test_client
|
WAYLAND_DISPLAY=wayland-1 ./build/wayland_test_client
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,6 +1,28 @@
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
|
|
||||||
|
static void
|
||||||
|
registry_handle_global(void *data, struct wl_registry *registry,
|
||||||
|
uint32_t name, const char *interface, uint32_t version)
|
||||||
|
{
|
||||||
|
printf("interface: '%s', version: %d, name: %d\n",
|
||||||
|
interface, version, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
registry_handle_global_remove(void *data, struct wl_registry *registry,
|
||||||
|
uint32_t name)
|
||||||
|
{
|
||||||
|
// This space deliberately left blank
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct wl_registry_listener
|
||||||
|
registry_listener = {
|
||||||
|
.global = registry_handle_global,
|
||||||
|
.global_remove = registry_handle_global_remove,
|
||||||
|
};
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct wl_display *display = wl_display_connect(NULL);
|
struct wl_display *display = wl_display_connect(NULL);
|
||||||
|
@ -8,6 +30,11 @@ int main(int argc, char *argv[])
|
||||||
fprintf(stderr, "Failed to connect to Wayland display.\n");
|
fprintf(stderr, "Failed to connect to Wayland display.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wl_registry *registry = wl_display_get_registry(display);
|
||||||
|
wl_registry_add_listener(registry, ®istry_listener, NULL);
|
||||||
|
wl_display_roundtrip(display);
|
||||||
|
|
||||||
fprintf(stderr, "Connection established!\n");
|
fprintf(stderr, "Connection established!\n");
|
||||||
|
|
||||||
while (wl_display_dispatch(display) != -1) {
|
while (wl_display_dispatch(display) != -1) {
|
||||||
|
|
Loading…
Reference in a new issue