aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <unknown>2006-04-28 06:33:59 +0000
committernyamatongwe <unknown>2006-04-28 06:33:59 +0000
commitf0855d6f0faa3f7e0602722fbbb2bd6526ecffa5 (patch)
tree90adb00f958b81004be113bbb1f8b51bf17fd542
parent8fcd543a7e41bef0e040a7c9b77ac8c7d1ac6439 (diff)
downloadscintilla-mirror-f0855d6f0faa3f7e0602722fbbb2bd6526ecffa5.tar.gz
Moved uri-list to first preference in formats so that files dragged from
recent version of Nautilus will trigger URI dropped notification rather than copy text into document.
-rw-r--r--gtk/ScintillaGTK.cxx30
1 files changed, 17 insertions, 13 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index 9361df5e3..1b507e1e4 100644
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -106,6 +106,7 @@ class ScintillaGTK : public ScintillaBase {
static GdkAtom atomClipboard;
static GdkAtom atomUTF8;
static GdkAtom atomString;
+ static GdkAtom atomUriList;
GdkAtom atomSought;
#if PLAT_GTK_WIN32
@@ -282,19 +283,19 @@ enum {
TARGET_STRING,
TARGET_TEXT,
TARGET_COMPOUND_TEXT,
- TARGET_UTF8_STRING
+ TARGET_UTF8_STRING,
+ TARGET_URI
};
GdkAtom ScintillaGTK::atomClipboard = 0;
GdkAtom ScintillaGTK::atomUTF8 = 0;
GdkAtom ScintillaGTK::atomString = 0;
+GdkAtom ScintillaGTK::atomUriList = 0;
static const GtkTargetEntry clipboardTargets[] = {
+ { "text/uri-list", 0, TARGET_URI },
{ "UTF8_STRING", 0, TARGET_UTF8_STRING },
{ "STRING", 0, TARGET_STRING },
-// { "TEXT", 0, TARGET_TEXT },
-// { "COMPOUND_TEXT", 0, TARGET_COMPOUND_TEXT },
- { "text/uri-list", 0, 0 },
};
static const gint nClipboardTargets = sizeof(clipboardTargets) / sizeof(clipboardTargets[0]);
@@ -1494,18 +1495,20 @@ void ScintillaGTK::ReceivedSelection(GtkSelectionData *selection_data) {
void ScintillaGTK::ReceivedDrop(GtkSelectionData *selection_data) {
dragWasDropped = true;
- if ((selection_data->type == GDK_TARGET_STRING) || (selection_data->type == atomUTF8)) {
+ if (selection_data->type == atomUriList) {
+ char *ptr = new char[selection_data->length + 1];
+ ptr[selection_data->length] = '\0';
+ memcpy(ptr, selection_data->data, selection_data->length);
+ NotifyURIDropped(ptr);
+ delete []ptr;
+ } else if ((selection_data->type == GDK_TARGET_STRING) || (selection_data->type == atomUTF8)) {
if (selection_data->length > 0) {
SelectionText selText;
GetGtkSelectionText(selection_data, selText);
DropAt(posDrop, selText.s, false, selText.rectangular);
}
} else if (selection_data->length > 0) {
- char *ptr = new char[selection_data->length + 1];
- ptr[selection_data->length] = '\0';
- memcpy(ptr, selection_data->data, selection_data->length);
- NotifyURIDropped(ptr);
- delete []ptr;
+ fprintf(stderr, "ReceivedDrop other %p\n", static_cast<void *>(selection_data->type));
}
Redraw();
}
@@ -2472,9 +2475,10 @@ GtkType scintilla_get_type() {
}
void ScintillaGTK::ClassInit(GtkObjectClass* object_class, GtkWidgetClass *widget_class, GtkContainerClass *container_class) {
- atomClipboard = gdk_atom_intern("CLIPBOARD", FALSE);
- atomUTF8 = gdk_atom_intern("UTF8_STRING", FALSE);
- atomString = GDK_SELECTION_TYPE_STRING;
+ atomClipboard = gdk_atom_intern("CLIPBOARD", FALSE);
+ atomUTF8 = gdk_atom_intern("UTF8_STRING", FALSE);
+ atomString = GDK_SELECTION_TYPE_STRING;
+ atomUriList = gdk_atom_intern("text/uri-list", FALSE);
// Define default signal handlers for the class: Could move more
// of the signal handlers here (those that currently attached to wDraw