Skip to content

Commit ad8749f

Browse files
committed
Bump wl_output interface to v4 (#727)
wl_output v3 allows clients to tell the server that it can clean up the related wl_resource. wl_output v4 adds the name and description events already present in xdg_output. Some clients may rely on that information instead of xdg-output-v1
1 parent bbfdec8 commit ad8749f

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

src/wayland/meta-wayland-outputs.c

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ output_resource_destroy (struct wl_resource *res)
6868
wayland_output->resources = g_list_remove (wayland_output->resources, res);
6969
}
7070

71+
static void
72+
meta_wl_output_release (struct wl_client *client,
73+
struct wl_resource *resource)
74+
{
75+
wl_resource_destroy (resource);
76+
}
77+
78+
static const struct wl_output_interface meta_wl_output_interface = {
79+
meta_wl_output_release,
80+
};
81+
7182
static MetaMonitor *
7283
pick_main_monitor (MetaLogicalMonitor *logical_monitor)
7384
{
@@ -293,6 +304,25 @@ send_output_events (struct wl_resource *resource,
293304
}
294305
}
295306

307+
if (need_all_events && version >= WL_OUTPUT_NAME_SINCE_VERSION)
308+
{
309+
const char *name;
310+
311+
name = meta_monitor_get_connector (monitor);
312+
wl_output_send_name (resource, name);
313+
need_done = TRUE;
314+
}
315+
316+
if (need_all_events && version >= WL_OUTPUT_DESCRIPTION_SINCE_VERSION)
317+
{
318+
const char *description;
319+
320+
description = meta_monitor_get_display_name (monitor);
321+
wl_output_send_description (resource, description);
322+
need_done = TRUE;
323+
}
324+
325+
296326
if (need_all_events && version >= WL_OUTPUT_DONE_SINCE_VERSION)
297327
{
298328
wl_output_send_done (resource);
@@ -319,8 +349,10 @@ bind_output (struct wl_client *client,
319349
resource = wl_resource_create (client, &wl_output_interface, version, id);
320350
wayland_output->resources = g_list_prepend (wayland_output->resources, resource);
321351

322-
wl_resource_set_user_data (resource, wayland_output);
323-
wl_resource_set_destructor (resource, output_resource_destroy);
352+
wl_resource_set_implementation (resource,
353+
&meta_wl_output_interface,
354+
wayland_output,
355+
output_resource_destroy);
324356

325357
if (!logical_monitor)
326358
return;

src/wayland/meta-wayland-versions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#define META_ZXDG_SHELL_V6_VERSION 1
4242
#define META_WL_SHELL_VERSION 1
4343
#define META_WL_SEAT_VERSION 5
44-
#define META_WL_OUTPUT_VERSION 2
44+
#define META_WL_OUTPUT_VERSION 4
4545
#define META_XSERVER_VERSION 1
4646
#define META_GTK_SHELL1_VERSION 3
4747
#define META_WL_SUBCOMPOSITOR_VERSION 1

0 commit comments

Comments
 (0)