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.12 by root, Sun Jan 22 12:21:27 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 {
170 180
171sub on_configure_notify { 181sub 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
179sub on_wm_delete_window { 190sub on_wm_delete_window {
184 1 195 1
185} 196}
186 197
187sub tab_start { 198sub 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);
216} 229}
217 230
218sub tab_key_press { 231sub tab_key_press {
219 my ($self, $tab, $event, $keysym, $str) = @_; 232 my ($self, $tab, $event, $keysym, $str) = @_;
220 233
221 if ($event->{state} & urxvt::ShiftMask 234 if ($event->{state} & urxvt::ShiftMask) {
222 && ($keysym == 0xff51 || $keysym == 0xff53)) { 235 if ($keysym == 0xff51 || $keysym == 0xff53) {
223 my ($idx) = grep $self->{tabs}[$_] == $tab, 0 .. $#{ $self->{tabs} }; 236 my ($idx) = grep $self->{tabs}[$_] == $tab, 0 .. $#{ $self->{tabs} };
224 237
225 --$idx if $keysym == 0xff51; 238 --$idx if $keysym == 0xff51;
226 ++$idx if $keysym == 0xff53; 239 ++$idx if $keysym == 0xff53;
227 240
228 $self->make_current ($self->{tabs}[$idx % @{ $self->{tabs}}]); 241 $self->make_current ($self->{tabs}[$idx % @{ $self->{tabs}}]);
229 $self->refresh; 242
243 return 1;
244 } elsif ($keysym == 0xff54) {
245 $self->new_tab;
246
247 return 1;
230 248 }
231 return 1;
232 } 249 }
250
251 ()
252}
253
254sub tab_property_notify {
255 my ($self, $tab, $event) = @_;
256
257 $self->copy_properties
258 if $event->{window} == $tab->parent;
233 259
234 () 260 ()
235} 261}
236 262
237sub tab_activity { 263sub tab_activity {
244 270
245# helper extension implementing the subwindows of a tabbed terminal. 271# helper extension implementing the subwindows of a tabbed terminal.
246# simply proxies all interesting calls back to the tabbed class. 272# simply proxies all interesting calls back to the tabbed class.
247 273
248{ 274{
249 for my $hook qw(start destroy key_press) { 275 for my $hook qw(start destroy key_press property_notify) {
250 eval qq{ 276 eval qq{
251 sub on_$hook { 277 sub on_$hook {
252 my \$parent = \$_[0]{term}{parent} 278 my \$parent = \$_[0]{term}{parent}
253 or return; 279 or return;
254 \$parent->tab_$hook (\@_) 280 \$parent->tab_$hook (\@_)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines