Mercurial > emacs
comparison src/xterm.c @ 1324:44215417cf6e
* 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.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Sat, 03 Oct 1992 05:10:14 +0000 |
parents | 74ae34a80f94 |
children | 517c3893ec5b |
comparison
equal
deleted
inserted
replaced
1323:25b5b55a3916 | 1324:44215417cf6e |
---|---|
1446 | 1446 |
1447 /* Initialize mode_switch_bit and modifier_meaning. */ | 1447 /* Initialize mode_switch_bit and modifier_meaning. */ |
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 |
1458 XDisplayKeycodes (x_current_display, &min_code, &max_code); | 1459 XDisplayKeycodes (x_current_display, &min_code, &max_code); |
1459 syms = XGetKeyboardMapping (x_current_display, | 1460 syms = XGetKeyboardMapping (x_current_display, |
1478 { | 1479 { |
1479 int code_col; | 1480 int code_col; |
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); |
1491 break; | |
1492 | |
1493 case XK_Alt_L: | |
1494 case XK_Alt_R: | |
1495 alt_mod_mask |= (1 << row); | |
1488 break; | 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 |
1500 /* Convert a set of X modifier bits to the proper form for a | 1512 /* Convert a set of X modifier bits to the proper form for a |
1501 struct input_event modifiers value. */ | 1513 struct input_event modifiers value. */ |
1533 otherwise. */ | 1545 otherwise. */ |
1534 result->kind = no_event; | 1546 result->kind = no_event; |
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) |
1542 { | 1556 { |
1543 if (! x_mouse_grabbed) | 1557 if (! x_mouse_grabbed) |
2059 { | 2073 { |
2060 register int i; | 2074 register int i; |
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); |
2068 bufp->frame = f; | 2082 bufp->frame = f; |
2069 bufp->timestamp = event.xkey.time; | 2083 bufp->timestamp = event.xkey.time; |
2388 case MappingNotify: | 2402 case MappingNotify: |
2389 if (event.xmapping.request == MappingKeyboard) | 2403 if (event.xmapping.request == MappingKeyboard) |
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: |
2396 break; | 2412 break; |
2397 } | 2413 } |