package Tk
::DragDrop
::XDNDSite
;
$VERSION = '3.010'; # $Id: //depot/Tk8/DragDrop/DragDrop/XDNDSite.pm#10 $
use base qw(Tk::DropSite);
sub XDND_PROTOCOL_VERSION
() { 3 }
Tk
::DropSite
->Type('XDND');
my ($src,$flags,@types) = unpack('LLLLL',$event->A);
# print "XdndEnter $src\n";
my $ver = ($flags >> 24) & 0xFF;
Tk
::catch
{ @prop = $t->property('get','XdndTypeList',$src) };
@types = @prop if (!$@
&& shift(@prop) eq 'ATOM');
$t->{"XDND$src"} = { ver
=> $ver, types
=> \
@types };
my ($src,$flags,@types) = unpack('LLLLL',$event->A);
# print "XdndLeave $src\n";
my $info = $t->{"XDND$src"};
my $over = $info->{site
};
$over->Apply(-entercommand
=> $X, $Y, 0)
my ($src,$flags,$xy,$time,$action) = unpack('LLLLL',$event->A);
my $info = $t->{"XDND$src"};
$info->{action
} = $action;
my $over = $info->{site
};
foreach my $site (@
$sites)
$sxy = ($site->X << 16) | $site->Y;
$swh = ($site->width << 16) | $site->height;
$site->Apply(-motioncommand
=> $X, $Y);
$over->Apply(-entercommand
=> $X, $Y, 0);
$site->Apply(-entercommand
=> $X, $Y, 1);
$site->Apply(-entercommand
=> $X, $Y, 1);
$over->Apply(-entercommand
=> $X, $Y, 0)
my $data = pack('LLLLL',$id,$sflags,$sxy,$swh,$action);
$t->SendClientMessage('XdndStatus',$src,32,$data);
my ($src,$flags,$time,$res1,$res2) = unpack('LLLLL',$event->A);
my $info = $t->{"XDND$src"};
my $site = $info->{'site'};
$site->Apply(-dropcommand
=> $Y, $Y, 'XdndSelection');
$site->Apply(-entercommand
=> $X, $Y, 0);
my $data = pack('LLLLL',oct($t->id),$sflags,0,0,0);
$t->SendClientMessage('XdndFinished',$src,32,$data);
{my ($class,$t,$sites) = @_;
$t->BindClientMessage('XdndLeave',[\
&XdndLeave
,$sites]);
$t->BindClientMessage('XdndEnter',[\
&XdndEnter
,$sites]);
$t->BindClientMessage('XdndPosition',[\
&XdndPosition
,$sites]);
$t->BindClientMessage('XdndDrop',[\
&XdndDrop
,$sites]);
$t->property('set','XdndAware','ATOM',32,[XDND_PROTOCOL_VERSION
]);
$t->property('delete','XdndAware');