diff options
| author | Eli Zaretskii | 2012-06-23 15:39:23 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2012-06-23 15:39:23 +0300 |
| commit | 0bd8297f9cee150f34cbab14c71825d21d7bf91c (patch) | |
| tree | 16a94bc4ac8fa7ea10b3de78584695a3d364487d | |
| parent | 63def6b6d1acb18d90c705687359edd4f4c2f49a (diff) | |
| download | emacs-0bd8297f9cee150f34cbab14c71825d21d7bf91c.tar.gz emacs-0bd8297f9cee150f34cbab14c71825d21d7bf91c.zip | |
Improve and document the language-change event on MS-Windows.
src/keyboard.c (kbd_buffer_get_event): Include the codepage and the
language ID in the event parameters.
src/w32term.c (w32_read_socket): Put the new keyboard codepage into
event.code, not the obscure "character set ID".
doc/lispref/commands.texi (Misc Events): Document the language-change event.
| -rw-r--r-- | doc/lispref/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/lispref/commands.texi | 32 | ||||
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/keyboard.c | 8 | ||||
| -rw-r--r-- | src/w32term.c | 6 |
5 files changed, 52 insertions, 6 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 838617cf866..154b4487d5e 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-06-23 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * commands.texi (Misc Events): Document the language-change event. | ||
| 4 | |||
| 1 | 2012-06-22 Paul Eggert <eggert@cs.ucla.edu> | 5 | 2012-06-22 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 6 | ||
| 3 | Support higher-resolution time stamps (Bug#9000). | 7 | Support higher-resolution time stamps (Bug#9000). |
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index 59ad2927411..a5fb4638c9d 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi | |||
| @@ -1716,6 +1716,38 @@ To test the signal handler, you can make Emacs send a signal to itself: | |||
| 1716 | @smallexample | 1716 | @smallexample |
| 1717 | (signal-process (emacs-pid) 'sigusr1) | 1717 | (signal-process (emacs-pid) 'sigusr1) |
| 1718 | @end smallexample | 1718 | @end smallexample |
| 1719 | |||
| 1720 | @cindex @code{language-change} event | ||
| 1721 | @item language-change | ||
| 1722 | This kind of event is generated on MS-Windows when the input language | ||
| 1723 | has changed. This typically means that the keyboard keys will send to | ||
| 1724 | Emacs characters from a different language. The generated event has | ||
| 1725 | this form: | ||
| 1726 | |||
| 1727 | @smallexample | ||
| 1728 | (language-change @var{frame} @var{codepage} @var{language-id}) | ||
| 1729 | @end smallexample | ||
| 1730 | |||
| 1731 | @noindent | ||
| 1732 | Here @var{frame} is the frame which was current when the input | ||
| 1733 | language changed; @var{codepage} is the new codepage number; and | ||
| 1734 | @var{language-id} is the numerical ID of the new input language. The | ||
| 1735 | coding-system (@pxref{Coding Systems}) that corresponds to | ||
| 1736 | @var{codepage} is @code{cp@var{codepage}} or | ||
| 1737 | @code{windows-@var{codepage}}. To convert @var{language-id} to a | ||
| 1738 | string (e.g., to use it for various language-dependent features, such | ||
| 1739 | as @code{set-language-environment}), use the | ||
| 1740 | @code{w32-get-locale-info} function, like this: | ||
| 1741 | |||
| 1742 | @smallexample | ||
| 1743 | ;; Get the abbreviated language name, such as "ENU" for English | ||
| 1744 | (w32-get-locale-info language-id) | ||
| 1745 | ;; Get the full English name of the language, | ||
| 1746 | ;; such as "English (United States)" | ||
| 1747 | (w32-get-locale-info language-id 4097) | ||
| 1748 | ;; Get the full localized name of the language | ||
| 1749 | (w32-get-locale-info language-id t) | ||
| 1750 | @end smallexample | ||
| 1719 | @end table | 1751 | @end table |
| 1720 | 1752 | ||
| 1721 | If one of these events arrives in the middle of a key sequence---that | 1753 | If one of these events arrives in the middle of a key sequence---that |
diff --git a/src/ChangeLog b/src/ChangeLog index 2266ccc49ef..a01a93f86e9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2012-06-23 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * keyboard.c (kbd_buffer_get_event): Include the codepage and the | ||
| 4 | language ID in the event parameters. | ||
| 5 | |||
| 6 | * w32term.c (w32_read_socket): Put the new keyboard codepage into | ||
| 7 | event.code, not the obscure "character set ID". | ||
| 8 | |||
| 1 | 2012-06-23 Chong Yidong <cyd@gnu.org> | 9 | 2012-06-23 Chong Yidong <cyd@gnu.org> |
| 2 | 10 | ||
| 3 | * xmenu.c (x_menu_wait_for_event): Adapt GTK3 to new xg_select. | 11 | * xmenu.c (x_menu_wait_for_event): Adapt GTK3 to new xg_select. |
diff --git a/src/keyboard.c b/src/keyboard.c index 9b80c5c7019..0e8d22c2b1c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -3982,9 +3982,11 @@ kbd_buffer_get_event (KBOARD **kbp, | |||
| 3982 | #if defined (WINDOWSNT) | 3982 | #if defined (WINDOWSNT) |
| 3983 | else if (event->kind == LANGUAGE_CHANGE_EVENT) | 3983 | else if (event->kind == LANGUAGE_CHANGE_EVENT) |
| 3984 | { | 3984 | { |
| 3985 | /* Make an event (language-change (FRAME CHARSET LCID)). */ | 3985 | /* Make an event (language-change (FRAME CODEPAGE LANGUAGE-ID)). */ |
| 3986 | obj = Fcons (event->frame_or_window, Qnil); | 3986 | obj = Fcons (Qlanguage_change, |
| 3987 | obj = Fcons (Qlanguage_change, Fcons (obj, Qnil)); | 3987 | list3 (event->frame_or_window, |
| 3988 | make_number (event->code), | ||
| 3989 | make_number (event->modifiers))); | ||
| 3988 | kbd_fetch_ptr = event + 1; | 3990 | kbd_fetch_ptr = event + 1; |
| 3989 | } | 3991 | } |
| 3990 | #endif | 3992 | #endif |
diff --git a/src/w32term.c b/src/w32term.c index 6a4b3ca4afb..4f4fa220a7b 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -4234,8 +4234,8 @@ w32_read_socket (struct terminal *terminal, int expected, | |||
| 4234 | /* Generate a language change event. */ | 4234 | /* Generate a language change event. */ |
| 4235 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 4235 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
| 4236 | 4236 | ||
| 4237 | /* lParam contains the input lang ID. Use it to update our | 4237 | /* lParam contains the input language ID in its low 16 bits. |
| 4238 | record of the keyboard codepage. */ | 4238 | Use it to update our record of the keyboard codepage. */ |
| 4239 | keyboard_codepage = codepage_for_locale ((LCID)(msg.msg.lParam | 4239 | keyboard_codepage = codepage_for_locale ((LCID)(msg.msg.lParam |
| 4240 | & 0xffff)); | 4240 | & 0xffff)); |
| 4241 | 4241 | ||
| @@ -4243,7 +4243,7 @@ w32_read_socket (struct terminal *terminal, int expected, | |||
| 4243 | { | 4243 | { |
| 4244 | inev.kind = LANGUAGE_CHANGE_EVENT; | 4244 | inev.kind = LANGUAGE_CHANGE_EVENT; |
| 4245 | XSETFRAME (inev.frame_or_window, f); | 4245 | XSETFRAME (inev.frame_or_window, f); |
| 4246 | inev.code = msg.msg.wParam; | 4246 | inev.code = keyboard_codepage; |
| 4247 | inev.modifiers = msg.msg.lParam & 0xffff; | 4247 | inev.modifiers = msg.msg.lParam & 0xffff; |
| 4248 | } | 4248 | } |
| 4249 | break; | 4249 | break; |