CC: | Andy Fingerhut <andy_fingerhut [...] alum.wustl.edu> |
Subject: | Possible bug fix for intermittent link_clicked signal behavior |
Date: | Wed, 04 Aug 2010 19:25:06 -0700 |
To: | bug-Gtk2-Ex-PodViewer [...] rt.cpan.org |
From: | Andy Fingerhut <jafingerhut [...] mac.com> |
My system: Ubuntu 10.4 LTS
Perl version 5.10.1
I have Synaptics package libgtk2-ex-podviewer-perl version 0.18-1
installed, and I have verified that the Perl source code is identical
to that in the version 0.18 .tar.gz file for PodViewer available on
CPAN.
I have been using gscan2pdf 0.9.31 and making modifications to it. It
uses Gtk2::Ex::PodViewer, and while trying to use the link_clicked
signal from PodViewer, I noticed that it seemed to only produce such a
signal intermittently. Sometimes I would click on a link at the
signal would be emitted, sometimes not. I did some Googling, and
found the following email that appears as if someone else may have
been experiencing similar troubles, but I'm not sure of that:
http://www.mail-archive.com/gtk-perl-list@gnome.org/msg04116.html
As an experiment, without any real understanding of how this code
works, I noticed that the PodViewer code for emitting link_enter and
link_leave signals was similar in some ways to that for emitting
link_clicked signals. One difference was the first argument to the
two calls to window_to_buffer_coords. I made the following one line
change to my copy of PodViewer.pm, and the link_clicked signals became
reliable -- they worked every time I clicked on one. If this works
for others, too, or the author could verify that it is actually a fix,
it would be great if a new version could be released and become the
standard one in Linux distros.
Thanks,
Andy Fingerhut
*** PodViewer.pm.orig 2008-10-04 07:01:23.000000000 -0700
--- PodViewer.pm 2010-08-04 18:33:22.000000000 -0700
***************
*** 454,460 ****
sub clicked {
my ($self, $event) = @_;
! my ($x, $y) = $self->window_to_buffer_coords('widget', $event-
Show quoted text
>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 '') {
--- 454,460 ----
sub clicked {
my ($self, $event) = @_;
! my ($x, $y) = $self->window_to_buffer_coords('text', $event-
Show quoted text >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 '') {