diff options
author | Ronan Pigott <rpigott@berkeley.edu> | 2021-10-25 23:31:48 -0700 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-10-31 10:33:14 +0100 |
commit | 8e225261f0eed9f992c77476a05832ff6f2f865d (patch) | |
tree | 759a3146c895607659b1418fced8dd79a83926af /backend | |
parent | e2aff8a9b0c2852931a80b615a3aa367d954c8da (diff) |
backend/wayland: use xdga client activation
Diffstat (limited to 'backend')
-rw-r--r-- | backend/wayland/backend.c | 11 | ||||
-rw-r--r-- | backend/wayland/meson.build | 1 | ||||
-rw-r--r-- | backend/wayland/output.c | 7 |
3 files changed, 19 insertions, 0 deletions
diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index 1ba62e67..ea216511 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -24,6 +24,7 @@ #include "linux-dmabuf-unstable-v1-client-protocol.h" #include "pointer-gestures-unstable-v1-client-protocol.h" #include "presentation-time-client-protocol.h" +#include "xdg-activation-v1-client-protocol.h" #include "xdg-decoration-unstable-v1-client-protocol.h" #include "xdg-shell-client-protocol.h" #include "tablet-unstable-v2-client-protocol.h" @@ -244,6 +245,9 @@ static void registry_global(void *data, struct wl_registry *registry, } else if (strcmp(iface, wl_shm_interface.name) == 0) { wl->shm = wl_registry_bind(registry, name, &wl_shm_interface, 1); wl_shm_add_listener(wl->shm, &shm_listener, wl); + } else if (strcmp(iface, xdg_activation_v1_interface.name) == 0) { + wl->activation_v1 = wl_registry_bind(registry, name, + &xdg_activation_v1_interface, 1); } } @@ -339,6 +343,7 @@ static void backend_destroy(struct wlr_backend *backend) { zwp_relative_pointer_manager_v1_destroy(wl->zwp_relative_pointer_manager_v1); } free(wl->drm_render_name); + free(wl->activation_token); xdg_wm_base_destroy(wl->xdg_wm_base); wl_compositor_destroy(wl->compositor); wl_registry_destroy(wl->registry); @@ -445,6 +450,12 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display, wl->local_display_destroy.notify = handle_display_destroy; wl_display_add_destroy_listener(display, &wl->local_display_destroy); + const char *token = getenv("XDG_ACTIVATION_TOKEN"); + if (token != NULL) { + wl->activation_token = strdup(token); + unsetenv("XDG_ACTIVATION_TOKEN"); + } + return &wl->backend; error_remote_display_src: diff --git a/backend/wayland/meson.build b/backend/wayland/meson.build index 85b5d697..ebe31529 100644 --- a/backend/wayland/meson.build +++ b/backend/wayland/meson.build @@ -12,6 +12,7 @@ client_protos = [ 'presentation-time', 'relative-pointer-unstable-v1', 'tablet-unstable-v2', + 'xdg-activation-v1', 'xdg-decoration-unstable-v1', 'xdg-shell', ] diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 4d9ef56e..8d8f036c 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -23,6 +23,7 @@ #include "linux-dmabuf-unstable-v1-client-protocol.h" #include "presentation-time-client-protocol.h" +#include "xdg-activation-v1-client-protocol.h" #include "xdg-decoration-unstable-v1-client-protocol.h" #include "xdg-shell-client-protocol.h" @@ -594,6 +595,12 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *wlr_backend) { } } + // TODO: let the compositor do this bit + if (backend->activation_v1 && backend->activation_token) { + xdg_activation_v1_activate(backend->activation_v1, + backend->activation_token, output->surface); + } + // Start the rendering loop by requesting the compositor to render a frame wlr_output_schedule_frame(wlr_output); |