[mutter/wip/carlosg/incr-is-fubar: 8/11] x11: Finish INCR transfers properly
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/incr-is-fubar: 8/11] x11: Finish INCR transfers properly
- Date: Sat, 11 Apr 2020 15:35:23 +0000 (UTC)
commit 0eb428a0b576611a777d7789a9cbb0da43b844d9
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Apr 11 17:12:18 2020 +0200
x11: Finish INCR transfers properly
INCR transfers are mandated to finish with a final 0-size XChangeProperty
roundtrip after the final data chunk. Actually honor this and ensure we
iterate just once more for this.
src/x11/meta-x11-selection-output-stream.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/src/x11/meta-x11-selection-output-stream.c b/src/x11/meta-x11-selection-output-stream.c
index 59ca1d400..7423dfa7d 100644
--- a/src/x11/meta-x11-selection-output-stream.c
+++ b/src/x11/meta-x11-selection-output-stream.c
@@ -54,6 +54,7 @@ struct _MetaX11SelectionOutputStreamPrivate
guint incr : 1;
guint delete_pending : 1;
guint pipe_error : 1;
+ guint closing : 1;
};
G_DEFINE_TYPE_WITH_PRIVATE (MetaX11SelectionOutputStream,
@@ -124,7 +125,7 @@ meta_x11_selection_output_stream_needs_flush_unlocked (MetaX11SelectionOutputStr
MetaX11SelectionOutputStreamPrivate *priv =
meta_x11_selection_output_stream_get_instance_private (stream);
- if (priv->data->len == 0)
+ if (priv->data->len == 0 && !priv->closing)
return FALSE;
if (g_output_stream_is_closing (G_OUTPUT_STREAM (stream)))
@@ -241,6 +242,16 @@ meta_x11_selection_output_stream_perform_flush (MetaX11SelectionOutputStream *st
}
else
{
+ if (priv->data->len == 0)
+ {
+ priv->closing = FALSE;
+ }
+ else if (priv->incr)
+ {
+ if (priv->data->len < max_size)
+ priv->closing = TRUE;
+ }
+
XChangeProperty (xdisplay,
priv->xwindow,
priv->xproperty,
@@ -267,6 +278,7 @@ meta_x11_selection_output_stream_perform_flush (MetaX11SelectionOutputStream *st
priv->flush_requested = FALSE;
priv->delete_pending = FALSE;
+ priv->closing = FALSE;
priv->pipe_error = TRUE;
XGetErrorText (xdisplay, error_code, error_str, sizeof (error_str));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]