Mercurial > emacs
comparison src/xterm.c @ 2661:77f1457d000e
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.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Tue, 04 May 1993 02:44:42 +0000 |
parents | 86c8a6e08fd4 |
children | 8b55aa587d3c |
comparison
equal
deleted
inserted
replaced
2660:b70f4760d769 | 2661:77f1457d000e |
---|---|
249 | 249 |
250 static WINDOWINFO_TYPE windowinfo; | 250 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 (); |
258 extern Window XCreateWindow (); | 258 extern Window XCreateWindow (); |
259 | 259 |
1468 XFree ((char *) syms); | 1468 XFree ((char *) syms); |
1469 XFreeModifiermap (mods); | 1469 XFreeModifiermap (mods); |
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) |
1481 | ((state & ControlMask) ? ctrl_modifier : 0) | 1480 | ((state & ControlMask) ? ctrl_modifier : 0) |
1482 | ((state & x_meta_mod_mask) ? meta_modifier : 0) | 1481 | ((state & x_meta_mod_mask) ? meta_modifier : 0) |
1483 | ((state & x_alt_mod_mask) ? alt_modifier : 0) | 1482 | ((state & x_alt_mod_mask) ? alt_modifier : 0) |
1484 | ((state & x_super_mod_mask) ? super_modifier : 0) | 1483 | ((state & x_super_mod_mask) ? super_modifier : 0) |
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 |
1491 the mouse. */ | 1502 the mouse. */ |
1492 | 1503 |
1499 /* Make the event type no_event; we'll change that when we decide | 1510 /* Make the event type no_event; we'll change that when we decide |
1500 otherwise. */ | 1511 otherwise. */ |
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)); |
1508 | 1519 |
1509 /* Notice if the mouse is still grabbed. */ | 1520 /* Notice if the mouse is still grabbed. */ |
2213 abort (); | 2224 abort (); |
2214 | 2225 |
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)); |
2222 emacs_event->frame_or_window = bar->window; | 2233 emacs_event->frame_or_window = bar->window; |
2223 emacs_event->timestamp = event->xbutton.time; | 2234 emacs_event->timestamp = event->xbutton.time; |
2771 { | 2782 { |
2772 KeySym keysym; | 2783 KeySym keysym; |
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 | |
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 | 2790 |
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, |
2789 &compose_status); | 2794 &compose_status); |
2806 temp_index = 0; | 2811 temp_index = 0; |
2807 temp_buffer[temp_index++] = keysym; | 2812 temp_buffer[temp_index++] = keysym; |
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++; |
2815 numchars--; | 2820 numchars--; |
2816 } | 2821 } |
2824 temp_index = 0; | 2829 temp_index = 0; |
2825 temp_buffer[temp_index++] = copy_buffer[i]; | 2830 temp_buffer[temp_index++] = copy_buffer[i]; |
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 } |
2833 | 2838 |
2834 count += nbytes; | 2839 count += nbytes; |
3591 f->display.x->icon_label = icon_name; | 3596 f->display.x->icon_label = icon_name; |
3592 else | 3597 else |
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); |
3601 #else /* ! defined (HAVE_X11) */ | 3608 #else /* ! defined (HAVE_X11) */ |
3602 if (icon_font_info == 0) | 3609 if (icon_font_info == 0) |