Re: Strange interaction between Gtk2::Dialog and signal from Goo::Canvas




In the example below, whichever Goo::Canvas::Text object is clicked,
only the signal from the first one clicked is fired. With
Gtk2::Buttons, it works.

If I comment out the

if ($dialog->run eq 'ok') {}

line, then the Goo::Canvas example works too.

Does anyone have any insight why that might be?


It looks like the button-press-event causes a pointer-grab. This leads
to the described behaviour, because all following events are received by
the first text item that was clicked until the grab gets broken.

Hence, you need to ungrab the pointer after destroying the dialog.
See:
http://library.gnome.org/devel/goocanvas/unstable/GooCanvas.html#goo-canvas-pointer-ungrab 


my $dialog = Gtk2::Dialog -> new ('Editing text...', $window,
'modal',
'gtk-ok' => 'ok',
'gtk-cancel' => 'cancel');
$dialog->set_default_response ('ok');
$dialog->show_all;
if ($dialog->run eq 'ok') {}
$dialog->destroy;

$canvas->pointer_ungrab( $widget, $ev->time );

return TRUE;
});
}


Your modified script is attached as well.

Regards
Mario

Attachment: goo.pl
Description: Perl program



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]