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
This commit is contained in:
Michael R Sweet 2006-01-04 19:53:34 +00:00
parent f5a571fc83
commit c4a0b7f056
3 changed files with 21 additions and 2 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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) {