From b06ccc3ddc51b9b1dd01aeeecc28adea69923592 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Fri, 21 Feb 2003 13:14:04 +0000 Subject: workaround what seems to be a gtk bug (#1445) gtk seems to loop (and take 100% user cpu) when I change the pixbuf of a gtkcellrendererpixbuf in a treeview that is not currently displayed --- perl-install/ugtk2.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'perl-install') diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm index 8994baf51..e9b8cb8da 100644 --- a/perl-install/ugtk2.pm +++ b/perl-install/ugtk2.pm @@ -1223,7 +1223,9 @@ sub ask_browse_tree_info_given_widgets { $w->{tree}->signal_connect(key_press_event => sub { my $c = chr($_[1]->keyval & 0xff); - $toggle->(0) if $_[1]->keyval >= 0x100 ? $c eq "\r" || $c eq "\x8d" : $c eq ' '; + if ($_[1]->keyval >= 0x100 ? $c eq "\r" || $c eq "\x8d" : $c eq ' ') { + Gtk2->timeout_add(1, sub { $toggle->(0), 0 }) + } 0; }); $w->{tree}->get_selection->signal_connect(changed => sub { @@ -1241,7 +1243,10 @@ sub ask_browse_tree_info_given_widgets { #- the following test for equality is because we can have a button_press_event first, then #- two changed events, the first being on a different row :/ (is it a bug in gtk2?) - that #- happens in rpmdrake when doing a "search" and directly trying to select a found package - $toggle->(1), $mouse_toggle_pending = 0 if $mouse_toggle_pending eq $model->get($iter, 0); + if ($mouse_toggle_pending eq $model->get($iter, 0)) { + Gtk2->timeout_add(1, sub { $toggle->(1), $mouse_toggle_pending = 0 }); + } + 0; }); $w->{tree}->signal_connect(button_press_event => sub { #- not too good, but CellRendererPixbuf doesn't have the needed signals :( my ($returns, $path, $column) = $w->{tree}->get_path_at_pos($_[1]->x, $_[1]->y); -- cgit v1.2.1