aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/wayland/backend.c11
-rw-r--r--backend/wayland/meson.build1
-rw-r--r--backend/wayland/output.c7
-rw-r--r--include/backend/wayland.h2
4 files changed, 21 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);
diff --git a/include/backend/wayland.h b/include/backend/wayland.h
index ac151267..3235494d 100644
--- a/include/backend/wayland.h
+++ b/include/backend/wayland.h
@@ -24,6 +24,7 @@ struct wlr_wl_backend {
size_t requested_outputs;
size_t last_output_num;
struct wl_listener local_display_destroy;
+ char *activation_token;
/* remote state */
struct wl_display *remote_display;
@@ -42,6 +43,7 @@ struct wlr_wl_backend {
struct wlr_drm_format_set shm_formats;
struct wlr_drm_format_set linux_dmabuf_v1_formats;
struct wl_drm *legacy_drm;
+ struct xdg_activation_v1 *activation_v1;
char *drm_render_name;
};