… | |
… | |
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 | |
… | |
… | |
170 | |
180 | |
171 | sub on_configure_notify { |
181 | sub on_configure_notify { |
172 | my ($self, $event) = @_; |
182 | my ($self, $event) = @_; |
173 | |
183 | |
174 | $self->configure; |
184 | $self->configure; |
|
|
185 | $self->refresh; |
175 | |
186 | |
176 | () |
187 | () |
177 | } |
188 | } |
178 | |
189 | |
179 | sub on_wm_delete_window { |
190 | sub on_wm_delete_window { |
… | |
… | |
184 | 1 |
195 | 1 |
185 | } |
196 | } |
186 | |
197 | |
187 | sub tab_start { |
198 | sub tab_start { |
188 | my ($self, $tab) = @_; |
199 | my ($self, $tab) = @_; |
|
|
200 | |
|
|
201 | $tab->XChangeInput ($tab->parent, urxvt::PropertyChangeMask); |
189 | |
202 | |
190 | push @{ $self->{tabs} }, $tab; |
203 | push @{ $self->{tabs} }, $tab; |
191 | |
204 | |
192 | # $tab->{name} ||= scalar @{ $self->{tabs} }; |
205 | # $tab->{name} ||= scalar @{ $self->{tabs} }; |
193 | $self->make_current ($tab); |
206 | $self->make_current ($tab); |
… | |
… | |
236 | } |
249 | } |
237 | |
250 | |
238 | () |
251 | () |
239 | } |
252 | } |
240 | |
253 | |
|
|
254 | sub tab_property_notify { |
|
|
255 | my ($self, $tab, $event) = @_; |
|
|
256 | |
|
|
257 | $self->copy_properties |
|
|
258 | if $event->{window} == $tab->parent; |
|
|
259 | |
|
|
260 | () |
|
|
261 | } |
|
|
262 | |
241 | sub tab_activity { |
263 | sub tab_activity { |
242 | my ($self, $tab) = @_; |
264 | my ($self, $tab) = @_; |
243 | |
265 | |
244 | $self->refresh; |
266 | $self->refresh; |
245 | } |
267 | } |
… | |
… | |
248 | |
270 | |
249 | # helper extension implementing the subwindows of a tabbed terminal. |
271 | # helper extension implementing the subwindows of a tabbed terminal. |
250 | # simply proxies all interesting calls back to the tabbed class. |
272 | # simply proxies all interesting calls back to the tabbed class. |
251 | |
273 | |
252 | { |
274 | { |
253 | for my $hook qw(start destroy key_press) { |
275 | for my $hook qw(start destroy key_press property_notify) { |
254 | eval qq{ |
276 | eval qq{ |
255 | sub on_$hook { |
277 | sub on_$hook { |
256 | my \$parent = \$_[0]{term}{parent} |
278 | my \$parent = \$_[0]{term}{parent} |
257 | or return; |
279 | or return; |
258 | \$parent->tab_$hook (\@_) |
280 | \$parent->tab_$hook (\@_) |