repo: rxvt-unicode-sixel action: commit revision: path_from: revision_from: 84fb35a1f1e9b1b632bcce6eddbd324086ac2954: path_to: revision_to:
commit 84fb35a1f1e9b1b632bcce6eddbd324086ac2954 Author: Marc LehmannDate: Sat Apr 26 20:51:12 2014 +0000 for discussion diff --git a/src/keyboard.C b/src/keyboard.C
--- a/src/keyboard.C
+++ b/src/keyboard.C
@@ -143,13 +143,15 @@ keyboard_manager::dispatch (rxvt_term *term, KeySym keysym, unsigned int state,
{
if (strncmp (str, "command:", 8) == 0)
term->cmdbuf_append (str + 8, strlen (str) - 8);
+ else if (strncmp (str, "string:", 7) == 0)
+ term->tt_write (colon + 1, strlen (colon + 1));
else if (strncmp (str, "perl:", 8) == 0)
HOOK_INVOKE ((term, HOOK_USER_COMMAND, DT_STR, colon + 1, DT_END));
- else if (HOOK_INVOKE ((term, HOOK_KEYBOARD_DISPATCH, DT_STR_LEN, str, colon - str, DT_STR, colon + 1, DT_END)))
- /* done */;
else
- term->tt_write (str, strlen (str));
+ HOOK_INVOKE ((term, HOOK_KEYBOARD_DISPATCH, DT_STR_LEN, str, colon - str, DT_STR, colon + 1, DT_END));
}
+ else
+ term->tt_write (str, strlen (str));
free (str);
diff --git a/src/perl/selection b/src/perl/selection
--- a/src/perl/selection
+++ b/src/perl/selection
@@ -64,6 +64,10 @@ sub on_user_command {
()
}
+sub on_keyboard_dispatch {
+ &on_user_command;
+}
+
sub on_init {
my ($self) = @_;
diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs
--- a/src/rxvtperl.xs
+++ b/src/rxvtperl.xs
@@ -795,6 +795,10 @@ BOOT:
IV iv;
} *civ, const_iv[] = {
# define const_iv(name) { # name, (IV)name }
+ const_iv (HOOK_INIT),
+ const_iv (HOOK_DESTROY),
+ const_iv (HOOK_KEYBOARD_DISPATCH),
+
const_iv (NUM_RESOURCES),
const_iv (DEFAULT_RSTYLE),
const_iv (OVERLAY_RSTYLE),
diff --git a/src/urxvt.pm b/src/urxvt.pm
--- a/src/urxvt.pm
+++ b/src/urxvt.pm
@@ -669,7 +669,7 @@ sub invoke {
local $TERM = shift;
my $htype = shift;
- if ($htype == 0) { # INIT
+ if ($htype == HOOK_INIT) {
my @dirs = $TERM->perl_libdirs;
my %ext_arg;
@@ -718,7 +718,13 @@ sub invoke {
verbose 10, "$HOOKNAME[$htype] (" . (join ", ", $TERM, @_) . ")"
if $verbosity >= 10;
- for my $pkg (keys %$cb) {
+ for my $pkg (
+ # this hook is only sent to the extension with the name
+ # matching the first arg
+ $htype == HOOK_KEYBOARD_DISPATCH
+ ? exists $cb->{"urxvt::ext::$_[0]"} ? "urxvt::ext::" . shift : return undef
+ : keys %$cb
+ ) {
my $retval_ = eval { $cb->{$pkg}->($TERM->{_pkg}{$pkg} || $TERM, @_) };
$retval ||= $retval_;
@@ -732,7 +738,7 @@ sub invoke {
if $verbosity >= 11;
}
- if ($htype == 1) { # DESTROY
+ if ($htype == HOOK_DESTROY) {
# clear package objects
%$_ = () for values %{ $TERM->{_pkg} };
-----END OF PAGE-----