|
| 1 | +/* |
| 2 | + * Copyright (C) 2024 Red Hat, Inc. |
| 3 | + * |
| 4 | + * This program is free software; you can redistribute it and/or |
| 5 | + * modify it under the terms of the GNU General Public License as |
| 6 | + * published by the Free Software Foundation; either version 2 of the |
| 7 | + * License, or (at your option) any later version. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, but |
| 10 | + * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | + * General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | + */ |
| 17 | + |
| 18 | +#include "config.h" |
| 19 | + |
| 20 | +#include "wayland/meta-wayland-fixes.h" |
| 21 | + |
| 22 | +#include "wayland/meta-wayland-private.h" |
| 23 | +#include "wayland/meta-wayland-versions.h" |
| 24 | + |
| 25 | +static void |
| 26 | +wl_fixes_destroy (struct wl_client *client, |
| 27 | + struct wl_resource *resource) |
| 28 | +{ |
| 29 | + wl_resource_destroy (resource); |
| 30 | +} |
| 31 | + |
| 32 | +static void |
| 33 | +wl_fixes_destroy_registry (struct wl_client *client, |
| 34 | + struct wl_resource *resource, |
| 35 | + struct wl_resource *registry_resource) |
| 36 | +{ |
| 37 | + wl_resource_destroy (registry_resource); |
| 38 | +} |
| 39 | + |
| 40 | +static const struct wl_fixes_interface meta_wayland_fixes_interface = { |
| 41 | + wl_fixes_destroy, |
| 42 | + wl_fixes_destroy_registry, |
| 43 | +}; |
| 44 | + |
| 45 | +static void |
| 46 | +bind_wl_fixes (struct wl_client *client, |
| 47 | + void *data, |
| 48 | + uint32_t version, |
| 49 | + uint32_t id) |
| 50 | +{ |
| 51 | + MetaWaylandCompositor *compositor = data; |
| 52 | + struct wl_resource *resource; |
| 53 | + |
| 54 | + resource = wl_resource_create (client, &wl_fixes_interface, version, id); |
| 55 | + wl_resource_set_implementation (resource, |
| 56 | + &meta_wayland_fixes_interface, |
| 57 | + compositor, |
| 58 | + NULL); |
| 59 | +} |
| 60 | + |
| 61 | +void |
| 62 | +meta_wayland_init_fixes (MetaWaylandCompositor *compositor) |
| 63 | +{ |
| 64 | + if (wl_global_create (compositor->wayland_display, |
| 65 | + &wl_fixes_interface, |
| 66 | + META_WL_FIXES_VERSION, |
| 67 | + compositor, |
| 68 | + bind_wl_fixes) == NULL) |
| 69 | + g_error ("Failed to register a global wl_fixes object"); |
| 70 | +} |
0 commit comments