From 1a5f2ad961c2f296c3449b06ddc26d4818473d0b Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 29 Oct 2012 10:56:34 -0700 Subject: [PATCH] ui.backend.gtk: Save the clipboard to the global clipboard so that it doesn't get deleted when Factor exits. Fixes #548. Add paste-selection, but commented out for now. --- basis/ui/backend/gtk/gtk.factor | 6 +++++- basis/ui/gadgets/editors/editors.factor | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/basis/ui/backend/gtk/gtk.factor b/basis/ui/backend/gtk/gtk.factor index b4c4225a9c..64e53a6a61 100644 --- a/basis/ui/backend/gtk/gtk.factor +++ b/basis/ui/backend/gtk/gtk.factor @@ -42,9 +42,13 @@ M: gtk-clipboard clipboard-contents [ &g_free utf8 alien>string ] [ f ] if* ] with-destructors ; +: save-global-clipboard ( -- ) + clipboard get-global handle>> gtk_clipboard_store ; + M: gtk-clipboard set-clipboard-contents swap [ handle>> ] [ utf8 string>alien ] bi* - -1 gtk_clipboard_set_text ; + -1 gtk_clipboard_set_text + save-global-clipboard ; : init-clipboard ( -- ) selection "PRIMARY" diff --git a/basis/ui/gadgets/editors/editors.factor b/basis/ui/gadgets/editors/editors.factor index ad4cf6b77b..ab385d48d0 100644 --- a/basis/ui/gadgets/editors/editors.factor +++ b/basis/ui/gadgets/editors/editors.factor @@ -499,6 +499,7 @@ editor "selection" f { } show-commands-menu ; editor "misc" f { + ! { T{ button-down f f 2 } paste-selection } { T{ button-down f f 3 } editor-menu } } define-command-map -- 2.34.1