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.9 by root, Fri Jan 20 16:13:33 2006 UTC vs.
Revision 1.11 by root, Fri Jan 20 18:50:49 2006 UTC

76 $tab->XMoveResizeWindow ( 76 $tab->XMoveResizeWindow (
77 $tab->parent, 77 $tab->parent,
78 0, $self->{tabheight}, 78 0, $self->{tabheight},
79 $self->width, $self->height - $self->{tabheight} 79 $self->width, $self->height - $self->{tabheight}
80 ); 80 );
81}
82
83sub copy_properties {
84 my ($self) = @_;
85 my $tab = $self->{cur};
81 86
82 my $wm_normal_hints = $self->XInternAtom ("WM_NORMAL_HINTS"); 87 my $wm_normal_hints = $self->XInternAtom ("WM_NORMAL_HINTS");
88
89 my %our_props = map +($_ => undef), $self->XListProperties ($self->parent);
83 90
84 for my $atom ($tab->XListProperties ($tab->parent)) { 91 for my $atom ($tab->XListProperties ($tab->parent)) {
85 my ($type, $format, $items) = $self->XGetWindowProperty ($tab->parent, $atom); 92 my ($type, $format, $items) = $self->XGetWindowProperty ($tab->parent, $atom);
93
94 delete $our_props{$atom};
86 95
87 if ($atom == $wm_normal_hints) { 96 if ($atom == $wm_normal_hints) {
88 my (@hints) = unpack "l!*", $items; 97 my (@hints) = unpack "l!*", $items;
89 98
90 $hints[$_] += $self->{tabheight} for (4, 6, 16); 99 $hints[$_] += $self->{tabheight} for (4, 6, 16);
92 $items = pack "l!*", @hints; 101 $items = pack "l!*", @hints;
93 } 102 }
94 $self->XChangeWindowProperty ($self->parent, $atom, $type, $format, $items); 103 $self->XChangeWindowProperty ($self->parent, $atom, $type, $format, $items);
95 } 104 }
96 105
97 $self->refresh; 106 $self->XDeleteProperty ($self->parent, $_) for keys %our_props;
98} 107}
99 108
100sub make_current { 109sub make_current {
101 my ($self, $tab) = @_; 110 my ($self, $tab) = @_;
102 111
107 } 116 }
108 117
109 $self->{cur} = $tab; 118 $self->{cur} = $tab;
110 119
111 $self->configure; 120 $self->configure;
121 $self->copy_properties;
112 $tab->focus_in; 122 $tab->focus_in;
113 $tab->XMapWindow ($tab->parent); 123 $tab->XMapWindow ($tab->parent);
124 delete $tab->{activity};
114 $self->refresh; 125 $self->refresh;
115 delete $tab->{activity};
116 126
117 () 127 ()
118} 128}
119 129
120sub on_button_press { 130sub on_button_press {
184 1 194 1
185} 195}
186 196
187sub tab_start { 197sub tab_start {
188 my ($self, $tab) = @_; 198 my ($self, $tab) = @_;
199
200 $tab->XChangeInput ($tab->parent, urxvt::PropertyChangeMask);
189 201
190 push @{ $self->{tabs} }, $tab; 202 push @{ $self->{tabs} }, $tab;
191 203
192# $tab->{name} ||= scalar @{ $self->{tabs} }; 204# $tab->{name} ||= scalar @{ $self->{tabs} };
193 $self->make_current ($tab); 205 $self->make_current ($tab);
216} 228}
217 229
218sub tab_key_press { 230sub tab_key_press {
219 my ($self, $tab, $event, $keysym, $str) = @_; 231 my ($self, $tab, $event, $keysym, $str) = @_;
220 232
221 if ($event->{state} & urxvt::ShiftMask 233 if ($event->{state} & urxvt::ShiftMask) {
222 && ($keysym == 0xff51 || $keysym == 0xff53)) { 234 if ($keysym == 0xff51 || $keysym == 0xff53) {
223 my ($idx) = grep $self->{tabs}[$_] == $tab, 0 .. $#{ $self->{tabs} }; 235 my ($idx) = grep $self->{tabs}[$_] == $tab, 0 .. $#{ $self->{tabs} };
224 236
225 --$idx if $keysym == 0xff51; 237 --$idx if $keysym == 0xff51;
226 ++$idx if $keysym == 0xff53; 238 ++$idx if $keysym == 0xff53;
227 239
228 $self->make_current ($self->{tabs}[$idx % @{ $self->{tabs}}]); 240 $self->make_current ($self->{tabs}[$idx % @{ $self->{tabs}}]);
229 $self->refresh; 241
242 return 1;
243 } elsif ($keysym == 0xff54) {
244 $self->new_tab;
245
246 return 1;
230 247 }
231 return 1;
232 } 248 }
249
250 ()
251}
252
253sub tab_property_notify {
254 my ($self, $tab, $event) = @_;
255
256 $self->copy_properties
257 if $event->{window} == $tab->parent;
233 258
234 () 259 ()
235} 260}
236 261
237sub tab_activity { 262sub tab_activity {
244 269
245# helper extension implementing the subwindows of a tabbed terminal. 270# helper extension implementing the subwindows of a tabbed terminal.
246# simply proxies all interesting calls back to the tabbed class. 271# simply proxies all interesting calls back to the tabbed class.
247 272
248{ 273{
249 for my $hook qw(start destroy key_press) { 274 for my $hook qw(start destroy key_press property_notify) {
250 eval qq{ 275 eval qq{
251 sub on_$hook { 276 sub on_$hook {
252 my \$parent = \$_[0]{term}{parent} 277 my \$parent = \$_[0]{term}{parent}
253 or return; 278 or return;
254 \$parent->tab_$hook (\@_) 279 \$parent->tab_$hook (\@_)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines