diff options
| author | Jim Blandy | 1992-10-03 05:10:14 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-10-03 05:10:14 +0000 |
| commit | f689eb05f4f6574471687899ce02757ce386b0b2 (patch) | |
| tree | 5d649b13a9c1ba18caf2aa597d9d85beac6e0331 /src | |
| parent | 8058415c7a046957bf2625d1576bbddafce97fc8 (diff) | |
| download | emacs-f689eb05f4f6574471687899ce02757ce386b0b2.tar.gz emacs-f689eb05f4f6574471687899ce02757ce386b0b2.zip | |
* 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.c | 28 |
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; | |||
| 1448 | static void | 1448 | static void |
| 1449 | x_find_modifier_meanings () | 1449 | x_find_modifier_meanings () |
| 1450 | { | 1450 | { |
| 1451 | KeyCode min_code, max_code; | 1451 | int min_code, max_code; |
| 1452 | KeySym *syms; | 1452 | KeySym *syms; |
| 1453 | int syms_per_code; | 1453 | int syms_per_code; |
| 1454 | XModifierKeymap *mods; | 1454 | XModifierKeymap *mods; |
| 1455 | int alt_mod_mask = 0; | ||
| 1455 | 1456 | ||
| 1456 | x_meta_mod_mask = 0; | 1457 | x_meta_mod_mask = 0; |
| 1457 | 1458 | ||
| @@ -1480,20 +1481,31 @@ x_find_modifier_meanings () | |||
| 1480 | 1481 | ||
| 1481 | for (code_col = 0; code_col < syms_per_code; code_col++) | 1482 | for (code_col = 0; code_col < syms_per_code; code_col++) |
| 1482 | { | 1483 | { |
| 1483 | int sym = syms[(code * syms_per_code) + code_col]; | 1484 | int sym = syms[((code - min_code) * syms_per_code) + code_col]; |
| 1484 | 1485 | ||
| 1485 | if (sym == XK_Meta_L || sym == XK_Meta_R) | 1486 | switch (sym) |
| 1486 | { | 1487 | { |
| 1488 | case XK_Meta_L: | ||
| 1489 | case XK_Meta_R: | ||
| 1487 | x_meta_mod_mask |= (1 << row); | 1490 | x_meta_mod_mask |= (1 << row); |
| 1488 | break; | 1491 | break; |
| 1492 | |||
| 1493 | case XK_Alt_L: | ||
| 1494 | case XK_Alt_R: | ||
| 1495 | alt_mod_mask |= (1 << row); | ||
| 1496 | break; | ||
| 1489 | } | 1497 | } |
| 1490 | } | 1498 | } |
| 1491 | } | 1499 | } |
| 1492 | } | 1500 | } |
| 1493 | } | 1501 | } |
| 1494 | 1502 | ||
| 1503 | /* If we couldn't find any meta keys, accept any alt keys as meta keys. */ | ||
| 1504 | if (! x_meta_mod_mask) | ||
| 1505 | x_meta_mod_mask = alt_mod_mask; | ||
| 1506 | |||
| 1495 | XFree ((char *) syms); | 1507 | XFree ((char *) syms); |
| 1496 | XFreeModifierMap (mods); | 1508 | XFreeModifiermap (mods); |
| 1497 | } | 1509 | } |
| 1498 | 1510 | ||
| 1499 | 1511 | ||
| @@ -1535,7 +1547,9 @@ construct_mouse_click (result, event, f, part, prefix) | |||
| 1535 | XSET (result->code, Lisp_Int, event->button); | 1547 | XSET (result->code, Lisp_Int, event->button); |
| 1536 | result->timestamp = event->time; | 1548 | result->timestamp = event->time; |
| 1537 | result->modifiers = (x_convert_modifiers (event->state) | 1549 | result->modifiers = (x_convert_modifiers (event->state) |
| 1538 | | (event->type == ButtonRelease ? up_modifier : 0)); | 1550 | | (event->type == ButtonRelease |
| 1551 | ? up_modifier | ||
| 1552 | : down_modifier)); | ||
| 1539 | 1553 | ||
| 1540 | /* Notice if the mouse is still grabbed. */ | 1554 | /* Notice if the mouse is still grabbed. */ |
| 1541 | if (event->type == ButtonPress) | 1555 | if (event->type == ButtonPress) |
| @@ -2061,7 +2075,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2061 | 2075 | ||
| 2062 | if (nbytes == 1) | 2076 | if (nbytes == 1) |
| 2063 | { | 2077 | { |
| 2064 | if (modifiers & Mod1Mask) | 2078 | if (modifiers & x_meta_mod_mask) |
| 2065 | *copy_buffer |= METABIT; | 2079 | *copy_buffer |= METABIT; |
| 2066 | bufp->kind = ascii_keystroke; | 2080 | bufp->kind = ascii_keystroke; |
| 2067 | XSET (bufp->code, Lisp_Int, *copy_buffer); | 2081 | XSET (bufp->code, Lisp_Int, *copy_buffer); |
| @@ -2390,6 +2404,8 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2390 | /* Someone has changed the keyboard mapping - flush the | 2404 | /* Someone has changed the keyboard mapping - flush the |
| 2391 | local cache. */ | 2405 | local cache. */ |
| 2392 | XRefreshKeyboardMapping (&event.xmapping); | 2406 | XRefreshKeyboardMapping (&event.xmapping); |
| 2407 | else if (event.xmapping.request == MappingModifier) | ||
| 2408 | x_find_modifier_meanings (); | ||
| 2393 | break; | 2409 | break; |
| 2394 | 2410 | ||
| 2395 | default: | 2411 | default: |