Blob Blame History Raw
From c4130d229816c2bf4734df9535b021052678204b Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Tue, 15 Dec 2015 17:41:33 +0100
Subject: [PATCH] Fix selection of text on Wayland

Do not clear selection if update of the primary selection failed.
This is expected to happen on Wayland and other platforms with no primary selection,
and just leads to the selected text being cleared after any attempt to change the
text selection itself through either mouse/keyboard.

https://bugzilla.gnome.org/show_bug.cgi?id=759506
---
 libview/ev-view.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/libview/ev-view.c b/libview/ev-view.c
index 9fa0546..f76eca8 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -9262,13 +9262,12 @@ ev_view_update_primary_selection (EvView *ev_view)
                 gtk_target_list_add_text_targets (target_list, 0);
                 targets = gtk_target_table_new_from_list (target_list, &n_targets);
                 gtk_target_list_unref (target_list);
-                
-		if (!gtk_clipboard_set_with_owner (clipboard,
-						   targets, n_targets,
-						   ev_view_primary_get_cb,
-						   ev_view_primary_clear_cb,
-						   G_OBJECT (ev_view)))
-			ev_view_primary_clear_cb (clipboard, ev_view);
+
+		gtk_clipboard_set_with_owner (clipboard,
+					      targets, n_targets,
+					      ev_view_primary_get_cb,
+					      ev_view_primary_clear_cb,
+					      G_OBJECT (ev_view));
 
                 gtk_target_table_free (targets, n_targets);
 	} else {
-- 
2.5.0