Files
@ e9239995eb57
Branch filter:
Location: light9/tkdnd-patch-on-r95
e9239995eb57
5.4 KiB
text/plain
fix effect new/clear commands
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | Index: unix/TkDND_XDND.c
===================================================================
--- unix/TkDND_XDND.c (revision 95)
+++ unix/TkDND_XDND.c (working copy)
@@ -517,7 +517,7 @@
ActionCopy, ActionMove, ActionLink, ActionAsk, ActionPrivate,
refuse_drop, ActionDefault
};
-
+ printf("TkDND_HandleXdndDrop\n");
if (interp == NULL) return False;
if (XDND_DROP_TIME(xevent) != 0) {
time = ((sizeof(Time) == 8 && XDND_DROP_TIME(xevent) < 0)
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 95)
+++ CMakeLists.txt (working copy)
@@ -168,7 +168,7 @@
ADD_DEFINITIONS ( -DTKDND_VERSION="${PKG_VERSION}" )
## Package debug definitions...
-# ADD_DEFINITIONS ( -DDEBUG_CLIENTMESSAGE_HANDLER )
+ADD_DEFINITIONS ( -DDEBUG_CLIENTMESSAGE_HANDLER )
## ===========================================================================
## Declare the package shared library target...
Index: library/tkdnd_unix.tcl
===================================================================
--- library/tkdnd_unix.tcl (revision 95)
+++ library/tkdnd_unix.tcl (working copy)
@@ -54,7 +54,7 @@
variable _last_mouse_root_y 0
proc debug {msg} {
- puts $msg
+ #puts $msg
};# debug
};# namespace xdnd
@@ -69,6 +69,7 @@
variable _common_drop_target_types; set _common_drop_target_types {}
variable _actionlist
variable _drag_source; set _drag_source $drag_source
+debug "_drop_target clear1"
variable _drop_target; set _drop_target {}
variable _actionlist; set _actionlist \
{copy move link ask private}
@@ -82,6 +83,15 @@
return default
};# xdnd::_HandleXdndEnter
+
+proc xdnd::_pointWithinWindow {win rootX rootY} {
+ set x [winfo rootx $win]
+ set y [winfo rooty $win]
+ set w [winfo width $win]
+ set h [winfo height $win]
+ return [expr "$rootX >= $x && $rootX < $x+$w && $rootY >= $y && $rootY < $y+$h"]
+}
+
# ----------------------------------------------------------------------------
# Command xdnd::_HandleXdndPosition
# ----------------------------------------------------------------------------
@@ -102,9 +112,19 @@
# debug "xdnd::_HandleXdndPosition: drop_target=$drop_target,\
# _drop_target=$_drop_target, rootX=$rootX, rootY=$rootY"
+ # drop_target may be a parent of the real target.
+
+ # this is all a workaround for 'winfo containing' never returning anything
+ set children [winfo children $drop_target]
+ foreach child $children {
+ if {[_pointWithinWindow $child $rootX $rootY]} {
+ return [_HandleXdndPosition $child $rootX $rootY $drag_source]
+ }
+ }
+
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
}
@@ -116,7 +136,7 @@
## 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...
@@ -130,7 +150,7 @@
}
}
- # 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.
@@ -152,6 +172,7 @@
uplevel \#0 $cmd
}
}
+ debug "_drop_target clear2"
set _drop_target {}
if {[info exists common_drag_source_types]} {
@@ -179,15 +200,16 @@
set _action [uplevel \#0 $cmd]
}
}
+ debug "_drop_target set3 $drop_target"
set _drop_target $drop_target
}
set _action refuse_drop
- set _drop_target {}
if {[info exists common_drag_source_types]} {
set _action copy
set _common_drag_source_types $common_drag_source_types
set _common_drop_target_types $common_drop_target_types
+ debug "_drop_target set5 -> $_drop_target"
set _drop_target $drop_target
## Drop target supports at least one type. Send a <<DropPosition>>.
set cmd [bind $drop_target <<DropPosition>>]
@@ -206,6 +228,10 @@
] $cmd]
set _action [uplevel \#0 $cmd]
}
+ } else {
+ # logic wasn't clear; i'm just guessing this should be the else-clause
+ debug "_drop_target clear4, was $_drop_target"
+ set _drop_target {}
}
# Return values: copy, move, link, ask, private, refuse_drop, default
# debug "xdnd::_HandleXdndPosition: ACTION: $_action"
@@ -227,7 +253,10 @@
variable _drop_target
variable _last_mouse_root_x
variable _last_mouse_root_y
- if {![info exists _drop_target]} {set _drop_target {}}
+ if {![info exists _drop_target]} {
+debug "_drop_target clear6"
+set _drop_target {}
+}
# debug "xdnd::_HandleXdndLeave: _drop_target=$_drop_target"
if {[info exists _drop_target] && [string length $_drop_target]} {
set cmd [bind $_drop_target <<DropLeave>>]
@@ -273,7 +302,7 @@
set rootX $_last_mouse_root_x
set rootY $_last_mouse_root_y
- # puts "xdnd::_HandleXdndDrop: $time"
+ puts "xdnd::_HandleXdndDrop: $time $_drop_target"
if {![info exists _drag_source] && ![string length $_drag_source]} {
return refuse_drop
|