Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / site_perl / 5.8.0 / sun4-solaris / Tk / DragDrop / KDESite.pm
CommitLineData
86530b38
AT
1package Tk::DragDrop::KDESite;
2use strict;
3use vars qw($VERSION);
4$VERSION = '3.007'; # $Id: //depot/Tk8/DragDrop/DragDrop/KDESite.pm#7 $
5use base qw(Tk::DropSite);
6
7Tk::DropSite->Type('KDE');
8
9sub InitSite
10{my ($class,$site) = @_;
11 my $w = $site->widget;
12 $w->BindClientMessage('DndProtocol',[\&KDEDrop,$site]);
13}
14
15sub HandleLoose
16{
17 my ($w,$seln) = @_;
18 return '';
19}
20
21sub HandleData
22{
23 my ($string,$offset,$max) = @_;
24 return substr($string,$offset,$max);
25}
26
27sub KDEDrop
28{
29 my ($w,$site) = @_;
30 my $event = $w->XEvent;
31 my ($type,$time,$flags,$X,$Y) = unpack('LLLLL',$event->A);
32 my @data = $w->property('get','DndSelection','root');
33 if ($type == 128 && @data == 1 && $data[0] =~ /^file:(.*)$/)
34 {
35 # Grab a selection for compatibility with other DND schemes
36 my $seln = 'XdndSelection';
37 $w->SelectionHandle('-selection' => $seln, -type => 'FILE_NAME',
38 [\&HandleData,"$1"]);
39 $w->SelectionOwn('-selection' => $seln,
40 -command => [\&HandleLoose,$w,$seln]);
41 $site->Apply(-dropcommand => $Y, $Y, $seln);
42 }
43 else
44 {
45 print join(' ',$type,$time,$flags,$X,$Y),':"',join(',',@data),'"',"\n";
46 }
47}
48
491;
50__END__