Skip to content

Commit e97ed94

Browse files
committed
[Wayland] Add support for wl_fixes interface
1 parent ffd0d37 commit e97ed94

6 files changed

Lines changed: 98 additions & 1 deletion

File tree

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ udev_req = '>= 228'
3737
gudev_req = '>= 232'
3838

3939
# wayland version requirements
40-
wayland_server_req = '>= 1.13.0'
40+
wayland_server_req = '>= 1.24'
4141
wayland_protocols_req = '>= 1.19'
4242

4343
# native backend version requirements

src/meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,8 @@ if have_wayland
518518
'wayland/meta-wayland-dma-buf.h',
519519
'wayland/meta-wayland-dnd-surface.c',
520520
'wayland/meta-wayland-dnd-surface.h',
521+
'wayland/meta-wayland-fixes.c',
522+
'wayland/meta-wayland-fixes.h',
521523
'wayland/meta-wayland-gtk-shell.c',
522524
'wayland/meta-wayland-gtk-shell.h',
523525
'wayland/meta-wayland.h',

src/wayland/meta-wayland-fixes.c

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
}

src/wayland/meta-wayland-fixes.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
#pragma once
19+
20+
#include "wayland/meta-wayland.h"
21+
22+
void meta_wayland_init_fixes (MetaWaylandCompositor *compositor);

src/wayland/meta-wayland-versions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,6 @@
5555
#define META_GTK_TEXT_INPUT_VERSION 1
5656
#define META_ZWP_TEXT_INPUT_V3_VERSION 1
5757
#define META_WP_VIEWPORTER_VERSION 1
58+
#define META_WL_FIXES_VERSION 1
5859

5960
#endif

src/wayland/meta-wayland.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "wayland/meta-wayland-data-device.h"
3535
#include "wayland/meta-wayland-dma-buf.h"
3636
#include "wayland/meta-wayland-egl-stream.h"
37+
#include "wayland/meta-wayland-fixes.h"
3738
#include "wayland/meta-wayland-inhibit-shortcuts-dialog.h"
3839
#include "wayland/meta-wayland-inhibit-shortcuts.h"
3940
#include "wayland/meta-wayland-outputs.h"
@@ -438,6 +439,7 @@ meta_wayland_compositor_setup (MetaWaylandCompositor *wayland_compositor)
438439
meta_wayland_surface_inhibit_shortcuts_dialog_init ();
439440
meta_wayland_text_input_init (compositor);
440441
meta_wayland_gtk_text_input_init (compositor);
442+
meta_wayland_init_fixes (compositor);
441443

442444
/* Xwayland specific protocol, needs to be filtered out for all other clients */
443445
if (meta_xwayland_grab_keyboard_init (compositor))

0 commit comments

Comments
 (0)