diff options
| author | Jason Rumney | 2009-07-22 16:03:39 +0000 |
|---|---|---|
| committer | Jason Rumney | 2009-07-22 16:03:39 +0000 |
| commit | c902b9205ba37aa2db7b9ee855fdca2a13e8076a (patch) | |
| tree | 8148bf8ada45819a89019da5270455395262b887 /src | |
| parent | 855b42a23dff7a633d728da3f8f562500472c89f (diff) | |
| download | emacs-c902b9205ba37aa2db7b9ee855fdca2a13e8076a.tar.gz emacs-c902b9205ba37aa2db7b9ee855fdca2a13e8076a.zip | |
* w32fns.c (w32_wnd_proc) [WM_IME_STARTCOMPOSITION]: Position
IME window at cursor (Bug#2570).
(w32_wnd_proc) [WM_IME_CHAR]: Release context when finished.
(globals_of_w32fns): Dynamically load functions required above.
* w32term.c (w32_draw_window_cursor): Send message to reposition
any IME window.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/w32fns.c | 45 | ||||
| -rw-r--r-- | src/w32term.c | 3 |
3 files changed, 58 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e15c3e7937f..e5c2c730d56 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2009-07-22 Jason Rumney <jasonr@gnu.org> | ||
| 2 | |||
| 3 | * w32fns.c (w32_wnd_proc) [WM_IME_STARTCOMPOSITION]: Position | ||
| 4 | IME window at cursor (Bug#2570). | ||
| 5 | (w32_wnd_proc) [WM_IME_CHAR]: Release context when finished. | ||
| 6 | (globals_of_w32fns): Dynamically load functions required above. | ||
| 7 | |||
| 8 | * w32term.c (w32_draw_window_cursor): Send message to reposition | ||
| 9 | any IME window. | ||
| 10 | |||
| 1 | 2009-07-21 Chong Yidong <cyd@stupidchicken.com> | 11 | 2009-07-21 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 12 | ||
| 3 | * fileio.c: Revert 2009-07-16 changes. | 13 | * fileio.c: Revert 2009-07-16 changes. |
diff --git a/src/w32fns.c b/src/w32fns.c index 8ecf3ccb206..8b6c6c21cd2 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -252,6 +252,9 @@ typedef BOOL (WINAPI * TrackMouseEvent_Proc) | |||
| 252 | typedef LONG (WINAPI * ImmGetCompositionString_Proc) | 252 | typedef LONG (WINAPI * ImmGetCompositionString_Proc) |
| 253 | (IN HIMC context, IN DWORD index, OUT LPVOID buffer, IN DWORD bufLen); | 253 | (IN HIMC context, IN DWORD index, OUT LPVOID buffer, IN DWORD bufLen); |
| 254 | typedef HIMC (WINAPI * ImmGetContext_Proc) (IN HWND window); | 254 | typedef HIMC (WINAPI * ImmGetContext_Proc) (IN HWND window); |
| 255 | typedef HWND (WINAPI * ImmReleaseContext_Proc) (IN HWND wnd, IN HIMC context); | ||
| 256 | typedef HWND (WINAPI * ImmSetCompositionWindow_Proc) (IN HIMC context, | ||
| 257 | IN COMPOSITIONFORM *form); | ||
| 255 | typedef HMONITOR (WINAPI * MonitorFromPoint_Proc) (IN POINT pt, IN DWORD flags); | 258 | typedef HMONITOR (WINAPI * MonitorFromPoint_Proc) (IN POINT pt, IN DWORD flags); |
| 256 | typedef BOOL (WINAPI * GetMonitorInfo_Proc) | 259 | typedef BOOL (WINAPI * GetMonitorInfo_Proc) |
| 257 | (IN HMONITOR monitor, OUT struct MONITOR_INFO* info); | 260 | (IN HMONITOR monitor, OUT struct MONITOR_INFO* info); |
| @@ -260,6 +263,8 @@ TrackMouseEvent_Proc track_mouse_event_fn = NULL; | |||
| 260 | ClipboardSequence_Proc clipboard_sequence_fn = NULL; | 263 | ClipboardSequence_Proc clipboard_sequence_fn = NULL; |
| 261 | ImmGetCompositionString_Proc get_composition_string_fn = NULL; | 264 | ImmGetCompositionString_Proc get_composition_string_fn = NULL; |
| 262 | ImmGetContext_Proc get_ime_context_fn = NULL; | 265 | ImmGetContext_Proc get_ime_context_fn = NULL; |
| 266 | ImmReleaseContext_Proc release_ime_context_fn = NULL; | ||
| 267 | ImmSetCompositionWindow_Proc set_ime_composition_window_fn = NULL; | ||
| 263 | MonitorFromPoint_Proc monitor_from_point_fn = NULL; | 268 | MonitorFromPoint_Proc monitor_from_point_fn = NULL; |
| 264 | GetMonitorInfo_Proc get_monitor_info_fn = NULL; | 269 | GetMonitorInfo_Proc get_monitor_info_fn = NULL; |
| 265 | 270 | ||
| @@ -3158,6 +3163,8 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) | |||
| 3158 | buffer = alloca(size); | 3163 | buffer = alloca(size); |
| 3159 | size = get_composition_string_fn (context, GCS_RESULTSTR, | 3164 | size = get_composition_string_fn (context, GCS_RESULTSTR, |
| 3160 | buffer, size); | 3165 | buffer, size); |
| 3166 | release_ime_context_fn (hwnd, context); | ||
| 3167 | |||
| 3161 | signal_user_input (); | 3168 | signal_user_input (); |
| 3162 | for (i = 0; i < size / sizeof (wchar_t); i++) | 3169 | for (i = 0; i < size / sizeof (wchar_t); i++) |
| 3163 | { | 3170 | { |
| @@ -3173,6 +3180,40 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) | |||
| 3173 | 3180 | ||
| 3174 | break; | 3181 | break; |
| 3175 | 3182 | ||
| 3183 | case WM_IME_STARTCOMPOSITION: | ||
| 3184 | if (!set_ime_composition_window_fn) | ||
| 3185 | goto dflt; | ||
| 3186 | else | ||
| 3187 | { | ||
| 3188 | COMPOSITIONFORM form; | ||
| 3189 | HIMC context; | ||
| 3190 | struct window *w; | ||
| 3191 | |||
| 3192 | if (!context) | ||
| 3193 | break; | ||
| 3194 | |||
| 3195 | f = x_window_to_frame (dpyinfo, hwnd); | ||
| 3196 | w = XWINDOW (FRAME_SELECTED_WINDOW (f)); | ||
| 3197 | |||
| 3198 | form.dwStyle = CFS_RECT; | ||
| 3199 | form.ptCurrentPos.x = w32_system_caret_x; | ||
| 3200 | form.ptCurrentPos.y = w32_system_caret_y; | ||
| 3201 | |||
| 3202 | form.rcArea.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, 0); | ||
| 3203 | form.rcArea.top = (WINDOW_TOP_EDGE_Y (w) | ||
| 3204 | + WINDOW_HEADER_LINE_HEIGHT (w)); | ||
| 3205 | form.rcArea.right = (WINDOW_BOX_RIGHT_EDGE_X (w) | ||
| 3206 | - WINDOW_RIGHT_MARGIN_WIDTH (w) | ||
| 3207 | - WINDOW_RIGHT_FRINGE_WIDTH (w)); | ||
| 3208 | form.rcArea.bottom = (WINDOW_BOTTOM_EDGE_Y (w) | ||
| 3209 | - WINDOW_MODE_LINE_HEIGHT (w)); | ||
| 3210 | |||
| 3211 | context = get_ime_context_fn (hwnd); | ||
| 3212 | set_ime_composition_window_fn (context, &form); | ||
| 3213 | release_ime_context_fn (hwnd, context); | ||
| 3214 | } | ||
| 3215 | break; | ||
| 3216 | |||
| 3176 | case WM_IME_ENDCOMPOSITION: | 3217 | case WM_IME_ENDCOMPOSITION: |
| 3177 | ignore_ime_char = 0; | 3218 | ignore_ime_char = 0; |
| 3178 | goto dflt; | 3219 | goto dflt; |
| @@ -7278,6 +7319,10 @@ globals_of_w32fns () | |||
| 7278 | GetProcAddress (imm32_lib, "ImmGetCompositionStringW"); | 7319 | GetProcAddress (imm32_lib, "ImmGetCompositionStringW"); |
| 7279 | get_ime_context_fn = (ImmGetContext_Proc) | 7320 | get_ime_context_fn = (ImmGetContext_Proc) |
| 7280 | GetProcAddress (imm32_lib, "ImmGetContext"); | 7321 | GetProcAddress (imm32_lib, "ImmGetContext"); |
| 7322 | release_ime_context_fn = (ImmReleaseContext_Proc) | ||
| 7323 | GetProcAddress (imm32_lib, "ImmReleaseContext"); | ||
| 7324 | set_ime_composition_window_fn = (ImmSetCompositionWindow_Proc) | ||
| 7325 | GetProcAddress (imm32_lib, "ImmSetCompositionWindow"); | ||
| 7281 | } | 7326 | } |
| 7282 | DEFVAR_INT ("w32-ansi-code-page", | 7327 | DEFVAR_INT ("w32-ansi-code-page", |
| 7283 | &w32_ansi_code_page, | 7328 | &w32_ansi_code_page, |
diff --git a/src/w32term.c b/src/w32term.c index dde006bbdef..b7642b46891 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -32,6 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 32 | #include <ctype.h> | 32 | #include <ctype.h> |
| 33 | #include <errno.h> | 33 | #include <errno.h> |
| 34 | #include <sys/stat.h> | 34 | #include <sys/stat.h> |
| 35 | #include <imm.h> | ||
| 35 | 36 | ||
| 36 | #include "charset.h" | 37 | #include "charset.h" |
| 37 | #include "character.h" | 38 | #include "character.h" |
| @@ -5128,6 +5129,8 @@ w32_draw_window_cursor (w, glyph_row, x, y, cursor_type, cursor_width, on_p, act | |||
| 5128 | = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y) | 5129 | = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y) |
| 5129 | + glyph_row->ascent - w->phys_cursor_ascent); | 5130 | + glyph_row->ascent - w->phys_cursor_ascent); |
| 5130 | 5131 | ||
| 5132 | PostMessage (hwnd, WM_IME_STARTCOMPOSITION, 0, 0); | ||
| 5133 | |||
| 5131 | /* If the size of the active cursor changed, destroy the old | 5134 | /* If the size of the active cursor changed, destroy the old |
| 5132 | system caret. */ | 5135 | system caret. */ |
| 5133 | if (w32_system_caret_hwnd | 5136 | if (w32_system_caret_hwnd |