… | |
… | |
366 | |
366 | |
367 | $pkg |
367 | $pkg |
368 | } |
368 | } |
369 | } |
369 | } |
370 | |
370 | |
|
|
371 | our $retval; # return value for urxvt |
|
|
372 | |
371 | # called by the rxvt core |
373 | # called by the rxvt core |
372 | sub invoke { |
374 | sub invoke { |
373 | local $TERM = shift; |
375 | local $TERM = shift; |
374 | my $htype = shift; |
376 | my $htype = shift; |
375 | |
377 | |
376 | if ($htype == 0) { # INIT |
378 | if ($htype == 0) { # INIT |
377 | my @dirs = ((split /:/, $TERM->resource ("perl_lib")), "$LIBDIR/perl"); |
379 | my @dirs = ((split /:/, $TERM->resource ("perl_lib")), "$LIBDIR/perl"); |
378 | |
380 | |
379 | for my $ext (split /:/, $TERM->resource ("perl_ext")) { |
381 | for my $ext (map { split /:/, $TERM->resource ("perl_ext_$_") } 1, 2) { |
380 | my @files = grep -f $_, map "$_/$ext", @dirs; |
382 | my @files = grep -f $_, map "$_/$ext", @dirs; |
381 | |
383 | |
382 | if (@files) { |
384 | if (@files) { |
383 | register_package script_package $files[0]; |
385 | register_package script_package $files[0]; |
384 | } else { |
386 | } else { |
385 | warn "perl extension '$ext' not found in perl library search path\n"; |
387 | warn "perl extension '$ext' not found in perl library search path\n"; |
386 | } |
388 | } |
387 | } |
389 | } |
|
|
390 | } |
388 | |
391 | |
|
|
392 | $retval = undef; |
|
|
393 | |
|
|
394 | if (my $cb = $TERM->{_hook}[$htype]) { |
|
|
395 | verbose 10, "$HOOKNAME[$htype] (" . (join ", ", $TERM, @_) . ")" |
|
|
396 | if $verbosity >= 10; |
|
|
397 | |
|
|
398 | keys %$cb; |
|
|
399 | |
|
|
400 | while (my ($pkg, $cb) = each %$cb) { |
|
|
401 | $retval = $cb->( |
|
|
402 | $TERM->{_pkg}{$pkg} ||= do { |
|
|
403 | my $proxy = bless { }, urxvt::term::proxy::; |
|
|
404 | Scalar::Util::weaken ($proxy->{term} = $TERM); |
|
|
405 | $proxy |
|
|
406 | }, |
|
|
407 | @_, |
|
|
408 | ) and last; |
|
|
409 | } |
|
|
410 | } |
|
|
411 | |
389 | } elsif ($htype == 1) { # DESTROY |
412 | if ($htype == 1) { # DESTROY |
|
|
413 | # remove hooks if unused |
390 | if (my $hook = $TERM->{_hook}) { |
414 | if (my $hook = $TERM->{_hook}) { |
391 | for my $htype (0..$#$hook) { |
415 | for my $htype (0..$#$hook) { |
392 | $hook_count[$htype] -= scalar keys %{ $hook->[$htype] || {} } |
416 | $hook_count[$htype] -= scalar keys %{ $hook->[$htype] || {} } |
393 | or set_should_invoke $htype, 0; |
417 | or set_should_invoke $htype, 0; |
394 | } |
418 | } |
395 | } |
419 | } |
|
|
420 | |
|
|
421 | # clear package objects |
|
|
422 | %$_ = () for values %{ $TERM->{_pkg} }; |
|
|
423 | |
|
|
424 | # clear package |
|
|
425 | %$TERM = (); |
396 | } |
426 | } |
397 | |
427 | |
398 | my $cb = $TERM->{_hook}[$htype] |
428 | $retval |
399 | or return; |
|
|
400 | |
|
|
401 | verbose 10, "$HOOKNAME[$htype] (" . (join ", ", $TERM, @_) . ")" |
|
|
402 | if $verbosity >= 10; |
|
|
403 | |
|
|
404 | keys %$cb; |
|
|
405 | |
|
|
406 | while (my ($pkg, $cb) = each %$cb) { |
|
|
407 | return 1 |
|
|
408 | if $cb->( |
|
|
409 | $TERM->{$pkg} ||= do { |
|
|
410 | my $proxy = bless { }, urxvt::term::proxy::; |
|
|
411 | Scalar::Util::weaken ($proxy->{term} = $TERM); |
|
|
412 | $proxy |
|
|
413 | }, |
|
|
414 | @_, |
|
|
415 | ); |
|
|
416 | } |
|
|
417 | |
|
|
418 | 0 |
|
|
419 | } |
429 | } |
420 | |
430 | |
421 | sub urxvt::term::proxy::AUTOLOAD { |
431 | sub urxvt::term::proxy::AUTOLOAD { |
422 | $urxvt::term::proxy::AUTOLOAD =~ /:([^:]+)$/ |
432 | $urxvt::term::proxy::AUTOLOAD =~ /:([^:]+)$/ |
423 | or die "FATAL: \$AUTOLOAD '$urxvt::term::proxy::AUTOLOAD' unparsable"; |
433 | or die "FATAL: \$AUTOLOAD '$urxvt::term::proxy::AUTOLOAD' unparsable"; |
… | |
… | |
461 | answerbackstring backgroundPixmap backspace_key boldFont boldItalicFont |
471 | answerbackstring backgroundPixmap backspace_key boldFont boldItalicFont |
462 | borderLess color cursorBlink cursorUnderline cutchars delete_key |
472 | borderLess color cursorBlink cursorUnderline cutchars delete_key |
463 | display_name embed ext_bwidth fade font geometry hold iconName |
473 | display_name embed ext_bwidth fade font geometry hold iconName |
464 | imFont imLocale inputMethod insecure int_bwidth intensityStyles |
474 | imFont imLocale inputMethod insecure int_bwidth intensityStyles |
465 | italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 modifier |
475 | italicFont jumpScroll lineSpace loginShell mapAlert menu meta8 modifier |
466 | mouseWheelScrollPage name pastableTabs path perl_eval perl_ext |
476 | mouseWheelScrollPage name pastableTabs path perl_eval perl_ext_1 perl_ext_2 |
467 | perl_lib pointerBlank pointerBlankDelay preeditType print_pipe pty_fd |
477 | perl_lib pointerBlank pointerBlankDelay preeditType print_pipe pty_fd |
468 | reverseVideo saveLines scrollBar scrollBar_align scrollBar_floating |
478 | reverseVideo saveLines scrollBar scrollBar_align scrollBar_floating |
469 | scrollBar_right scrollBar_thickness scrollTtyKeypress scrollTtyOutput |
479 | scrollBar_right scrollBar_thickness scrollTtyKeypress scrollTtyOutput |
470 | scrollWithBuffer scrollstyle secondaryScreen secondaryScroll selectstyle |
480 | scrollWithBuffer scrollstyle secondaryScreen secondaryScroll selectstyle |
471 | shade term_name title transparent transparent_all tripleclickwords |
481 | shade term_name title transparent transparent_all tripleclickwords |