1 | #! perl |
1 | #! perl |
2 | |
2 | |
3 | # this extension implements popup-menu functionality for urxvt. it works |
3 | # this extension implements popup-menu functionality for urxvt. it works |
4 | # together with the urxvt::popup class. |
4 | # together with the urxvt::popup class. |
5 | |
|
|
6 | use List::Util; |
|
|
7 | |
5 | |
8 | sub refresh { |
6 | sub refresh { |
9 | my ($self) = @_; |
7 | my ($self) = @_; |
10 | |
8 | |
11 | my $cmd = "\x1b[H"; |
9 | my $cmd = "\x1b[H"; |
… | |
… | |
57 | $self->destroy; |
55 | $self->destroy; |
58 | } |
56 | } |
59 | |
57 | |
60 | $self->{press}[$event->{button}] = 0; |
58 | $self->{press}[$event->{button}] = 0; |
61 | |
59 | |
62 | if ($event->{button} == 1) { |
|
|
63 | refresh $self; |
60 | refresh $self; |
64 | |
61 | |
65 | warn "$event->{row} $event->{col}\n";#d# |
|
|
66 | |
|
|
67 | if ($col >= 0 && $col < $self->ncol |
62 | if ($col >= 0 && $col < $self->ncol |
68 | && $row >= 0 && $row < @{ $self->{data}{item} }) { |
63 | && $row >= 0 && $row < @{ $self->{data}{item} }) { |
69 | $self->{data}{item}[$row]{activate}->($event); |
64 | $self->{data}{item}[$row]{activate}->($event); |
70 | print "ok\n"; |
|
|
71 | } |
|
|
72 | } |
65 | } |
73 | |
66 | |
74 | 1 |
67 | 1 |
75 | } |
68 | } |
76 | |
69 | |