… | |
… | |
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 | |
|
|
83 | sub 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 | |
100 | sub make_current { |
109 | sub 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); |
114 | delete $tab->{activity}; |
124 | delete $tab->{activity}; |
115 | $self->refresh; |
125 | $self->refresh; |
116 | |
126 | |
… | |
… | |
184 | 1 |
194 | 1 |
185 | } |
195 | } |
186 | |
196 | |
187 | sub tab_start { |
197 | sub 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); |
… | |
… | |
236 | } |
248 | } |
237 | |
249 | |
238 | () |
250 | () |
239 | } |
251 | } |
240 | |
252 | |
|
|
253 | sub tab_property_notify { |
|
|
254 | my ($self, $tab, $event) = @_; |
|
|
255 | |
|
|
256 | $self->copy_properties |
|
|
257 | if $event->{window} == $tab->parent; |
|
|
258 | |
|
|
259 | () |
|
|
260 | } |
|
|
261 | |
241 | sub tab_activity { |
262 | sub tab_activity { |
242 | my ($self, $tab) = @_; |
263 | my ($self, $tab) = @_; |
243 | |
264 | |
244 | $self->refresh; |
265 | $self->refresh; |
245 | } |
266 | } |
… | |
… | |
248 | |
269 | |
249 | # helper extension implementing the subwindows of a tabbed terminal. |
270 | # helper extension implementing the subwindows of a tabbed terminal. |
250 | # simply proxies all interesting calls back to the tabbed class. |
271 | # simply proxies all interesting calls back to the tabbed class. |
251 | |
272 | |
252 | { |
273 | { |
253 | for my $hook qw(start destroy key_press) { |
274 | for my $hook qw(start destroy key_press property_notify) { |
254 | eval qq{ |
275 | eval qq{ |
255 | sub on_$hook { |
276 | sub on_$hook { |
256 | my \$parent = \$_[0]{term}{parent} |
277 | my \$parent = \$_[0]{term}{parent} |
257 | or return; |
278 | or return; |
258 | \$parent->tab_$hook (\@_) |
279 | \$parent->tab_$hook (\@_) |