summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changelog5
-rw-r--r--library/tkdnd_unix.tcl19
2 files changed, 21 insertions, 3 deletions
diff --git a/Changelog b/Changelog
index a1aafb6..24b0be5 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,8 @@
+2014-10-07 Petasis George <petasis@iit.demokritos.gr>
+ * library/tkdnd_macosx.tcl:
+
+ * library/tkdnd_unix.tcl: Added support for DND_HTML in XDND.
+
2014-09-21 Petasis George <petasis@iit.demokritos.gr>
* library/tkdnd_macosx.tcl:
* library/tkdnd_unix.tcl: Changed implementation to re-use the
diff --git a/library/tkdnd_unix.tcl b/library/tkdnd_unix.tcl
index a4e7891..0a1bdf7 100644
--- a/library/tkdnd_unix.tcl
+++ b/library/tkdnd_unix.tcl
@@ -49,6 +49,8 @@ namespace eval xdnd {
TEXT DND_Text \
COMPOUND_TEXT DND_Text \
text/uri-list DND_Files \
+ text/html\;charset=utf-8 DND_HTML \
+ text/html DND_HTML \
application/x-color DND_Color \
]
};# initialise
@@ -178,8 +180,17 @@ proc xdnd::normalise_data { type data } {
# Else, it returns a list of 8 or 32 bit numbers...
switch -glob $type {
STRING - UTF8_STRING - TEXT - COMPOUND_TEXT {return $data}
- text/html -
- text/plain {
+ text/html {
+ if {[catch {
+ encoding convertfrom unicode $data
+ } string]} {
+ set string $data
+ }
+ return [string map {\r\n \n} $string]
+ }
+ text/html\;charset=utf-8 -
+ text/plain\;charset=utf-8 -
+ text/plain {
if {[catch {
encoding convertfrom utf-8 [tkdnd::bytes_to_string $data]
} string]} {
@@ -487,7 +498,7 @@ proc xdnd::_HandleXdndFinished {event} {
set _dodragdrop_drop_target 0
variable _dragging
if {$_dragging} {set _dragging 0}
-
+
variable _dodragdrop_drop_target_accepts_drop
variable _dodragdrop_drop_target_accepts_action
if {[dict size $event]} {
@@ -616,7 +627,9 @@ proc xdnd::_default_action {event} {
proc xdnd::getFormatForType {type} {
switch -glob [string tolower $type] {
text/plain\;charset=utf-8 -
+ text/html\;charset=utf-8 -
utf8_string {set format UTF8_STRING}
+ text/html -
text/plain -
string -
text -