ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/perl/urxvt-popup
(Generate patch)

Comparing rxvt-unicode/src/perl/urxvt-popup (file contents):
Revision 1.13 by root, Wed Jan 18 11:05:09 2006 UTC vs.
Revision 1.17 by sf-exg, Mon Jun 11 05:03:46 2012 UTC

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 - "no user serviceable parts inside".
5 5
6sub refresh { 6sub refresh {
7 my ($self) = @_; 7 my ($self) = @_;
8 8
9 my $cmd = "\x1b[H"; 9 my $cmd = "\x1b[H";
51} 51}
52 52
53sub on_button_release { 53sub on_button_release {
54 my ($self, $event) = @_; 54 my ($self, $event) = @_;
55 55
56 if ($event->{button} == $self->{data}{event}{button}) {
57 $self->ungrab;
58 $self->destroy;
59 }
60
61 $self->{press}[$event->{button}] = 0; 56 $self->{press}[$event->{button}] = 0;
62 57
63 my ($row, $col) = ($event->{row}, $event->{col}); 58 my ($row, $col) = ($event->{row}, $event->{col});
64 if ($col >= 0 && $col < $self->ncol 59 if ($col >= 0 && $col < $self->ncol
65 && $row >= 0 && $row < @{ $self->{data}{item} }) { 60 && $row >= 0 && $row < @{ $self->{data}{item} }) {
66 my $item = $self->{data}{item}[$row]; 61 my $item = $self->{data}{item}[$row];
67 $item->{activate}->($event, $item); 62 $item->{activate}->($event, $item);
68 } 63 }
69 64
70 $self->refresh; 65 $self->refresh;
66
67 if ($event->{button} == $self->{data}{event}{button}) {
68 $self->ungrab;
69 $self->destroy;
70 }
71 71
72 1 72 1
73} 73}
74 74
75sub on_focus_out { 75sub on_focus_out {
106 $pos = "+$x+$y"; 106 $pos = "+$x+$y";
107 } 107 }
108 108
109 $self->resource (geometry => "${width}x${height}$pos"); 109 $self->resource (geometry => "${width}x${height}$pos");
110 110
111 $self->{term}{urxvt_popup_init_done} = 1;
112
111 () 113 ()
112} 114}
113 115
114sub on_start { 116sub on_start {
115 my ($self) = @_; 117 my ($self) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines