From 22e659977faafc0f55a02be7197d49885be362c1 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Wed, 8 Jan 2003 16:40:46 +0000 Subject: fix a misc bug in rpmdrake (selecting a pkg doesn't work in certain circumstances - seems to be when the treeview doesn't have the focus, for exa mple after a search) by changing a bit the way we handle button_press_event in ask_browse_tree_info --- perl-install/ugtk2.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'perl-install') diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm index 37c105e2d..c4775b138 100644 --- a/perl-install/ugtk2.pm +++ b/perl-install/ugtk2.pm @@ -1245,11 +1245,17 @@ sub ask_browse_tree_info_given_widgets { } else { $curr = $iter; } - $toggle->(1), $mouse_toggle_pending = 0 if $mouse_toggle_pending; + #- 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); }); $w->{tree}->signal_connect(button_press_event => sub { #- not too good, but CellRendererPixbuf doesn't have the needed signals :( - my ($x, $textw, $pixw) = ($_[1]->x, $w->{textcolumn}->get_width, $w->{pixcolumn}->get_width); - $mouse_toggle_pending = 1 if $x > $textw && $x < $textw + $pixw; + my ($returns, $path, $column) = $w->{tree}->get_path_at_pos($_[1]->x, $_[1]->y); + if ($returns) { + Gtk2->equals($column, $w->{pixcolumn}) and $mouse_toggle_pending = $w->{tree_model}->get($path, 0); + $path->free; + } }); $common->{rebuild_tree}->(); &$update_size; -- cgit v1.2.1