126 lines
5.0 KiB
Diff
126 lines
5.0 KiB
Diff
From a8115378fd876bfd4c3871428cdc16134ed484b1 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
Date: Tue, 5 Jan 2021 11:11:18 +0100
|
|
Subject: [PATCH] media-keys: Mark screen cast as stopped if it was signalled
|
|
as such
|
|
|
|
gnome-shell now sends a 'Stopped' signal if it was stopped without
|
|
gsd-media-keys itself being the stopper.
|
|
---
|
|
plugins/media-keys/gsd-media-keys-manager.c | 52 +++++++++++++++++++--
|
|
1 file changed, 49 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
|
|
index 4d251f08..a526d5cf 100644
|
|
--- a/plugins/media-keys/gsd-media-keys-manager.c
|
|
+++ b/plugins/media-keys/gsd-media-keys-manager.c
|
|
@@ -210,6 +210,7 @@ struct GsdMediaKeysManagerPrivate
|
|
guint screencast_timeout_id;
|
|
gboolean screencast_recording;
|
|
GCancellable *screencast_cancellable;
|
|
+ guint screencast_stopped_signal_id;
|
|
|
|
/* Rotation */
|
|
guint iio_sensor_watch_id;
|
|
@@ -2346,20 +2347,26 @@ do_rfkill_action (GsdMediaKeysManager *manager,
|
|
}
|
|
|
|
static void
|
|
-screencast_stop (GsdMediaKeysManager *manager)
|
|
+screencast_stopped (GsdMediaKeysManager *manager)
|
|
{
|
|
if (manager->priv->screencast_timeout_id > 0) {
|
|
g_source_remove (manager->priv->screencast_timeout_id);
|
|
manager->priv->screencast_timeout_id = 0;
|
|
}
|
|
|
|
+ manager->priv->screencast_recording = FALSE;
|
|
+}
|
|
+
|
|
+static void
|
|
+screencast_stop (GsdMediaKeysManager *manager)
|
|
+{
|
|
+ screencast_stopped (manager);
|
|
+
|
|
g_dbus_proxy_call (manager->priv->screencast_proxy,
|
|
"StopScreencast", NULL,
|
|
G_DBUS_CALL_FLAGS_NONE, -1,
|
|
manager->priv->screencast_cancellable,
|
|
NULL, NULL);
|
|
-
|
|
- manager->priv->screencast_recording = FALSE;
|
|
}
|
|
|
|
static gboolean
|
|
@@ -2835,6 +2842,21 @@ initialize_volume_handler (GsdMediaKeysManager *manager)
|
|
gnome_settings_profile_end ("gvc_mixer_control_new");
|
|
}
|
|
|
|
+
|
|
+static void
|
|
+on_screencast_stopped (GDBusConnection *connection,
|
|
+ const gchar *sender_name,
|
|
+ const gchar *object_path,
|
|
+ const gchar *interface_name,
|
|
+ const gchar *signal_name,
|
|
+ GVariant *parameters,
|
|
+ gpointer data)
|
|
+{
|
|
+ GsdMediaKeysManager *manager = data;
|
|
+
|
|
+ screencast_stopped (manager);
|
|
+}
|
|
+
|
|
static void
|
|
on_screencast_proxy_ready (GObject *source,
|
|
GAsyncResult *result,
|
|
@@ -2850,7 +2872,20 @@ on_screencast_proxy_ready (GObject *source,
|
|
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
|
g_warning ("Failed to create proxy for screencast: %s", error->message);
|
|
g_error_free (error);
|
|
+ return;
|
|
}
|
|
+
|
|
+ manager->priv->screencast_stopped_signal_id =
|
|
+ g_dbus_connection_signal_subscribe (manager->priv->connection,
|
|
+ SHELL_DBUS_NAME ".Screencast",
|
|
+ SHELL_DBUS_NAME ".Screencast",
|
|
+ "Stopped",
|
|
+ SHELL_DBUS_PATH "/Screencast",
|
|
+ NULL,
|
|
+ G_DBUS_SIGNAL_FLAGS_NONE,
|
|
+ on_screencast_stopped,
|
|
+ manager,
|
|
+ NULL);
|
|
}
|
|
|
|
static void
|
|
@@ -2901,6 +2936,11 @@ shell_presence_changed (GsdMediaKeysManager *manager)
|
|
on_screencast_proxy_ready, manager);
|
|
g_free (name_owner);
|
|
} else {
|
|
+ if (manager->priv->screencast_stopped_signal_id)
|
|
+ g_dbus_connection_signal_unsubscribe (manager->priv->connection,
|
|
+ manager->priv->screencast_stopped_signal_id);
|
|
+ manager->priv->screencast_stopped_signal_id = 0;
|
|
+
|
|
g_ptr_array_set_size (manager->priv->keys, 0);
|
|
g_clear_object (&manager->priv->key_grabber);
|
|
g_clear_object (&manager->priv->screencast_proxy);
|
|
@@ -3091,6 +3131,12 @@ gsd_media_keys_manager_stop (GsdMediaKeysManager *manager)
|
|
priv->reenable_power_button_timer_id = 0;
|
|
}
|
|
|
|
+ if (priv->screencast_stopped_signal_id) {
|
|
+ g_dbus_connection_signal_unsubscribe (priv->connection,
|
|
+ priv->screencast_stopped_signal_id);
|
|
+ priv->screencast_stopped_signal_id = 0;
|
|
+ }
|
|
+
|
|
g_clear_pointer (&manager->priv->ca, ca_context_destroy);
|
|
|
|
#if HAVE_GUDEV
|
|
--
|
|
2.27.0
|
|
|