mirror of
https://github.com/brl/mutter.git
synced 2025-06-13 16:59:30 +00:00
wayland: Set dummy selection source on .set_selection(null)
Requesting a selection with a NULL data source means "unset the clipboard", but internally we use an unset clipboard as the indication that the clipboard manager should take over. Moreover, this unset request may go unheard if the current owner is someone else than the MetaWaylandDataDevice. Instead, set a dummy data source with no mimetypes nor data, this both prevents the clipboard manager from taking over and ensures the selection is replaced with it. The MetaSelectionSourceMemory was also added some checks to allow for this dummy mode. Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/793
This commit is contained in:
@ -76,6 +76,9 @@ meta_selection_source_memory_get_mimetypes (MetaSelectionSource *source)
|
||||
{
|
||||
MetaSelectionSourceMemory *source_mem = META_SELECTION_SOURCE_MEMORY (source);
|
||||
|
||||
if (!source_mem->mimetype)
|
||||
return NULL;
|
||||
|
||||
return g_list_prepend (NULL, g_strdup (source_mem->mimetype));
|
||||
}
|
||||
|
||||
@ -84,7 +87,7 @@ meta_selection_source_memory_finalize (GObject *object)
|
||||
{
|
||||
MetaSelectionSourceMemory *source_mem = META_SELECTION_SOURCE_MEMORY (object);
|
||||
|
||||
g_bytes_unref (source_mem->content);
|
||||
g_clear_pointer (&source_mem->content, g_bytes_unref);
|
||||
g_free (source_mem->mimetype);
|
||||
|
||||
G_OBJECT_CLASS (meta_selection_source_memory_parent_class)->finalize (object);
|
||||
|
Reference in New Issue
Block a user