diff options
author | petasis <petasis@f3661a36-4baa-549a-d6c7-40e0ffef350e> | 2010-06-16 19:56:46 (GMT) |
---|---|---|
committer | petasis <petasis@f3661a36-4baa-549a-d6c7-40e0ffef350e> | 2010-06-16 19:56:46 (GMT) |
commit | e8ba23277035a53b2e9c899f29b62534bad9e8a9 (patch) | |
tree | 9b87b3ae1e640664303e710b94cf8c458111dd9c /library/tkdnd_unix.tcl | |
parent | dba5f8f36b76953baa8696cb55de86e89bcd1265 (diff) | |
download | tkdnd-e8ba23277035a53b2e9c899f29b62534bad9e8a9.zip tkdnd-e8ba23277035a53b2e9c899f29b62534bad9e8a9.tar.gz tkdnd-e8ba23277035a53b2e9c899f29b62534bad9e8a9.tar.bz2 |
Linux fixes
Diffstat (limited to 'library/tkdnd_unix.tcl')
-rw-r--r-- | library/tkdnd_unix.tcl | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/library/tkdnd_unix.tcl b/library/tkdnd_unix.tcl index 3963c94..c66b349 100644 --- a/library/tkdnd_unix.tcl +++ b/library/tkdnd_unix.tcl @@ -67,10 +67,10 @@ proc xdnd::_HandleXdndEnter { path drag_source typelist } { variable _drop_target; set _drop_target {} variable _actionlist; set _actionlist \ {copy move link ask private} - debug "\n===============================================================" - debug "xdnd::_HandleXdndEnter: path=$path, drag_source=$drag_source,\ - typelist=$typelist" - debug "xdnd::_HandleXdndEnter: ACTION: default" + # debug "\n===============================================================" + # debug "xdnd::_HandleXdndEnter: path=$path, drag_source=$drag_source,\ + # typelist=$typelist" + # debug "xdnd::_HandleXdndEnter: ACTION: default" return default };# xdnd::_HandleXdndEnter @@ -87,17 +87,17 @@ proc xdnd::_HandleXdndPosition { drop_target rootX rootY } { variable _common_drop_target_types variable _drag_source variable _drop_target - debug "xdnd::_HandleXdndPosition: drop_target=$drop_target,\ + # debug "xdnd::_HandleXdndPosition: drop_target=$drop_target,\ _drop_target=$_drop_target, rootX=$rootX, rootY=$rootY" if {![info exists _drag_source] && ![string length $_drag_source]} { - debug "xdnd::_HandleXdndPosition: no or empty _drag_source:\ - return refuse_drop" + # debug "xdnd::_HandleXdndPosition: no or empty _drag_source:\ + # return refuse_drop" return refuse_drop } ## Does the new drop target support any of our new types? set _types [bind $drop_target <<DropTargetTypes>>] - debug ">> Accepted types: $drop_target $_types" + # debug ">> Accepted types: $drop_target $_types" if {[llength $_types]} { ## Examine the drop target types, to find at least one match with the drag ## source types... @@ -111,11 +111,11 @@ proc xdnd::_HandleXdndPosition { drop_target rootX rootY } { } } - debug "\t($_drop_target) -> ($drop_target)" + # debug "\t($_drop_target) -> ($drop_target)" if {$drop_target != $_drop_target} { if {[string length $_drop_target]} { ## Call the <<DropLeave>> event. - debug "\t<<DropLeave>> on $_drop_target" + # debug "\t<<DropLeave>> on $_drop_target" set cmd [bind $_drop_target <<DropLeave>>] if {[string length $cmd]} { set _codelist $_typelist @@ -189,7 +189,7 @@ proc xdnd::_HandleXdndPosition { drop_target rootX rootY } { } } # Return values: copy, move, link, ask, private, refuse_drop, default - debug "xdnd::_HandleXdndPosition: ACTION: $_action" + # debug "xdnd::_HandleXdndPosition: ACTION: $_action" return $_action };# xdnd::_HandleXdndPosition @@ -207,7 +207,7 @@ proc xdnd::_HandleXdndLeave { } { variable _drag_source variable _drop_target if {![info exists _drop_target]} {set _drop_target {}} - debug "xdnd::_HandleXdndLeave: _drop_target=$_drop_target" + # debug "xdnd::_HandleXdndLeave: _drop_target=$_drop_target" if {[info exists _drop_target] && [string length $_drop_target]} { set cmd [bind $_drop_target <<DropLeave>>] if {[string length $cmd]} { @@ -259,7 +259,7 @@ proc xdnd::_HandleXdndDrop { time } { } if {![llength $_common_drag_source_types]} {return refuse_drop} ## Get the dropped data. - set data [_GetDroppedData] + set data [_GetDroppedData $time] ## Try to select the most specific <<Drop>> event. foreach type [concat $_common_drag_source_types $_common_drop_target_types] { set type [_platform_independent_type $type] @@ -304,10 +304,19 @@ proc xdnd::_HandleXdndDrop { time } { # ---------------------------------------------------------------------------- # Command xdnd::_GetDroppedData # ---------------------------------------------------------------------------- -proc xdnd::_GetDroppedData { } { +proc xdnd::_GetDroppedData { time } { variable _drop_target - return [selection get -displayof $_drop_target \ - -selection XdndSelection -type STRING] + variable _common_drag_source_types + foreach type $_common_drag_source_types { + # puts "TYPE: $type ($_drop_target)" + # _get_selection $_drop_target $time $type + if {![catch { + selection get -displayof $_drop_target -selection XdndSelection \ + -type $type} result options]} { + return $result + } + } + return -options $options $result };# xdnd::_GetDroppedData # ---------------------------------------------------------------------------- @@ -366,7 +375,7 @@ proc xdnd::_normalise_data { type data } { # ---------------------------------------------------------------------------- proc xdnd::_platform_specific_type { type } { switch $type { - DND_Text {return [list text/plain]} + DND_Text {return [list text/plain UTF8_STRING STRING]} DND_Files {return [list text/uri-list]} default {return [list $type]} } @@ -377,6 +386,8 @@ proc xdnd::_platform_specific_type { type } { # ---------------------------------------------------------------------------- proc xdnd::_platform_independent_type { type } { switch $type { + UTF8_STRING - + STRING - text/plain {return DND_Text} text/uri-list {return DND_Files} default {return [list $type]} |