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.236 by root, Sat May 17 17:12:29 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
685 } elsif (/^-(.*)$/) { 690 } elsif (/^-(.*)$/) {
686 delete $ext_arg{$1}; 691 delete $ext_arg{$1};
692
687 } elsif (/^([^<]+)<(.*)>$/) { 693 } elsif (/^([^<]+)<(.*)>$/) {
688 push @{ $ext_arg{$1} }, $2; 694 push @{ $ext_arg{$1} }, $2;
695
689 } else { 696 } else {
690 $ext_arg{$_} ||= []; 697 $ext_arg{$_} ||= [];
691 } 698 }
699 }
700
701 # now register default key bindings
702 while (my ($k, $v) = each %{ $TERM->{meta}{binding} }) {
703 $TERM->bind_action ($k, "$v->[0]:$v->[1]");
692 } 704 }
693 705
694 for my $ext (sort keys %ext_arg) { 706 for my $ext (sort keys %ext_arg) {
695 my @files = grep -f $_, map "$_/$ext", @dirs; 707 my @files = grep -f $_, map "$_/$ext", @dirs;
696 708
1079 1091
1080 return if exists $self->{meta}; 1092 return if exists $self->{meta};
1081 1093
1082 my @libdirs = perl_libdirs $self; 1094 my @libdirs = perl_libdirs $self;
1083 1095
1084 return if $self->{meta_libdirs} eq join "\x00", @libdirs; 1096# return if $self->{meta_libdirs} eq join "\x00", @libdirs;#d#
1085 1097
1086 my %meta;
1087
1088 $self->{meta_libdirs} = join "\x00", @libdirs; 1098# $self->{meta_libdirs} = join "\x00", @libdirs;#d#
1089 $self->{meta} = \%meta; 1099 $self->{meta} = \my %meta;
1090
1091 my %ext;
1092 1100
1093 # first gather extensions 1101 # first gather extensions
1094 for my $dir (reverse @libdirs) { 1102 for my $dir (reverse @libdirs) {
1095 opendir my $fh, $dir 1103 opendir my $fh, $dir
1096 or next; 1104 or next;
1110 } else { 1118 } else {
1111 $ext{resource}{$pattern} = [$ext, $type, $desc]; 1119 $ext{resource}{$pattern} = [$ext, $type, $desc];
1112 } 1120 }
1113 } elsif (/^#:META:BINDING:(.*)/) { 1121 } elsif (/^#:META:BINDING:(.*)/) {
1114 my ($keysym, $action) = split /:/, $1; 1122 my ($keysym, $action) = split /:/, $1;
1115 $ext{binding}{$keysym} = $action; 1123 $ext{binding}{$keysym} = [$ext, $action];
1116 } elsif (/^\s*(?:#|$)/) { 1124 } elsif (/^\s*(?:#|$)/) {
1117 # skip other comments and empty lines 1125 # skip other comments and empty lines
1118 } else { 1126 } else {
1119 last; # stop parsing on first non-empty non-comment line 1127 last; # stop parsing on first non-empty non-comment line
1120 } 1128 }
1121 } 1129 }
1122 1130
1123 $meta{$ext} = \%ext; 1131 $meta{ext}{$ext} = \%ext;
1124 } 1132 }
1125 } 1133 }
1126 1134
1127 # and now merge resources and bindings 1135 # and now merge resources and bindings
1128 while (my ($k, $v) = each %ext) { 1136 while (my ($k, $v) = each %{ $meta{ext} }) {
1129 #TODO: should check for extensions overriding each other 1137 #TODO: should check for extensions overriding each other
1130 %{ $meta{resource} } = (%{ $meta{resource} }, %{ $v->{resource} }); 1138 %{ $meta{resource} } = (%{ $meta{resource} }, %{ $v->{resource} });
1131 %{ $meta{binding} } = (%{ $meta{binding} }, %{ $v->{binding} }); 1139 %{ $meta{binding} } = (%{ $meta{binding} }, %{ $v->{binding} });
1132 } 1140 }
1133} 1141}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines