comparison tkdnd-patch-on-r95 @ 866:43ddee394d28

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