diff --git a/CHANGELOG.md b/CHANGELOG.md index cda805ca..541096ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -101,6 +101,7 @@ e.g. multi-line prompt input in fish is treated as separate lines, rather than one logical, when selecting and copying it ([#1487][1487]). +* wayland-protocols >= 1.41 is now required. [1925]: https://codeberg.org/dnkl/foot/issues/1925 [1487]: https://codeberg.org/dnkl/foot/issues/1487 diff --git a/client.c b/client.c index ceee1b29..e7df3768 100644 --- a/client.c +++ b/client.c @@ -67,14 +67,11 @@ version_and_features(void) { static char buf[256]; snprintf(buf, sizeof(buf), - "version: %s %cpgo %cime %cgraphemes %ctoplevel-icon %csystem-bell %ccolor-management %cassertions", + "version: %s %cpgo %cime %cgraphemes %cassertions", FOOT_VERSION, feature_pgo() ? '+' : '-', feature_ime() ? '+' : '-', feature_graphemes() ? '+' : '-', - feature_xdg_toplevel_icon() ? '+' : '-', - feature_xdg_system_bell() ? '+' : '-', - feature_wp_color_management() ? '+' : '-', feature_assertions() ? '+' : '-'); return buf; } diff --git a/config.c b/config.c index b141f564..6c8e147f 100644 --- a/config.c +++ b/config.c @@ -1112,21 +1112,11 @@ parse_section_main(struct context *ctx) if (!value_to_bool(ctx, &gamma_correct)) return false; -#if defined(HAVE_WP_COLOR_MANAGEMENT) conf->gamma_correct = gamma_correct ? GAMMA_CORRECT_ENABLED : GAMMA_CORRECT_DISABLED; return true; -#else - if (gamma_correct) { - LOG_CONTEXTUAL_WARN( - "ignoring; foot was built without color-management support"); - } - - conf->gamma_correct = GAMMA_CORRECT_DISABLED; - return true; -#endif } else { @@ -3339,11 +3329,7 @@ config_load(struct config *conf, const char *conf_path, .underline_thickness = {.pt = 0., .px = -1}, .strikeout_thickness = {.pt = 0., .px = -1}, .dpi_aware = false, -#if defined(HAVE_WP_COLOR_MANAGEMENT) .gamma_correct = GAMMA_CORRECT_AUTO, -#else - .gamma_correct = GAMMA_CORRECT_DISABLED, -#endif .security = { .osc52 = OSC52_ENABLED, }, diff --git a/foot-features.h b/foot-features.h index c6c9c6f4..ad447767 100644 --- a/foot-features.h +++ b/foot-features.h @@ -37,30 +37,3 @@ static inline bool feature_graphemes(void) return false; #endif } - -static inline bool feature_xdg_toplevel_icon(void) -{ -#if defined(HAVE_XDG_TOPLEVEL_ICON) - return true; -#else - return false; -#endif -} - -static inline bool feature_xdg_system_bell(void) -{ -#if defined(HAVE_XDG_SYSTEM_BELL) - return true; -#else - return false; -#endif -} - -static inline bool feature_wp_color_management(void) -{ -#if defined(HAVE_WP_COLOR_MANAGEMENT) - return true; -#else - return false; -#endif -} diff --git a/main.c b/main.c index e7183238..7e07038f 100644 --- a/main.c +++ b/main.c @@ -51,14 +51,11 @@ version_and_features(void) { static char buf[256]; snprintf(buf, sizeof(buf), - "version: %s %cpgo %cime %cgraphemes %ctoplevel-icon %csystem-bell %ccolor-management %cassertions", + "version: %s %cpgo %cime %cgraphemes %cassertions", FOOT_VERSION, feature_pgo() ? '+' : '-', feature_ime() ? '+' : '-', feature_graphemes() ? '+' : '-', - feature_xdg_toplevel_icon() ? '+' : '-', - feature_xdg_system_bell() ? '+' : '-', - feature_wp_color_management() ? '+' : '-', feature_assertions() ? '+' : '-'); return buf; } diff --git a/meson.build b/meson.build index d84a848c..3d2ce91a 100644 --- a/meson.build +++ b/meson.build @@ -132,7 +132,7 @@ math = cc.find_library('m') threads = [dependency('threads'), cc.find_library('stdthreads', required: false)] libepoll = dependency('epoll-shim', required: false) pixman = dependency('pixman-1') -wayland_protocols = dependency('wayland-protocols', version: '>=1.32', +wayland_protocols = dependency('wayland-protocols', version: '>=1.41', fallback: 'wayland-protocols', default_options: ['tests=false']) wayland_client = dependency('wayland-client') @@ -169,32 +169,11 @@ wl_proto_xml = [ wayland_protocols_datadir / 'unstable/tablet/tablet-unstable-v2.xml', # required by cursor-shape-v1 wayland_protocols_datadir / 'staging/cursor-shape/cursor-shape-v1.xml', wayland_protocols_datadir / 'staging/single-pixel-buffer/single-pixel-buffer-v1.xml', + wayland_protocols_datadir / 'staging/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml', + wayland_protocols_datadir / 'staging/xdg-system-bell/xdg-system-bell-v1.xml', + wayland_protocols_datadir / 'staging/color-management/color-management-v1.xml', ] -if wayland_protocols.version().version_compare('>=1.37') - add_project_arguments('-DHAVE_XDG_TOPLEVEL_ICON', language: 'c') - wl_proto_xml += [wayland_protocols_datadir / 'staging/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml'] - xdg_toplevel_icon = true -else - xdg_toplevel_icon = false -endif - -if wayland_protocols.version().version_compare('>=1.38') - add_project_arguments('-DHAVE_XDG_SYSTEM_BELL', language: 'c') - wl_proto_xml += [wayland_protocols_datadir / 'staging/xdg-system-bell/xdg-system-bell-v1.xml'] - xdg_system_bell = true -else - xdg_system_bell = false -endif - -if wayland_protocols.version().version_compare('>=1.41') - add_project_arguments('-DHAVE_WP_COLOR_MANAGEMENT', language: 'c') - wl_proto_xml += [wayland_protocols_datadir / 'staging/color-management/color-management-v1.xml'] - wp_color_management = true -else - wp_color_management = false -endif - foreach prot : wl_proto_xml wl_proto_headers += custom_target( prot.underscorify() + '-client-header', @@ -436,9 +415,6 @@ summary( 'Themes': get_option('themes'), 'IME': get_option('ime'), 'Grapheme clustering': utf8proc.found(), - 'Wayland: xdg-toplevel-icon-v1': xdg_toplevel_icon, - 'Wayland: xdg-system-bell-v1': xdg_system_bell, - 'Wayland: wp-color-management-v1': wp_color_management, 'utmp backend': utmp_backend, 'utmp helper default path': utmp_default_helper_path, 'Build terminfo': tic.found(), diff --git a/render.c b/render.c index eea43c10..4975394f 100644 --- a/render.c +++ b/render.c @@ -22,10 +22,7 @@ #include #include #include - -#if defined(HAVE_XDG_TOPLEVEL_ICON) #include -#endif #include @@ -5092,7 +5089,6 @@ render_refresh_app_id(struct terminal *term) void render_refresh_icon(struct terminal *term) { -#if defined(HAVE_XDG_TOPLEVEL_ICON) if (term->wl->toplevel_icon_manager == NULL) { LOG_DBG("compositor does not implement xdg-toplevel-icon: " "ignoring request to refresh window icon"); @@ -5126,7 +5122,6 @@ render_refresh_icon(struct terminal *term) xdg_toplevel_icon_v1_destroy(icon); term->render.icon.last_update = now; -#endif } void @@ -5232,10 +5227,6 @@ render_xcursor_set(struct seat *seat, struct terminal *term, bool render_do_linear_blending(const struct terminal *term) { -#if defined(HAVE_WP_COLOR_MANAGEMENT) return term->conf->gamma_correct != GAMMA_CORRECT_DISABLED && term->wl->color_management.img_description != NULL; -#else - return false; -#endif } diff --git a/wayland.c b/wayland.c index 1c083a9e..14d9bed9 100644 --- a/wayland.c +++ b/wayland.c @@ -675,8 +675,6 @@ static const struct wp_presentation_listener presentation_listener = { .clock_id = &clock_id, }; -#if defined(HAVE_WP_COLOR_MANAGEMENT) - static void color_manager_create_image_description(struct wayland *wayl) { @@ -758,7 +756,6 @@ static const struct wp_color_manager_v1_listener color_manager_listener = { .supported_tf_named = &color_manager_supported_tf_named, .done = &color_manager_done, }; -#endif static bool verify_iface_version(const char *iface, uint32_t version, uint32_t wanted) @@ -1457,7 +1454,6 @@ handle_global(void *data, struct wl_registry *registry, &wp_single_pixel_buffer_manager_v1_interface, required); } -#if defined(HAVE_XDG_TOPLEVEL_ICON) else if (streq(interface, xdg_toplevel_icon_v1_interface.name)) { const uint32_t required = 1; if (!verify_iface_version(interface, version, required)) @@ -1466,9 +1462,7 @@ handle_global(void *data, struct wl_registry *registry, wayl->toplevel_icon_manager = wl_registry_bind( wayl->registry, name, &xdg_toplevel_icon_v1_interface, required); } -#endif -#if defined(HAVE_XDG_SYSTEM_BELL) else if (streq(interface, xdg_system_bell_v1_interface.name)) { const uint32_t required = 1; if (!verify_iface_version(interface, version, required)) @@ -1477,9 +1471,7 @@ handle_global(void *data, struct wl_registry *registry, wayl->system_bell = wl_registry_bind( wayl->registry, name, &xdg_system_bell_v1_interface, required); } -#endif -#if defined(HAVE_WP_COLOR_MANAGEMENT) else if (streq(interface, wp_color_manager_v1_interface.name)) { const uint32_t required = 1; if (!verify_iface_version(interface, version, required)) @@ -1491,7 +1483,6 @@ handle_global(void *data, struct wl_registry *registry, wp_color_manager_v1_add_listener( wayl->color_management.manager, &color_manager_listener, wayl); } -#endif #if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED else if (streq(interface, zwp_text_input_manager_v3_interface.name)) { @@ -1733,11 +1724,9 @@ wayl_init(struct fdm *fdm, struct key_binding_manager *key_binding_manager, "falling back to client-side cursors"); } -#if defined(HAVE_XDG_TOPLEVEL_ICON) if (wayl->toplevel_icon_manager == NULL) { LOG_WARN("compositor does not implement the XDG toplevel icon protocol"); } -#endif #if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED if (wayl->text_input_manager == NULL) { @@ -1815,21 +1804,14 @@ wayl_destroy(struct wayland *wayl) zwp_text_input_manager_v3_destroy(wayl->text_input_manager); #endif -#if defined(HAVE_WP_COLOR_MANAGEMENT) if (wayl->color_management.img_description != NULL) wp_image_description_v1_destroy(wayl->color_management.img_description); if (wayl->color_management.manager != NULL) wp_color_manager_v1_destroy(wayl->color_management.manager); -#endif - -#if defined(HAVE_XDG_SYSTEM_BELL) if (wayl->system_bell != NULL) xdg_system_bell_v1_destroy(wayl->system_bell); -#endif -#if defined(HAVE_XDG_TOPLEVEL_ICON) if (wayl->toplevel_icon_manager != NULL) xdg_toplevel_icon_manager_v1_destroy(wayl->toplevel_icon_manager); -#endif if (wayl->single_pixel_manager != NULL) wp_single_pixel_buffer_manager_v1_destroy(wayl->single_pixel_manager); if (wayl->fractional_scale_manager != NULL) @@ -1947,7 +1929,6 @@ wayl_win_init(struct terminal *term, const char *token) xdg_toplevel_set_app_id(win->xdg_toplevel, conf->app_id); -#if defined(HAVE_XDG_TOPLEVEL_ICON) if (wayl->toplevel_icon_manager != NULL) { const char *app_id = term->app_id != NULL ? term->app_id : term->conf->app_id; @@ -1960,9 +1941,7 @@ wayl_win_init(struct terminal *term, const char *token) wayl->toplevel_icon_manager, win->xdg_toplevel, icon); xdg_toplevel_icon_v1_destroy(icon); } -#endif -#if defined(HAVE_WP_COLOR_MANAGEMENT) if (term->conf->gamma_correct != GAMMA_CORRECT_DISABLED) { if (wayl->color_management.img_description != NULL) { xassert(wayl->color_management.manager != NULL); @@ -1992,7 +1971,6 @@ wayl_win_init(struct terminal *term, const char *token) /* "auto" - don't warn */ } } -#endif if (conf->csd.preferred == CONF_CSD_PREFER_NONE) { /* User specifically do *not* want decorations */ @@ -2136,11 +2114,8 @@ wayl_win_destroy(struct wl_window *win) tll_remove(win->xdg_tokens, it); } -#if defined(HAVE_WP_COLOR_MANAGEMENT) if (win->surface.color_management != NULL) wp_color_management_surface_v1_destroy(win->surface.color_management); -#endif - if (win->fractional_scale != NULL) wp_fractional_scale_v1_destroy(win->fractional_scale); if (win->surface.viewport != NULL) @@ -2417,7 +2392,6 @@ wayl_win_set_urgent(struct wl_window *win) bool wayl_win_ring_bell(const struct wl_window *win) { -#if defined(HAVE_XDG_SYSTEM_BELL) if (win->term->wl->system_bell == NULL) { static bool have_warned = false; @@ -2431,9 +2405,6 @@ wayl_win_ring_bell(const struct wl_window *win) xdg_system_bell_v1_ring(win->term->wl->system_bell, win->surface.surf); return true; -#else - return false; -#endif } bool @@ -2471,7 +2442,6 @@ wayl_win_subsurface_new_with_custom_parent( return false; } -#if defined(HAVE_WP_COLOR_MANAGEMENT) surf->surface.color_management = NULL; if (win->term->conf->gamma_correct && wayl->color_management.img_description != NULL) @@ -2485,7 +2455,6 @@ wayl_win_subsurface_new_with_custom_parent( surf->surface.color_management, wayl->color_management.img_description, WP_COLOR_MANAGER_V1_RENDER_INTENT_PERCEPTUAL); } -#endif struct wl_subsurface *sub = wl_subcompositor_get_subsurface( wayl->sub_compositor, main_surface, parent); @@ -2538,12 +2507,10 @@ wayl_win_subsurface_destroy(struct wayl_sub_surface *surf) if (surf == NULL) return; -#if defined(HAVE_WP_COLOR_MANAGEMENT) if (surf->surface.color_management != NULL) { wp_color_management_surface_v1_destroy(surf->surface.color_management); surf->surface.color_management = NULL; } -#endif if (surf->surface.viewport != NULL) { wp_viewport_destroy(surf->surface.viewport); diff --git a/wayland.h b/wayland.h index ec27281a..6215d708 100644 --- a/wayland.h +++ b/wayland.h @@ -9,6 +9,7 @@ #include /* Wayland protocols */ +#include #include #include #include @@ -19,18 +20,8 @@ #include #include #include - -#if defined(HAVE_XDG_TOPLEVEL_ICON) - #include -#endif - -#if defined(HAVE_XDG_SYSTEM_BELL) - #include -#endif - -#if defined(HAVE_WP_COLOR_MANAGEMENT) - #include -#endif +#include +#include #include #include @@ -65,9 +56,7 @@ enum touch_state { struct wayl_surface { struct wl_surface *surf; struct wp_viewport *viewport; -#if defined(HAVE_WP_COLOR_MANAGEMENT) struct wp_color_management_surface_v1 *color_management; -#endif }; struct wayl_sub_surface { @@ -458,15 +447,10 @@ struct wayland { struct wp_single_pixel_buffer_manager_v1 *single_pixel_manager; -#if defined(HAVE_XDG_TOPLEVEL_ICON) struct xdg_toplevel_icon_manager_v1 *toplevel_icon_manager; -#endif -#if defined(HAVE_XDG_SYSTEM_BELL) struct xdg_system_bell_v1 *system_bell; -#endif -#if defined(HAVE_WP_COLOR_MANAGEMENT) struct { struct wp_color_manager_v1 *manager; struct wp_image_description_v1 *img_description; @@ -475,7 +459,6 @@ struct wayland { bool have_tf_ext_linear; bool have_primaries_srgb; } color_management; -#endif bool presentation_timings; struct wp_presentation *presentation;