diff --git a/meson.build b/meson.build index d31202d3..c6a9228d 100644 --- a/meson.build +++ b/meson.build @@ -152,15 +152,9 @@ wl_proto_xml = [ wayland_protocols_datadir + '/unstable/primary-selection/primary-selection-unstable-v1.xml', wayland_protocols_datadir + '/stable/presentation-time/presentation-time.xml', wayland_protocols_datadir + '/unstable/text-input/text-input-unstable-v3.xml', + wayland_protocols_datadir + '/staging/xdg-activation/xdg-activation-v1.xml', ] -if wayland_protocols.version().version_compare('>=1.21') - add_project_arguments('-DHAVE_XDG_ACTIVATION', language: 'c') - wl_proto_xml += [wayland_protocols_datadir + '/staging/xdg-activation/xdg-activation-v1.xml'] - xdg_activation = true -else - xdg_activation = false -endif if wayland_protocols.version().version_compare('>=1.31') add_project_arguments('-DHAVE_FRACTIONAL_SCALE', language: 'c') wl_proto_xml += [wayland_protocols_datadir + '/stable/viewporter/viewporter.xml'] @@ -394,7 +388,6 @@ summary( 'Themes': get_option('themes'), 'IME': get_option('ime'), 'Grapheme clustering': utf8proc.found(), - 'Wayland: xdg-activation-v1': xdg_activation, 'Wayland: fractional-scale-v1': fractional_scale, 'Wayland: cursor-shape-v1': cursor_shape, 'utmp backend': utmp_backend, diff --git a/url-mode.c b/url-mode.c index bd9b5157..a5da7ca7 100644 --- a/url-mode.c +++ b/url-mode.c @@ -86,7 +86,6 @@ spawn_url_launcher_with_token(struct terminal *term, return ret; } -#if defined(HAVE_XDG_ACTIVATION) struct spawn_activation_context { struct terminal *term; char *url; @@ -101,13 +100,11 @@ activation_token_done(const char *token, void *data) free(ctx->url); free(ctx); } -#endif static bool spawn_url_launcher(struct seat *seat, struct terminal *term, const char *url, uint32_t serial) { -#if defined(HAVE_XDG_ACTIVATION) struct spawn_activation_context *ctx = xmalloc(sizeof(*ctx)); *ctx = (struct spawn_activation_context){ .term = term, @@ -123,7 +120,6 @@ spawn_url_launcher(struct seat *seat, struct terminal *term, const char *url, free(ctx->url); free(ctx); -#endif return spawn_url_launcher_with_token(term, url, NULL); } diff --git a/wayland.c b/wayland.c index c338bef8..3cfc37d0 100644 --- a/wayland.c +++ b/wayland.c @@ -1217,7 +1217,6 @@ handle_global(void *data, struct wl_registry *registry, } } -#if defined(HAVE_XDG_ACTIVATION) else if (strcmp(interface, xdg_activation_v1_interface.name) == 0) { const uint32_t required = 1; if (!verify_iface_version(interface, version, required)) @@ -1226,7 +1225,6 @@ handle_global(void *data, struct wl_registry *registry, wayl->xdg_activation = wl_registry_bind( wayl->registry, name, &xdg_activation_v1_interface, required); } -#endif #if defined(HAVE_FRACTIONAL_SCALE) else if (strcmp(interface, wp_viewporter_interface.name) == 0) { @@ -1481,11 +1479,7 @@ wayl_init(struct fdm *fdm, struct key_binding_manager *key_binding_manager, if (wayl->primary_selection_device_manager == NULL) LOG_WARN("no primary selection available"); -#if defined(HAVE_XDG_ACTIVATION) if (wayl->xdg_activation == NULL) { -#else - if (true) { -#endif LOG_WARN( "no XDG activation support; " "bell.urgent will fall back to coloring the window margins red"); @@ -1604,10 +1598,8 @@ wayl_destroy(struct wayland *wayl) if (wayl->cursor_shape_manager != NULL) wp_cursor_shape_manager_v1_destroy(wayl->cursor_shape_manager); #endif -#if defined(HAVE_XDG_ACTIVATION) if (wayl->xdg_activation != NULL) xdg_activation_v1_destroy(wayl->xdg_activation); -#endif if (wayl->xdg_output_manager != NULL) zxdg_output_manager_v1_destroy(wayl->xdg_output_manager); if (wayl->shell != NULL) @@ -1739,11 +1731,9 @@ wayl_win_init(struct terminal *term, const char *token) wl_surface_commit(win->surface.surf); -#if defined(HAVE_XDG_ACTIVATION) /* Complete XDG startup notification */ if (token) xdg_activation_v1_activate(wayl->xdg_activation, token, win->surface.surf); -#endif if (!wayl_win_subsurface_new(win, &win->overlay, false)) { LOG_ERR("failed to create overlay surface"); @@ -1850,14 +1840,13 @@ wayl_win_destroy(struct wl_window *win) shm_purge(term->render.chains.url); shm_purge(term->render.chains.csd); -#if defined(HAVE_XDG_ACTIVATION) tll_foreach(win->xdg_tokens, it) { xdg_activation_token_v1_destroy(it->item->xdg_token); free(it->item); tll_remove(win->xdg_tokens, it); } -#endif + #if defined(HAVE_FRACTIONAL_SCALE) if (win->fractional_scale != NULL) wp_fractional_scale_v1_destroy(win->fractional_scale); @@ -2090,7 +2079,6 @@ wayl_win_alpha_changed(struct wl_window *win) wl_surface_set_opaque_region(win->surface.surf, NULL); } -#if defined(HAVE_XDG_ACTIVATION) static void activation_token_for_urgency_done(const char *token, void *data) { @@ -2100,12 +2088,10 @@ activation_token_for_urgency_done(const char *token, void *data) win->urgency_token_is_pending = false; xdg_activation_v1_activate(wayl->xdg_activation, token, win->surface.surf); } -#endif /* HAVE_XDG_ACTIVATION */ bool wayl_win_set_urgent(struct wl_window *win) { -#if defined(HAVE_XDG_ACTIVATION) if (win->urgency_token_is_pending) { /* We already have a pending token. Don’t request another one, * to avoid flooding the Wayland socket */ @@ -2119,7 +2105,6 @@ wayl_win_set_urgent(struct wl_window *win) win->urgency_token_is_pending = true; return true; } -#endif return false; } @@ -2229,8 +2214,6 @@ wayl_win_subsurface_destroy(struct wayl_sub_surface *surf) } } -#if defined(HAVE_XDG_ACTIVATION) - static void activation_token_done(void *data, struct xdg_activation_token_v1 *xdg_token, const char *token) @@ -2296,4 +2279,3 @@ wayl_get_activation_token( xdg_activation_token_v1_commit(token); return true; } -#endif diff --git a/wayland.h b/wayland.h index 275338a8..c200e79f 100644 --- a/wayland.h +++ b/wayland.h @@ -15,10 +15,7 @@ #include #include #include - -#if defined(HAVE_XDG_ACTIVATION) - #include -#endif +#include #if defined(HAVE_FRACTIONAL_SCALE) #include @@ -345,7 +342,6 @@ struct wl_url { enum csd_mode {CSD_UNKNOWN, CSD_NO, CSD_YES}; -#if defined(HAVE_XDG_ACTIVATION) typedef void (*activation_token_cb_t)(const char *token, void *data); /* @@ -359,7 +355,6 @@ struct xdg_activation_token_context { activation_token_cb_t cb; /* User provided callback */ void *cb_data; /* Callback user pointer */ }; -#endif struct wayland; struct wl_window { @@ -367,10 +362,10 @@ struct wl_window { struct wayl_surface surface; struct xdg_surface *xdg_surface; struct xdg_toplevel *xdg_toplevel; -#if defined(HAVE_XDG_ACTIVATION) + tll(struct xdg_activation_token_context *) xdg_tokens; bool urgency_token_is_pending; -#endif + #if defined(HAVE_FRACTIONAL_SCALE) struct wp_fractional_scale_v1 *fractional_scale; #endif @@ -451,9 +446,7 @@ struct wayland { struct wl_data_device_manager *data_device_manager; struct zwp_primary_selection_device_manager_v1 *primary_selection_device_manager; -#if defined(HAVE_XDG_ACTIVATION) struct xdg_activation_v1 *xdg_activation; -#endif #if defined(HAVE_CURSOR_SHAPE) struct wp_cursor_shape_manager_v1 *cursor_shape_manager; @@ -515,8 +508,6 @@ bool wayl_win_subsurface_new_with_custom_parent( struct wayl_sub_surface *surf, bool allow_pointer_input); void wayl_win_subsurface_destroy(struct wayl_sub_surface *surf); -#if defined(HAVE_XDG_ACTIVATION) 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); -#endif