diff options
author | nyamatongwe <devnull@localhost> | 2000-07-13 04:40:55 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2000-07-13 04:40:55 +0000 |
commit | c3513b02107e9dcd65c39bd540804fa9db5d0bf0 (patch) | |
tree | a792481229d8f5edf8385f9570d52ff0852f322b | |
parent | fb64414bf3aa6da21355b88d556174e2c92afea8 (diff) | |
download | scintilla-mirror-c3513b02107e9dcd65c39bd540804fa9db5d0bf0.tar.gz |
Added John's selection unclaiming code.
-rw-r--r-- | gtk/ScintillaGTK.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index 1989a138c..a0cafa93a 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -86,6 +86,7 @@ private: void ReceivedSelection(GtkSelectionData *selection_data); void ReceivedDrop(GtkSelectionData *selection_data); void GetSelection(GtkSelectionData *selection_data, guint info, char *text, bool isRectangular); + void UnclaimSelection(GdkEventSelection *selection_event); void Resize(int width, int height); // Callback functions @@ -105,6 +106,7 @@ private: guint time, ScintillaGTK *sciThis); static void SelectionGet(GtkWidget *widget, GtkSelectionData *selection_data, guint info, guint time, ScintillaGTK *sciThis); + static void SelectionClearEvent(GtkWidget *widget, GdkEventSelection *selection_event, ScintillaGTK *sciThis); static void DragBegin(GtkWidget *widget, GdkDragContext *context, ScintillaGTK *sciThis); static gboolean DragMotion(GtkWidget *widget, GdkDragContext *context, @@ -214,6 +216,8 @@ void ScintillaGTK::Initialise() { GtkSignalFunc(SelectionReceived), this); gtk_signal_connect(GTK_OBJECT(wDraw.GetID()), "selection_get", GtkSignalFunc(SelectionGet), this); + gtk_signal_connect(GTK_OBJECT(wDraw.GetID()), "selection_clear_event", + GtkSignalFunc(SelectionClearEvent), this); gtk_widget_set_events(wDraw.GetID(), GDK_EXPOSURE_MASK @@ -651,6 +655,13 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, ch delete []tmpBuffer; } +void ScintillaGTK::UnclaimSelection(GdkEventSelection *selection_event) { + if (selection_event->selection == GDK_SELECTION_PRIMARY) { + delete [] primarySelectionCopy; + primarySelectionCopy = NULL; + } +} + void ScintillaGTK::Resize(int width, int height) { //Platform::DebugPrintf("Resize %d %d\n", width, height); DropGraphics(); @@ -896,6 +907,11 @@ void ScintillaGTK::SelectionGet(GtkWidget *, sciThis->GetSelection(selection_data, info, sciThis->pasteBuffer, sciThis->pasteBufferIsRectangular); } +void ScintillaGTK::SelectionClearEvent(GtkWidget *, GdkEventSelection *selection_event, ScintillaGTK *sciThis) { + //Platform::DebugPrintf("Selection clear\n"); + sciThis->UnclaimSelection(selection_event); +} + void ScintillaGTK::DragBegin(GtkWidget *, GdkDragContext *, ScintillaGTK *) { //Platform::DebugPrintf("DragBegin\n"); |