… | |
… | |
43 | $self->want_refresh; |
43 | $self->want_refresh; |
44 | } |
44 | } |
45 | |
45 | |
46 | sub new_tab { |
46 | sub new_tab { |
47 | my ($self, @argv) = @_; |
47 | my ($self, @argv) = @_; |
48 | |
|
|
49 | my $offset = $self->fheight; |
|
|
50 | |
48 | |
51 | # save a backlink to us, make sure tabbed is inactive |
49 | # save a backlink to us, make sure tabbed is inactive |
52 | push @urxvt::TERM_INIT, sub { |
50 | push @urxvt::TERM_INIT, sub { |
53 | my ($term) = @_; |
51 | my ($term) = @_; |
54 | $term->{parent} = $self; |
52 | $term->{parent} = $self; |
… | |
… | |
105 | my $current = delete $self->{current_properties}; |
103 | my $current = delete $self->{current_properties}; |
106 | |
104 | |
107 | # pass 1: copy over properties different or nonexisting |
105 | # pass 1: copy over properties different or nonexisting |
108 | for my $atom ($tab->XListProperties ($tab->parent)) { |
106 | for my $atom ($tab->XListProperties ($tab->parent)) { |
109 | my ($type, $format, $items) = $self->XGetWindowProperty ($tab->parent, $atom); |
107 | my ($type, $format, $items) = $self->XGetWindowProperty ($tab->parent, $atom); |
110 | |
108 | |
111 | # fix up size hints |
109 | # fix up size hints |
112 | if ($atom == $wm_normal_hints) { |
110 | if ($atom == $wm_normal_hints) { |
113 | my (@hints) = unpack "l!*", $items; |
111 | my (@hints) = unpack "l!*", $items; |
114 | |
112 | |
115 | $hints[$_] += $self->{tabheight} for (4, 6, 16); |
113 | $hints[$_] += $self->{tabheight} for (4, 6, 16); |
116 | |
114 | |
117 | $items = pack "l!*", @hints; |
115 | $items = pack "l!*", @hints; |
118 | } |
116 | } |
119 | |
117 | |
120 | my $cur = delete $current->{$atom}; |
118 | my $cur = delete $current->{$atom}; |
121 | |
119 | |
… | |
… | |
136 | if (my $cur = $self->{cur}) { |
134 | if (my $cur = $self->{cur}) { |
137 | delete $cur->{activity}; |
135 | delete $cur->{activity}; |
138 | $cur->XUnmapWindow ($cur->parent) if $cur->mapped; |
136 | $cur->XUnmapWindow ($cur->parent) if $cur->mapped; |
139 | $cur->focus_out; |
137 | $cur->focus_out; |
140 | } |
138 | } |
141 | |
139 | |
142 | $self->{cur} = $tab; |
140 | $self->{cur} = $tab; |
143 | |
141 | |
144 | $self->configure; |
142 | $self->configure; |
145 | $self->copy_properties; |
143 | $self->copy_properties; |
146 | |
144 | |
147 | $tab->focus_out; # just in case, should be a nop |
145 | $tab->focus_out; # just in case, should be a nop |
148 | $tab->focus_in if $self->focus; |
146 | $tab->focus_in if $self->focus; |
149 | |
147 | |
150 | $tab->XMapWindow ($tab->parent); |
148 | $tab->XMapWindow ($tab->parent); |
151 | delete $tab->{activity}; |
149 | delete $tab->{activity}; |
152 | $self->refresh; |
150 | $self->refresh; |
153 | |
151 | |
154 | () |
152 | () |
… | |
… | |
166 | my ($self, $event) = @_; |
164 | my ($self, $event) = @_; |
167 | |
165 | |
168 | $self->{cur}->focus_out; |
166 | $self->{cur}->focus_out; |
169 | |
167 | |
170 | () |
168 | () |
|
|
169 | } |
|
|
170 | |
|
|
171 | sub on_tt_write { |
|
|
172 | my ($self, $octets) = @_; |
|
|
173 | |
|
|
174 | $self->{cur}->tt_write ($octets); |
|
|
175 | |
|
|
176 | 1 |
171 | } |
177 | } |
172 | |
178 | |
173 | sub on_key_press { |
179 | sub on_key_press { |
174 | my ($self, $event) = @_; |
180 | my ($self, $event) = @_; |
175 | |
181 | |
… | |
… | |
312 | |
318 | |
313 | --$idx if $keysym == 0xff51; |
319 | --$idx if $keysym == 0xff51; |
314 | ++$idx if $keysym == 0xff53; |
320 | ++$idx if $keysym == 0xff53; |
315 | |
321 | |
316 | $self->make_current ($self->{tabs}[$idx % @{ $self->{tabs}}]); |
322 | $self->make_current ($self->{tabs}[$idx % @{ $self->{tabs}}]); |
317 | |
323 | |
318 | return 1; |
324 | return 1; |
319 | } elsif ($keysym == 0xff54) { |
325 | } elsif ($keysym == 0xff54) { |
320 | $self->new_tab; |
326 | $self->new_tab; |
321 | |
327 | |
322 | return 1; |
328 | return 1; |