summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2018-08-23 02:47:04 +0200
committerlukefromdc <[email protected]>2018-08-23 22:58:16 -0400
commit4d26225d475b16de3de4aca3b6e0587d0ded3984 (patch)
tree23f5a17bf459a9b4c861b9bd58fecc3b4082f0c6
parent4a74dc65ffb89e0ef391cdf1f0d4c07cb1d20889 (diff)
downloadpluma-4d26225d475b16de3de4aca3b6e0587d0ded3984.tar.bz2
pluma-4d26225d475b16de3de4aca3b6e0587d0ded3984.tar.xz
pluma-view: Fix: Don't loss the PRIMARY clipboard
Fixes https://github.com/mate-desktop/pluma/issues/179
-rw-r--r--pluma/pluma-view.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/pluma/pluma-view.c b/pluma/pluma-view.c
index 17dc8f20..1c14fc4b 100644
--- a/pluma/pluma-view.c
+++ b/pluma/pluma-view.c
@@ -2137,6 +2137,18 @@ show_line_numbers_menu (GtkWidget *view,
static gboolean
pluma_view_button_press_event (GtkWidget *widget, GdkEventButton *event)
{
+ static gchar *primtxt = "";
+
+ gchar *txt_clip = gtk_clipboard_wait_for_text (gtk_clipboard_get (GDK_SELECTION_PRIMARY));
+
+ if (txt_clip)
+ {
+ primtxt = g_strdup (txt_clip);
+ g_free (txt_clip);
+ }
+ else
+ gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_PRIMARY), primtxt, strlen (primtxt));
+
if ((event->type == GDK_BUTTON_PRESS) &&
(event->window == gtk_text_view_get_window (GTK_TEXT_VIEW (widget),
GTK_TEXT_WINDOW_LEFT)))