Subject: | More Drag/Drop Problems [with PATCH] |
This problem was posted to the ptk mailing list by Ala Qumsieh. The core of the problem is that for stacked widgets which are dropsites always the first widget get the drops, regardless of the stacking order. Changing Tk::DragSite::Rect to use Tk::Widget::containing seems to work better.
Regards,
Slaven
#
#
# To apply this patch:
# STEP 1: Chdir to the source directory.
# STEP 2: Run the 'applypatch' program with this patch file as input.
#
# If you do not have 'applypatch', it is part of the 'makepatch' package
# that you can fetch from the Comprehensive Perl Archive Network:
# http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz
# In the above URL, 'x' should be 2 or higher.
#
# To apply this patch without the use of 'applypatch':
# STEP 1: Chdir to the source directory.
# STEP 2: Run the 'patch' program with this file as input.
#
#### End of Preamble ####
#### Patch data follows ####
diff -up '/usr/local/dist/cpan/build/Tk-804.025_beta14/DragDrop/DragDrop/Rect.pm' 'DragDrop/DragDrop/Rect.pm'
Index: ./DragDrop/DragDrop/Rect.pm
--- ./DragDrop/DragDrop/Rect.pm Sun Dec 14 20:44:50 2003
+++ ./DragDrop/DragDrop/Rect.pm Mon Mar 15 20:09:16 2004
@@ -9,14 +9,16 @@ $VERSION = sprintf '4.%03d', q$Revision:
sub Over
{
my ($site,$X,$Y) = @_;
- my $x = $site->X;
- my $y = $site->Y;
- my $w = $site->width;
- my $h = $site->height;
-
- my $val = ($X >= $x && $X < ($x + $w) && $Y >= $y && $Y < ($y + $h));
- # print "Over ",$site->Show," $X,$Y => $val\n";
- return $val;
+ my $Over;
+ $Over = sub
+ {
+ my $w = shift;
+ return 1 if $w->containing($X,$Y) eq $w;
+ my $parent = $w->parent;
+ return if !$parent;
+ return $Over->($parent);
+ };
+ return $Over->($site->{widget});
}
sub FindSite
#### End of Patch data ####
#### ApplyPatch data follows ####
# Data version : 1.0
# Date generated : Mon Mar 15 20:09:18 2004
# Generated by : makepatch 2.00_07*
# Recurse directories : Yes
# Excluded files : (\A|/).*\~\Z
# (\A|/).*\.a\Z
# (\A|/).*\.bak\Z
# (\A|/).*\.BAK\Z
# (\A|/).*\.elc\Z
# (\A|/).*\.exe\Z
# (\A|/).*\.gz\Z
# (\A|/).*\.ln\Z
# (\A|/).*\.o\Z
# (\A|/).*\.obj\Z
# (\A|/).*\.olb\Z
# (\A|/).*\.old\Z
# (\A|/).*\.orig\Z
# (\A|/).*\.rej\Z
# (\A|/).*\.so\Z
# (\A|/).*\.Z\Z
# (\A|/)\.del\-.*\Z
# (\A|/)\.make\.state\Z
# (\A|/)\.nse_depinfo\Z
# (\A|/)core\Z
# (\A|/)tags\Z
# (\A|/)TAGS\Z
# v 'pTk/patchlevel.h' 934 1079376698 33060
# p 'DragDrop/DragDrop/Rect.pm' 1481 1079377756 0100444
#### End of ApplyPatch data ####
#### End of Patch kit [created: Mon Mar 15 20:09:18 2004] ####
#### Patch checksum: 64 2125 1691 ####
#### Checksum: 82 2748 53163 ####