Subject: | link-clicked text window for x,y lookup |
Date: | Wed, 22 Sep 2010 07:05:43 +1000 |
To: | bug-Gtk2-Ex-PodViewer [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
With recent debian gtk 2.20.1 and perl-gtk 1.221, clicking near the top
of a link in PodViewer doesn't emit the link-clicked signal.
The effect can be seen in the podviewer program. Clicking in the top
half of the letters making up a link does nothing, but clicking in the
bottom half goes to the link target.
I think the button-press signal gets the 'text' window, not the 'widget'
window and looking up window_to_buffer_coords() with the latter ends up
a few pixels off. Perhaps,
sub clicked {
my ($self, $event) = @_;
my $wintype = $self->get_window_type ($event->window);
my ($x, $y) = $self->window_to_buffer_coords($wintype, $event->get_coords);
my $iter = $self->get_iter_at_location($x, $y);
my $text = $self->get_link_text_at_iter($iter);
if (defined($text) && $text ne '') {
$self->signal_emit('link_clicked', $text);
}
return 1;
}