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.10 by root, Fri Jan 20 16:18:07 2006 UTC vs.
Revision 1.14 by root, Fri Feb 3 05:49:42 2006 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines