my perl code looks like this:
#!/usr/bin/env perl
use strict;
use warnings;
use Tk;
my $mw = Tk::MainWindow->new();
$mw->overrideredirect(1);
my $canvas = $mw->Canvas(
-bg => 'white',
-width => 410,
)->pack(-fill => 'both', -expand => 1);
my $rect_filled = $canvas->createRectangle(
0, 0, 360, 100,
-outline => '#C0C0C0',
-fill => '#FFEC73',
);
$canvas->bind( $rect_filled, '<Enter>' => sub{
$canvas->itemconfigure( $rect_filled,
-outline => '#E0E0E0',
-fill => '#0000ff',
);
});
$canvas->bind( $rect_filled, '<Leave>' => sub{
$canvas->itemconfigure( $rect_filled,
-outline => '#C0C0C0',
-fill => '#FFEC73',
);
});
$mw->MainLoop();
If I run this code, i can see the yellow rectangle. But, when I move the mouse into the canvas from above, the ENTER-event comes only after ~30 pixels, seen in the screenshot.
It seems as if the titlebar is still above the canvas.
How can I stop this behavior so that the ENTER-event is also raised from the coordinates (0,0)?
-- Update for question:
- Debian 8.11
- Gnome 3.14.1
- Perl 5.20.2
- Tk 804.032