From 133ceff9a6036150f71f3da27620c32187dd0a82 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Thu, 4 Sep 2003 16:42:13 +0000 Subject: [PATCH] added support for X11 clipboard pasting with CTRL-V shortcut --- helm/gTopLevel/texTermEditor.ml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/helm/gTopLevel/texTermEditor.ml b/helm/gTopLevel/texTermEditor.ml index 3cf099349..047938828 100644 --- a/helm/gTopLevel/texTermEditor.ml +++ b/helm/gTopLevel/texTermEditor.ml @@ -124,7 +124,9 @@ module Make(C:Disambiguate.Callbacks) = end else if key = GdkKeysyms._BackSpace then Mathml_editor.drop tex_editor - (List.mem `CONTROL (GdkEvent.Key.state e)) ; + (List.mem `CONTROL (GdkEvent.Key.state e)) + else if key = GdkKeysyms._v then + ignore (mmlwidget#misc#convert_selection "STRING" `PRIMARY); let adj = mmlwidget#get_hadjustment in mmlwidget#thaw ; adj#set_value adj#upper ; @@ -156,6 +158,19 @@ module Make(C:Disambiguate.Callbacks) = ~useCapture:false in object(self) + + initializer + ignore (mmlwidget#misc#connect#selection_received + ~callback: (fun selection_data ~time -> + let input = try selection_data#data with Gpointer.Null -> "" in + mmlwidget#freeze ; + ignore (Mathml_editor.freeze tex_editor) ; + for i = 0 to String.length input - 1 do + Mathml_editor.push tex_editor input.[i] + done; + ignore (Mathml_editor.thaw tex_editor) ; + mmlwidget#thaw)) + method coerce = mmlwidget#coerce method reset = mmlwidget#freeze ; -- 2.39.2