mirror of
https://github.com/brl/mutter.git
synced 2025-02-16 21:34:09 +00:00
remote-desktop/session: Maybe emit 'owner-changed' after clipboard enabled
If there is a clipboard owner when enabling the clipboard integration without immediately overriding the owner, send an initial owner-changed event. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1552>
This commit is contained in:
parent
5104a9b2ce
commit
2cdb0414c2
@ -888,10 +888,8 @@ generate_owner_changed_variant (char **mime_types_array,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_selection_owner_changed (MetaSelection *selection,
|
emit_owner_changed (MetaRemoteDesktopSession *session,
|
||||||
MetaSelectionType selection_type,
|
MetaSelectionSource *owner)
|
||||||
MetaSelectionSource *owner,
|
|
||||||
MetaRemoteDesktopSession *session)
|
|
||||||
{
|
{
|
||||||
char log_buf[255];
|
char log_buf[255];
|
||||||
g_autofree char **mime_types_array = NULL;
|
g_autofree char **mime_types_array = NULL;
|
||||||
@ -900,14 +898,11 @@ on_selection_owner_changed (MetaSelection *selection,
|
|||||||
GVariant *options_variant;
|
GVariant *options_variant;
|
||||||
const char *object_path;
|
const char *object_path;
|
||||||
|
|
||||||
if (selection_type != META_SELECTION_CLIPBOARD)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (owner)
|
if (owner)
|
||||||
{
|
{
|
||||||
GList *mime_types;
|
GList *mime_types;
|
||||||
mime_types = meta_selection_source_get_mimetypes (owner);
|
|
||||||
|
|
||||||
|
mime_types = meta_selection_source_get_mimetypes (owner);
|
||||||
mime_types_array = g_new0 (char *, g_list_length (mime_types) + 1);
|
mime_types_array = g_new0 (char *, g_list_length (mime_types) + 1);
|
||||||
for (l = meta_selection_source_get_mimetypes (owner), i = 0;
|
for (l = meta_selection_source_get_mimetypes (owner), i = 0;
|
||||||
l;
|
l;
|
||||||
@ -941,6 +936,18 @@ on_selection_owner_changed (MetaSelection *selection,
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_selection_owner_changed (MetaSelection *selection,
|
||||||
|
MetaSelectionType selection_type,
|
||||||
|
MetaSelectionSource *owner,
|
||||||
|
MetaRemoteDesktopSession *session)
|
||||||
|
{
|
||||||
|
if (selection_type != META_SELECTION_CLIPBOARD)
|
||||||
|
return;
|
||||||
|
|
||||||
|
emit_owner_changed (session, owner);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
handle_enable_clipboard (MetaDBusRemoteDesktopSession *skeleton,
|
handle_enable_clipboard (MetaDBusRemoteDesktopSession *skeleton,
|
||||||
GDBusMethodInvocation *invocation,
|
GDBusMethodInvocation *invocation,
|
||||||
@ -951,6 +958,7 @@ handle_enable_clipboard (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
g_autoptr (GError) error = NULL;
|
g_autoptr (GError) error = NULL;
|
||||||
MetaDisplay *display = meta_get_display ();
|
MetaDisplay *display = meta_get_display ();
|
||||||
MetaSelection *selection = meta_display_get_selection (display);
|
MetaSelection *selection = meta_display_get_selection (display);
|
||||||
|
g_autoptr (MetaSelectionSourceRemote) source_remote = NULL;
|
||||||
|
|
||||||
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
||||||
"Enable clipboard for %s",
|
"Enable clipboard for %s",
|
||||||
@ -969,8 +977,6 @@ handle_enable_clipboard (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
G_VARIANT_TYPE_STRING_ARRAY);
|
G_VARIANT_TYPE_STRING_ARRAY);
|
||||||
if (mime_types_variant)
|
if (mime_types_variant)
|
||||||
{
|
{
|
||||||
g_autoptr (MetaSelectionSourceRemote) source_remote = NULL;
|
|
||||||
|
|
||||||
source_remote = create_remote_desktop_source (session,
|
source_remote = create_remote_desktop_source (session,
|
||||||
mime_types_variant,
|
mime_types_variant,
|
||||||
&error);
|
&error);
|
||||||
@ -982,7 +988,10 @@ handle_enable_clipboard (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
error->message);
|
error->message);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (source_remote)
|
||||||
|
{
|
||||||
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
meta_topic (META_DEBUG_REMOTE_DESKTOP,
|
||||||
"Setting remote desktop clipboard source: %p from %s",
|
"Setting remote desktop clipboard source: %p from %s",
|
||||||
source_remote, session->peer_name);
|
source_remote, session->peer_name);
|
||||||
@ -992,6 +1001,16 @@ handle_enable_clipboard (MetaDBusRemoteDesktopSession *skeleton,
|
|||||||
META_SELECTION_CLIPBOARD,
|
META_SELECTION_CLIPBOARD,
|
||||||
META_SELECTION_SOURCE (source_remote));
|
META_SELECTION_SOURCE (source_remote));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MetaSelectionSource *owner;
|
||||||
|
|
||||||
|
owner = meta_selection_get_current_owner (selection,
|
||||||
|
META_SELECTION_CLIPBOARD);
|
||||||
|
|
||||||
|
if (owner)
|
||||||
|
emit_owner_changed (session, owner);
|
||||||
|
}
|
||||||
|
|
||||||
session->is_clipboard_enabled = TRUE;
|
session->is_clipboard_enabled = TRUE;
|
||||||
session->owner_changed_handler_id =
|
session->owner_changed_handler_id =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user