summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changelog7
-rw-r--r--library/tkdnd.tcl26
2 files changed, 19 insertions, 14 deletions
diff --git a/Changelog b/Changelog
index e5e8507..cc38f39 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,11 @@
-2015-02-25 Petasis George <petasis@iit.demokritos.gr>
+2015-03-15 Petasis George <petasis@iit.demokritos.gr>
TkDND 2.8 released.
+2015-03-04 Petasis George <petasis@iit.demokritos.gr>
+ * library/tkdnd.tcl: Added support in <<DragInitCmd>> & <<DragEndCmd>>
+ for %x, %y mouse coordinates (relative to window that is the drag
+ source).
+
2015-02-20 Petasis George <petasis@iit.demokritos.gr>
* unix/TkDND_XDND.c: Fixed a bug in converting Time to a Tcl object.
Now Tcl_NewWideIntObj() is used, as Tcl_NewLongObj() could cause an
diff --git a/library/tkdnd.tcl b/library/tkdnd.tcl
index 51ed777..c8f05af 100644
--- a/library/tkdnd.tcl
+++ b/library/tkdnd.tcl
@@ -50,12 +50,12 @@ namespace eval ::tkdnd {
variable _windowingsystem
- bind TkDND_Drag1 <ButtonPress-1> {tkdnd::_begin_drag press 1 %W %s %X %Y}
- bind TkDND_Drag1 <B1-Motion> {tkdnd::_begin_drag motion 1 %W %s %X %Y}
- bind TkDND_Drag2 <ButtonPress-2> {tkdnd::_begin_drag press 2 %W %s %X %Y}
- bind TkDND_Drag2 <B2-Motion> {tkdnd::_begin_drag motion 2 %W %s %X %Y}
- bind TkDND_Drag3 <ButtonPress-3> {tkdnd::_begin_drag press 3 %W %s %X %Y}
- bind TkDND_Drag3 <B3-Motion> {tkdnd::_begin_drag motion 3 %W %s %X %Y}
+ bind TkDND_Drag1 <ButtonPress-1> {tkdnd::_begin_drag press 1 %W %s %X %Y %x %y}
+ bind TkDND_Drag1 <B1-Motion> {tkdnd::_begin_drag motion 1 %W %s %X %Y %x %y}
+ bind TkDND_Drag2 <ButtonPress-2> {tkdnd::_begin_drag press 2 %W %s %X %Y %x %y}
+ bind TkDND_Drag2 <B2-Motion> {tkdnd::_begin_drag motion 2 %W %s %X %Y %x %y}
+ bind TkDND_Drag3 <ButtonPress-3> {tkdnd::_begin_drag press 3 %W %s %X %Y %x %y}
+ bind TkDND_Drag3 <B3-Motion> {tkdnd::_begin_drag motion 3 %W %s %X %Y %x %y}
# ----------------------------------------------------------------------------
# Command tkdnd::initialise: Initialise the TkDND package.
@@ -255,7 +255,7 @@ proc ::tkdnd::drop_target { mode path { types {} } } {
# ----------------------------------------------------------------------------
# Command tkdnd::_begin_drag
# ----------------------------------------------------------------------------
-proc ::tkdnd::_begin_drag { event button source state X Y } {
+proc ::tkdnd::_begin_drag { event button source state X Y x y } {
variable _x0
variable _y0
variable _state
@@ -275,7 +275,7 @@ proc ::tkdnd::_begin_drag { event button source state X Y } {
if { [string equal $_state "press"] } {
if { abs($_x0-$X) > 3 || abs($_y0-$Y) > 3 } {
set _state "done"
- _init_drag $button $source $state $X $Y
+ _init_drag $button $source $state $X $Y $x $y
}
}
}
@@ -285,12 +285,12 @@ proc ::tkdnd::_begin_drag { event button source state X Y } {
# ----------------------------------------------------------------------------
# Command tkdnd::_init_drag
# ----------------------------------------------------------------------------
-proc ::tkdnd::_init_drag { button source state rootX rootY } {
+proc ::tkdnd::_init_drag { button source state rootX rootY X Y } {
# Call the <<DragInitCmd>> binding.
set cmd [bind $source <<DragInitCmd>>]
if {[string length $cmd]} {
- set cmd [string map [list %W $source %X $rootX %Y $rootY \
- %S $state %e <<DragInitCmd>> %A \{\} \
+ set cmd [string map [list %W $source %X $rootX %Y $rootY %x $X %y $Y \
+ %S $state %e <<DragInitCmd>> %A \{\} %% % \
%t [bind $source <<DragSourceTypes>>]] $cmd]
set info [uplevel \#0 $cmd]
set len [llength $info]
@@ -334,7 +334,7 @@ proc ::tkdnd::_init_drag { button source state rootX rootY } {
}
## Call _end_drag to notify the widget of the result of the drag
## operation...
- _end_drag $button $source {} $action {} $data {} $state $rootX $rootY
+ _end_drag $button $source {} $action {} $data {} $state $rootX $rootY $X $Y
}
};# tkdnd::_init_drag
@@ -348,7 +348,7 @@ proc ::tkdnd::_end_drag { button source target action type data result
# Call the <<DragEndCmd>> binding.
set cmd [bind $source <<DragEndCmd>>]
if {[string length $cmd]} {
- set cmd [string map [list %W $source %X $rootX %Y $rootY \
+ set cmd [string map [list %W $source %X $rootX %Y $rootY %x $X %y $Y %% % \
%S $state %e <<DragEndCmd>> %A \{$action\}] $cmd]
set info [uplevel \#0 $cmd]
# if { $info != "" } {