|
|
79df40 |
From c483a57e848aa966eec6dfcb9d31786d83050a33 Mon Sep 17 00:00:00 2001
|
|
|
79df40 |
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
|
|
|
79df40 |
Date: Wed, 24 Jul 2019 17:10:49 +0200
|
|
|
79df40 |
Subject: [PATCH 28/28] cleanup: Unref GSource's once attached
|
|
|
79df40 |
|
|
|
79df40 |
When a source is attached the main contaxt takes the ownership of it, so we
|
|
|
79df40 |
can safely them.
|
|
|
79df40 |
|
|
|
79df40 |
https://gitlab.gnome.org/GNOME/mutter/merge_requests/682
|
|
|
79df40 |
---
|
|
|
79df40 |
clutter/clutter/clutter-backend.c | 1 +
|
|
|
79df40 |
clutter/clutter/clutter-master-clock-default.c | 2 +-
|
|
|
79df40 |
clutter/clutter/evdev/clutter-device-manager-evdev.c | 2 +-
|
|
|
79df40 |
src/backends/meta-screen-cast-stream-src.c | 1 +
|
|
|
79df40 |
src/backends/x11/meta-backend-x11.c | 3 ++-
|
|
|
79df40 |
src/wayland/meta-wayland.c | 2 +-
|
|
|
79df40 |
6 files changed, 7 insertions(+), 4 deletions(-)
|
|
|
79df40 |
|
|
|
79df40 |
diff --git a/clutter/clutter/clutter-backend.c b/clutter/clutter/clutter-backend.c
|
|
|
79df40 |
index 41ea3daed..df51464cc 100644
|
|
|
79df40 |
--- a/clutter/clutter/clutter-backend.c
|
|
|
79df40 |
+++ b/clutter/clutter/clutter-backend.c
|
|
|
79df40 |
@@ -381,60 +381,61 @@ clutter_backend_real_create_context (ClutterBackend *backend,
|
|
|
79df40 |
if (clutter_backend_do_real_create_context (backend, all_known_drivers[j].driver_id, &internal_error))
|
|
|
79df40 |
break;
|
|
|
79df40 |
|
|
|
79df40 |
if (internal_error)
|
|
|
79df40 |
{
|
|
|
79df40 |
CLUTTER_NOTE (BACKEND, "Unable to use the %s driver: %s",
|
|
|
79df40 |
all_known_drivers[j].driver_desc,
|
|
|
79df40 |
internal_error->message);
|
|
|
79df40 |
g_clear_error (&internal_error);
|
|
|
79df40 |
}
|
|
|
79df40 |
}
|
|
|
79df40 |
}
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
g_strfreev (known_drivers);
|
|
|
79df40 |
|
|
|
79df40 |
if (backend->cogl_context == NULL)
|
|
|
79df40 |
{
|
|
|
79df40 |
if (internal_error != NULL)
|
|
|
79df40 |
g_propagate_error (error, internal_error);
|
|
|
79df40 |
else
|
|
|
79df40 |
g_set_error_literal (error, CLUTTER_INIT_ERROR,
|
|
|
79df40 |
CLUTTER_INIT_ERROR_BACKEND,
|
|
|
79df40 |
_("Unable to initialize the Clutter backend: no available drivers found."));
|
|
|
79df40 |
|
|
|
79df40 |
return FALSE;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
backend->cogl_source = cogl_glib_source_new (backend->cogl_context, G_PRIORITY_DEFAULT);
|
|
|
79df40 |
g_source_attach (backend->cogl_source, NULL);
|
|
|
79df40 |
+ g_source_unref (backend->cogl_source);
|
|
|
79df40 |
|
|
|
79df40 |
return TRUE;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
static ClutterFeatureFlags
|
|
|
79df40 |
clutter_backend_real_get_features (ClutterBackend *backend)
|
|
|
79df40 |
{
|
|
|
79df40 |
ClutterFeatureFlags flags = 0;
|
|
|
79df40 |
|
|
|
79df40 |
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_MULTIPLE_ONSCREEN))
|
|
|
79df40 |
{
|
|
|
79df40 |
CLUTTER_NOTE (BACKEND, "Cogl supports multiple onscreen framebuffers");
|
|
|
79df40 |
flags |= CLUTTER_FEATURE_STAGE_MULTIPLE;
|
|
|
79df40 |
}
|
|
|
79df40 |
else
|
|
|
79df40 |
{
|
|
|
79df40 |
CLUTTER_NOTE (BACKEND, "Cogl only supports one onscreen framebuffer");
|
|
|
79df40 |
flags |= CLUTTER_FEATURE_STAGE_STATIC;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_THROTTLE))
|
|
|
79df40 |
{
|
|
|
79df40 |
CLUTTER_NOTE (BACKEND, "Cogl supports swap buffers throttling");
|
|
|
79df40 |
flags |= CLUTTER_FEATURE_SYNC_TO_VBLANK;
|
|
|
79df40 |
}
|
|
|
79df40 |
else
|
|
|
79df40 |
CLUTTER_NOTE (BACKEND, "Cogl doesn't support swap buffers throttling");
|
|
|
79df40 |
|
|
|
79df40 |
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT))
|
|
|
79df40 |
{
|
|
|
79df40 |
diff --git a/clutter/clutter/clutter-master-clock-default.c b/clutter/clutter/clutter-master-clock-default.c
|
|
|
79df40 |
index 7b2df0df3..83b1eadcb 100644
|
|
|
79df40 |
--- a/clutter/clutter/clutter-master-clock-default.c
|
|
|
79df40 |
+++ b/clutter/clutter/clutter-master-clock-default.c
|
|
|
79df40 |
@@ -577,61 +577,61 @@ clutter_clock_dispatch (GSource *source,
|
|
|
79df40 |
g_slist_free (stages);
|
|
|
79df40 |
|
|
|
79df40 |
master_clock->prev_tick = master_clock->cur_tick;
|
|
|
79df40 |
|
|
|
79df40 |
_clutter_threads_release_lock ();
|
|
|
79df40 |
|
|
|
79df40 |
return TRUE;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
static void
|
|
|
79df40 |
clutter_master_clock_default_finalize (GObject *gobject)
|
|
|
79df40 |
{
|
|
|
79df40 |
ClutterMasterClockDefault *master_clock = CLUTTER_MASTER_CLOCK_DEFAULT (gobject);
|
|
|
79df40 |
|
|
|
79df40 |
g_slist_free (master_clock->timelines);
|
|
|
79df40 |
|
|
|
79df40 |
G_OBJECT_CLASS (clutter_master_clock_default_parent_class)->finalize (gobject);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
static void
|
|
|
79df40 |
clutter_master_clock_default_class_init (ClutterMasterClockDefaultClass *klass)
|
|
|
79df40 |
{
|
|
|
79df40 |
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
|
79df40 |
|
|
|
79df40 |
gobject_class->finalize = clutter_master_clock_default_finalize;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
static void
|
|
|
79df40 |
clutter_master_clock_default_init (ClutterMasterClockDefault *self)
|
|
|
79df40 |
{
|
|
|
79df40 |
- GSource *source;
|
|
|
79df40 |
+ g_autoptr (GSource) source = NULL;
|
|
|
79df40 |
|
|
|
79df40 |
source = clutter_clock_source_new (self);
|
|
|
79df40 |
self->source = source;
|
|
|
79df40 |
|
|
|
79df40 |
self->idle = FALSE;
|
|
|
79df40 |
self->ensure_next_iteration = FALSE;
|
|
|
79df40 |
self->paused = FALSE;
|
|
|
79df40 |
|
|
|
79df40 |
#ifdef CLUTTER_ENABLE_DEBUG
|
|
|
79df40 |
self->frame_budget = G_USEC_PER_SEC / 60;
|
|
|
79df40 |
#endif
|
|
|
79df40 |
|
|
|
79df40 |
g_source_set_priority (source, CLUTTER_PRIORITY_REDRAW);
|
|
|
79df40 |
g_source_set_can_recurse (source, FALSE);
|
|
|
79df40 |
g_source_attach (source, NULL);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
static void
|
|
|
79df40 |
clutter_master_clock_default_add_timeline (ClutterMasterClock *clock,
|
|
|
79df40 |
ClutterTimeline *timeline)
|
|
|
79df40 |
{
|
|
|
79df40 |
ClutterMasterClockDefault *master_clock = (ClutterMasterClockDefault *) clock;
|
|
|
79df40 |
gboolean is_first;
|
|
|
79df40 |
|
|
|
79df40 |
if (g_slist_find (master_clock->timelines, timeline))
|
|
|
79df40 |
return;
|
|
|
79df40 |
|
|
|
79df40 |
is_first = master_clock->timelines == NULL;
|
|
|
79df40 |
|
|
|
79df40 |
master_clock->timelines = g_slist_prepend (master_clock->timelines,
|
|
|
79df40 |
diff --git a/clutter/clutter/evdev/clutter-device-manager-evdev.c b/clutter/clutter/evdev/clutter-device-manager-evdev.c
|
|
|
79df40 |
index 11cb4781a..49566c233 100644
|
|
|
79df40 |
--- a/clutter/clutter/evdev/clutter-device-manager-evdev.c
|
|
|
79df40 |
+++ b/clutter/clutter/evdev/clutter-device-manager-evdev.c
|
|
|
79df40 |
@@ -706,61 +706,61 @@ clutter_event_dispatch (GSource *g_source,
|
|
|
79df40 |
/* Drop events if we don't have any stage to forward them to */
|
|
|
79df40 |
if (!_clutter_input_device_get_stage (input_device))
|
|
|
79df40 |
goto out;
|
|
|
79df40 |
|
|
|
79df40 |
/* forward the event into clutter for emission etc. */
|
|
|
79df40 |
_clutter_stage_queue_event (event->any.stage, event, FALSE);
|
|
|
79df40 |
|
|
|
79df40 |
/* update the device states *after* the event */
|
|
|
79df40 |
event_state = seat->button_state |
|
|
|
79df40 |
xkb_state_serialize_mods (seat->xkb, XKB_STATE_MODS_EFFECTIVE);
|
|
|
79df40 |
_clutter_input_device_set_state (seat->core_pointer, event_state);
|
|
|
79df40 |
_clutter_input_device_set_state (seat->core_keyboard, event_state);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
out:
|
|
|
79df40 |
_clutter_threads_release_lock ();
|
|
|
79df40 |
|
|
|
79df40 |
return TRUE;
|
|
|
79df40 |
}
|
|
|
79df40 |
static GSourceFuncs event_funcs = {
|
|
|
79df40 |
clutter_event_prepare,
|
|
|
79df40 |
clutter_event_check,
|
|
|
79df40 |
clutter_event_dispatch,
|
|
|
79df40 |
NULL
|
|
|
79df40 |
};
|
|
|
79df40 |
|
|
|
79df40 |
static ClutterEventSource *
|
|
|
79df40 |
clutter_event_source_new (ClutterDeviceManagerEvdev *manager_evdev)
|
|
|
79df40 |
{
|
|
|
79df40 |
ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv;
|
|
|
79df40 |
- GSource *source;
|
|
|
79df40 |
+ g_autoptr (GSource) source = NULL;
|
|
|
79df40 |
ClutterEventSource *event_source;
|
|
|
79df40 |
gint fd;
|
|
|
79df40 |
|
|
|
79df40 |
source = g_source_new (&event_funcs, sizeof (ClutterEventSource));
|
|
|
79df40 |
event_source = (ClutterEventSource *) source;
|
|
|
79df40 |
|
|
|
79df40 |
/* setup the source */
|
|
|
79df40 |
event_source->manager_evdev = manager_evdev;
|
|
|
79df40 |
|
|
|
79df40 |
fd = libinput_get_fd (priv->libinput);
|
|
|
79df40 |
event_source->event_poll_fd.fd = fd;
|
|
|
79df40 |
event_source->event_poll_fd.events = G_IO_IN;
|
|
|
79df40 |
|
|
|
79df40 |
/* and finally configure and attach the GSource */
|
|
|
79df40 |
g_source_set_priority (source, CLUTTER_PRIORITY_EVENTS);
|
|
|
79df40 |
g_source_add_poll (source, &event_source->event_poll_fd);
|
|
|
79df40 |
g_source_set_can_recurse (source, TRUE);
|
|
|
79df40 |
g_source_attach (source, NULL);
|
|
|
79df40 |
|
|
|
79df40 |
return event_source;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
static void
|
|
|
79df40 |
clutter_event_source_free (ClutterEventSource *source)
|
|
|
79df40 |
{
|
|
|
79df40 |
GSource *g_source = (GSource *) source;
|
|
|
79df40 |
|
|
|
79df40 |
CLUTTER_NOTE (EVENT, "Removing GSource for evdev device manager");
|
|
|
79df40 |
|
|
|
79df40 |
/* ignore the return value of close, it's not like we can do something
|
|
|
79df40 |
diff --git a/src/backends/meta-screen-cast-stream-src.c b/src/backends/meta-screen-cast-stream-src.c
|
|
|
79df40 |
index 457c0589e..254ef983d 100644
|
|
|
79df40 |
--- a/src/backends/meta-screen-cast-stream-src.c
|
|
|
79df40 |
+++ b/src/backends/meta-screen-cast-stream-src.c
|
|
|
79df40 |
@@ -465,60 +465,61 @@ static void
|
|
|
79df40 |
init_spa_type (MetaSpaType *type,
|
|
|
79df40 |
struct spa_type_map *map)
|
|
|
79df40 |
{
|
|
|
79df40 |
spa_type_media_type_map (map, &type->media_type);
|
|
|
79df40 |
spa_type_media_subtype_map (map, &type->media_subtype);
|
|
|
79df40 |
spa_type_format_video_map (map, &type->format_video);
|
|
|
79df40 |
spa_type_video_format_map (map, &type->video_format);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
static MetaPipeWireSource *
|
|
|
79df40 |
create_pipewire_source (void)
|
|
|
79df40 |
{
|
|
|
79df40 |
MetaPipeWireSource *pipewire_source;
|
|
|
79df40 |
|
|
|
79df40 |
pipewire_source =
|
|
|
79df40 |
(MetaPipeWireSource *) g_source_new (&pipewire_source_funcs,
|
|
|
79df40 |
sizeof (MetaPipeWireSource));
|
|
|
79df40 |
pipewire_source->pipewire_loop = pw_loop_new (NULL);
|
|
|
79df40 |
if (!pipewire_source->pipewire_loop)
|
|
|
79df40 |
{
|
|
|
79df40 |
g_source_destroy ((GSource *) pipewire_source);
|
|
|
79df40 |
return NULL;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
g_source_add_unix_fd (&pipewire_source->base,
|
|
|
79df40 |
pw_loop_get_fd (pipewire_source->pipewire_loop),
|
|
|
79df40 |
G_IO_IN | G_IO_ERR);
|
|
|
79df40 |
|
|
|
79df40 |
pw_loop_enter (pipewire_source->pipewire_loop);
|
|
|
79df40 |
g_source_attach (&pipewire_source->base, NULL);
|
|
|
79df40 |
+ g_source_unref (&pipewire_source->base);
|
|
|
79df40 |
|
|
|
79df40 |
return pipewire_source;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
static const struct pw_remote_events remote_events = {
|
|
|
79df40 |
PW_VERSION_REMOTE_EVENTS,
|
|
|
79df40 |
.state_changed = on_state_changed,
|
|
|
79df40 |
};
|
|
|
79df40 |
|
|
|
79df40 |
static gboolean
|
|
|
79df40 |
meta_screen_cast_stream_src_initable_init (GInitable *initable,
|
|
|
79df40 |
GCancellable *cancellable,
|
|
|
79df40 |
GError **error)
|
|
|
79df40 |
{
|
|
|
79df40 |
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (initable);
|
|
|
79df40 |
MetaScreenCastStreamSrcPrivate *priv =
|
|
|
79df40 |
meta_screen_cast_stream_src_get_instance_private (src);
|
|
|
79df40 |
|
|
|
79df40 |
priv->pipewire_source = create_pipewire_source ();
|
|
|
79df40 |
if (!priv->pipewire_source)
|
|
|
79df40 |
{
|
|
|
79df40 |
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
|
|
79df40 |
"Failed to create PipeWire source");
|
|
|
79df40 |
return FALSE;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
priv->pipewire_core = pw_core_new (priv->pipewire_source->pipewire_loop,
|
|
|
79df40 |
NULL);
|
|
|
79df40 |
if (!priv->pipewire_core)
|
|
|
79df40 |
{
|
|
|
79df40 |
diff --git a/src/backends/x11/meta-backend-x11.c b/src/backends/x11/meta-backend-x11.c
|
|
|
79df40 |
index 3f8645e93..b9acf48c0 100644
|
|
|
79df40 |
--- a/src/backends/x11/meta-backend-x11.c
|
|
|
79df40 |
+++ b/src/backends/x11/meta-backend-x11.c
|
|
|
79df40 |
@@ -449,71 +449,72 @@ x_event_source_dispatch (GSource *source,
|
|
|
79df40 |
gpointer user_data)
|
|
|
79df40 |
{
|
|
|
79df40 |
XEventSource *x_source = (XEventSource *) source;
|
|
|
79df40 |
MetaBackend *backend = x_source->backend;
|
|
|
79df40 |
MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
|
|
|
79df40 |
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
|
|
|
79df40 |
|
|
|
79df40 |
while (XPending (priv->xdisplay))
|
|
|
79df40 |
{
|
|
|
79df40 |
XEvent event;
|
|
|
79df40 |
|
|
|
79df40 |
XNextEvent (priv->xdisplay, &event);
|
|
|
79df40 |
|
|
|
79df40 |
handle_host_xevent (backend, &event);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
return TRUE;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
static GSourceFuncs x_event_funcs = {
|
|
|
79df40 |
x_event_source_prepare,
|
|
|
79df40 |
x_event_source_check,
|
|
|
79df40 |
x_event_source_dispatch,
|
|
|
79df40 |
};
|
|
|
79df40 |
|
|
|
79df40 |
static GSource *
|
|
|
79df40 |
x_event_source_new (MetaBackend *backend)
|
|
|
79df40 |
{
|
|
|
79df40 |
MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
|
|
|
79df40 |
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
|
|
|
79df40 |
- GSource *source;
|
|
|
79df40 |
+ g_autoptr (GSource) source = NULL;
|
|
|
79df40 |
XEventSource *x_source;
|
|
|
79df40 |
|
|
|
79df40 |
source = g_source_new (&x_event_funcs, sizeof (XEventSource));
|
|
|
79df40 |
x_source = (XEventSource *) source;
|
|
|
79df40 |
x_source->backend = backend;
|
|
|
79df40 |
x_source->event_poll_fd.fd = ConnectionNumber (priv->xdisplay);
|
|
|
79df40 |
x_source->event_poll_fd.events = G_IO_IN;
|
|
|
79df40 |
g_source_add_poll (source, &x_source->event_poll_fd);
|
|
|
79df40 |
|
|
|
79df40 |
g_source_attach (source, NULL);
|
|
|
79df40 |
+
|
|
|
79df40 |
return source;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
static void
|
|
|
79df40 |
on_monitors_changed (MetaMonitorManager *manager,
|
|
|
79df40 |
MetaBackend *backend)
|
|
|
79df40 |
{
|
|
|
79df40 |
MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
|
|
|
79df40 |
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
|
|
|
79df40 |
|
|
|
79df40 |
priv->cached_current_logical_monitor = NULL;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
static void
|
|
|
79df40 |
meta_backend_x11_post_init (MetaBackend *backend)
|
|
|
79df40 |
{
|
|
|
79df40 |
MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
|
|
|
79df40 |
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
|
|
|
79df40 |
MetaMonitorManager *monitor_manager;
|
|
|
79df40 |
int major, minor;
|
|
|
79df40 |
gboolean has_xi = FALSE;
|
|
|
79df40 |
|
|
|
79df40 |
priv->source = x_event_source_new (backend);
|
|
|
79df40 |
|
|
|
79df40 |
if (!XSyncQueryExtension (priv->xdisplay, &priv->xsync_event_base, &priv->xsync_error_base) ||
|
|
|
79df40 |
!XSyncInitialize (priv->xdisplay, &major, &minor))
|
|
|
79df40 |
meta_fatal ("Could not initialize XSync");
|
|
|
79df40 |
|
|
|
79df40 |
priv->counter = find_idletime_counter (priv);
|
|
|
79df40 |
if (priv->counter == None)
|
|
|
79df40 |
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
|
|
|
79df40 |
index bab6b4ac4..44f48a0ee 100644
|
|
|
79df40 |
--- a/src/wayland/meta-wayland.c
|
|
|
79df40 |
+++ b/src/wayland/meta-wayland.c
|
|
|
79df40 |
@@ -325,61 +325,61 @@ meta_wayland_pre_clutter_init (void)
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
static bool
|
|
|
79df40 |
meta_xwayland_global_filter (const struct wl_client *client,
|
|
|
79df40 |
const struct wl_global *global,
|
|
|
79df40 |
void *data)
|
|
|
79df40 |
{
|
|
|
79df40 |
MetaWaylandCompositor *compositor = (MetaWaylandCompositor *) data;
|
|
|
79df40 |
MetaXWaylandManager *xwayland_manager = &compositor->xwayland_manager;
|
|
|
79df40 |
|
|
|
79df40 |
/* Keyboard grabbing protocol is for Xwayland only */
|
|
|
79df40 |
if (client != xwayland_manager->client)
|
|
|
79df40 |
return (wl_global_get_interface (global) !=
|
|
|
79df40 |
&zwp_xwayland_keyboard_grab_manager_v1_interface);
|
|
|
79df40 |
|
|
|
79df40 |
/* All others are visible to all clients */
|
|
|
79df40 |
return true;
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
void
|
|
|
79df40 |
meta_wayland_override_display_name (char *display_name)
|
|
|
79df40 |
{
|
|
|
79df40 |
g_clear_pointer (&_display_name_override, g_free);
|
|
|
79df40 |
_display_name_override = g_strdup (display_name);
|
|
|
79df40 |
}
|
|
|
79df40 |
|
|
|
79df40 |
void
|
|
|
79df40 |
meta_wayland_init (void)
|
|
|
79df40 |
{
|
|
|
79df40 |
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
|
|
79df40 |
- GSource *wayland_event_source;
|
|
|
79df40 |
+ g_autoptr (GSource) wayland_event_source = NULL;
|
|
|
79df40 |
|
|
|
79df40 |
wayland_event_source = wayland_event_source_new (compositor->wayland_display);
|
|
|
79df40 |
|
|
|
79df40 |
/* XXX: Here we are setting the wayland event source to have a
|
|
|
79df40 |
* slightly lower priority than the X event source, because we are
|
|
|
79df40 |
* much more likely to get confused being told about surface changes
|
|
|
79df40 |
* relating to X clients when we don't know what's happened to them
|
|
|
79df40 |
* according to the X protocol.
|
|
|
79df40 |
*/
|
|
|
79df40 |
g_source_set_priority (wayland_event_source, GDK_PRIORITY_EVENTS + 1);
|
|
|
79df40 |
g_source_attach (wayland_event_source, NULL);
|
|
|
79df40 |
|
|
|
79df40 |
if (!wl_global_create (compositor->wayland_display,
|
|
|
79df40 |
&wl_compositor_interface,
|
|
|
79df40 |
META_WL_COMPOSITOR_VERSION,
|
|
|
79df40 |
compositor, compositor_bind))
|
|
|
79df40 |
g_error ("Failed to register the global wl_compositor");
|
|
|
79df40 |
|
|
|
79df40 |
wl_display_init_shm (compositor->wayland_display);
|
|
|
79df40 |
|
|
|
79df40 |
meta_wayland_outputs_init (compositor);
|
|
|
79df40 |
meta_wayland_data_device_manager_init (compositor);
|
|
|
79df40 |
meta_wayland_subsurfaces_init (compositor);
|
|
|
79df40 |
meta_wayland_shell_init (compositor);
|
|
|
79df40 |
meta_wayland_pointer_gestures_init (compositor);
|
|
|
79df40 |
meta_wayland_tablet_manager_init (compositor);
|
|
|
79df40 |
meta_wayland_seat_init (compositor);
|
|
|
79df40 |
meta_wayland_relative_pointer_init (compositor);
|
|
|
79df40 |
meta_wayland_pointer_constraints_init (compositor);
|
|
|
79df40 |
meta_wayland_xdg_foreign_init (compositor);
|
|
|
79df40 |
--
|
|
|
79df40 |
2.26.2
|
|
|
79df40 |
|