--- rxvt-unicode/src/perl/urxvt-popup 2006/01/07 20:29:28 1.2 +++ rxvt-unicode/src/perl/urxvt-popup 2006/01/08 00:34:57 1.8 @@ -3,8 +3,6 @@ # this extension implements popup-menu functionality for urxvt. it works # together with the urxvt::popup class. -use List::Util; - sub refresh { my ($self) = @_; @@ -18,7 +16,9 @@ $rend = $self->{press} ? "\x1b[m" : "\x1b[30;46m"; } - $cmd .= "$rend\x1b[K" . $self->locale_encode ($item->{text}) . "\015\012"; + $cmd .= "$rend\x1b[K"; + $cmd .= $self->locale_encode ($item->{render}->($item)); + $cmd .= "\015\012"; $row++; } @@ -30,7 +30,7 @@ my ($self, $event) = @_; $self->{hover} = $event->{row} + 1; - refresh $self; + $self->refresh; 1 } @@ -39,7 +39,7 @@ my ($self, $event) = @_; $self->{press}[$event->{button}] = 1; - refresh $self; + $self->refresh; 1 } @@ -55,19 +55,15 @@ $self->destroy; } - if ($event->{button} == 1) { - $self->{press}[$event->{button}] = 0; - refresh $self; - - warn "$event->{row} $event->{col}\n";#d# - - if ($col >= 0 && $col < $self->ncol - && $row >= 0 && $row < @{ $self->{data}{item} }) { - $self->{data}{item}[$row]{activate}->($event); - print "ok\n"; - } + $self->{press}[$event->{button}] = 0; + + if ($col >= 0 && $col < $self->ncol + && $row >= 0 && $row < @{ $self->{data}{item} }) { + $self->{data}{item}[$row]{activate}->($event); } + $self->refresh; + 1 } @@ -75,7 +71,7 @@ my ($self) = @_; delete $self->{hover}; - refresh $self; + $self->refresh; () } @@ -113,7 +109,7 @@ # might fail, but try anyways $self->grab ($self->{data}{event}{time}, 1) - and $self->allow_events_sync; + and $self->allow_events_async; on_button_press $self, $self->{data}{event} if $self->{data}{event}{button}; @@ -128,11 +124,9 @@ # should definitely not fail $self->grab ($self->{data}{event}{time}, 1) - and $self->allow_events_sync; + and $self->allow_events_async; } -sub on_destroy { -}