diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2020-04-11 17:05:24 +0200 |
---|---|---|
committer | Robert Mader <robert.mader@posteo.de> | 2020-04-19 21:58:13 +0200 |
commit | 8240aba80f081a7ec4d9028875ffa8cbae922532 (patch) | |
tree | 95af02b991e168335112923760fb70336bbde271 | |
parent | 5f34a0f2452557005688348e97aa790b9095003e (diff) | |
download | mutter-8240aba80f081a7ec4d9028875ffa8cbae922532.tar.gz |
x11: Only send SelectionNotify on first INCR chunk
This should only be sent if the selection can be sent at once, or
if we are right about to notify on the first chunk of an INCR
transfer.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1198
(cherry picked from commit 7c939d78c2b20989412a710665cbbea6b12ff8dd)
-rw-r--r-- | src/x11/meta-x11-selection-output-stream.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/x11/meta-x11-selection-output-stream.c b/src/x11/meta-x11-selection-output-stream.c index 6095b5500..86c54ba11 100644 --- a/src/x11/meta-x11-selection-output-stream.c +++ b/src/x11/meta-x11-selection-output-stream.c @@ -203,6 +203,7 @@ meta_x11_selection_output_stream_perform_flush (MetaX11SelectionOutputStream *st meta_x11_selection_output_stream_get_instance_private (stream); Display *xdisplay; size_t element_size, n_elements; + gboolean first_chunk = FALSE; int error_code; g_assert (!priv->delete_pending); @@ -217,6 +218,9 @@ meta_x11_selection_output_stream_perform_flush (MetaX11SelectionOutputStream *st element_size = get_element_size (priv->format); n_elements = priv->data->len / element_size; + if (!priv->incr) + first_chunk = TRUE; + if (!g_output_stream_is_closing (G_OUTPUT_STREAM (stream))) { XWindowAttributes attrs; @@ -252,7 +256,8 @@ meta_x11_selection_output_stream_perform_flush (MetaX11SelectionOutputStream *st g_byte_array_remove_range (priv->data, 0, n_elements * element_size); } - meta_x11_selection_output_stream_notify_selection (stream); + if (first_chunk) + meta_x11_selection_output_stream_notify_selection (stream); priv->delete_pending = TRUE; g_cond_broadcast (&priv->cond); |