Subject: | X Error in Tk remote drag and drop |
Date: | Fri, 3 Jun 2016 07:23:43 +0200 |
To: | bug-Tk [...] rt.cpan.org |
From: | PR Software <pr.software [...] free.fr> |
Hello,
I use PERL 5.18.2 on Linux Mint (Debian) with Tk 804.033 and I have an
error when I drag the icon of a file from the Cinnamon desktop and drop
it on a Tk widget :
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 25 (X_SendEvent)
Resource id in failed request: 0x2fd00fd
Serial number of failed request: 164
Current serial number in output stream: 165
The numeric values are different between two run of the program.
My source code is:
#!/usr/bin/perl
use strict;
use Tk;
use Tk::DropSite;
my $mw = new MainWindow();
my $label = $mw->Label(-text => "Drop on me")->pack;
$label->DropSite(-droptypes => [$^O eq 'MSWin32' ? 'Win32' :
'XDND'], -dropcommand => [\&dropFile, $label]);
MainLoop;
sub dropFile {
my ($widget, $selection) = @_;
my $filename = $widget->SelectionGet(-selection => $selection,
'STRING');
print "DROP [$filename]\n";
}
The same code works fine on Windows with Strawberry PERL 5.22.0.
Thanks for the help.