Skip to content

Commit

Permalink
pluma-view: Fix: Don't loss the PRIMARY clipboard
Browse files Browse the repository at this point in the history
Fixes #179
  • Loading branch information
sc0w authored and lukefromdc committed Aug 24, 2018
1 parent 4a74dc6 commit 4d26225
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pluma/pluma-view.c
Expand Up @@ -2137,6 +2137,18 @@ show_line_numbers_menu (GtkWidget *view,
static gboolean static gboolean
pluma_view_button_press_event (GtkWidget *widget, GdkEventButton *event) 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) && if ((event->type == GDK_BUTTON_PRESS) &&
(event->window == gtk_text_view_get_window (GTK_TEXT_VIEW (widget), (event->window == gtk_text_view_get_window (GTK_TEXT_VIEW (widget),
GTK_TEXT_WINDOW_LEFT))) GTK_TEXT_WINDOW_LEFT)))
Expand Down

0 comments on commit 4d26225

Please sign in to comment.