1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
From b8bbab864a1367ac47bcc0998b4c07d20020965a Mon Sep 17 00:00:00 2001
From: Marius Vlad <marius.vlad@collabora.com>
Date: Thu, 5 Oct 2023 18:23:52 +0300
Subject: [PATCH] ext/wayland: Add title/appid support
Upstream-Status: Pending
Bug-AGL: SPEC-4870
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
---
ext/wayland/gstwaylandsink.c | 41 +++++++++++++++++++++++++++++-
ext/wayland/gstwaylandsink.h | 2 ++
gst-libs/gst/wayland/gstwlwindow.c | 12 ++++++++-
gst-libs/gst/wayland/gstwlwindow.h | 3 ++-
4 files changed, 55 insertions(+), 3 deletions(-)
diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c
index 2f116bf..69f4a00 100644
--- a/ext/wayland/gstwaylandsink.c
+++ b/ext/wayland/gstwaylandsink.c
@@ -61,6 +61,8 @@ enum
PROP_DISPLAY,
PROP_FULLSCREEN,
PROP_ROTATE_METHOD,
+ PROP_APP_ID,
+ PROP_TITLE,
PROP_LAST
};
@@ -177,6 +179,16 @@ gst_wayland_sink_class_init (GstWaylandSinkClass * klass)
GST_TYPE_VIDEO_ORIENTATION_METHOD, GST_VIDEO_ORIENTATION_IDENTITY,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class, PROP_APP_ID,
+ g_param_spec_string ("appid", "Top-level application id", "Wayland "
+ "appid, as xdg_shell::set_app_id",
+ NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class, PROP_TITLE,
+ g_param_spec_string ("title", "Top-level title", "Wayland "
+ "title, xdg_shell::set_title",
+ NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
/**
* waylandsink:render-rectangle:
*
@@ -266,6 +278,16 @@ gst_wayland_sink_get_property (GObject * object,
g_value_set_enum (value, self->current_rotate_method);
GST_OBJECT_UNLOCK (self);
break;
+ case PROP_APP_ID:
+ GST_OBJECT_LOCK (self);
+ g_value_set_string (value, self->app_id);
+ GST_OBJECT_UNLOCK (self);
+ break;
+ case PROP_TITLE:
+ GST_OBJECT_LOCK (self);
+ g_value_set_string (value, self->title);
+ GST_OBJECT_UNLOCK (self);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -289,6 +311,16 @@ gst_wayland_sink_set_property (GObject * object,
gst_wayland_sink_set_fullscreen (self, g_value_get_boolean (value));
GST_OBJECT_UNLOCK (self);
break;
+ case PROP_APP_ID:
+ GST_OBJECT_LOCK (self);
+ self->app_id = g_value_dup_string (value);
+ GST_OBJECT_UNLOCK (self);
+ break;
+ case PROP_TITLE:
+ GST_OBJECT_LOCK (self);
+ self->title = g_value_dup_string (value);
+ GST_OBJECT_UNLOCK (self);
+ break;
case PROP_ROTATE_METHOD:
gst_wayland_sink_set_rotate_method (self, g_value_get_enum (value),
FALSE);
@@ -310,12 +342,18 @@ gst_wayland_sink_finalize (GObject * object)
gst_buffer_unref (self->last_buffer);
if (self->display)
g_object_unref (self->display);
+ if (self->title)
+ g_object_unref (self->title);
+ if (self->app_id)
+ g_object_unref (self->app_id);
if (self->window)
g_object_unref (self->window);
if (self->pool)
gst_object_unref (self->pool);
g_free (self->display_name);
+ g_free (self->title);
+ g_free (self->app_id);
g_mutex_clear (&self->display_lock);
g_mutex_clear (&self->render_lock);
@@ -761,7 +799,8 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
if (!self->window) {
/* if we were not provided a window, create one ourselves */
self->window = gst_wl_window_new_toplevel (self->display,
- &self->video_info, self->fullscreen, &self->render_lock);
+ &self->video_info, self->fullscreen, &self->app_id, &self->title,
+ &self->render_lock);
g_signal_connect_object (self->window, "closed",
G_CALLBACK (on_window_closed), self, 0);
gst_wl_window_set_rotate_method (self->window,
diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h
index 3243d8c..6aee19d 100644
--- a/ext/wayland/gstwaylandsink.h
+++ b/ext/wayland/gstwaylandsink.h
@@ -58,6 +58,8 @@ struct _GstWaylandSink
gboolean fullscreen;
gchar *display_name;
+ gchar *app_id;
+ gchar *title;
gboolean redraw_pending;
GMutex render_lock;
diff --git a/gst-libs/gst/wayland/gstwlwindow.c b/gst-libs/gst/wayland/gstwlwindow.c
index 6004993..de0a81e 100644
--- a/gst-libs/gst/wayland/gstwlwindow.c
+++ b/gst-libs/gst/wayland/gstwlwindow.c
@@ -270,7 +270,7 @@ gst_wl_window_ensure_fullscreen (GstWlWindow * self, gboolean fullscreen)
GstWlWindow *
gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info,
- gboolean fullscreen, GMutex * render_lock)
+ gboolean fullscreen, gchar *app_id, gchar *title, GMutex * render_lock)
{
GstWlWindow *self;
GstWlWindowPrivate *priv;
@@ -307,6 +307,16 @@ gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info,
gst_wl_window_ensure_fullscreen (self, fullscreen);
+ if (app_id)
+ xdg_toplevel_set_app_id (priv->xdg_toplevel, app_id);
+ else
+ xdg_toplevel_set_app_id (priv->xdg_toplevel, "ext.wayland.waylandsink");
+ if (title)
+ xdg_toplevel_set_title (priv->xdg_toplevel, title);
+ else
+ xdg_toplevel_set_title (priv->xdg_toplevel, "ext.wayland.waylandsink");
+
+
/* Finally, commit the xdg_surface state as toplevel */
priv->configured = FALSE;
wl_surface_commit (priv->area_surface);
diff --git a/gst-libs/gst/wayland/gstwlwindow.h b/gst-libs/gst/wayland/gstwlwindow.h
index 06c4001..e102052 100644
--- a/gst-libs/gst/wayland/gstwlwindow.h
+++ b/gst-libs/gst/wayland/gstwlwindow.h
@@ -39,7 +39,8 @@ void gst_wl_window_ensure_fullscreen (GstWlWindow * self,
GST_WL_API
GstWlWindow *gst_wl_window_new_toplevel (GstWlDisplay * display,
- const GstVideoInfo * info, gboolean fullscreen, GMutex * render_lock);
+ const GstVideoInfo * info, gboolean fullscreen, gchar * app_id,
+ gchar *title, GMutex * render_lock);
GST_WL_API
GstWlWindow *gst_wl_window_new_in_surface (GstWlDisplay * display,
--
2.35.1
|