--- rxvt-unicode/src/perl/urxvt-popup 2006/01/07 20:23:53 1.1 +++ rxvt-unicode/src/perl/urxvt-popup 2006/01/07 21:43:17 1.5 @@ -1,5 +1,8 @@ #! perl +# this extension implements popup-menu functionality for urxvt. it works +# together with the urxvt::popup class. + use List::Util; sub refresh { @@ -15,7 +18,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++; } @@ -52,8 +57,9 @@ $self->destroy; } + $self->{press}[$event->{button}] = 0; + if ($event->{button} == 1) { - $self->{press}[$event->{button}] = 0; refresh $self; warn "$event->{row} $event->{col}\n";#d# @@ -110,7 +116,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}; @@ -125,11 +131,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 { -}