Skip to content

Commit 22f4e09

Browse files
committed
[Wayland] Add support for wl_fixes interface
1 parent 3f76365 commit 22f4e09

File tree

6 files changed

+99
-1
lines changed

6 files changed

+99
-1
lines changed

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.20'
40+
wayland_server_req = '>= 1.24'
4141
wayland_protocols_req = '>= 1.36'
4242

4343
# native backend version requirements

src/meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,8 @@ if have_wayland
513513
'wayland/meta-wayland-dma-buf.h',
514514
'wayland/meta-wayland-dnd-surface.c',
515515
'wayland/meta-wayland-dnd-surface.h',
516+
'wayland/meta-wayland-fixes.c',
517+
'wayland/meta-wayland-fixes.h',
516518
'wayland/meta-wayland-gtk-shell.c',
517519
'wayland/meta-wayland-gtk-shell.h',
518520
'wayland/meta-wayland-background-actor.c',

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
@@ -61,5 +61,6 @@
6161
#define META_XDG_TOPLEVEL_TAG_V1_VERSION 1
6262
#define META_WP_CURSOR_SHAPE_VERSION 2
6363
#define META_ZWLR_LAYER_SHELL_V1_VERSION 4
64+
#define META_WL_FIXES_VERSION 1
6465

6566
#endif

src/wayland/meta-wayland.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "wayland/meta-wayland-dma-buf.h"
3939
#include "wayland/meta-wayland-egl-stream.h"
4040
#include "wayland/meta-wayland-idle-inhibit.h"
41+
#include "wayland/meta-wayland-fixes.h"
4142
#include "wayland/meta-wayland-inhibit-shortcuts-dialog.h"
4243
#include "wayland/meta-wayland-inhibit-shortcuts.h"
4344
#include "wayland/meta-wayland-legacy-xdg-foreign.h"
@@ -449,6 +450,8 @@ meta_wayland_compositor_setup (MetaWaylandCompositor *wayland_compositor)
449450
meta_wayland_init_xdg_wm_dialog (compositor);
450451
meta_wayland_xdg_toplevel_tag_init (compositor);
451452
meta_wayland_init_cursor_shape (compositor);
453+
meta_wayland_gtk_text_input_init (compositor);
454+
meta_wayland_init_fixes (compositor);
452455

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

0 commit comments

Comments
 (0)