Mercurial > emacs
comparison src/xterm.c @ 48085:1c06bf924a62
(Qeql): Declare.
(Vx_keysym_table): New.
(syms_of_xterm): Initialize it.
(XTread_socket): Use it. Deal with ASCII keysyms.
(XSetIMValues) [HAVE_X11R6]: Prototype.
author | Dave Love <fx@gnu.org> |
---|---|
date | Wed, 30 Oct 2002 19:12:37 +0000 |
parents | 77df00035231 |
children | cffd13ef1a1d |
comparison
equal
deleted
inserted
replaced
48084:7853f9048269 | 48085:1c06bf924a62 |
---|---|
378 | 378 |
379 /* Tells if a window manager is present or not. */ | 379 /* Tells if a window manager is present or not. */ |
380 | 380 |
381 extern Lisp_Object Vx_no_window_manager; | 381 extern Lisp_Object Vx_no_window_manager; |
382 | 382 |
383 extern Lisp_Object Qface, Qmouse_face; | 383 extern Lisp_Object Qface, Qmouse_face, Qeql; |
384 | 384 |
385 extern int errno; | 385 extern int errno; |
386 | 386 |
387 /* A mask of extra modifier bits to put into every keyboard char. */ | 387 /* A mask of extra modifier bits to put into every keyboard char. */ |
388 | 388 |
389 extern EMACS_INT extra_keyboard_modifiers; | 389 extern EMACS_INT extra_keyboard_modifiers; |
390 | 390 |
391 /* The keysyms to use for the various modifiers. */ | 391 /* The keysyms to use for the various modifiers. */ |
392 | 392 |
393 Lisp_Object Vx_alt_keysym, Vx_hyper_keysym, Vx_meta_keysym, Vx_super_keysym; | 393 Lisp_Object Vx_alt_keysym, Vx_hyper_keysym, Vx_meta_keysym, Vx_super_keysym; |
394 Lisp_Object Vx_keysym_table; | |
394 static Lisp_Object Qalt, Qhyper, Qmeta, Qsuper, Qmodifier_value; | 395 static Lisp_Object Qalt, Qhyper, Qmeta, Qsuper, Qmodifier_value; |
395 | 396 |
396 static Lisp_Object Qvendor_specific_keysyms; | 397 static Lisp_Object Qvendor_specific_keysyms; |
397 static Lisp_Object Qlatin_1, Qutf_8; | 398 static Lisp_Object Qlatin_1, Qutf_8; |
398 | 399 |
8775 | 8776 |
8776 /* Xaw scroll bar callback. Invoked for incremental scrolling., | 8777 /* Xaw scroll bar callback. Invoked for incremental scrolling., |
8777 i.e. line or page up or down. WIDGET is the Xaw scroll bar | 8778 i.e. line or page up or down. WIDGET is the Xaw scroll bar |
8778 widget. CLIENT_DATA is a pointer to the scroll_bar structure for | 8779 widget. CLIENT_DATA is a pointer to the scroll_bar structure for |
8779 the scroll bar. CALL_DATA is an integer specifying the action that | 8780 the scroll bar. CALL_DATA is an integer specifying the action that |
8780 has taken place. It's magnitude is in the range 0..height of the | 8781 has taken place. Its magnitude is in the range 0..height of the |
8781 scroll bar. Negative values mean scroll towards buffer start. | 8782 scroll bar. Negative values mean scroll towards buffer start. |
8782 Values < height of scroll bar mean line-wise movement. */ | 8783 Values < height of scroll bar mean line-wise movement. */ |
8783 | 8784 |
8784 static void | 8785 static void |
8785 xaw_scroll_callback (widget, client_data, call_data) | 8786 xaw_scroll_callback (widget, client_data, call_data) |
10813 || ((unsigned)(orig_keysym) >= XK_ISO_Lock | 10814 || ((unsigned)(orig_keysym) >= XK_ISO_Lock |
10814 && (unsigned)(orig_keysym) <= XK_ISO_Last_Group_Lock) | 10815 && (unsigned)(orig_keysym) <= XK_ISO_Last_Group_Lock) |
10815 #endif | 10816 #endif |
10816 )) | 10817 )) |
10817 { | 10818 { |
10819 Lisp_Object c; | |
10820 | |
10818 if (temp_index == sizeof temp_buffer / sizeof (short)) | 10821 if (temp_index == sizeof temp_buffer / sizeof (short)) |
10819 temp_index = 0; | 10822 temp_index = 0; |
10820 temp_buffer[temp_index++] = keysym; | 10823 temp_buffer[temp_index++] = keysym; |
10821 bufp->kind = NON_ASCII_KEYSTROKE_EVENT; | 10824 /* First deal with keysyms which have |
10822 bufp->code = keysym; | 10825 defined translations to characters. */ |
10826 if (keysym >= 32 && keysym < 128) | |
10827 /* Avoid explicitly decoding each ASCII | |
10828 character. */ | |
10829 { | |
10830 bufp->kind = ASCII_KEYSTROKE_EVENT; | |
10831 bufp->code = c; | |
10832 } | |
10833 else if (! EQ ((c = Fgethash (make_number (keysym), | |
10834 Vx_keysym_table, | |
10835 Qnil)), | |
10836 Qnil)) | |
10837 { | |
10838 bufp->kind = (SINGLE_BYTE_CHAR_P (c) | |
10839 ? ASCII_KEYSTROKE_EVENT | |
10840 : MULTIBYTE_CHAR_KEYSTROKE_EVENT); | |
10841 bufp->code = c; | |
10842 } | |
10843 else | |
10844 { | |
10845 /* Not a character keysym. | |
10846 make_lispy_event will convert it to a | |
10847 symbolic key. */ | |
10848 bufp->kind = NON_ASCII_KEYSTROKE_EVENT; | |
10849 bufp->code = keysym; | |
10850 } | |
10823 XSETFRAME (bufp->frame_or_window, f); | 10851 XSETFRAME (bufp->frame_or_window, f); |
10824 bufp->arg = Qnil; | 10852 bufp->arg = Qnil; |
10825 bufp->modifiers | 10853 bufp->modifiers |
10826 = x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f), | 10854 = x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f), |
10827 modifiers); | 10855 modifiers); |
10829 bufp++; | 10857 bufp++; |
10830 count++; | 10858 count++; |
10831 numchars--; | 10859 numchars--; |
10832 } | 10860 } |
10833 else if (numchars > nbytes) | 10861 else if (numchars > nbytes) |
10834 { | 10862 { /* Raw bytes, not keysym. */ |
10835 register int i; | 10863 register int i; |
10836 register int c; | 10864 register int c; |
10837 int nchars, len; | 10865 int nchars, len; |
10838 | 10866 |
10839 /* The input should be decoded with `coding_system' | 10867 /* The input should be decoded with `coding_system' |
12612 UNBLOCK_INPUT; | 12640 UNBLOCK_INPUT; |
12613 } | 12641 } |
12614 | 12642 |
12615 #endif /* HAVE_X11R6 */ | 12643 #endif /* HAVE_X11R6 */ |
12616 | 12644 |
12645 #ifdef HAVE_X11R6 | |
12646 /* This isn't prototyped in OSF 5.0 or 5.1a. */ | |
12647 extern char *XSetIMValues P_ ((XIM, ...)); | |
12648 #endif | |
12649 | |
12617 /* Open the connection to the XIM server on display DPYINFO. | 12650 /* Open the connection to the XIM server on display DPYINFO. |
12618 RESOURCE_NAME is the resource name Emacs uses. */ | 12651 RESOURCE_NAME is the resource name Emacs uses. */ |
12619 | 12652 |
12620 static void | 12653 static void |
12621 xim_open_dpy (dpyinfo, resource_name) | 12654 xim_open_dpy (dpyinfo, resource_name) |
12638 XGetIMValues (xim, XNQueryInputStyle, &dpyinfo->xim_styles, NULL); | 12671 XGetIMValues (xim, XNQueryInputStyle, &dpyinfo->xim_styles, NULL); |
12639 | 12672 |
12640 #ifdef HAVE_X11R6 | 12673 #ifdef HAVE_X11R6 |
12641 destroy.callback = xim_destroy_callback; | 12674 destroy.callback = xim_destroy_callback; |
12642 destroy.client_data = (XPointer)dpyinfo; | 12675 destroy.client_data = (XPointer)dpyinfo; |
12643 /* This isn't prototyped in OSF 5.0. */ | |
12644 XSetIMValues (xim, XNDestroyCallback, &destroy, NULL); | 12676 XSetIMValues (xim, XNDestroyCallback, &destroy, NULL); |
12645 #endif | 12677 #endif |
12646 } | 12678 } |
12647 | 12679 |
12648 #else /* not USE_XIM */ | 12680 #else /* not USE_XIM */ |
15360 This should be one of the symbols `alt', `hyper', `meta', `super'. | 15392 This should be one of the symbols `alt', `hyper', `meta', `super'. |
15361 For example, `super' means use the Super_L and Super_R keysyms. The | 15393 For example, `super' means use the Super_L and Super_R keysyms. The |
15362 default is nil, which is the same as `super'. */); | 15394 default is nil, which is the same as `super'. */); |
15363 Vx_super_keysym = Qnil; | 15395 Vx_super_keysym = Qnil; |
15364 | 15396 |
15397 DEFVAR_LISP ("x-keysym-table", &Vx_keysym_table, | |
15398 doc: /* Hash table of character codes indexed by X keysym codes. */); | |
15399 Vx_keysym_table = make_hash_table (Qeql, make_number (900), | |
15400 make_float (DEFAULT_REHASH_SIZE), | |
15401 make_float (DEFAULT_REHASH_THRESHOLD), | |
15402 Qnil, Qnil, Qnil); | |
15365 } | 15403 } |
15366 | 15404 |
15367 #endif /* HAVE_X_WINDOWS */ | 15405 #endif /* HAVE_X_WINDOWS */ |