From 22f4e0902b6888bb70042b829dc54985381de31a Mon Sep 17 00:00:00 2001 From: Sunderland93 Date: Mon, 4 Aug 2025 13:15:18 +0400 Subject: [PATCH 1/2] [Wayland] Add support for wl_fixes interface --- meson.build | 2 +- src/meson.build | 2 + src/wayland/meta-wayland-fixes.c | 70 +++++++++++++++++++++++++++++ src/wayland/meta-wayland-fixes.h | 22 +++++++++ src/wayland/meta-wayland-versions.h | 1 + src/wayland/meta-wayland.c | 3 ++ 6 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 src/wayland/meta-wayland-fixes.c create mode 100644 src/wayland/meta-wayland-fixes.h diff --git a/meson.build b/meson.build index 41366236e..7a75c72aa 100644 --- a/meson.build +++ b/meson.build @@ -37,7 +37,7 @@ udev_req = '>= 228' gudev_req = '>= 232' # wayland version requirements -wayland_server_req = '>= 1.20' +wayland_server_req = '>= 1.24' wayland_protocols_req = '>= 1.36' # native backend version requirements diff --git a/src/meson.build b/src/meson.build index 50c59f9d4..9c6b1ef06 100644 --- a/src/meson.build +++ b/src/meson.build @@ -513,6 +513,8 @@ if have_wayland 'wayland/meta-wayland-dma-buf.h', 'wayland/meta-wayland-dnd-surface.c', 'wayland/meta-wayland-dnd-surface.h', + 'wayland/meta-wayland-fixes.c', + 'wayland/meta-wayland-fixes.h', 'wayland/meta-wayland-gtk-shell.c', 'wayland/meta-wayland-gtk-shell.h', 'wayland/meta-wayland-background-actor.c', diff --git a/src/wayland/meta-wayland-fixes.c b/src/wayland/meta-wayland-fixes.c new file mode 100644 index 000000000..5b9104ba9 --- /dev/null +++ b/src/wayland/meta-wayland-fixes.c @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "config.h" + +#include "wayland/meta-wayland-fixes.h" + +#include "wayland/meta-wayland-private.h" +#include "wayland/meta-wayland-versions.h" + +static void +wl_fixes_destroy (struct wl_client *client, + struct wl_resource *resource) +{ + wl_resource_destroy (resource); +} + +static void +wl_fixes_destroy_registry (struct wl_client *client, + struct wl_resource *resource, + struct wl_resource *registry_resource) +{ + wl_resource_destroy (registry_resource); +} + +static const struct wl_fixes_interface meta_wayland_fixes_interface = { + wl_fixes_destroy, + wl_fixes_destroy_registry, +}; + +static void +bind_wl_fixes (struct wl_client *client, + void *data, + uint32_t version, + uint32_t id) +{ + MetaWaylandCompositor *compositor = data; + struct wl_resource *resource; + + resource = wl_resource_create (client, &wl_fixes_interface, version, id); + wl_resource_set_implementation (resource, + &meta_wayland_fixes_interface, + compositor, + NULL); +} + +void +meta_wayland_init_fixes (MetaWaylandCompositor *compositor) +{ + if (wl_global_create (compositor->wayland_display, + &wl_fixes_interface, + META_WL_FIXES_VERSION, + compositor, + bind_wl_fixes) == NULL) + g_error ("Failed to register a global wl_fixes object"); +} diff --git a/src/wayland/meta-wayland-fixes.h b/src/wayland/meta-wayland-fixes.h new file mode 100644 index 000000000..5bc327f02 --- /dev/null +++ b/src/wayland/meta-wayland-fixes.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2024 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#pragma once + +#include "wayland/meta-wayland.h" + +void meta_wayland_init_fixes (MetaWaylandCompositor *compositor); diff --git a/src/wayland/meta-wayland-versions.h b/src/wayland/meta-wayland-versions.h index 2f84bf080..f223c4971 100644 --- a/src/wayland/meta-wayland-versions.h +++ b/src/wayland/meta-wayland-versions.h @@ -61,5 +61,6 @@ #define META_XDG_TOPLEVEL_TAG_V1_VERSION 1 #define META_WP_CURSOR_SHAPE_VERSION 2 #define META_ZWLR_LAYER_SHELL_V1_VERSION 4 +#define META_WL_FIXES_VERSION 1 #endif diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c index 2cdc380bc..8f7415c75 100644 --- a/src/wayland/meta-wayland.c +++ b/src/wayland/meta-wayland.c @@ -38,6 +38,7 @@ #include "wayland/meta-wayland-dma-buf.h" #include "wayland/meta-wayland-egl-stream.h" #include "wayland/meta-wayland-idle-inhibit.h" +#include "wayland/meta-wayland-fixes.h" #include "wayland/meta-wayland-inhibit-shortcuts-dialog.h" #include "wayland/meta-wayland-inhibit-shortcuts.h" #include "wayland/meta-wayland-legacy-xdg-foreign.h" @@ -449,6 +450,8 @@ meta_wayland_compositor_setup (MetaWaylandCompositor *wayland_compositor) meta_wayland_init_xdg_wm_dialog (compositor); meta_wayland_xdg_toplevel_tag_init (compositor); meta_wayland_init_cursor_shape (compositor); + meta_wayland_gtk_text_input_init (compositor); + meta_wayland_init_fixes (compositor); /* Xwayland specific protocol, needs to be filtered out for all other clients */ if (meta_xwayland_grab_keyboard_init (compositor)) From e6feab01d0049b2b157c72c844293e979b04a720 Mon Sep 17 00:00:00 2001 From: Sunderland93 Date: Fri, 6 Mar 2026 15:59:19 +0400 Subject: [PATCH 2/2] remove merge conflict --- src/wayland/meta-wayland.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c index 8f7415c75..e688caeaf 100644 --- a/src/wayland/meta-wayland.c +++ b/src/wayland/meta-wayland.c @@ -450,7 +450,6 @@ meta_wayland_compositor_setup (MetaWaylandCompositor *wayland_compositor) meta_wayland_init_xdg_wm_dialog (compositor); meta_wayland_xdg_toplevel_tag_init (compositor); meta_wayland_init_cursor_shape (compositor); - meta_wayland_gtk_text_input_init (compositor); meta_wayland_init_fixes (compositor); /* Xwayland specific protocol, needs to be filtered out for all other clients */