summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Blandy <jimb@redhat.com>1992-10-03 05:10:14 +0000
committerJim Blandy <jimb@redhat.com>1992-10-03 05:10:14 +0000
commitf689eb05f4f6574471687899ce02757ce386b0b2 (patch)
tree5d649b13a9c1ba18caf2aa597d9d85beac6e0331 /src
parent8058415c7a046957bf2625d1576bbddafce97fc8 (diff)
downloademacs-f689eb05f4f6574471687899ce02757ce386b0b2.tar.gz
* xterm.c (x_find_modifier_meanings): If there are no
modifiers containing a Meta_ keysym, use the Alt keysyms to denote meta. (construct_mouse_click): Set the down_modifier bit on mouse button press events. (XTread_socket): When processing keypress events, use x_meta_mod_mask when processing ordinary ASCII characters, not just when processing function keys and other non-ASCII events. (XTread_socket): If we receive a MappingNotify event with the `request' member set to `MappingModifier', then call x_find_modifier_meanings to refresh x_meta_mod_mask.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 3fd74453882..be9f87bac88 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1448,10 +1448,11 @@ static int x_meta_mod_mask;
static void
x_find_modifier_meanings ()
{
- KeyCode min_code, max_code;
+ int min_code, max_code;
KeySym *syms;
int syms_per_code;
XModifierKeymap *mods;
+ int alt_mod_mask = 0;
x_meta_mod_mask = 0;
@@ -1480,20 +1481,31 @@ x_find_modifier_meanings ()
for (code_col = 0; code_col < syms_per_code; code_col++)
{
- int sym = syms[(code * syms_per_code) + code_col];
+ int sym = syms[((code - min_code) * syms_per_code) + code_col];
- if (sym == XK_Meta_L || sym == XK_Meta_R)
+ switch (sym)
{
+ case XK_Meta_L:
+ case XK_Meta_R:
x_meta_mod_mask |= (1 << row);
break;
+
+ case XK_Alt_L:
+ case XK_Alt_R:
+ alt_mod_mask |= (1 << row);
+ break;
}
}
}
}
}
+ /* If we couldn't find any meta keys, accept any alt keys as meta keys. */
+ if (! x_meta_mod_mask)
+ x_meta_mod_mask = alt_mod_mask;
+
XFree ((char *) syms);
- XFreeModifierMap (mods);
+ XFreeModifiermap (mods);
}
@@ -1535,7 +1547,9 @@ construct_mouse_click (result, event, f, part, prefix)
XSET (result->code, Lisp_Int, event->button);
result->timestamp = event->time;
result->modifiers = (x_convert_modifiers (event->state)
- | (event->type == ButtonRelease ? up_modifier : 0));
+ | (event->type == ButtonRelease
+ ? up_modifier
+ : down_modifier));
/* Notice if the mouse is still grabbed. */
if (event->type == ButtonPress)
@@ -2061,7 +2075,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
if (nbytes == 1)
{
- if (modifiers & Mod1Mask)
+ if (modifiers & x_meta_mod_mask)
*copy_buffer |= METABIT;
bufp->kind = ascii_keystroke;
XSET (bufp->code, Lisp_Int, *copy_buffer);
@@ -2390,6 +2404,8 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
/* Someone has changed the keyboard mapping - flush the
local cache. */
XRefreshKeyboardMapping (&event.xmapping);
+ else if (event.xmapping.request == MappingModifier)
+ x_find_modifier_meanings ();
break;
default: