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

Comparing rxvt-unicode/src/perl/tabbed (file contents):
Revision 1.8 by root, Fri Jan 20 15:47:55 2006 UTC vs.
Revision 1.10 by root, Fri Jan 20 16:18:07 2006 UTC

18 my $idx = 0; 18 my $idx = 0;
19 19
20 for my $tab (@{ $self->{tabs} }) { 20 for my $tab (@{ $self->{tabs} }) {
21 $idx++; 21 $idx++;
22 22
23 my $act = $tab->{activity} && $tab != $self->{cur}
24 ? "*" : " ";
25
23 my $txt = " $idx "; 26 my $txt = "$act$idx$act";
24 my $len = length $txt; 27 my $len = length $txt;
25 28
26 substr $text, $ofs, $len + 1, "$txt|"; 29 substr $text, $ofs, $len + 1, "$txt|";
27 @$rend[$ofs .. $ofs + $len - 1] = (urxvt::OVERLAY_RSTYLE) x $len 30 @$rend[$ofs .. $ofs + $len - 1] = (urxvt::OVERLAY_RSTYLE) x $len
28 if $tab == $self->{cur}; 31 if $tab == $self->{cur};
96 99
97sub make_current { 100sub make_current {
98 my ($self, $tab) = @_; 101 my ($self, $tab) = @_;
99 102
100 if (my $cur = $self->{cur}) { 103 if (my $cur = $self->{cur}) {
104 delete $cur->{activity};
101 $cur->XUnmapWindow ($cur->parent) if $cur->mapped; 105 $cur->XUnmapWindow ($cur->parent) if $cur->mapped;
102 $cur->focus_out; 106 $cur->focus_out;
103 } 107 }
104 108
105 $self->{cur} = $tab; 109 $self->{cur} = $tab;
106 110
107 $self->configure; 111 $self->configure;
108 $tab->focus_in; 112 $tab->focus_in;
109 $tab->XMapWindow ($tab->parent); 113 $tab->XMapWindow ($tab->parent);
114 delete $tab->{activity};
110 $self->refresh; 115 $self->refresh;
111 116
112 () 117 ()
113} 118}
114 119
211} 216}
212 217
213sub tab_key_press { 218sub tab_key_press {
214 my ($self, $tab, $event, $keysym, $str) = @_; 219 my ($self, $tab, $event, $keysym, $str) = @_;
215 220
216 if ($event->{state} & urxvt::ShiftMask 221 if ($event->{state} & urxvt::ShiftMask) {
217 && ($keysym == 0xff51 || $keysym == 0xff53)) { 222 if ($keysym == 0xff51 || $keysym == 0xff53) {
218 my ($idx) = grep $self->{tabs}[$_] == $tab, 0 .. $#{ $self->{tabs} }; 223 my ($idx) = grep $self->{tabs}[$_] == $tab, 0 .. $#{ $self->{tabs} };
219 224
220 --$idx if $keysym == 0xff51; 225 --$idx if $keysym == 0xff51;
221 ++$idx if $keysym == 0xff53; 226 ++$idx if $keysym == 0xff53;
222 227
223 $self->make_current ($self->{tabs}[$idx % @{ $self->{tabs}}]); 228 $self->make_current ($self->{tabs}[$idx % @{ $self->{tabs}}]);
224 $self->refresh; 229
230 return 1;
231 } elsif ($keysym == 0xff54) {
232 $self->new_tab;
233
234 return 1;
225 235 }
226 return 1;
227 } 236 }
228 237
229 () 238 ()
239}
240
241sub tab_activity {
242 my ($self, $tab) = @_;
243
244 $self->refresh;
230} 245}
231 246
232package urxvt::ext::tabbed::tab; 247package urxvt::ext::tabbed::tab;
233 248
234# helper extension implementing the subwindows of a tabbed terminal. 249# helper extension implementing the subwindows of a tabbed terminal.
245 }; 260 };
246 die if $@; 261 die if $@;
247 } 262 }
248} 263}
249 264
265sub on_add_lines {
266 $_[0]->{activity}++
267 or $_[0]{term}{parent}->tab_activity ($_[0]);
268 ()
269}
250 270
251 271

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines