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.11 by root, Sun Jan 8 01:16:10 2006 UTC vs.
Revision 1.13 by root, Wed Jan 18 11:05:09 2006 UTC

61 $self->{press}[$event->{button}] = 0; 61 $self->{press}[$event->{button}] = 0;
62 62
63 my ($row, $col) = ($event->{row}, $event->{col}); 63 my ($row, $col) = ($event->{row}, $event->{col});
64 if ($col >= 0 && $col < $self->ncol 64 if ($col >= 0 && $col < $self->ncol
65 && $row >= 0 && $row < @{ $self->{data}{item} }) { 65 && $row >= 0 && $row < @{ $self->{data}{item} }) {
66 $self->{data}{item}[$row]{activate}->($event); 66 my $item = $self->{data}{item}[$row];
67 $item->{activate}->($event, $item);
67 } 68 }
68 69
69 $self->refresh; 70 $self->refresh;
70 71
71 1 72 1
86 my $data = $self->{data} = $urxvt::popup::self; 87 my $data = $self->{data} = $urxvt::popup::self;
87 88
88 $_->{width} = $self->strwidth ($_->{text}) 89 $_->{width} = $self->strwidth ($_->{text})
89 for @{ $data->{item} }; 90 for @{ $data->{item} };
90 91
92 $self->resource (title => "URxvt Popup Menu");
93 $self->resource (name => "URxvt.popup");
94
91 $self->resource ($_ => $data->{term}->resource ($_)) 95 $self->resource ($_ => $data->{term}->resource ($_))
92 for qw(font boldFont italicFont boldItalicFont color+0 color+1); 96 for qw(font boldFont italicFont boldItalicFont color+0 color+1);
93 97
94 my $width = List::Util::max map $_->{width}, @{ $data->{item} }; 98 my $width = List::Util::max map $_->{width}, @{ $data->{item} };
95 my $height = @{ $data->{item} }; 99 my $height = @{ $data->{item} };
97 my $pos = ""; 101 my $pos = "";
98 102
99 if ($data->{event}) { 103 if ($data->{event}) {
100 my $x = int List::Util::max 0, $data->{event}{x_root} - $width * $data->{term}->fwidth * 0.5; 104 my $x = int List::Util::max 0, $data->{event}{x_root} - $width * $data->{term}->fwidth * 0.5;
101 my $y = int List::Util::max 0, $data->{event}{y_root} - $data->{term}->fheight * 0.5; 105 my $y = int List::Util::max 0, $data->{event}{y_root} - $data->{term}->fheight * 0.5;
102
103 $pos = "+$x+$y"; 106 $pos = "+$x+$y";
104 } 107 }
105 108
106 $self->resource (geometry => "${width}x${height}$pos"); 109 $self->resource (geometry => "${width}x${height}$pos");
107 110
130 $self->grab ($self->{data}{event}{time}, 1) 133 $self->grab ($self->{data}{event}{time}, 1)
131 and $self->allow_events_async; 134 and $self->allow_events_async;
132} 135}
133 136
134 137
135
136
137
138

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines