|
40 | 40 | #include "text-input-unstable-v3.h" |
41 | 41 | #include "linux-dmabuf-unstable-v1.h" |
42 | 42 | #include "presentation-time.h" |
| 43 | +#include "xdg-activation-v1.h" |
43 | 44 | #include "xdg-decoration-unstable-v1.h" |
44 | 45 | #include "xdg-shell.h" |
45 | 46 | #include "viewporter.h" |
@@ -1897,6 +1898,11 @@ static void registry_handle_add(void *data, struct wl_registry *reg, uint32_t id |
1897 | 1898 | xx_color_manager_v4_add_listener(wl->color_manager, &color_manager_listener, wl); |
1898 | 1899 | } |
1899 | 1900 |
|
| 1901 | + if (!strcmp(interface, xdg_activation_v1_interface.name) && found++) { |
| 1902 | + ver = 1; |
| 1903 | + wl->xdg_activation = wl_registry_bind(reg, id, &xdg_activation_v1_interface, ver); |
| 1904 | + } |
| 1905 | + |
1900 | 1906 | if (!strcmp(interface, zxdg_decoration_manager_v1_interface.name) && found++) { |
1901 | 1907 | ver = 1; |
1902 | 1908 | wl->xdg_decoration_manager = wl_registry_bind(reg, id, &zxdg_decoration_manager_v1_interface, ver); |
@@ -2087,6 +2093,16 @@ static bool create_input(struct vo_wayland_state *wl) |
2087 | 2093 | return 0; |
2088 | 2094 | } |
2089 | 2095 |
|
| 2096 | +static void xdg_activate(struct vo_wayland_state *wl) |
| 2097 | +{ |
| 2098 | + const char *token = getenv("XDG_ACTIVATION_TOKEN"); |
| 2099 | + if (token) { |
| 2100 | + MP_VERBOSE(wl, "Activating window with token: '%s'\n", token); |
| 2101 | + xdg_activation_v1_activate(wl->xdg_activation, token, wl->surface); |
| 2102 | + unsetenv("XDG_ACTIVATION_TOKEN"); |
| 2103 | + } |
| 2104 | +} |
| 2105 | + |
2090 | 2106 | static int create_viewports(struct vo_wayland_state *wl) |
2091 | 2107 | { |
2092 | 2108 | wl->viewport = wp_viewporter_get_viewport(wl->viewporter, wl->surface); |
@@ -3173,6 +3189,13 @@ bool vo_wayland_init(struct vo *vo) |
3173 | 3189 | if (create_xdg_surface(wl)) |
3174 | 3190 | goto err; |
3175 | 3191 |
|
| 3192 | + if (wl->xdg_activation) { |
| 3193 | + xdg_activate(wl); |
| 3194 | + } else { |
| 3195 | + MP_VERBOSE(wl, "Compositor doesn't support the %s protocol!\n", |
| 3196 | + xdg_activation_v1_interface.name); |
| 3197 | + } |
| 3198 | + |
3176 | 3199 | if (wl->subcompositor) { |
3177 | 3200 | wl->osd_subsurface = wl_subcompositor_get_subsurface(wl->subcompositor, wl->osd_surface, wl->video_surface); |
3178 | 3201 | wl->video_subsurface = wl_subcompositor_get_subsurface(wl->subcompositor, wl->video_surface, wl->surface); |
@@ -3472,6 +3495,9 @@ void vo_wayland_uninit(struct vo *vo) |
3472 | 3495 | if (wl->wm_base) |
3473 | 3496 | xdg_wm_base_destroy(wl->wm_base); |
3474 | 3497 |
|
| 3498 | + if (wl->xdg_activation) |
| 3499 | + xdg_activation_v1_destroy(wl->xdg_activation); |
| 3500 | + |
3475 | 3501 | if (wl->xdg_decoration_manager) |
3476 | 3502 | zxdg_decoration_manager_v1_destroy(wl->xdg_decoration_manager); |
3477 | 3503 |
|
|
0 commit comments