Update to 3.35.1

This commit is contained in:
Florian Müllner 2019-10-12 22:57:56 +02:00
parent 751740e9bf
commit 6a7586bda5
14 changed files with 9 additions and 1004 deletions

1
.gitignore vendored
View File

@ -161,3 +161,4 @@ mutter-2.31.5.tar.bz2
/mutter-3.33.92.tar.xz
/mutter-3.34.0.tar.xz
/mutter-3.34.1.tar.xz
/mutter-3.35.1.tar.xz

View File

@ -1,60 +0,0 @@
From 1cc249fe18c8c280d8087642e0ac1f0287c53a64 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Thu, 10 Oct 2019 10:10:38 +0200
Subject: [PATCH 1/2] kms: Always predict state after processing update
Not only mode sets have state that should be predicted; changing gamma
currently happens with its own update, so we missed predicting that.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/840
---
src/backends/native/meta-kms-update-private.h | 2 --
src/backends/native/meta-kms-update.c | 6 ------
src/backends/native/meta-kms.c | 3 +--
3 files changed, 1 insertion(+), 10 deletions(-)
diff --git a/src/backends/native/meta-kms-update-private.h b/src/backends/native/meta-kms-update-private.h
index 88e2590af..df7737c9b 100644
--- a/src/backends/native/meta-kms-update-private.h
+++ b/src/backends/native/meta-kms-update-private.h
@@ -110,6 +110,4 @@ GList * meta_kms_update_get_connector_properties (MetaKmsUpdate *update);
GList * meta_kms_update_get_crtc_gammas (MetaKmsUpdate *update);
-gboolean meta_kms_update_has_mode_set (MetaKmsUpdate *update);
-
#endif /* META_KMS_UPDATE_PRIVATE_H */
diff --git a/src/backends/native/meta-kms-update.c b/src/backends/native/meta-kms-update.c
index 2a4a05c3e..c946aa7a2 100644
--- a/src/backends/native/meta-kms-update.c
+++ b/src/backends/native/meta-kms-update.c
@@ -282,12 +282,6 @@ meta_kms_update_get_crtc_gammas (MetaKmsUpdate *update)
return update->crtc_gammas;
}
-gboolean
-meta_kms_update_has_mode_set (MetaKmsUpdate *update)
-{
- return !!update->mode_sets;
-}
-
void
meta_kms_update_seal (MetaKmsUpdate *update)
{
diff --git a/src/backends/native/meta-kms.c b/src/backends/native/meta-kms.c
index 9485bb4e8..804a1adda 100644
--- a/src/backends/native/meta-kms.c
+++ b/src/backends/native/meta-kms.c
@@ -211,8 +211,7 @@ meta_kms_update_process_in_impl (MetaKmsImpl *impl,
ret = meta_kms_impl_process_update (impl, update, error);
- if (meta_kms_update_has_mode_set (update))
- meta_kms_predict_states_in_impl (meta_kms_impl_get_kms (impl), update);
+ meta_kms_predict_states_in_impl (meta_kms_impl_get_kms (impl), update);
return ret;
}
--
2.23.0

View File

@ -1,43 +0,0 @@
From dfd44ff9713760ba051c20b9b5cab58d183c069e Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 11 Oct 2019 13:25:35 +0200
Subject: [PATCH 1/8] wayland: Plug MetaSelectionSourceWayland leaks
There was a dangling ref left on all of them, oops.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/848
---
src/wayland/meta-wayland-data-device.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index 2ca77e8ea..e063a9a0c 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -1309,6 +1309,7 @@ data_device_start_drag (struct wl_client *client,
g_list_free_full (mimetypes, g_free);
set_selection_source (data_device, META_SELECTION_DND,
selection_source);
+ g_object_unref (selection_source);
meta_wayland_pointer_set_focus (seat->pointer, NULL);
meta_wayland_data_device_start_drag (data_device, client,
@@ -1694,6 +1695,7 @@ meta_wayland_data_device_set_selection (MetaWaylandDataDevice *data_device,
set_selection_source (data_device, META_SELECTION_CLIPBOARD,
selection_source);
+ g_object_unref (selection_source);
}
else
{
@@ -1831,6 +1833,7 @@ meta_wayland_data_device_set_primary (MetaWaylandDataDevice *data_device,
set_selection_source (data_device, META_SELECTION_PRIMARY,
selection_source);
+ g_object_unref (selection_source);
}
else
{
--
2.23.0

View File

@ -1,52 +0,0 @@
From 59a697f773e856776887c6e11e452fe4b2cefed0 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Thu, 10 Oct 2019 12:16:58 +0200
Subject: [PATCH] x11: Translate well known selection atoms to mimetypes
Some antediluvian x11 clients only bother to set atoms like
UTF8_STRING/STRING/TEXT/... and no matching mimetypes. Cover for them
and add the well known mimetypes if they are missing.
Reported at https://bugzilla.redhat.com/show_bug.cgi?id=1758873
https://gitlab.gnome.org/GNOME/mutter/merge_requests/842
---
src/x11/meta-selection-source-x11.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/x11/meta-selection-source-x11.c b/src/x11/meta-selection-source-x11.c
index 15a763651..1a0369ab0 100644
--- a/src/x11/meta-selection-source-x11.c
+++ b/src/x11/meta-selection-source-x11.c
@@ -139,6 +139,8 @@ atoms_to_mimetypes (MetaX11Display *display,
const Atom *atoms;
gsize size;
guint i, n_atoms;
+ gboolean utf8_string_found = FALSE, utf8_text_plain_found = FALSE;
+ gboolean string_found = FALSE, text_plain_found = FALSE;
atoms = g_bytes_get_data (bytes, &size);
n_atoms = size / sizeof (Atom);
@@ -149,8 +151,19 @@ atoms_to_mimetypes (MetaX11Display *display,
mimetype = gdk_x11_get_xatom_name (atoms[i]);
mimetypes = g_list_prepend (mimetypes, g_strdup (mimetype));
+
+ utf8_text_plain_found |= strcmp (mimetype, "text/plain;charset=utf-8") == 0;
+ text_plain_found |= strcmp (mimetype, "text/plain") == 0;
+ utf8_string_found |= strcmp (mimetype, "UTF8_STRING") == 0;
+ string_found |= strcmp (mimetype, "STRING") == 0;
}
+ /* Ensure non-x11 clients get well-known mimetypes */
+ if (string_found && !text_plain_found)
+ mimetypes = g_list_prepend (mimetypes, g_strdup ("text/plain"));
+ if (utf8_string_found && !utf8_text_plain_found)
+ mimetypes = g_list_prepend (mimetypes, g_strdup ("text/plain;charset=utf-8"));
+
return mimetypes;
}
--
2.23.0

View File

@ -1,114 +0,0 @@
From 1b4709794ea3602f5573fee164c880a14f049d3b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Thu, 10 Oct 2019 10:47:05 +0200
Subject: [PATCH 2/2] kms/crtc: Read gamma state when prediction failed
If we did a mode set, the gamma may have been changed by the kernel, and
if we didn't also update the gamma in the same transaction, we have no
way to predict the current gamma ramp state. In this case, read the
gamma state directly from KMS.
This should be relatively harmless regarding the race conditions the
state prediction was meant to solve, as the worst case is we get none or
out of date gamma ramps; and since this is for when gamma ramps are not
updated at mode setting time, we'd get intermediate gamma state to begin
with, so it's not worse than what we currently do anyway.
Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/851
https://gitlab.gnome.org/GNOME/mutter/merge_requests/840
---
src/backends/native/meta-kms-crtc.c | 46 +++++++++++++++++++++++++++--
1 file changed, 43 insertions(+), 3 deletions(-)
diff --git a/src/backends/native/meta-kms-crtc.c b/src/backends/native/meta-kms-crtc.c
index 3610df903..da99a58cd 100644
--- a/src/backends/native/meta-kms-crtc.c
+++ b/src/backends/native/meta-kms-crtc.c
@@ -143,14 +143,26 @@ meta_kms_crtc_update_state (MetaKmsCrtc *crtc)
drmModeFreeCrtc (drm_crtc);
}
+static void
+clear_gamma_state (MetaKmsCrtc *crtc)
+{
+ crtc->current_state.gamma.size = 0;
+ g_clear_pointer (&crtc->current_state.gamma.red, g_free);
+ g_clear_pointer (&crtc->current_state.gamma.green, g_free);
+ g_clear_pointer (&crtc->current_state.gamma.blue, g_free);
+}
+
void
meta_kms_crtc_predict_state (MetaKmsCrtc *crtc,
MetaKmsUpdate *update)
{
+ gboolean is_gamma_valid;
GList *mode_sets;
GList *crtc_gammas;
GList *l;
+ is_gamma_valid = TRUE;
+
mode_sets = meta_kms_update_get_mode_sets (update);
for (l = mode_sets; l; l = l->next)
{
@@ -178,6 +190,8 @@ meta_kms_crtc_predict_state (MetaKmsCrtc *crtc,
crtc->current_state.drm_mode = (drmModeModeInfo) { 0 };
}
+ is_gamma_valid = FALSE;
+
break;
}
@@ -196,8 +210,36 @@ meta_kms_crtc_predict_state (MetaKmsCrtc *crtc,
g_memdup (gamma->green, gamma->size * sizeof (uint16_t));
crtc->current_state.gamma.blue =
g_memdup (gamma->blue, gamma->size * sizeof (uint16_t));
+
+ is_gamma_valid = TRUE;
break;
}
+
+ if (!is_gamma_valid)
+ {
+ if (crtc->current_state.is_drm_mode_valid)
+ {
+ MetaKmsImplDevice *impl_device;
+ drmModeCrtc *drm_crtc;
+
+ impl_device = meta_kms_device_get_impl_device (crtc->device);
+ drm_crtc = drmModeGetCrtc (meta_kms_impl_device_get_fd (impl_device),
+ crtc->id);
+ if (drm_crtc)
+ {
+ read_gamma_state (crtc, impl_device, drm_crtc);
+ drmModeFreeCrtc (drm_crtc);
+ }
+ else
+ {
+ clear_gamma_state (crtc);
+ }
+ }
+ else
+ {
+ clear_gamma_state (crtc);
+ }
+ }
}
MetaKmsCrtc *
@@ -220,9 +262,7 @@ meta_kms_crtc_finalize (GObject *object)
{
MetaKmsCrtc *crtc = META_KMS_CRTC (object);
- g_clear_pointer (&crtc->current_state.gamma.red, g_free);
- g_clear_pointer (&crtc->current_state.gamma.green, g_free);
- g_clear_pointer (&crtc->current_state.gamma.blue, g_free);
+ clear_gamma_state (crtc);
G_OBJECT_CLASS (meta_kms_crtc_parent_class)->finalize (object);
}
--
2.23.0

View File

@ -1,94 +0,0 @@
From f2e2fcf758d7fe10604327d37f29593c9a1cf5b8 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 11 Oct 2019 16:49:24 +0200
Subject: [PATCH 2/8] wayland: Drop field from MetaWaylandDataSourcePrimary
This is a subclass of MetaWaylandDataSourceWayland, so there's no need
for a duplicate wl_resource field. Make sure to reuse the parent struct
one.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/848
---
src/wayland/meta-wayland-data-device.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index e063a9a0c..310ad13cf 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -84,8 +84,6 @@ typedef struct _MetaWaylandDataSourceWayland
typedef struct _MetaWaylandDataSourcePrimary
{
MetaWaylandDataSourceWayland parent;
-
- struct wl_resource *resource;
} MetaWaylandDataSourcePrimary;
G_DEFINE_TYPE_WITH_PRIVATE (MetaWaylandDataSource, meta_wayland_data_source,
@@ -1452,10 +1450,10 @@ meta_wayland_data_source_primary_send (MetaWaylandDataSource *source,
const gchar *mime_type,
gint fd)
{
- MetaWaylandDataSourcePrimary *source_primary;
+ MetaWaylandDataSourceWayland *source_wayland;
- source_primary = META_WAYLAND_DATA_SOURCE_PRIMARY (source);
- gtk_primary_selection_source_send_send (source_primary->resource,
+ source_wayland = META_WAYLAND_DATA_SOURCE_WAYLAND (source);
+ gtk_primary_selection_source_send_send (source_wayland->resource,
mime_type, fd);
close (fd);
}
@@ -1463,10 +1461,10 @@ meta_wayland_data_source_primary_send (MetaWaylandDataSource *source,
static void
meta_wayland_data_source_primary_cancel (MetaWaylandDataSource *source)
{
- MetaWaylandDataSourcePrimary *source_primary;
+ MetaWaylandDataSourceWayland *source_wayland;
- source_primary = META_WAYLAND_DATA_SOURCE_PRIMARY (source);
- gtk_primary_selection_source_send_cancelled (source_primary->resource);
+ source_wayland = META_WAYLAND_DATA_SOURCE_WAYLAND (source);
+ gtk_primary_selection_source_send_cancelled (source_wayland->resource);
}
static void
@@ -1780,7 +1778,7 @@ meta_wayland_data_device_set_primary (MetaWaylandDataDevice *data_device,
{
struct wl_resource *resource;
- resource = META_WAYLAND_DATA_SOURCE_PRIMARY (source)->resource;
+ resource = META_WAYLAND_DATA_SOURCE_WAYLAND (source)->resource;
if (wl_resource_get_client (resource) !=
meta_wayland_keyboard_get_focus_client (seat->keyboard))
@@ -1825,7 +1823,7 @@ meta_wayland_data_device_set_primary (MetaWaylandDataDevice *data_device,
data_device);
mimetypes = copy_string_array_to_list (meta_wayland_data_source_get_mime_types (source));
- selection_source = meta_selection_source_wayland_new (META_WAYLAND_DATA_SOURCE_PRIMARY (source)->resource,
+ selection_source = meta_selection_source_wayland_new (META_WAYLAND_DATA_SOURCE_WAYLAND (source)->resource,
mimetypes,
gtk_primary_selection_source_send_send,
gtk_primary_selection_source_send_cancelled);
@@ -1971,7 +1969,7 @@ static const struct wl_data_device_manager_interface manager_interface = {
static void
destroy_primary_source (struct wl_resource *resource)
{
- MetaWaylandDataSourcePrimary *source = wl_resource_get_user_data (resource);
+ MetaWaylandDataSourceWayland *source = wl_resource_get_user_data (resource);
source->resource = NULL;
g_object_unref (source);
@@ -2207,7 +2205,7 @@ meta_wayland_data_source_wayland_new (struct wl_resource *resource)
static MetaWaylandDataSource *
meta_wayland_data_source_primary_new (struct wl_resource *resource)
{
- MetaWaylandDataSourcePrimary *source_primary =
+ MetaWaylandDataSourceWayland *source_primary =
g_object_new (META_TYPE_WAYLAND_DATA_SOURCE_PRIMARY, NULL);
source_primary->resource = resource;
--
2.23.0

View File

@ -1,30 +0,0 @@
From dd2b1278a01e4c9783818b8b8f02f766f7c8434a Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 11 Oct 2019 18:02:13 +0200
Subject: [PATCH 3/8] wayland: Chain up to the right finalize on
MetaWaylandDataSourceWayland
This function was using the wrong parent class pointer, so it was mistakenly
skipping over MetaWaylandDataSource::finalize.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/848
---
src/wayland/meta-wayland-data-device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index 310ad13cf..7948fe912 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -1420,7 +1420,7 @@ meta_wayland_source_drag_finished (MetaWaylandDataSource *source)
static void
meta_wayland_source_finalize (GObject *object)
{
- G_OBJECT_CLASS (meta_wayland_data_source_parent_class)->finalize (object);
+ G_OBJECT_CLASS (meta_wayland_data_source_wayland_parent_class)->finalize (object);
}
static void
--
2.23.0

View File

@ -1,97 +0,0 @@
From e53db92a7b65e450594a72076386c597548681b1 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 11 Oct 2019 12:27:56 +0200
Subject: [PATCH 4/8] wayland: Emit wl/primary offer after changing selection
We are still poking the mimetypes from the previous selection when creating
the new offer. This may come out wrong between changes of the copied
mimetypes.
Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/789
---
src/wayland/meta-wayland-data-device.c | 48 +++++++++++++-------------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index 7948fe912..24e97222a 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -1660,18 +1660,6 @@ meta_wayland_data_device_set_selection (MetaWaylandDataDevice *data_device,
data_device->selection_data_source = source;
data_device->selection_serial = serial;
- focus_client = meta_wayland_keyboard_get_focus_client (seat->keyboard);
- if (focus_client)
- {
- data_device_resource = wl_resource_find_for_client (&data_device->resource_list, focus_client);
- if (data_device_resource)
- {
- struct wl_resource *offer;
- offer = create_and_send_clipboard_offer (data_device, data_device_resource);
- wl_data_device_send_selection (data_device_resource, offer);
- }
- }
-
if (source)
{
MetaWaylandDataSourceWayland *source_wayland =
@@ -1700,6 +1688,18 @@ meta_wayland_data_device_set_selection (MetaWaylandDataDevice *data_device,
unset_selection_source (data_device, META_SELECTION_CLIPBOARD);
}
+ focus_client = meta_wayland_keyboard_get_focus_client (seat->keyboard);
+ if (focus_client)
+ {
+ data_device_resource = wl_resource_find_for_client (&data_device->resource_list, focus_client);
+ if (data_device_resource)
+ {
+ struct wl_resource *offer;
+ offer = create_and_send_clipboard_offer (data_device, data_device_resource);
+ wl_data_device_send_selection (data_device_resource, offer);
+ }
+ }
+
wl_signal_emit (&data_device->selection_ownership_signal, source);
}
@@ -1800,18 +1800,6 @@ meta_wayland_data_device_set_primary (MetaWaylandDataDevice *data_device,
data_device->primary_data_source = source;
data_device->primary_serial = serial;
- focus_client = meta_wayland_keyboard_get_focus_client (seat->keyboard);
- if (focus_client)
- {
- data_device_resource = wl_resource_find_for_client (&data_device->primary_resource_list, focus_client);
- if (data_device_resource)
- {
- struct wl_resource *offer;
- offer = create_and_send_primary_offer (data_device, data_device_resource);
- gtk_primary_selection_device_send_selection (data_device_resource, offer);
- }
- }
-
if (source)
{
MetaSelectionSource *selection_source;
@@ -1838,6 +1826,18 @@ meta_wayland_data_device_set_primary (MetaWaylandDataDevice *data_device,
unset_selection_source (data_device, META_SELECTION_PRIMARY);
}
+ focus_client = meta_wayland_keyboard_get_focus_client (seat->keyboard);
+ if (focus_client)
+ {
+ data_device_resource = wl_resource_find_for_client (&data_device->primary_resource_list, focus_client);
+ if (data_device_resource)
+ {
+ struct wl_resource *offer;
+ offer = create_and_send_primary_offer (data_device, data_device_resource);
+ gtk_primary_selection_device_send_selection (data_device_resource, offer);
+ }
+ }
+
wl_signal_emit (&data_device->primary_ownership_signal, source);
}
--
2.23.0

View File

@ -1,42 +0,0 @@
From 227d27204983f7be20536d79d216f76f80f5cceb Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 11 Oct 2019 17:47:00 +0200
Subject: [PATCH 5/8] wayland: Check resource before emitting cancelled event
If a data source is destroyed we first unset the resource, and then try to
unref the related selection source. At this point the only event that might
be emitted by the internal selection machinery is .cancelled, so make sure
we avoid it on destroyed sources.
Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/842
---
src/wayland/meta-wayland-data-device.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index 24e97222a..3dfedd959 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -1369,7 +1369,8 @@ meta_wayland_source_cancel (MetaWaylandDataSource *source)
MetaWaylandDataSourceWayland *source_wayland =
META_WAYLAND_DATA_SOURCE_WAYLAND (source);
- wl_data_source_send_cancelled (source_wayland->resource);
+ if (source_wayland->resource)
+ wl_data_source_send_cancelled (source_wayland->resource);
}
static void
@@ -1464,7 +1465,8 @@ meta_wayland_data_source_primary_cancel (MetaWaylandDataSource *source)
MetaWaylandDataSourceWayland *source_wayland;
source_wayland = META_WAYLAND_DATA_SOURCE_WAYLAND (source);
- gtk_primary_selection_source_send_cancelled (source_wayland->resource);
+ if (source_wayland->resource)
+ gtk_primary_selection_source_send_cancelled (source_wayland->resource);
}
static void
--
2.23.0

View File

@ -1,240 +0,0 @@
From ea4665bf512d030dfa717d3e8b859bd72693a1ca Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 11 Oct 2019 17:09:26 +0200
Subject: [PATCH 6/8] wayland: Simplify MetaSelectionSourceWayland
Instead of taking resource and send/cancel funcs, take a
MetaWaylandDataSource, which exposes all the vfuncs to do the same on the
internal resource.
This has the added side effect that only MetaWaylandDataSource has a
pointer to the wl_resource, which may be unset untimely.
Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/842
---
.../meta-selection-source-wayland-private.h | 12 ++----
src/wayland/meta-selection-source-wayland.c | 36 +++++++++-------
src/wayland/meta-wayland-data-device.c | 42 ++-----------------
src/wayland/meta-wayland-data-device.h | 2 +
4 files changed, 31 insertions(+), 61 deletions(-)
diff --git a/src/wayland/meta-selection-source-wayland-private.h b/src/wayland/meta-selection-source-wayland-private.h
index 6affc77a8..a6ada8898 100644
--- a/src/wayland/meta-selection-source-wayland-private.h
+++ b/src/wayland/meta-selection-source-wayland-private.h
@@ -25,6 +25,8 @@
#include <wayland-server.h>
#include "meta/meta-selection-source.h"
+#include "wayland/meta-wayland-data-device.h"
+#include "wayland/meta-wayland-data-device-private.h"
#define META_TYPE_SELECTION_SOURCE_WAYLAND (meta_selection_source_wayland_get_type ())
@@ -33,14 +35,6 @@ G_DECLARE_FINAL_TYPE (MetaSelectionSourceWayland,
META, SELECTION_SOURCE_WAYLAND,
MetaSelectionSource)
-typedef void (* MetaWaylandSendFunc) (struct wl_resource *resource,
- const char *mimetype,
- int fd);
-typedef void (* MetaWaylandCancelFunc) (struct wl_resource *resource);
-
-MetaSelectionSource * meta_selection_source_wayland_new (struct wl_resource *resource,
- GList *mime_types,
- MetaWaylandSendFunc send_func,
- MetaWaylandCancelFunc cancel_func);
+MetaSelectionSource * meta_selection_source_wayland_new (MetaWaylandDataSource *source);
#endif /* META_SELECTION_SOURCE_WAYLAND_H */
diff --git a/src/wayland/meta-selection-source-wayland.c b/src/wayland/meta-selection-source-wayland.c
index 7031c911e..4f6f0c33c 100644
--- a/src/wayland/meta-selection-source-wayland.c
+++ b/src/wayland/meta-selection-source-wayland.c
@@ -29,10 +29,8 @@
struct _MetaSelectionSourceWayland
{
MetaSelectionSource parent_instance;
+ MetaWaylandDataSource *data_source;
GList *mimetypes;
- MetaWaylandSendFunc send_func;
- MetaWaylandCancelFunc cancel_func;
- struct wl_resource *resource;
};
G_DEFINE_TYPE (MetaSelectionSourceWayland, meta_selection_source_wayland,
@@ -85,7 +83,8 @@ meta_selection_source_wayland_read_async (MetaSelectionSource *source,
g_task_set_source_tag (task, meta_selection_source_wayland_read_async);
stream = g_unix_input_stream_new (pipe_fds[0], TRUE);
- source_wayland->send_func (source_wayland->resource, mimetype, pipe_fds[1]);
+ meta_wayland_data_source_send (source_wayland->data_source,
+ mimetype, pipe_fds[1]);
close (pipe_fds[1]);
g_task_return_pointer (task, stream, g_object_unref);
@@ -119,7 +118,7 @@ meta_selection_source_wayland_deactivated (MetaSelectionSource *source)
MetaSelectionSourceWayland *source_wayland =
META_SELECTION_SOURCE_WAYLAND (source);
- source_wayland->cancel_func (source_wayland->resource);
+ meta_wayland_data_source_cancel (source_wayland->data_source);
META_SELECTION_SOURCE_CLASS (meta_selection_source_wayland_parent_class)->deactivated (source);
}
@@ -143,20 +142,29 @@ meta_selection_source_wayland_init (MetaSelectionSourceWayland *source)
{
}
+static GList *
+copy_string_array_to_list (struct wl_array *array)
+{
+ GList *l = NULL;
+ char **p;
+
+ wl_array_for_each (p, array)
+ l = g_list_prepend (l, g_strdup (*p));
+
+ return l;
+}
+
MetaSelectionSource *
-meta_selection_source_wayland_new (struct wl_resource *resource,
- GList *mime_types,
- MetaWaylandSendFunc send_func,
- MetaWaylandCancelFunc cancel_func)
+meta_selection_source_wayland_new (MetaWaylandDataSource *data_source)
{
MetaSelectionSourceWayland *source_wayland;
+ struct wl_array *mimetypes;
source_wayland = g_object_new (META_TYPE_SELECTION_SOURCE_WAYLAND, NULL);
- source_wayland->mimetypes = g_list_copy_deep (mime_types,
- (GCopyFunc) g_strdup, NULL);
- source_wayland->send_func = send_func;
- source_wayland->cancel_func = cancel_func;
- source_wayland->resource = resource;
+ source_wayland->data_source = data_source;
+
+ mimetypes = meta_wayland_data_source_get_mime_types (data_source);
+ source_wayland->mimetypes = copy_string_array_to_list (mimetypes);
return META_SELECTION_SOURCE (source_wayland);
}
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index 3dfedd959..0044a80b8 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -250,7 +250,7 @@ meta_wayland_data_source_get_mime_types (const MetaWaylandDataSource *source)
return &priv->mime_types;
}
-static void
+void
meta_wayland_data_source_cancel (MetaWaylandDataSource *source)
{
META_WAYLAND_DATA_SOURCE_GET_CLASS (source)->cancel (source);
@@ -1152,18 +1152,6 @@ destroy_data_device_icon (struct wl_listener *listener, void *data)
clutter_actor_remove_all_children (drag_grab->feedback_actor);
}
-static GList *
-copy_string_array_to_list (struct wl_array *array)
-{
- GList *l = NULL;
- char **p;
-
- wl_array_for_each (p, array)
- l = g_list_prepend (l, g_strdup (*p));
-
- return l;
-}
-
void
meta_wayland_data_device_start_drag (MetaWaylandDataDevice *data_device,
struct wl_client *client,
@@ -1263,7 +1251,6 @@ data_device_start_drag (struct wl_client *client,
MetaWaylandSurface *surface = NULL, *icon_surface = NULL;
MetaWaylandDataSource *drag_source = NULL;
MetaSelectionSource *selection_source;
- GList *mimetypes;
if (origin_resource)
surface = wl_resource_get_user_data (origin_resource);
@@ -1299,12 +1286,7 @@ data_device_start_drag (struct wl_client *client,
return;
}
- mimetypes = copy_string_array_to_list (meta_wayland_data_source_get_mime_types (drag_source));
- selection_source = meta_selection_source_wayland_new (source_resource,
- mimetypes,
- wl_data_source_send_send,
- wl_data_source_send_cancelled);
- g_list_free_full (mimetypes, g_free);
+ selection_source = meta_selection_source_wayland_new (drag_source);
set_selection_source (data_device, META_SELECTION_DND,
selection_source);
g_object_unref (selection_source);
@@ -1664,23 +1646,14 @@ meta_wayland_data_device_set_selection (MetaWaylandDataDevice *data_device,
if (source)
{
- MetaWaylandDataSourceWayland *source_wayland =
- META_WAYLAND_DATA_SOURCE_WAYLAND (source);
MetaSelectionSource *selection_source;
- GList *mimetypes;
meta_wayland_data_source_set_seat (source, seat);
g_object_weak_ref (G_OBJECT (source),
selection_data_source_destroyed,
data_device);
- mimetypes = copy_string_array_to_list (meta_wayland_data_source_get_mime_types (source));
- selection_source = meta_selection_source_wayland_new (source_wayland->resource,
- mimetypes,
- wl_data_source_send_send,
- wl_data_source_send_cancelled);
- g_list_free_full (mimetypes, g_free);
-
+ selection_source = meta_selection_source_wayland_new (source);
set_selection_source (data_device, META_SELECTION_CLIPBOARD,
selection_source);
g_object_unref (selection_source);
@@ -1805,20 +1778,13 @@ meta_wayland_data_device_set_primary (MetaWaylandDataDevice *data_device,
if (source)
{
MetaSelectionSource *selection_source;
- GList *mimetypes;
meta_wayland_data_source_set_seat (source, seat);
g_object_weak_ref (G_OBJECT (source),
primary_source_destroyed,
data_device);
- mimetypes = copy_string_array_to_list (meta_wayland_data_source_get_mime_types (source));
- selection_source = meta_selection_source_wayland_new (META_WAYLAND_DATA_SOURCE_WAYLAND (source)->resource,
- mimetypes,
- gtk_primary_selection_source_send_send,
- gtk_primary_selection_source_send_cancelled);
- g_list_free_full (mimetypes, g_free);
-
+ selection_source = meta_selection_source_wayland_new (source);
set_selection_source (data_device, META_SELECTION_PRIMARY,
selection_source);
g_object_unref (selection_source);
diff --git a/src/wayland/meta-wayland-data-device.h b/src/wayland/meta-wayland-data-device.h
index 729baacd9..efa5478bf 100644
--- a/src/wayland/meta-wayland-data-device.h
+++ b/src/wayland/meta-wayland-data-device.h
@@ -111,6 +111,8 @@ gboolean meta_wayland_data_source_has_target (MetaWaylandDataSource *source)
void meta_wayland_data_source_set_has_target (MetaWaylandDataSource *source,
gboolean has_target);
+void meta_wayland_data_source_cancel (MetaWaylandDataSource *source);
+
void meta_wayland_data_source_send (MetaWaylandDataSource *source,
const gchar *mime_type,
gint fd);
--
2.23.0

View File

@ -1,138 +0,0 @@
From 84cc89e19a2765f9d011c39ed6cc37689a7cc34e Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 11 Oct 2019 18:43:00 +0200
Subject: [PATCH 7/8] 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
---
src/core/meta-selection-source-memory.c | 5 ++++-
src/wayland/meta-wayland-data-device.c | 25 +++++++++++++------------
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/src/core/meta-selection-source-memory.c b/src/core/meta-selection-source-memory.c
index 04b7f39a3..c8b0c83f5 100644
--- a/src/core/meta-selection-source-memory.c
+++ b/src/core/meta-selection-source-memory.c
@@ -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);
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index 0044a80b8..f95be0bf8 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -36,6 +36,7 @@
#include <unistd.h>
#include "compositor/meta-dnd-actor-private.h"
+#include "meta/meta-selection-source-memory.h"
#include "wayland/meta-selection-source-wayland-private.h"
#include "wayland/meta-wayland-dnd-surface.h"
#include "wayland/meta-wayland-pointer.h"
@@ -1627,6 +1628,7 @@ meta_wayland_data_device_set_selection (MetaWaylandDataDevice *data_device,
MetaWaylandSeat *seat = wl_container_of (data_device, seat, data_device);
struct wl_resource *data_device_resource;
struct wl_client *focus_client;
+ MetaSelectionSource *selection_source;
if (data_device->selection_data_source &&
data_device->selection_serial - serial < UINT32_MAX / 2)
@@ -1646,23 +1648,22 @@ meta_wayland_data_device_set_selection (MetaWaylandDataDevice *data_device,
if (source)
{
- MetaSelectionSource *selection_source;
-
meta_wayland_data_source_set_seat (source, seat);
g_object_weak_ref (G_OBJECT (source),
selection_data_source_destroyed,
data_device);
selection_source = meta_selection_source_wayland_new (source);
- set_selection_source (data_device, META_SELECTION_CLIPBOARD,
- selection_source);
- g_object_unref (selection_source);
}
else
{
- unset_selection_source (data_device, META_SELECTION_CLIPBOARD);
+ selection_source = g_object_new (META_TYPE_SELECTION_SOURCE_MEMORY, NULL);
}
+ set_selection_source (data_device, META_SELECTION_CLIPBOARD,
+ selection_source);
+ g_object_unref (selection_source);
+
focus_client = meta_wayland_keyboard_get_focus_client (seat->keyboard);
if (focus_client)
{
@@ -1748,6 +1749,7 @@ meta_wayland_data_device_set_primary (MetaWaylandDataDevice *data_device,
MetaWaylandSeat *seat = wl_container_of (data_device, seat, data_device);
struct wl_resource *data_device_resource;
struct wl_client *focus_client;
+ MetaSelectionSource *selection_source;
if (META_IS_WAYLAND_DATA_SOURCE_PRIMARY (source))
{
@@ -1777,23 +1779,22 @@ meta_wayland_data_device_set_primary (MetaWaylandDataDevice *data_device,
if (source)
{
- MetaSelectionSource *selection_source;
-
meta_wayland_data_source_set_seat (source, seat);
g_object_weak_ref (G_OBJECT (source),
primary_source_destroyed,
data_device);
selection_source = meta_selection_source_wayland_new (source);
- set_selection_source (data_device, META_SELECTION_PRIMARY,
- selection_source);
- g_object_unref (selection_source);
}
else
{
- unset_selection_source (data_device, META_SELECTION_PRIMARY);
+ selection_source = g_object_new (META_TYPE_SELECTION_SOURCE_MEMORY, NULL);
}
+ set_selection_source (data_device, META_SELECTION_PRIMARY,
+ selection_source);
+ g_object_unref (selection_source);
+
focus_client = meta_wayland_keyboard_get_focus_client (seat->keyboard);
if (focus_client)
{
--
2.23.0

View File

@ -1,67 +0,0 @@
From e1751ad9ee1ac4a1bfcb49352c88bb001ae55594 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Fri, 11 Oct 2019 19:32:42 +0200
Subject: [PATCH 8/8] wayland: Figure out better the right selection source for
a wl_data_offer
We were just looking at DnD actions which might still be unset at that
point. Instead of doing these heuristics, store the selection type on
the data offer.
Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/845
---
src/wayland/meta-wayland-data-device.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c
index f95be0bf8..38aa0f317 100644
--- a/src/wayland/meta-wayland-data-device.c
+++ b/src/wayland/meta-wayland-data-device.c
@@ -60,6 +60,7 @@ struct _MetaWaylandDataOffer
gboolean action_sent;
uint32_t dnd_actions;
enum wl_data_device_manager_dnd_action preferred_dnd_action;
+ MetaSelectionType selection_type;
};
typedef struct _MetaWaylandDataSourcePrivate
@@ -399,11 +400,7 @@ data_offer_receive (struct wl_client *client, struct wl_resource *resource,
GList *mime_types;
gboolean found;
- if (offer->dnd_actions != 0)
- selection_type = META_SELECTION_DND;
- else
- selection_type = META_SELECTION_CLIPBOARD;
-
+ selection_type = offer->selection_type;
mime_types = meta_selection_get_mimetypes (meta_display_get_selection (display),
selection_type);
found = g_list_find_custom (mime_types, mime_type, (GCompareFunc) g_strcmp0) != NULL;
@@ -622,6 +619,7 @@ create_and_send_dnd_offer (MetaWaylandDataSource *source,
MetaWaylandDataOffer *offer = g_slice_new0 (MetaWaylandDataOffer);
char **p;
+ offer->selection_type = META_SELECTION_DND;
offer->source = source;
g_object_add_weak_pointer (G_OBJECT (source), (gpointer *)&offer->source);
offer->resource = wl_resource_create (wl_resource_get_client (target),
@@ -2043,6 +2041,7 @@ create_and_send_clipboard_offer (MetaWaylandDataDevice *data_device,
return NULL;
offer = g_slice_new0 (MetaWaylandDataOffer);
+ offer->selection_type = META_SELECTION_CLIPBOARD;
offer->resource = wl_resource_create (wl_resource_get_client (target),
&wl_data_offer_interface,
wl_resource_get_version (target), 0);
@@ -2075,6 +2074,7 @@ create_and_send_primary_offer (MetaWaylandDataDevice *data_device,
return NULL;
offer = g_slice_new0 (MetaWaylandDataOffer);
+ offer->selection_type = META_SELECTION_PRIMARY;
offer->resource = wl_resource_create (wl_resource_get_client (target),
&gtk_primary_selection_offer_interface,
wl_resource_get_version (target), 0);
--
2.23.0

View File

@ -4,17 +4,17 @@
%global json_glib_version 0.12.0
%global libinput_version 1.4
%global pipewire_version 0.2.2
%global mutter_api_version 5
%global mutter_api_version 6
Name: mutter
Version: 3.34.1
Release: 2%{?dist}
Version: 3.35.1
Release: 1%{?dist}
Summary: Window and compositing manager based on Clutter
License: GPLv2+
#VCS: git:git://git.gnome.org/mutter
URL: http://www.gnome.org
Source0: http://download.gnome.org/sources/%{name}/3.34/%{name}-%{version}.tar.xz
Source0: http://download.gnome.org/sources/%{name}/3.35/%{name}-%{version}.tar.xz
# Work-around for OpenJDK's compliance test
Patch0: 0001-window-actor-Special-case-shaped-Java-windows.patch
@ -24,28 +24,6 @@ Patch0: 0001-window-actor-Special-case-shaped-Java-windows.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1749433
# https://gitlab.gnome.org/GNOME/mutter/issues/826
Patch1: 0001-cursor-tracker-Add-API-to-keep-the-wayland-pointer-f.patch
# https://gitlab.gnome.org/GNOME/mutter/merge_requests/840
# Fixes night light breakage in 3.34.1:
# https://bugzilla.redhat.com/show_bug.cgi?id=1760254
Patch2: 0001-kms-Always-predict-state-after-processing-update.patch
Patch3: 0002-kms-crtc-Read-gamma-state-when-prediction-failed.patch
# https://gitlab.gnome.org/GNOME/mutter/merge_requests/848
# Fixes several issues with selections, including copy/paste and
# drag/drop bugs:
# https://bugzilla.redhat.com/show_bug.cgi?id=1751646
# https://bugzilla.redhat.com/show_bug.cgi?id=1759644
Patch4: 0001-wayland-Plug-MetaSelectionSourceWayland-leaks.patch
Patch5: 0002-wayland-Drop-field-from-MetaWaylandDataSourcePrimary.patch
Patch6: 0003-wayland-Chain-up-to-the-right-finalize-on-MetaWaylan.patch
Patch7: 0004-wayland-Emit-wl-primary-offer-after-changing-selecti.patch
Patch8: 0005-wayland-Check-resource-before-emitting-cancelled-eve.patch
Patch9: 0006-wayland-Simplify-MetaSelectionSourceWayland.patch
Patch10: 0007-wayland-Set-dummy-selection-source-on-.set_selection.patch
Patch11: 0008-wayland-Figure-out-better-the-right-selection-source.patch
# https://gitlab.gnome.org/GNOME/mutter/merge_requests/842
# Fixes issue with X selection buffers in Qt applications:
# https://bugzilla.redhat.com/show_bug.cgi?id=1758873
Patch12: 0001-x11-Translate-well-known-selection-atoms-to-mimetype.patch
BuildRequires: chrpath
BuildRequires: pango-devel
@ -190,6 +168,9 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop
%{_datadir}/mutter-%{mutter_api_version}/tests
%changelog
* Sat Oct 12 2019 Florian Müllner <fmuellner@redhat.com> - 3.35.1-1
- Update to 3.35.1
* Sat Oct 12 2019 Adam Williamson <awilliam@redhat.com> - 3.34.1-2
- Backport multiple fixes for F31 FE/blocker bugs:
MR #832 for #1749433 (also needs change in gnome-shell)

View File

@ -1 +1 @@
SHA512 (mutter-3.34.1.tar.xz) = f95cc88f3874d91d54f0655f09f68be26e50c9740f278854cf2a019251dc0ddbfeb02e8b97c051cb98c9c6ab200f6e453f25279f3c86dfbfc172f8d8f0e37716
SHA512 (mutter-3.35.1.tar.xz) = 66dfe97ae502255a871c08fd4f00ef72db9e624577785ac7376d014435527930674cef5733ca127fffe14068b3b890dc2e31a4b9b8839a69c311c37a5bbabea8