=item B<-fade> I<number>
-Fade the text by the given percentage when focus is lost.
+Fade the text by the given percentage when focus is lost. resource B<fading>.
=item B<-tint> I<colour>
=item B<-pixmap> I<file[;geom]>
Compile I<XPM>: Specify XPM file for the background and also optionally
-specify its scaling with a geometry string. Note you may need to add
-quotes to avoid special shell interpretation of the `;' in the
+specify its scaling with a geometry string. Note you may need to
+add quotes to avoid special shell interpretation of the C<;> in the
command-line; resource B<backgroundPixmap>.
=item B<-cr> I<colour>
=item B<-lsp> I<number>
-Compile I<linespace>: Lines (pixel height) to insert between each row
-of the display; resource B<linespace>.
+Compile I<frills>: Lines (pixel height) to insert between each row of
+the display. Useful to work around font rendering problems; resource
+B<linespace>.
=item B<-tn> I<termname>
Use the specified colour to display bold or italic characters when the
foreground colour is the default. If font styles are not available
-(Compile styles) and this option is unset, reverse video is used instead.
+(Compile I<styles>) and this option is unset, reverse video is used instead.
=item B<colorUL:> I<colour>
appended to it. option B<-fn>.
Each font can either be a standard X11 core font (XLFD) name, with
-optional prefix C<x:> or a Xft font (Compile xft), prefixed with C<xft:>.
+optional prefix C<x:> or a Xft font (Compile I<xft>), prefixed with C<xft:>.
In addition, each font can be prefixed with additional hints and
specifications enclosed in square brackets (C<[]>). The only available
=item B<keysym.>I<sym>: I<string>
-Associate I<string> with keysym I<sym> (B<0xFF00 - 0xFFFF>). It may
-contain escape values (\a: bell, \b: backspace, \e, \E: escape, \n:
-newline, \r: return, \t:
-tab, \000: octal number) or control characters (^?: delete, ^@: null,
-^A ...) and may enclosed with double quotes so that it can start or end
-with whitespace. The intervening resource name B<keysym.> cannot be
-omitted. This resource is only available when compiled with
-KEYSYM_RESOURCE.
+Compile I<frills>: Associate I<string> with keysym I<sym>. The
+intervening resource name B<keysym.> cannot be omitted.
+
+The format of I<sym> is "I<(modifiers-)key>", where I<modifiers> can be
+any combination of B<ISOLevel3>, B<AppKeypad>, B<Control>, B<NumLock>,
+B<Shift>, B<Meta>, B<Lock>, B<Mod1>, B<Mod2>, B<Mod3>, B<Mod4>, B<Mod5>,
+and the abbreviated B<I>, B<K>, B<C>, B<N>, B<S>, B<M>, B<A>, B<L>, B<1>,
+B<2>, B<3>, B<4>, B<5>.
+
+The B<NumLock>, B<Meta> and B<ISOLevel3> modifiers are usually aliased to
+whatever modifier the NumLock key, Meta/Alt keys or ISO Level3 Shift/AltGr
+keys are being mapped. B<AppKeypad> is a artificial modifier mapped to the
+current application keymap mode state.
+
+The spellings of I<key> can be obtained by using B<xev>(1) command or
+searching keysym macros from B</usr/X11R6/include/X11/keysymdef.h> and
+omitting the prefix B<XK_>. Alternatively you can specify I<key> by its hex
+keysym value (B<0x0000 - 0xFFFF>). Note that the lookup of I<sym>s is not
+performed in an exact manner; however, the closest match is assured.
+
+I<string> may contain escape values (C<\a>: bell, C<\b>: backspace,
+C<\e>, C<\E>: escape, C<\n>: newline, C<\r>: carriage return, C<\t>: tab,
+C<\000>: octal number) or verbatim control characters (C<^?>: delete,
+C<^@>: null, C<^A> ...) and may be enclosed with double quotes so that it
+can start or end with whitespace.
+
+You can define a range of keysyms in one shot by providing a I<string>
+with pattern B<list/PREFIX/MIDDLE/SUFFIX>, where the delimeter `/'
+should be a character not used by the strings.
+
+Its usage can be demonstrated by an example:
+
+ URxvt.keysym.M-C-0x61: list|\e<M-C-|abc|>
+
+The above line is equivalent to the following three lines:
+
+ URxvt.keysym.Meta-Control-0x61: \e<M-C-a>
+ URxvt.keysym.Meta-Control-0x62: \e<M-C-b>
+ URxvt.keysym.Meta-Control-0x63: \e<M-C-c>
+
+If I<string> takes the form of C<proto:STRING>, the specified B<STRING> is
+interpreted and executed as @@RXVT_NAME@@'s control sequence. For example,
+C<proto:\033]701;zh_CN.GBK\007> means: change the current locale to
+C<zh_CN.GBK>.
=back
line.
Starting a selection while pressing the B<Meta> key (or B<Meta+Ctrl> keys)
-(Compile: frills) will create a rectangular selection instead of a normal
+(Compile: I<frills>) will create a rectangular selection instead of a normal
one.
=item B<Insertion>:
{
assert (hash[0] == 0 && "register_done() need to be called");
- if (state & term->ModMetaMask)
- state |= MetaMask;
-
- if (state & term->ModNumLockMask)
- state |= NumLockMask;
+ if (state & term->ModMetaMask) state |= MetaMask;
+ if (state & term->ModNumLockMask) state |= NumLockMask;
+ if (state & term->ModLevel3Mask) state |= Level3Mask;
if (!!(term->priv_modes & PrivMode_aplKP) != !!(state & ShiftMask))
state |= AppKeypadMask;
for (int j = 0; j < a->range; ++j)
{
int index = find_keysym (a->keysym + j, a->state & OtherModMask);
+
assert (index >= 0);
keysym_t *b = keymap [index];
assert (i == (signed) index || // the normally expected result
#include "rxvt.h" /* NECESSARY */
#include "version.h"
+#ifdef KEYSYM_RESOURCE
+#include "keyboard.h"
+#endif
+
/* #define DEBUG_RESOURCES */
static const char *const xnames[2] = { ".Xdefaults", ".Xresources" };
STRG (Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL),
STRG (Rs_int_bwidth, "internalBorder", "b", "number", "internal border in pixels"),
BOOL (Rs_borderLess, "borderLess", "bl", Opt_borderLess, "borderless window"),
-#endif
-#ifndef NO_LINESPACE
STRG (Rs_lineSpace, "lineSpace", "lsp", "number", "number of extra pixels between rows"),
#endif
STRG (Rs_scrollBar_thickness, "thickness", "sbt", "number", "scrollbar thickness/width in pixels"),
#if defined(ENABLE_FRILLS)
"frills,"
#endif
-#if !defined(NO_LINESPACE)
- "linespace,"
-#endif
#if defined(PREFER_24BIT)
"24bit,"
#endif
* non-NULL for command-line options (need to allocate)
*/
#define NEWARGLIM 500 /* `reasonable' size */
+
+struct keysym_vocabulary_t
+{
+ const char *name;
+ unsigned short len;
+ unsigned short value;
+};
+keysym_vocabulary_t keysym_vocabulary[] =
+{
+ { "ISOLevel3", 9, Level3Mask },
+ { "AppKeypad", 9, AppKeypadMask },
+ { "Control", 7, ControlMask },
+ { "NumLock", 7, NumLockMask },
+ { "Shift", 5, ShiftMask },
+ { "Meta", 4, MetaMask },
+ { "Lock", 4, LockMask },
+ { "Mod1", 4, Mod1Mask },
+ { "Mod2", 4, Mod2Mask },
+ { "Mod3", 4, Mod3Mask },
+ { "Mod4", 4, Mod4Mask },
+ { "Mod5", 4, Mod5Mask },
+ { "I", 1, Level3Mask },
+ { "K", 1, AppKeypadMask },
+ { "C", 1, ControlMask },
+ { "N", 1, NumLockMask },
+ { "S", 1, ShiftMask },
+ { "M", 1, MetaMask },
+ { "A", 1, MetaMask },
+ { "L", 1, LockMask },
+ { "1", 1, Mod1Mask },
+ { "2", 1, Mod2Mask },
+ { "3", 1, Mod3Mask },
+ { "4", 1, Mod4Mask },
+ { "5", 1, Mod5Mask },
+};
+
int
rxvt_term::parse_keysym (const char *str, const char *arg)
{
- int n, sym;
- char *key_string, *newarg = NULL;
- char newargstr[NEWARGLIM];
+ int n, sym;
+ unsigned int state = 0;
+ const char *pmodend = NULL;
+ char *newarg = NULL;
+ char newargstr[NEWARGLIM];
if (arg == NULL)
{
if ((n = rxvt_Str_match (str, "keysym.")) == 0)
return 0;
+
str += n; /* skip `keysym.' */
+ if ((pmodend = strchr (str, ':')) < str)
+ return -1;
}
+ else
+ pmodend = str + strlen(str);
+
+ for (--pmodend; str < pmodend; --pmodend)
+ if (*pmodend == '-')
+ break;
+
+ while (str < pmodend)
+ {
+ unsigned int i;
+
+ for (i=0; i < sizeof (keysym_vocabulary) / sizeof (keysym_vocabulary_t); ++i)
+ {
+ if (strncmp (str, keysym_vocabulary [i].name, keysym_vocabulary [i].len) == 0)
+ {
+ state |= keysym_vocabulary[i].value;
+ str += keysym_vocabulary[i].len;
+ break;
+ }
+ }
+
+ if (i >= sizeof (keysym_vocabulary) / sizeof (keysym_vocabulary_t))
+ return -1;
+
+ if (*str == '-')
+ ++str;
+ }
+
/* some scanf () have trouble with a 0x prefix */
- if (isdigit (str[0]))
+ if (str[0] == '0' && toupper (str[1]) == 'X')
{
- if (str[0] == '0' && toupper (str[1]) == 'X')
- str += 2;
+ str += 2;
+
if (arg)
{
if (sscanf (str, (strchr (str, ':') ? "%x:" : "%x"), &sym) != 1)
*/
strncpy (newargstr, str, NEWARGLIM - 1);
newargstr[NEWARGLIM - 1] = '\0';
+
if (arg == NULL)
{
if ((newarg = strchr (newargstr, ':')) == NULL)
return -1;
+
*newarg++ = '\0'; /* terminate keysym name */
}
+
if ((sym = XStringToKeysym (newargstr)) == None)
return -1;
}
- if (sym < 0xFF00 || sym > 0xFFFF) /* we only do extended keys */
- return -1;
- sym &= 0xFF;
- if (Keysym_map[sym] != NULL) /* already set ? */
- return -1;
-
if (newarg == NULL)
{
strncpy (newargstr, arg, NEWARGLIM - 1);
newargstr[NEWARGLIM - 1] = '\0';
newarg = newargstr;
}
+
rxvt_Str_trim (newarg);
if (*newarg == '\0' || (n = rxvt_Str_escaped (newarg)) == 0)
return -1;
- MIN_IT (n, 255);
- key_string = (char *)rxvt_malloc ((n + 1) * sizeof (char));
-
- key_string[0] = n;
- strncpy (key_string + 1, newarg, n);
- Keysym_map[sym] = (unsigned char *)key_string;
+ keyboard->register_user_translation (sym, state, newarg);
return 1;
}