… | |
… | |
71 | sub configure { |
71 | sub configure { |
72 | my ($self) = @_; |
72 | my ($self) = @_; |
73 | |
73 | |
74 | my $tab = $self->{cur}; |
74 | my $tab = $self->{cur}; |
75 | |
75 | |
|
|
76 | $tab->XMoveResizeWindow ( |
|
|
77 | $tab->parent, |
|
|
78 | 0, $self->{tabheight} - 1, |
|
|
79 | $self->width, $self->height - $self->{tabheight} |
|
|
80 | ); |
76 | $tab->XMoveResizeWindow ( |
81 | $tab->XMoveResizeWindow ( |
77 | $tab->parent, |
82 | $tab->parent, |
78 | 0, $self->{tabheight}, |
83 | 0, $self->{tabheight}, |
79 | $self->width, $self->height - $self->{tabheight} |
84 | $self->width, $self->height - $self->{tabheight} |
80 | ); |
85 | ); |
|
|
86 | } |
|
|
87 | |
|
|
88 | sub copy_properties { |
|
|
89 | my ($self) = @_; |
|
|
90 | my $tab = $self->{cur}; |
81 | |
91 | |
82 | my $wm_normal_hints = $self->XInternAtom ("WM_NORMAL_HINTS"); |
92 | my $wm_normal_hints = $self->XInternAtom ("WM_NORMAL_HINTS"); |
|
|
93 | |
|
|
94 | my %our_props = map +($_ => undef), $self->XListProperties ($self->parent); |
83 | |
95 | |
84 | for my $atom ($tab->XListProperties ($tab->parent)) { |
96 | for my $atom ($tab->XListProperties ($tab->parent)) { |
85 | my ($type, $format, $items) = $self->XGetWindowProperty ($tab->parent, $atom); |
97 | my ($type, $format, $items) = $self->XGetWindowProperty ($tab->parent, $atom); |
|
|
98 | |
|
|
99 | delete $our_props{$atom}; |
86 | |
100 | |
87 | if ($atom == $wm_normal_hints) { |
101 | if ($atom == $wm_normal_hints) { |
88 | my (@hints) = unpack "l!*", $items; |
102 | my (@hints) = unpack "l!*", $items; |
89 | |
103 | |
90 | $hints[$_] += $self->{tabheight} for (4, 6, 16); |
104 | $hints[$_] += $self->{tabheight} for (4, 6, 16); |
… | |
… | |
92 | $items = pack "l!*", @hints; |
106 | $items = pack "l!*", @hints; |
93 | } |
107 | } |
94 | $self->XChangeWindowProperty ($self->parent, $atom, $type, $format, $items); |
108 | $self->XChangeWindowProperty ($self->parent, $atom, $type, $format, $items); |
95 | } |
109 | } |
96 | |
110 | |
97 | $self->refresh; |
111 | $self->XDeleteProperty ($self->parent, $_) for keys %our_props; |
98 | } |
112 | } |
99 | |
113 | |
100 | sub make_current { |
114 | sub make_current { |
101 | my ($self, $tab) = @_; |
115 | my ($self, $tab) = @_; |
102 | |
116 | |
… | |
… | |
107 | } |
121 | } |
108 | |
122 | |
109 | $self->{cur} = $tab; |
123 | $self->{cur} = $tab; |
110 | |
124 | |
111 | $self->configure; |
125 | $self->configure; |
|
|
126 | $self->copy_properties; |
112 | $tab->focus_in; |
127 | $tab->focus_in; |
113 | $tab->XMapWindow ($tab->parent); |
128 | $tab->XMapWindow ($tab->parent); |
114 | delete $tab->{activity}; |
129 | delete $tab->{activity}; |
115 | $self->refresh; |
130 | $self->refresh; |
116 | |
131 | |
… | |
… | |
170 | |
185 | |
171 | sub on_configure_notify { |
186 | sub on_configure_notify { |
172 | my ($self, $event) = @_; |
187 | my ($self, $event) = @_; |
173 | |
188 | |
174 | $self->configure; |
189 | $self->configure; |
|
|
190 | $self->refresh; |
175 | |
191 | |
176 | () |
192 | () |
177 | } |
193 | } |
178 | |
194 | |
179 | sub on_wm_delete_window { |
195 | sub on_wm_delete_window { |
… | |
… | |
184 | 1 |
200 | 1 |
185 | } |
201 | } |
186 | |
202 | |
187 | sub tab_start { |
203 | sub tab_start { |
188 | my ($self, $tab) = @_; |
204 | my ($self, $tab) = @_; |
|
|
205 | |
|
|
206 | $tab->XChangeInput ($tab->parent, urxvt::PropertyChangeMask); |
189 | |
207 | |
190 | push @{ $self->{tabs} }, $tab; |
208 | push @{ $self->{tabs} }, $tab; |
191 | |
209 | |
192 | # $tab->{name} ||= scalar @{ $self->{tabs} }; |
210 | # $tab->{name} ||= scalar @{ $self->{tabs} }; |
193 | $self->make_current ($tab); |
211 | $self->make_current ($tab); |
… | |
… | |
236 | } |
254 | } |
237 | |
255 | |
238 | () |
256 | () |
239 | } |
257 | } |
240 | |
258 | |
|
|
259 | sub tab_property_notify { |
|
|
260 | my ($self, $tab, $event) = @_; |
|
|
261 | |
|
|
262 | $self->copy_properties |
|
|
263 | if $event->{window} == $tab->parent; |
|
|
264 | |
|
|
265 | () |
|
|
266 | } |
|
|
267 | |
241 | sub tab_activity { |
268 | sub tab_activity { |
242 | my ($self, $tab) = @_; |
269 | my ($self, $tab) = @_; |
243 | |
270 | |
244 | $self->refresh; |
271 | $self->refresh; |
245 | } |
272 | } |
… | |
… | |
248 | |
275 | |
249 | # helper extension implementing the subwindows of a tabbed terminal. |
276 | # helper extension implementing the subwindows of a tabbed terminal. |
250 | # simply proxies all interesting calls back to the tabbed class. |
277 | # simply proxies all interesting calls back to the tabbed class. |
251 | |
278 | |
252 | { |
279 | { |
253 | for my $hook qw(start destroy key_press) { |
280 | for my $hook qw(start destroy key_press property_notify) { |
254 | eval qq{ |
281 | eval qq{ |
255 | sub on_$hook { |
282 | sub on_$hook { |
256 | my \$parent = \$_[0]{term}{parent} |
283 | my \$parent = \$_[0]{term}{parent} |
257 | or return; |
284 | or return; |
258 | \$parent->tab_$hook (\@_) |
285 | \$parent->tab_$hook (\@_) |