summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2006-01-04 19:53:34 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2006-01-04 19:53:34 +0000
commitc4a0b7f05642e9d233e2eb7e490dc3d7f9db5833 (patch)
treec625ce7c4b29b58339f954fd29f6d026ed0703db
parentf5a571fc83921005c21eff1383cd30ac4afadd2c (diff)
Fl::dnd() now sets the content type of the drag to
"text/uri-list" when it sees the dragged text is composed of URIs. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4736 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--CHANGES3
-rw-r--r--src/Fl_x.cxx3
-rw-r--r--src/fl_dnd_x.cxx17
3 files changed, 21 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 067b11877..1241beb3f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,9 @@ CHANGES IN FLTK 1.1.7
- Documentation fixes (STR #571, STR #648, STR #692, STR
#730, STR #744, STR #745, STR #931, STR #942, STR #960,
STR #969)
+ - Fl::dnd() now sets the content type of the drag to
+ "text/uri-list" when it sees the dragged text is
+ composed of URIs.
- Fixed keyboard shortcut handling in FLUID and shortcut
labeling in FLTK (STR #1129)
- Fixed include path for CMake build (STR #1123)
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index d930c2ec7..7b0f1149e 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -286,6 +286,7 @@ Atom fl_XdndStatus;
Atom fl_XdndActionCopy;
Atom fl_XdndFinished;
//Atom fl_XdndProxy;
+Atom fl_XdndURIList;
static void fd_callback(int,void *) {
@@ -339,6 +340,8 @@ void fl_open_display(Display* d) {
fl_XdndActionCopy = XInternAtom(d, "XdndActionCopy", 0);
fl_XdndFinished = XInternAtom(d, "XdndFinished", 0);
//fl_XdndProxy = XInternAtom(d, "XdndProxy", 0);
+ fl_XdndEnter = XInternAtom(d, "XdndEnter", 0);
+ fl_XdndURIList = XInternAtom(d, "text/uri-list", 0);
Fl::add_fd(ConnectionNumber(d), POLLIN, fd_callback);
diff --git a/src/fl_dnd_x.cxx b/src/fl_dnd_x.cxx
index feb83126f..6d7ac1590 100644
--- a/src/fl_dnd_x.cxx
+++ b/src/fl_dnd_x.cxx
@@ -28,6 +28,7 @@
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/x.H>
+#include "flstring.h"
extern Atom fl_XdndAware;
@@ -41,8 +42,10 @@ extern Atom fl_XdndStatus;
extern Atom fl_XdndActionCopy;
extern Atom fl_XdndFinished;
//extern Atom fl_XdndProxy;
+extern Atom fl_XdndURIList;
extern char fl_i_own_selection[2];
+extern char *fl_selection_buffer[2];
extern void fl_sendClientMessage(Window window, Atom message,
unsigned long d0,
@@ -122,8 +125,18 @@ int Fl::dnd() {
if (local_window) {
local_handle(FL_DND_ENTER, local_window);
} else if (dndversion) {
- fl_sendClientMessage(target_window, fl_XdndEnter, source_window,
- dndversion<<24, XA_STRING, 0, 0);
+ if (strncmp(fl_selection_buffer[0], "file:///", 8) &&
+ strncmp(fl_selection_buffer[0], "ftp://", 6) &&
+ strncmp(fl_selection_buffer[0], "http://", 7) &&
+ strncmp(fl_selection_buffer[0], "https://", 8)) {
+ // Send plain text...
+ fl_sendClientMessage(target_window, fl_XdndEnter, source_window,
+ dndversion<<24, XA_STRING, 0, 0);
+ } else {
+ // Send file/URI list...
+ fl_sendClientMessage(target_window, fl_XdndEnter, source_window,
+ dndversion<<24, fl_XdndURIList, XA_STRING, 0);
+ }
}
}
if (local_window) {