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 | 2c9c08c2f39b9daf5dc24abdea4318cbe2510846 (patch) | |
tree | 192b22865ab9c60c4be203f3d4963f90d3878918 | |
parent | 9ba147768d741fa402f09d9545528d88faefca05 (diff) | |
download | scintilla-mirror-2c9c08c2f39b9daf5dc24abdea4318cbe2510846.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) { |