diff --git a/meson.build b/meson.build index 79a0e8144..ebd84b43c 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 10fb80dc5..cc93974ec 100644 --- a/src/meson.build +++ b/src/meson.build @@ -514,6 +514,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.h', 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 6d2dbd7bc..f75b39fab 100644 --- a/src/wayland/meta-wayland-versions.h +++ b/src/wayland/meta-wayland-versions.h @@ -54,6 +54,7 @@ #define META_ZWP_XWAYLAND_KEYBOARD_GRAB_V1_VERSION 1 #define META_ZWP_TEXT_INPUT_V3_VERSION 1 #define META_WP_VIEWPORTER_VERSION 1 +#define META_WL_FIXES_VERSION 1 #define META_XDG_ACTIVATION_V1_VERSION 1 #define META_XDG_DIALOG_VERSION 1 #define META_ZWP_PRIMARY_SELECTION_V1_VERSION 1 diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c index aeb39ec5d..adbae4e4f 100644 --- a/src/wayland/meta-wayland.c +++ b/src/wayland/meta-wayland.c @@ -35,6 +35,7 @@ #include "wayland/meta-wayland-data-device.h" #include "wayland/meta-wayland-dma-buf.h" #include "wayland/meta-wayland-egl-stream.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" @@ -440,6 +441,7 @@ meta_wayland_compositor_setup (MetaWaylandCompositor *wayland_compositor) meta_wayland_keyboard_shortcuts_inhibit_init (compositor); meta_wayland_surface_inhibit_shortcuts_dialog_init (); meta_wayland_text_input_init (compositor); + meta_wayland_init_fixes (compositor); meta_wayland_activation_init (compositor); meta_wayland_init_xdg_wm_dialog (compositor);