ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/urxvt.pm
(Generate patch)

Comparing rxvt-unicode/src/urxvt.pm (file contents):
Revision 1.234 by root, Sat May 17 15:25:04 2014 UTC vs.
Revision 1.237 by root, Sun May 18 18:09:52 2014 UTC

288Called whenever a user-configured event is being activated (e.g. via 288Called whenever a user-configured event is being activated (e.g. via
289a C<perl:string> action bound to a key, see description of the B<keysym> 289a C<perl:string> action bound to a key, see description of the B<keysym>
290resource in the urxvt(1) manpage). 290resource in the urxvt(1) manpage).
291 291
292The event is simply the action string. This interface is going away in 292The event is simply the action string. This interface is going away in
293preference to the C<< ->register_keysym_action >> method. 293preference to the C<on_action> hook.
294 294
295=item on_resize_all_windows $term, $new_width, $new_height 295=item on_resize_all_windows $term, $new_width, $new_height
296 296
297Called just after the new window size has been calculated, but before 297Called just after the new window size has been calculated, but before
298windows are actually being resized or hints are being set. If this hook 298windows are actually being resized or hints are being set. If this hook
679 for ( 679 for (
680 @{ delete $TERM->{perl_ext_3} }, 680 @{ delete $TERM->{perl_ext_3} },
681 grep $_, map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2 681 grep $_, map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2
682 ) { 682 ) {
683 if ($_ eq "default") { 683 if ($_ eq "default") {
684 $ext_arg{$_} ||= [] for qw(selection option-popup selection-popup searchable-scrollback readline); 684
685 $ext_arg{$_} = []
686 for
687 qw(selection option-popup selection-popup readline),
688 map $_->[0], values %{ $TERM->{meta}{binding} };
689
690 for ($TERM->_keysym_resources) {
691 next if /^(?:string|command|builtin|builtin-string|perl)/;
692 next unless /^([A-Za-z0-9_\-]+):/;
693
694 my $ext = $1;
695 $ext =~ y/-/_/;
696
697 $ext_arg{$ext} = [];
698 }
699
685 } elsif (/^-(.*)$/) { 700 } elsif (/^-(.*)$/) {
686 delete $ext_arg{$1}; 701 delete $ext_arg{$1};
702
687 } elsif (/^([^<]+)<(.*)>$/) { 703 } elsif (/^([^<]+)<(.*)>$/) {
688 push @{ $ext_arg{$1} }, $2; 704 push @{ $ext_arg{$1} }, $2;
705
689 } else { 706 } else {
690 $ext_arg{$_} ||= []; 707 $ext_arg{$_} ||= [];
708 }
709 }
710
711 # now register default key bindings
712 for my $ext (sort keys %ext_arg) {
713 while (my ($k, $v) = each %{ $TERM->{meta}{ext}{$ext}{binding} }) {
714 $TERM->bind_action ($k, "$v->[0]:$v->[1]");
691 } 715 }
692 } 716 }
693 717
694 for my $ext (sort keys %ext_arg) { 718 for my $ext (sort keys %ext_arg) {
695 my @files = grep -f $_, map "$_/$ext", @dirs; 719 my @files = grep -f $_, map "$_/$ext", @dirs;
1079 1103
1080 return if exists $self->{meta}; 1104 return if exists $self->{meta};
1081 1105
1082 my @libdirs = perl_libdirs $self; 1106 my @libdirs = perl_libdirs $self;
1083 1107
1084 return if $self->{meta_libdirs} eq join "\x00", @libdirs; 1108# return if $self->{meta_libdirs} eq join "\x00", @libdirs;#d#
1085 1109
1086 my %meta;
1087
1088 $self->{meta_libdirs} = join "\x00", @libdirs; 1110# $self->{meta_libdirs} = join "\x00", @libdirs;#d#
1089 $self->{meta} = \%meta; 1111 $self->{meta} = \my %meta;
1090
1091 my %ext;
1092 1112
1093 # first gather extensions 1113 # first gather extensions
1094 for my $dir (reverse @libdirs) { 1114 for my $dir (reverse @libdirs) {
1095 opendir my $fh, $dir 1115 opendir my $fh, $dir
1096 or next; 1116 or next;
1110 } else { 1130 } else {
1111 $ext{resource}{$pattern} = [$ext, $type, $desc]; 1131 $ext{resource}{$pattern} = [$ext, $type, $desc];
1112 } 1132 }
1113 } elsif (/^#:META:BINDING:(.*)/) { 1133 } elsif (/^#:META:BINDING:(.*)/) {
1114 my ($keysym, $action) = split /:/, $1; 1134 my ($keysym, $action) = split /:/, $1;
1115 $ext{binding}{$keysym} = $action; 1135 $ext{binding}{$keysym} = [$ext, $action];
1116 } elsif (/^\s*(?:#|$)/) { 1136 } elsif (/^\s*(?:#|$)/) {
1117 # skip other comments and empty lines 1137 # skip other comments and empty lines
1118 } else { 1138 } else {
1119 last; # stop parsing on first non-empty non-comment line 1139 last; # stop parsing on first non-empty non-comment line
1120 } 1140 }
1121 } 1141 }
1122 1142
1123 $meta{$ext} = \%ext; 1143 $meta{ext}{$ext} = \%ext;
1124 } 1144 }
1125 } 1145 }
1126 1146
1127 # and now merge resources and bindings 1147 # and now merge resources and bindings
1128 while (my ($k, $v) = each %ext) { 1148 while (my ($k, $v) = each %{ $meta{ext} }) {
1129 #TODO: should check for extensions overriding each other 1149 #TODO: should check for extensions overriding each other
1130 %{ $meta{resource} } = (%{ $meta{resource} }, %{ $v->{resource} }); 1150 %{ $meta{resource} } = (%{ $meta{resource} }, %{ $v->{resource} });
1131 %{ $meta{binding} } = (%{ $meta{binding} }, %{ $v->{binding} }); 1151 %{ $meta{binding} } = (%{ $meta{binding} }, %{ $v->{binding} });
1132 } 1152 }
1133} 1153}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines