aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-07-23 04:58:37 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-07-23 05:17:21 +0000
commit69f56b86b7ad30a028917121783ea51e9fe9c3a3 (patch)
tree205770df84e2666ce3e3ca61a6c4aba1c144d623
parentspawn: add optional reaper callback, return pid_t (diff)
wayland: add wayl_activate()
wayl_activate() takes an XDG activation token and does an XDG activation request.
-rw-r--r--wayland.c15
-rw-r--r--wayland.h2
2 files changed, 15 insertions, 2 deletions
diff --git a/wayland.c b/wayland.c
index 04f50bda..3f65901b 100644
--- a/wayland.c
+++ b/wayland.c
@@ -1824,8 +1824,7 @@ wayl_win_init(struct terminal *term, const char *token)
wl_surface_commit(win->surface.surf);
/* Complete XDG startup notification */
- if (token && wayl->xdg_activation != NULL)
- xdg_activation_v1_activate(wayl->xdg_activation, token, win->surface.surf);
+ wayl_activate(wayl, win, token);
if (!wayl_win_subsurface_new(win, &win->overlay, false)) {
LOG_ERR("failed to create overlay surface");
@@ -2377,3 +2376,15 @@ wayl_get_activation_token(
xdg_activation_token_v1_commit(token);
return true;
}
+
+void
+wayl_activate(struct wayland *wayl, struct wl_window *win, const char *token)
+{
+ if (wayl->xdg_activation == NULL)
+ return;
+
+ if (token == NULL)
+ return;
+
+ xdg_activation_v1_activate(wayl->xdg_activation, token, win->surface.surf);
+}
diff --git a/wayland.h b/wayland.h
index 9db02d89..ca9c05fa 100644
--- a/wayland.h
+++ b/wayland.h
@@ -499,3 +499,5 @@ void wayl_win_subsurface_destroy(struct wayl_sub_surface *surf);
bool wayl_get_activation_token(
struct wayland *wayl, struct seat *seat, uint32_t serial,
struct wl_window *win, activation_token_cb_t cb, void *cb_data);
+void wayl_activate(struct wayland *wayl, struct wl_window *win, const char *token);
+