summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2005-02-01 03:13:01 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2005-02-01 03:13:01 +0000
commite4ccb4ac07d1c9a5d0798beb49d2048bcdd714bf (patch)
tree2e0ba268b0ef1837131e1cc623f13b9fe5523652
parent1d871d5744a9bec3d8750b567d4c7b22203f1b2d (diff)
Fix X11 DND support.
src/Fl_x.cxx: - Check the list of source types and pick the first one that starts with "text/". git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3995 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--CHANGES2
-rw-r--r--src/Fl_x.cxx26
2 files changed, 25 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index ed2ecfbb7..11427ed8a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
CHANGES IN FLTK 1.1.7
+ - The X11 DND code did not correctly select a text
+ format for incoming data (STR #711)
- Fixes to Fl_JPEG_Image error handler.
- Fl_Menu::popup() and ::pulldown() would crash an
application if a callback created widgets before they
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index 7649d9ba2..861a18a25 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_x.cxx,v 1.24.2.24.2.41 2004/12/03 03:14:16 easysw Exp $"
+// "$Id$"
//
// X specific code for the Fast Light Tool Kit (FLTK).
//
@@ -634,6 +634,7 @@ int fl_handle(const XEvent& thisevent)
in_a_window = true;
fl_dnd_source_window = data[0];
// version number is data[1]>>24
+// printf("XdndEnter, version %ld\n", data[1] >> 24);
if (data[1]&1) {
// get list of data types:
Atom actual; int format; unsigned long count, remaining;
@@ -657,7 +658,26 @@ int fl_handle(const XEvent& thisevent)
fl_dnd_source_types[2] = data[4];
fl_dnd_source_types[3] = 0;
}
- fl_dnd_type = fl_dnd_source_types[0]; // should pick text or url
+
+ // Loop through the source types and pick the first text type...
+ int i;
+
+ for (i = 0; fl_dnd_source_types[i]; i ++)
+ {
+// printf("fl_dnd_source_types[%d] = %ld (%s)\n", i,
+// fl_dnd_source_types[i],
+// XGetAtomName(fl_display, fl_dnd_source_types[i]));
+
+ if (!strncmp(XGetAtomName(fl_display, fl_dnd_source_types[i]),
+ "text/", 5))
+ break;
+ }
+
+ if (fl_dnd_source_types[i])
+ fl_dnd_type = fl_dnd_source_types[i];
+ else
+ fl_dnd_type = fl_dnd_source_types[0];
+
event = FL_DND_ENTER;
break;
@@ -1303,5 +1323,5 @@ void Fl_Window::make_current() {
#endif
//
-// End of "$Id: Fl_x.cxx,v 1.24.2.24.2.41 2004/12/03 03:14:16 easysw Exp $".
+// End of "$Id$".
//