-- Leo's gemini proxy
-- Connecting to git.thebackupbox.net:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
repo: rxvt-unicode-sixel action: commit revision: path_from: revision_from: e1b0e9f80f9fbaaf3c4a3c73792020e220ae7761: path_to: revision_to:
commit e1b0e9f80f9fbaaf3c4a3c73792020e220ae7761 Author: Marc Lehmann <schmorp@schmorp.de> Date: Sun May 18 18:09:52 2014 +0000 *** empty log message *** diff --git a/src/rxvt.h b/src/rxvt.h
--- a/src/rxvt.h +++ b/src/rxvt.h @@ -1573,6 +1573,7 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen int bind_action (const char *str, const char *arg); const char *x_resource (const char *name); void extract_resources (); + void enumerate_keysym_resources (void (*cb)(rxvt_term *, const char *, const char *)); void extract_keysym_resources (); }; diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs
--- a/src/rxvtperl.xs +++ b/src/rxvtperl.xs @@ -494,6 +494,20 @@ rxvt_perl_interp::parse_resource (rxvt_term *term, const char *name, bool arg, b return ret; } +static void +_keysym_resource_push (rxvt_term *term, const char *k, const char *v) +{ + dSP; + XPUSHs (sv_2mortal (newSVpv (v, 0))); + PUTBACK; +} + +static void +_keysym_resources (rxvt_term *term) +{ + term->enumerate_keysym_resources (_keysym_resource_push); +} + static void ungrab (rxvt_term *THIS) { @@ -1195,6 +1209,13 @@ rxvt_term::put_option_db (octet_string specifier, octet_string value) CODE: XrmPutStringResource (&THIS->option_db, specifier, value); +void +rxvt_term::_keysym_resources () + PPCODE: + PUTBACK; + _keysym_resources (THIS); + SPAGAIN; + int rxvt_term::grab_button (int button, U32 modifiers, Window window = THIS->vt) CODE: diff --git a/src/urxvt.pm b/src/urxvt.pm
--- a/src/urxvt.pm +++ b/src/urxvt.pm @@ -682,11 +682,21 @@ sub invoke { ) { if ($_ eq "default") { - $ext_arg{$_} ||= [] + $ext_arg{$_} = [] for qw(selection option-popup selection-popup readline), map $_->[0], values %{ $TERM->{meta}{binding} }; + for ($TERM->_keysym_resources) { + next if /^(?:string|command|builtin|builtin-string|perl)/; + next unless /^([A-Za-z0-9_\-]+):/; + + my $ext = $1; + $ext =~ y/-/_/; + + $ext_arg{$ext} = []; + } + } elsif (/^-(.*)$/) { delete $ext_arg{$1}; @@ -699,8 +709,10 @@ sub invoke { } # now register default key bindings - while (my ($k, $v) = each %{ $TERM->{meta}{binding} }) { - $TERM->bind_action ($k, "$v->[0]:$v->[1]"); + for my $ext (sort keys %ext_arg) { + while (my ($k, $v) = each %{ $TERM->{meta}{ext}{$ext}{binding} }) { + $TERM->bind_action ($k, "$v->[0]:$v->[1]"); + } } for my $ext (sort keys %ext_arg) { diff --git a/src/xdefaults.C b/src/xdefaults.C
--- a/src/xdefaults.C +++ b/src/xdefaults.C @@ -629,6 +629,12 @@ rxvt_term::get_options (int argc, const char *const *argv) /*----------------------------------------------------------------------*/ # ifdef KEYSYM_RESOURCE +static void +rxvt_define_key (rxvt_term *term, const char *k, const char *v) +{ + term->bind_action (k, v); +} + /* * Define key from XrmEnumerateDatabase. * quarks will be something like @@ -636,21 +642,27 @@ rxvt_term::get_options (int argc, const char *const *argv) * value will be a string */ static int -rxvt_define_key (XrmDatabase *database ecb_unused, - XrmBindingList bindings ecb_unused, - XrmQuarkList quarks, - XrmRepresentation *type ecb_unused, - XrmValue *value, - XPointer closure) +rxvt_keysym_enumerate_helper ( + XrmDatabase *database ecb_unused, + XrmBindingList bindings ecb_unused, + XrmQuarkList quarks, + XrmRepresentation *type ecb_unused, + XrmValue *value, + XPointer closure +) { - rxvt_term *term = (rxvt_term *)closure; int last; for (last = 0; quarks[last] != NULLQUARK; last++) /* look for last quark in list */ ; - last--; - term->bind_action (XrmQuarkToString (quarks[last]), (char *)value->addr); + rxvt_term *term = (rxvt_term *)(((void **)closure)[0]); + void (*cb)(rxvt_term *, const char *, const char *) + = (void (*)(rxvt_term *, const char *, const char *)) + (((void **)closure)[1]); + + cb (term, XrmQuarkToString (quarks[last - 1]), (char *)value->addr); + return False; } @@ -833,13 +845,18 @@ rxvt_term::extract_resources () } void -rxvt_term::extract_keysym_resources () +rxvt_term::enumerate_keysym_resources (void (*cb)(rxvt_term *, const char *, const char *)) { #ifndef NO_RESOURCES /* * [R5 or later]: enumerate the resource database */ # ifdef KEYSYM_RESOURCE + void *closure[2] = { + (void *)this, + (void *)cb, + }; + XrmDatabase database = XrmGetDatabase (dpy); XrmName name_prefix[3]; XrmClass class_prefix[3]; @@ -852,16 +869,23 @@ rxvt_term::extract_keysym_resources () class_prefix[2] = NULLQUARK; /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ XrmEnumerateDatabase (database, name_prefix, class_prefix, - XrmEnumOneLevel, rxvt_define_key, (XPointer)this); + XrmEnumOneLevel, rxvt_keysym_enumerate_helper, (XPointer)closure); # ifdef RESFALLBACK name_prefix[0] = class_prefix[0] = XrmStringToName (RESFALLBACK); /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ XrmEnumerateDatabase (database, name_prefix, class_prefix, - XrmEnumOneLevel, rxvt_define_key, (XPointer)this); + XrmEnumOneLevel, rxvt_keysym_enumerate_helper, (XPointer)closure); # endif # endif #endif /* NO_RESOURCES */ } +void +rxvt_term::extract_keysym_resources () +{ + enumerate_keysym_resources (rxvt_define_key); +} + /*----------------------- end-of-file (C source) -----------------------*/ +
-----END OF PAGE-----
-- Response ended
-- Page fetched on Sun Jun 2 13:11:35 2024