diff options
author | Jiří Techet <techet@gmail.com> | 2015-01-02 00:59:53 +0100 |
---|---|---|
committer | Jiří Techet <techet@gmail.com> | 2015-01-02 00:59:53 +0100 |
commit | 10f61ef8233bf4574abb0d246d303de9956ff921 (patch) | |
tree | be696d2315e5debdb8f1f488a5b340bec1bb9029 | |
parent | 22acf45b514cb63e29ba59288d60137c43c4ac60 (diff) | |
download | scintilla-mirror-10f61ef8233bf4574abb0d246d303de9956ff921.tar.gz |
Use gtk_clipboard_request_contents() instead of gtk_selection_convert() for paste on GTK
When compiling Scintilla on OS X with GTK2 backend (and GTK2 with Quartz backend),
gtk_selection_convert() doesn't work. GtkClipboard seems to work fine though.
-rw-r--r-- | gtk/ScintillaGTK.cxx | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index 61eba53c1..9f8a8b6b8 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -314,6 +314,8 @@ private: static void Destroy(GObject *object); static void SelectionReceived(GtkWidget *widget, GtkSelectionData *selection_data, guint time); + static void ClipboardReceived(GtkClipboard *clipboard, GtkSelectionData *selection_data, + gpointer data); static void SelectionGet(GtkWidget *widget, GtkSelectionData *selection_data, guint info, guint time); static gint SelectionClear(GtkWidget *widget, GdkEventSelection *selection_event); @@ -1485,10 +1487,18 @@ void ScintillaGTK::Copy() { } } +void ScintillaGTK::ClipboardReceived(GtkClipboard *clipboard, GtkSelectionData *selection_data, gpointer data) { + ScintillaGTK *sciThis = static_cast<ScintillaGTK *>(data); + sciThis->ReceivedSelection(selection_data); +} + void ScintillaGTK::Paste() { atomSought = atomUTF8; - gtk_selection_convert(GTK_WIDGET(PWidget(wMain)), - atomClipboard, atomSought, GDK_CURRENT_TIME); + GtkClipboard *clipBoard = + gtk_widget_get_clipboard(GTK_WIDGET(PWidget(wMain)), atomClipboard); + if (clipBoard == NULL) + return; + gtk_clipboard_request_contents(clipBoard, atomSought, ClipboardReceived, this); } void ScintillaGTK::CreateCallTipWindow(PRectangle rc) { |