diff options
| author | Jim Blandy | 1993-05-04 02:44:42 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-05-04 02:44:42 +0000 |
| commit | dfeccd2d1337783ae77886e92ca522d01f55c70c (patch) | |
| tree | c2397bb0ff426e0cdc942d56c42d1f969bf28fd7 | |
| parent | f80dc88865694fb162f61e8857fe1ef857b493e6 (diff) | |
| download | emacs-dfeccd2d1337783ae77886e92ca522d01f55c70c.tar.gz emacs-dfeccd2d1337783ae77886e92ca522d01f55c70c.zip | |
Implement extra_keyboard_modifiers properly.
* keyboard.c (syms_of_keyboard): Doc fix for
extra-keyboard-modifiers; use the same modifier bits as we do for
characters.
(read_char): Apply all the modifiers in extra_keyboard_modifiers
to the input characters, so you can get hyper, super, and the rest
of the gang.
* xterm.c (x_emacs_to_x_modifiers): New function.
(x_convert_modifiers): Renamed to x_x_to_emacs_modifiers, for
consistency. Callers changed.
(XTread_socket): Apply x_emacs_to_x_modifiers to
extra_keyboard_modifiers before setting the state member of the
event; this will get all the modifiers on ASCII characters.
* xterm.c (x_text_icon): Don't call XSetIconName; it should be
unnecessary, and perhaps it's killing the icon pixmap.
| -rw-r--r-- | src/xterm.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/src/xterm.c b/src/xterm.c index 84ea74b6118..d5ed6dfe19a 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -251,7 +251,7 @@ static WINDOWINFO_TYPE windowinfo; | |||
| 251 | 251 | ||
| 252 | extern int errno; | 252 | extern int errno; |
| 253 | 253 | ||
| 254 | /* See keyboard.c. */ | 254 | /* A mask of extra modifier bits to put into every keyboard char. */ |
| 255 | extern int extra_keyboard_modifiers; | 255 | extern int extra_keyboard_modifiers; |
| 256 | 256 | ||
| 257 | extern Display *XOpenDisplay (); | 257 | extern Display *XOpenDisplay (); |
| @@ -1470,11 +1470,10 @@ x_find_modifier_meanings () | |||
| 1470 | } | 1470 | } |
| 1471 | 1471 | ||
| 1472 | 1472 | ||
| 1473 | /* Convert a set of X modifier bits to the proper form for a | 1473 | /* Convert between the modifier bits X uses and the modifier bits |
| 1474 | struct input_event modifiers value. */ | 1474 | Emacs uses. */ |
| 1475 | |||
| 1476 | static unsigned int | 1475 | static unsigned int |
| 1477 | x_convert_modifiers (state) | 1476 | x_x_to_emacs_modifiers (state) |
| 1478 | unsigned int state; | 1477 | unsigned int state; |
| 1479 | { | 1478 | { |
| 1480 | return ( ((state & (ShiftMask | x_shift_lock_mask)) ? shift_modifier : 0) | 1479 | return ( ((state & (ShiftMask | x_shift_lock_mask)) ? shift_modifier : 0) |
| @@ -1485,6 +1484,18 @@ x_convert_modifiers (state) | |||
| 1485 | | ((state & x_hyper_mod_mask) ? hyper_modifier : 0)); | 1484 | | ((state & x_hyper_mod_mask) ? hyper_modifier : 0)); |
| 1486 | } | 1485 | } |
| 1487 | 1486 | ||
| 1487 | static unsigned int | ||
| 1488 | x_emacs_to_x_modifiers (state) | ||
| 1489 | unsigned int state; | ||
| 1490 | { | ||
| 1491 | return ( ((state & alt_modifier) ? x_alt_mod_mask : 0) | ||
| 1492 | | ((state & super_modifier) ? x_super_mod_mask : 0) | ||
| 1493 | | ((state & hyper_modifier) ? x_hyper_mod_mask : 0) | ||
| 1494 | | ((state & shift_modifier) ? ShiftMask : 0) | ||
| 1495 | | ((state & ctrl_modifier) ? ControlMask : 0) | ||
| 1496 | | ((state & meta_modifier) ? x_meta_mod_mask : 0)); | ||
| 1497 | } | ||
| 1498 | |||
| 1488 | /* Prepare a mouse-event in *RESULT for placement in the input queue. | 1499 | /* Prepare a mouse-event in *RESULT for placement in the input queue. |
| 1489 | 1500 | ||
| 1490 | If the event is a button press, then note that we have grabbed | 1501 | If the event is a button press, then note that we have grabbed |
| @@ -1501,7 +1512,7 @@ construct_mouse_click (result, event, f) | |||
| 1501 | result->kind = mouse_click; | 1512 | result->kind = mouse_click; |
| 1502 | XSET (result->code, Lisp_Int, event->button - Button1); | 1513 | XSET (result->code, Lisp_Int, event->button - Button1); |
| 1503 | result->timestamp = event->time; | 1514 | result->timestamp = event->time; |
| 1504 | result->modifiers = (x_convert_modifiers (event->state) | 1515 | result->modifiers = (x_x_to_emacs_modifiers (event->state) |
| 1505 | | (event->type == ButtonRelease | 1516 | | (event->type == ButtonRelease |
| 1506 | ? up_modifier | 1517 | ? up_modifier |
| 1507 | : down_modifier)); | 1518 | : down_modifier)); |
| @@ -2215,7 +2226,7 @@ x_scroll_bar_handle_click (bar, event, emacs_event) | |||
| 2215 | emacs_event->kind = scroll_bar_click; | 2226 | emacs_event->kind = scroll_bar_click; |
| 2216 | XSET (emacs_event->code, Lisp_Int, event->xbutton.button - Button1); | 2227 | XSET (emacs_event->code, Lisp_Int, event->xbutton.button - Button1); |
| 2217 | emacs_event->modifiers = | 2228 | emacs_event->modifiers = |
| 2218 | (x_convert_modifiers (event->xbutton.state) | 2229 | (x_x_to_emacs_modifiers (event->xbutton.state) |
| 2219 | | (event->type == ButtonRelease | 2230 | | (event->type == ButtonRelease |
| 2220 | ? up_modifier | 2231 | ? up_modifier |
| 2221 | : down_modifier)); | 2232 | : down_modifier)); |
| @@ -2773,16 +2784,10 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2773 | char copy_buffer[80]; | 2784 | char copy_buffer[80]; |
| 2774 | int modifiers; | 2785 | int modifiers; |
| 2775 | 2786 | ||
| 2776 | event.xkey.state |= extra_keyboard_modifiers; | 2787 | event.xkey.state |
| 2788 | |= x_emacs_to_x_modifiers (extra_keyboard_modifiers); | ||
| 2777 | modifiers = event.xkey.state; | 2789 | modifiers = event.xkey.state; |
| 2778 | 2790 | ||
| 2779 | /* Some keyboards generate different characters | ||
| 2780 | depending on the state of the meta key, in an attempt | ||
| 2781 | to support non-English typists. It would be nice to | ||
| 2782 | keep this functionality somehow, but for now, we will | ||
| 2783 | just clear the meta-key flag to get the 'pure' character. */ | ||
| 2784 | event.xkey.state &= ~Mod1Mask; | ||
| 2785 | |||
| 2786 | /* This will have to go some day... */ | 2791 | /* This will have to go some day... */ |
| 2787 | nbytes = | 2792 | nbytes = |
| 2788 | XLookupString (&event.xkey, copy_buffer, 80, &keysym, | 2793 | XLookupString (&event.xkey, copy_buffer, 80, &keysym, |
| @@ -2808,7 +2813,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2808 | bufp->kind = non_ascii_keystroke; | 2813 | bufp->kind = non_ascii_keystroke; |
| 2809 | XSET (bufp->code, Lisp_Int, (unsigned) keysym - 0xff00); | 2814 | XSET (bufp->code, Lisp_Int, (unsigned) keysym - 0xff00); |
| 2810 | XSET (bufp->frame_or_window, Lisp_Frame, f); | 2815 | XSET (bufp->frame_or_window, Lisp_Frame, f); |
| 2811 | bufp->modifiers = x_convert_modifiers (modifiers); | 2816 | bufp->modifiers = x_x_to_emacs_modifiers (modifiers); |
| 2812 | bufp->timestamp = event.xkey.time; | 2817 | bufp->timestamp = event.xkey.time; |
| 2813 | bufp++; | 2818 | bufp++; |
| 2814 | count++; | 2819 | count++; |
| @@ -2826,7 +2831,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2826 | bufp->kind = ascii_keystroke; | 2831 | bufp->kind = ascii_keystroke; |
| 2827 | XSET (bufp->code, Lisp_Int, copy_buffer[i]); | 2832 | XSET (bufp->code, Lisp_Int, copy_buffer[i]); |
| 2828 | XSET (bufp->frame_or_window, Lisp_Frame, f); | 2833 | XSET (bufp->frame_or_window, Lisp_Frame, f); |
| 2829 | bufp->modifiers = x_convert_modifiers (modifiers); | 2834 | bufp->modifiers = x_x_to_emacs_modifiers (modifiers); |
| 2830 | bufp->timestamp = event.xkey.time; | 2835 | bufp->timestamp = event.xkey.time; |
| 2831 | bufp++; | 2836 | bufp++; |
| 2832 | } | 2837 | } |
| @@ -3593,8 +3598,10 @@ x_text_icon (f, icon_name) | |||
| 3593 | if (! f->display.x->icon_label) | 3598 | if (! f->display.x->icon_label) |
| 3594 | f->display.x->icon_label = " *emacs* "; | 3599 | f->display.x->icon_label = " *emacs* "; |
| 3595 | 3600 | ||
| 3601 | #if 0 | ||
| 3596 | XSetIconName (x_current_display, FRAME_X_WINDOW (f), | 3602 | XSetIconName (x_current_display, FRAME_X_WINDOW (f), |
| 3597 | (char *) f->display.x->icon_label); | 3603 | (char *) f->display.x->icon_label); |
| 3604 | #endif | ||
| 3598 | 3605 | ||
| 3599 | f->display.x->icon_bitmap_flag = 0; | 3606 | f->display.x->icon_bitmap_flag = 0; |
| 3600 | x_wm_set_icon_pixmap (f, 0); | 3607 | x_wm_set_icon_pixmap (f, 0); |