--- rxvt-unicode/src/perl/tabbed 2006/02/11 02:01:16 1.17 +++ rxvt-unicode/src/perl/tabbed 2008/02/08 13:18:02 1.22 @@ -44,7 +44,7 @@ } sub new_tab { - my ($self) = @_; + my ($self, @argv) = @_; my $offset = $self->fheight; @@ -65,6 +65,7 @@ my $term = new urxvt::term $self->env, $urxvt::RXVTNAME, -embed => $self->parent, + @argv, ; } @@ -86,6 +87,12 @@ ); } +sub on_resize_all_windows { + my ($self, $width, $height) = @_; + + 1 +} + sub copy_properties { my ($self) = @_; my $tab = $self->{cur}; @@ -94,7 +101,9 @@ my %our_props = map +($_ => undef), $self->XListProperties ($self->parent); - delete $our_props{$self->XInternAtom ($_)} for qw(WM_STATE WM_ICON_SIZE); + delete $our_props{$self->XInternAtom ($_)} + for qw(WM_STATE WM_ICON_SIZE + _NET_WM_VISIBLE_NAME _NET_WM_VISIBLE_ICON_NAME _NET_WM_ICON_GEOMETRY _NET_FRAME_EXTENTS); for my $atom ($tab->XListProperties ($tab->parent)) { my ($type, $format, $items) = $self->XGetWindowProperty ($tab->parent, $atom); @@ -103,12 +112,17 @@ if ($atom == $wm_normal_hints) { my (@hints) = unpack "l!*", $items; - + $hints[$_] += $self->{tabheight} for (4, 6, 16); - + $items = pack "l!*", @hints; } - $self->XChangeWindowProperty ($self->parent, $atom, $type, $format, $items); + + my ($dtype, $dformat, $ditems) = $self->XGetWindowProperty ($self->parent, $atom); + + if ($dtype != $type or $dformat != $format or $ditems ne $items) { + $self->XChangeWindowProperty ($self->parent, $atom, $type, $format, $items); + } } $self->XDeleteProperty ($self->parent, $_) for keys %our_props; @@ -127,7 +141,10 @@ $self->configure; $self->copy_properties; - $tab->focus_in; + + $tab->focus_out; # just in case, should be a nop + $tab->focus_in if $self->focus; + $tab->XMapWindow ($tab->parent); delete $tab->{activity}; $self->refresh; @@ -228,7 +245,13 @@ $self->cmd_parse ("\033[?25l"); - $self->new_tab; + my @argv = $self->argv; + + do { + shift @argv; + } while @argv && $argv[0] ne "-e"; + + $self->new_tab (@argv); () } @@ -301,6 +324,19 @@ return 1; } + } + elsif ($event->{state} & urxvt::ControlMask) { + if ($keysym == 0xff51 || $keysym == 0xff53) { + my ($idx1) = grep $self->{tabs}[$_] == $tab, 0 .. $#{ $self->{tabs} }; + my $idx2 = ($idx1 + ($keysym == 0xff51 ? -1 : +1)) % @{ $self->{tabs} }; + + ($self->{tabs}[$idx1], $self->{tabs}[$idx2]) = + ($self->{tabs}[$idx2], $self->{tabs}[$idx1]); + + $self->make_current ($self->{tabs}[$idx2]); + + return 1; + } } ()