comparison src/gui_w32.c @ 27249:d5570658f18d v8.2.4153

patch 8.2.4153: MS-Windows: Global IME is no longer supported Commit: https://github.com/vim/vim/commit/4ac893f32109f29349661322676e5b81eb169b74 Author: K.Takata <kentkt@csc.jp> Date: Thu Jan 20 12:44:28 2022 +0000 patch 8.2.4153: MS-Windows: Global IME is no longer supported Problem: MS-Windows: Global IME is no longer supported. Solution: Remove the Global IME implementation. (Ken Takata, closes https://github.com/vim/vim/issues/9562)
author Bram Moolenaar <Bram@vim.org>
date Thu, 20 Jan 2022 13:45:06 +0100
parents 6837d2c14dee
children 59cdcd1e47b8
comparison
equal deleted inserted replaced
27248:c69bec136e5f 27249:d5570658f18d
194 # endif 194 # endif
195 # if defined(FEAT_TOOLBAR) || defined(FEAT_BEVAL_GUI) || defined(FEAT_GUI_TABLINE) 195 # if defined(FEAT_TOOLBAR) || defined(FEAT_BEVAL_GUI) || defined(FEAT_GUI_TABLINE)
196 # include <commctrl.h> 196 # include <commctrl.h>
197 # endif 197 # endif
198 # include <windowsx.h> 198 # include <windowsx.h>
199
200 # ifdef GLOBAL_IME
201 # include "glbl_ime.h"
202 # endif
203 199
204 #endif // PROTO 200 #endif // PROTO
205 201
206 #ifdef FEAT_MENU 202 #ifdef FEAT_MENU
207 # define MENUHINTS // show menu hints in command line 203 # define MENUHINTS // show menu hints in command line
356 // scrollbar dragging can be done directly. It's not allowed while commands 352 // scrollbar dragging can be done directly. It's not allowed while commands
357 // are executed, because it may move the cursor and that may cause unexpected 353 // are executed, because it may move the cursor and that may cause unexpected
358 // problems (e.g., while ":s" is working). 354 // problems (e.g., while ":s" is working).
359 static int allow_scrollbar = FALSE; 355 static int allow_scrollbar = FALSE;
360 356
361 #ifdef GLOBAL_IME
362 # define MyTranslateMessage(x) global_ime_TranslateMessage(x)
363 #else
364 # define MyTranslateMessage(x) TranslateMessage(x)
365 #endif
366
367 #ifndef _DPI_AWARENESS_CONTEXTS_ 357 #ifndef _DPI_AWARENESS_CONTEXTS_
368 typedef HANDLE DPI_AWARENESS_CONTEXT; 358 typedef HANDLE DPI_AWARENESS_CONTEXT;
369 359
370 typedef enum DPI_AWARENESS { 360 typedef enum DPI_AWARENESS {
371 DPI_AWARENESS_INVALID = -1, 361 DPI_AWARENESS_INVALID = -1,
446 GetClientRect(s_textArea, &rect); 436 GetClientRect(s_textArea, &rect);
447 DWriteContext_BindDC(s_dwc, s_hdc, &rect); 437 DWriteContext_BindDC(s_dwc, s_hdc, &rect);
448 } 438 }
449 } 439 }
450 #endif 440 #endif
451
452 // use of WindowProc depends on Global IME
453 static LRESULT WINAPI MyWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
454 441
455 extern int current_font_height; // this is in os_mswin.c 442 extern int current_font_height; // this is in os_mswin.c
456 443
457 static struct 444 static struct
458 { 445 {
559 /* 546 /*
560 * For control IME. 547 * For control IME.
561 * 548 *
562 * These LOGFONTW used for IME. 549 * These LOGFONTW used for IME.
563 */ 550 */
564 #if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME) 551 #ifdef FEAT_MBYTE_IME
565 // holds LOGFONTW for 'guifontwide' if available, otherwise 'guifont' 552 // holds LOGFONTW for 'guifontwide' if available, otherwise 'guifont'
566 static LOGFONTW norm_logfont; 553 static LOGFONTW norm_logfont;
567 #endif
568 #ifdef FEAT_MBYTE_IME
569 // holds LOGFONTW for 'guifont' always. 554 // holds LOGFONTW for 'guifont' always.
570 static LOGFONTW sub_logfont; 555 static LOGFONTW sub_logfont;
571 #endif 556 #endif
572 557
573 #ifdef FEAT_MBYTE_IME 558 #ifdef FEAT_MBYTE_IME
1313 #ifdef FEAT_BEVAL_GUI 1298 #ifdef FEAT_BEVAL_GUI
1314 case WM_NOTIFY: Handle_WM_Notify(hwnd, (LPNMHDR)lParam); 1299 case WM_NOTIFY: Handle_WM_Notify(hwnd, (LPNMHDR)lParam);
1315 return TRUE; 1300 return TRUE;
1316 #endif 1301 #endif
1317 default: 1302 default:
1318 return MyWindowProc(hwnd, uMsg, wParam, lParam); 1303 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
1319 } 1304 }
1320 }
1321
1322 static LRESULT WINAPI
1323 MyWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
1324 {
1325 #ifdef GLOBAL_IME
1326 return global_ime_DefWindowProc(hwnd, message, wParam, lParam);
1327 #else
1328 return DefWindowProcW(hwnd, message, wParam, lParam);
1329 #endif
1330 } 1305 }
1331 1306
1332 /* 1307 /*
1333 * Called when the foreground or background color has been changed. 1308 * Called when the foreground or background color has been changed.
1334 */ 1309 */
1842 // Make Windows generate the dead key's character 1817 // Make Windows generate the dead key's character
1843 deadCharExpel.message = originalMsg.message; 1818 deadCharExpel.message = originalMsg.message;
1844 deadCharExpel.hwnd = originalMsg.hwnd; 1819 deadCharExpel.hwnd = originalMsg.hwnd;
1845 deadCharExpel.wParam = VK_SPACE; 1820 deadCharExpel.wParam = VK_SPACE;
1846 1821
1847 MyTranslateMessage(&deadCharExpel); 1822 TranslateMessage(&deadCharExpel);
1848 1823
1849 // re-generate the current character free of the dead char influence 1824 // re-generate the current character free of the dead char influence
1850 PostMessage(originalMsg.hwnd, originalMsg.message, originalMsg.wParam, 1825 PostMessage(originalMsg.hwnd, originalMsg.message, originalMsg.wParam,
1851 originalMsg.lParam); 1826 originalMsg.lParam);
1852 } 1827 }
1917 * consumed at that point (This is when we let Windows combine the 1892 * consumed at that point (This is when we let Windows combine the
1918 * dead character on its own) 1893 * dead character on its own)
1919 * 1894 *
1920 * - Before doing something special such as regenerating keypresses to 1895 * - Before doing something special such as regenerating keypresses to
1921 * expel the dead character as this could trigger an infinite loop if 1896 * expel the dead character as this could trigger an infinite loop if
1922 * for some reason MyTranslateMessage() do not trigger a call 1897 * for some reason TranslateMessage() do not trigger a call
1923 * immediately to _OnChar() (or _OnSysChar()). 1898 * immediately to _OnChar() (or _OnSysChar()).
1924 */ 1899 */
1925 if (dead_key) 1900 if (dead_key)
1926 { 1901 {
1927 /* 1902 /*
1937 * user expects. 1912 * user expects.
1938 */ 1913 */
1939 if ((vk == VK_SPACE || vk == VK_BACK || vk == VK_ESCAPE)) 1914 if ((vk == VK_SPACE || vk == VK_BACK || vk == VK_ESCAPE))
1940 { 1915 {
1941 dead_key = 0; 1916 dead_key = 0;
1942 MyTranslateMessage(&msg); 1917 TranslateMessage(&msg);
1943 return; 1918 return;
1944 } 1919 }
1945 // In modes where we are not typing, dead keys should behave 1920 // In modes where we are not typing, dead keys should behave
1946 // normally 1921 // normally
1947 else if (!(get_real_state() & (INSERT | CMDLINE | SELECTMODE))) 1922 else if (!(get_real_state() & (INSERT | CMDLINE | SELECTMODE)))
2067 { 2042 {
2068 string[0] = Ctrl_AT; 2043 string[0] = Ctrl_AT;
2069 add_to_input_buf(string, 1); 2044 add_to_input_buf(string, 1);
2070 } 2045 }
2071 else 2046 else
2072 MyTranslateMessage(&msg); 2047 TranslateMessage(&msg);
2073 } 2048 }
2074 else 2049 else
2075 MyTranslateMessage(&msg); 2050 TranslateMessage(&msg);
2076 } 2051 }
2077 } 2052 }
2078 #ifdef FEAT_MBYTE_IME 2053 #ifdef FEAT_MBYTE_IME
2079 else if (msg.message == WM_IME_NOTIFY) 2054 else if (msg.message == WM_IME_NOTIFY)
2080 _OnImeNotify(msg.hwnd, (DWORD)msg.wParam, (DWORD)msg.lParam); 2055 _OnImeNotify(msg.hwnd, (DWORD)msg.wParam, (DWORD)msg.lParam);
2081 else if (msg.message == WM_KEYUP && im_get_status()) 2056 else if (msg.message == WM_KEYUP && im_get_status())
2082 // added for non-MS IME (Yasuhiro Matsumoto) 2057 // added for non-MS IME (Yasuhiro Matsumoto)
2083 MyTranslateMessage(&msg); 2058 TranslateMessage(&msg);
2084 #endif
2085 #if !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME)
2086 // GIME_TEST
2087 else if (msg.message == WM_IME_STARTCOMPOSITION)
2088 {
2089 POINT point;
2090
2091 global_ime_set_font(&norm_logfont);
2092 point.x = FILL_X(gui.col);
2093 point.y = FILL_Y(gui.row);
2094 MapWindowPoints(s_textArea, s_hwnd, &point, 1);
2095 global_ime_set_position(&point);
2096 }
2097 #endif 2059 #endif
2098 2060
2099 #ifdef FEAT_MENU 2061 #ifdef FEAT_MENU
2100 // Check for <F10>: Default effect is to select the menu. When <F10> is 2062 // Check for <F10>: Default effect is to select the menu. When <F10> is
2101 // mapped we need to stop it here to avoid strange effects (e.g., for the 2063 // mapped we need to stop it here to avoid strange effects (e.g., for the
2945 HWND hwnd, 2907 HWND hwnd,
2946 HWND hwndOldFocus) 2908 HWND hwndOldFocus)
2947 { 2909 {
2948 gui_focus_change(TRUE); 2910 gui_focus_change(TRUE);
2949 s_getting_focus = TRUE; 2911 s_getting_focus = TRUE;
2950 (void)MyWindowProc(hwnd, WM_SETFOCUS, (WPARAM)hwndOldFocus, 0); 2912 (void)DefWindowProcW(hwnd, WM_SETFOCUS, (WPARAM)hwndOldFocus, 0);
2951 } 2913 }
2952 2914
2953 static void 2915 static void
2954 _OnKillFocus( 2916 _OnKillFocus(
2955 HWND hwnd, 2917 HWND hwnd,
2956 HWND hwndNewFocus) 2918 HWND hwndNewFocus)
2957 { 2919 {
2958 gui_focus_change(FALSE); 2920 gui_focus_change(FALSE);
2959 s_getting_focus = FALSE; 2921 s_getting_focus = FALSE;
2960 (void)MyWindowProc(hwnd, WM_KILLFOCUS, (WPARAM)hwndNewFocus, 0); 2922 (void)DefWindowProcW(hwnd, WM_KILLFOCUS, (WPARAM)hwndNewFocus, 0);
2961 } 2923 }
2962 2924
2963 /* 2925 /*
2964 * Get a message when the user switches back to vim 2926 * Get a message when the user switches back to vim
2965 */ 2927 */
2969 BOOL fActivate, 2931 BOOL fActivate,
2970 DWORD dwThreadId) 2932 DWORD dwThreadId)
2971 { 2933 {
2972 // we call gui_focus_change() in _OnSetFocus() 2934 // we call gui_focus_change() in _OnSetFocus()
2973 // gui_focus_change((int)fActivate); 2935 // gui_focus_change((int)fActivate);
2974 return MyWindowProc(hwnd, WM_ACTIVATEAPP, fActivate, (DWORD)dwThreadId); 2936 return DefWindowProcW(hwnd, WM_ACTIVATEAPP, fActivate, (DWORD)dwThreadId);
2975 } 2937 }
2976 2938
2977 void 2939 void
2978 gui_mch_destroy_scrollbar(scrollbar_T *sb) 2940 gui_mch_destroy_scrollbar(scrollbar_T *sb)
2979 { 2941 {
3242 if (s_hwnd != NULL) 3204 if (s_hwnd != NULL)
3243 { 3205 {
3244 destroying = TRUE; // ignore WM_DESTROY message now 3206 destroying = TRUE; // ignore WM_DESTROY message now
3245 DestroyWindow(s_hwnd); 3207 DestroyWindow(s_hwnd);
3246 } 3208 }
3247
3248 #ifdef GLOBAL_IME
3249 global_ime_end();
3250 #endif
3251 } 3209 }
3252 3210
3253 static char_u * 3211 static char_u *
3254 logfont2name(LOGFONTW lf) 3212 logfont2name(LOGFONTW lf)
3255 { 3213 {
3397 if (font == NOFONT) 3355 if (font == NOFONT)
3398 return FAIL; 3356 return FAIL;
3399 3357
3400 if (font_name == NULL) 3358 if (font_name == NULL)
3401 font_name = (char_u *)lf.lfFaceName; 3359 font_name = (char_u *)lf.lfFaceName;
3402 #if defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME) 3360 #ifdef FEAT_MBYTE_IME
3403 norm_logfont = lf; 3361 norm_logfont = lf;
3404 #endif
3405 #ifdef FEAT_MBYTE_IME
3406 sub_logfont = lf; 3362 sub_logfont = lf;
3407 #endif
3408 #ifdef FEAT_MBYTE_IME
3409 if (!s_in_dpichanged) 3363 if (!s_in_dpichanged)
3410 update_im_font(); 3364 update_im_font();
3411 #endif 3365 #endif
3412 gui_mch_free_font(gui.norm_font); 3366 gui_mch_free_font(gui.norm_font);
3413 gui.norm_font = font; 3367 gui.norm_font = font;
4548 cx = lpwpos->cx; 4502 cx = lpwpos->cx;
4549 cy = lpwpos->cy; 4503 cy = lpwpos->cy;
4550 netbeans_frame_moved(x, y); 4504 netbeans_frame_moved(x, y);
4551 } 4505 }
4552 // Allow to send WM_SIZE and WM_MOVE 4506 // Allow to send WM_SIZE and WM_MOVE
4553 FORWARD_WM_WINDOWPOSCHANGED(hwnd, lpwpos, MyWindowProc); 4507 FORWARD_WM_WINDOWPOSCHANGED(hwnd, lpwpos, DefWindowProcW);
4554 } 4508 }
4555 #endif 4509 #endif
4556 4510
4557 4511
4558 static HWND hwndTip = NULL; 4512 static HWND hwndTip = NULL;
4714 { 4668 {
4715 show_tabline_popup_menu(); 4669 show_tabline_popup_menu();
4716 return 0L; 4670 return 0L;
4717 } 4671 }
4718 } 4672 }
4719 return MyWindowProc(hwnd, uMsg, wParam, lParam); 4673 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
4720 } 4674 }
4721 case WM_LBUTTONDBLCLK: 4675 case WM_LBUTTONDBLCLK:
4722 { 4676 {
4723 /* 4677 /*
4724 * If the user double clicked the tabline, create a new tab 4678 * If the user double clicked the tabline, create a new tab
4731 GetCursorPos((LPPOINT)&pt); 4685 GetCursorPos((LPPOINT)&pt);
4732 GetWindowRect(s_textArea, &rect); 4686 GetWindowRect(s_textArea, &rect);
4733 if (pt.y < rect.top) 4687 if (pt.y < rect.top)
4734 send_tabline_menu_event(0, TABLINE_MENU_NEW); 4688 send_tabline_menu_event(0, TABLINE_MENU_NEW);
4735 } 4689 }
4736 return MyWindowProc(hwnd, uMsg, wParam, lParam); 4690 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
4737 } 4691 }
4738 #endif 4692 #endif
4739 4693
4740 case WM_QUERYENDSESSION: // System wants to go down. 4694 case WM_QUERYENDSESSION: // System wants to go down.
4741 gui_shell_closed(); // Will exit when no changed buffers. 4695 gui_shell_closed(); // Will exit when no changed buffers.
4771 _OnSysChar(hwnd, (UINT)wParam, (int)(short)LOWORD(lParam)); 4725 _OnSysChar(hwnd, (UINT)wParam, (int)(short)LOWORD(lParam));
4772 return 0L; 4726 return 0L;
4773 } 4727 }
4774 #ifdef FEAT_MENU 4728 #ifdef FEAT_MENU
4775 else 4729 else
4776 return MyWindowProc(hwnd, uMsg, wParam, lParam); 4730 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
4777 #endif 4731 #endif
4778 4732
4779 case WM_SYSKEYUP: 4733 case WM_SYSKEYUP:
4780 #ifdef FEAT_MENU 4734 #ifdef FEAT_MENU
4781 // This used to be done only when menu is active: ALT key is used for 4735 // This used to be done only when menu is active: ALT key is used for
4782 // that. But that caused problems when menu is disabled and using 4736 // that. But that caused problems when menu is disabled and using
4783 // Alt-Tab-Esc: get into a strange state where no mouse-moved events 4737 // Alt-Tab-Esc: get into a strange state where no mouse-moved events
4784 // are received, mouse pointer remains hidden. 4738 // are received, mouse pointer remains hidden.
4785 return MyWindowProc(hwnd, uMsg, wParam, lParam); 4739 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
4786 #else 4740 #else
4787 return 0L; 4741 return 0L;
4788 #endif 4742 #endif
4789 4743
4790 case WM_EXITSIZEMOVE: 4744 case WM_EXITSIZEMOVE:
4921 # endif 4875 # endif
4922 default: 4876 default:
4923 # ifdef FEAT_GUI_TABLINE 4877 # ifdef FEAT_GUI_TABLINE
4924 if (gui_mch_showing_tabline() 4878 if (gui_mch_showing_tabline()
4925 && ((LPNMHDR)lParam)->hwndFrom == s_tabhwnd) 4879 && ((LPNMHDR)lParam)->hwndFrom == s_tabhwnd)
4926 return MyWindowProc(hwnd, uMsg, wParam, lParam); 4880 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
4927 # endif 4881 # endif
4928 break; 4882 break;
4929 } 4883 }
4930 break; 4884 break;
4931 #endif 4885 #endif
4968 { 4922 {
4969 LRESULT result; 4923 LRESULT result;
4970 int x, y; 4924 int x, y;
4971 int xPos = GET_X_LPARAM(lParam); 4925 int xPos = GET_X_LPARAM(lParam);
4972 4926
4973 result = MyWindowProc(hwnd, uMsg, wParam, lParam); 4927 result = DefWindowProcW(hwnd, uMsg, wParam, lParam);
4974 if (result == HTCLIENT) 4928 if (result == HTCLIENT)
4975 { 4929 {
4976 #ifdef FEAT_GUI_TABLINE 4930 #ifdef FEAT_GUI_TABLINE
4977 if (gui_mch_showing_tabline()) 4931 if (gui_mch_showing_tabline())
4978 { 4932 {
5000 // break; notreached 4954 // break; notreached
5001 4955
5002 #ifdef FEAT_MBYTE_IME 4956 #ifdef FEAT_MBYTE_IME
5003 case WM_IME_NOTIFY: 4957 case WM_IME_NOTIFY:
5004 if (!_OnImeNotify(hwnd, (DWORD)wParam, (DWORD)lParam)) 4958 if (!_OnImeNotify(hwnd, (DWORD)wParam, (DWORD)lParam))
5005 return MyWindowProc(hwnd, uMsg, wParam, lParam); 4959 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
5006 return 1L; 4960 return 1L;
5007 4961
5008 case WM_IME_COMPOSITION: 4962 case WM_IME_COMPOSITION:
5009 if (!_OnImeComposition(hwnd, wParam, lParam)) 4963 if (!_OnImeComposition(hwnd, wParam, lParam))
5010 return MyWindowProc(hwnd, uMsg, wParam, lParam); 4964 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
5011 return 1L; 4965 return 1L;
5012 #endif 4966 #endif
5013 case WM_DPICHANGED: 4967 case WM_DPICHANGED:
5014 return _OnDpiChanged(hwnd, (UINT)LOWORD(wParam), (UINT)HIWORD(wParam), 4968 return _OnDpiChanged(hwnd, (UINT)LOWORD(wParam), (UINT)HIWORD(wParam),
5015 (RECT*)lParam); 4969 (RECT*)lParam);
5017 default: 4971 default:
5018 #ifdef MSWIN_FIND_REPLACE 4972 #ifdef MSWIN_FIND_REPLACE
5019 if (uMsg == s_findrep_msg && s_findrep_msg != 0) 4973 if (uMsg == s_findrep_msg && s_findrep_msg != 0)
5020 _OnFindRepl(); 4974 _OnFindRepl();
5021 #endif 4975 #endif
5022 return MyWindowProc(hwnd, uMsg, wParam, lParam); 4976 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
5023 } 4977 }
5024 4978
5025 return DefWindowProc(hwnd, uMsg, wParam, lParam); 4979 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
5026 } 4980 }
5027 4981
5028 /* 4982 /*
5029 * End of call-back routines 4983 * End of call-back routines
5030 */ 4984 */
5364 gui_mch_init(void) 5318 gui_mch_init(void)
5365 { 5319 {
5366 const WCHAR szVimWndClassW[] = VIM_CLASSW; 5320 const WCHAR szVimWndClassW[] = VIM_CLASSW;
5367 const WCHAR szTextAreaClassW[] = L"VimTextArea"; 5321 const WCHAR szTextAreaClassW[] = L"VimTextArea";
5368 WNDCLASSW wndclassw; 5322 WNDCLASSW wndclassw;
5369 #ifdef GLOBAL_IME
5370 ATOM atom;
5371 #endif
5372 5323
5373 // Return here if the window was already opened (happens when 5324 // Return here if the window was already opened (happens when
5374 // gui_mch_dialog() is called early). 5325 // gui_mch_dialog() is called early).
5375 if (s_hwnd != NULL) 5326 if (s_hwnd != NULL)
5376 goto theend; 5327 goto theend;
5410 wndclassw.hCursor = LoadCursor(NULL, IDC_ARROW); 5361 wndclassw.hCursor = LoadCursor(NULL, IDC_ARROW);
5411 wndclassw.hbrBackground = s_brush; 5362 wndclassw.hbrBackground = s_brush;
5412 wndclassw.lpszMenuName = NULL; 5363 wndclassw.lpszMenuName = NULL;
5413 wndclassw.lpszClassName = szVimWndClassW; 5364 wndclassw.lpszClassName = szVimWndClassW;
5414 5365
5415 if (( 5366 if (RegisterClassW(&wndclassw) == 0)
5416 #ifdef GLOBAL_IME
5417 atom =
5418 #endif
5419 RegisterClassW(&wndclassw)) == 0)
5420 return FAIL; 5367 return FAIL;
5421 } 5368 }
5422 5369
5423 if (vim_parent_hwnd != NULL) 5370 if (vim_parent_hwnd != NULL)
5424 { 5371 {
5487 s_dpi = pGetDpiForWindow(s_hwnd); 5434 s_dpi = pGetDpiForWindow(s_hwnd);
5488 update_scrollbar_size(); 5435 update_scrollbar_size();
5489 //TRACE("System DPI: %d, DPI: %d", pGetDpiForSystem(), s_dpi); 5436 //TRACE("System DPI: %d, DPI: %d", pGetDpiForSystem(), s_dpi);
5490 } 5437 }
5491 5438
5492 #ifdef GLOBAL_IME
5493 global_ime_init(atom, s_hwnd);
5494 #endif
5495 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME) 5439 #if defined(FEAT_MBYTE_IME) && defined(DYNAMIC_IME)
5496 dyn_imm_load(); 5440 dyn_imm_load();
5497 #endif 5441 #endif
5498 5442
5499 // Create the text area window 5443 // Create the text area window
6060 return status; 6004 return status;
6061 } 6005 }
6062 6006
6063 #endif // FEAT_MBYTE_IME 6007 #endif // FEAT_MBYTE_IME
6064 6008
6065 #if !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME)
6066 // Win32 with GLOBAL IME
6067
6068 /*
6069 * Notify cursor position to IM.
6070 */
6071 void
6072 im_set_position(int row, int col)
6073 {
6074 // Win32 with GLOBAL IME
6075 POINT p;
6076
6077 p.x = FILL_X(col);
6078 p.y = FILL_Y(row);
6079 MapWindowPoints(s_textArea, s_hwnd, &p, 1);
6080 global_ime_set_position(&p);
6081 }
6082
6083 /*
6084 * Set IM status on ("active" is TRUE) or off ("active" is FALSE).
6085 */
6086 void
6087 im_set_active(int active)
6088 {
6089 global_ime_set_status(active);
6090 }
6091
6092 /*
6093 * Get IM status. When IM is on, return not 0. Else return 0.
6094 */
6095 int
6096 im_get_status(void)
6097 {
6098 return global_ime_get_status();
6099 }
6100 #endif
6101 6009
6102 /* 6010 /*
6103 * Convert latin9 text "text[len]" to ucs-2 in "unicodebuf". 6011 * Convert latin9 text "text[len]" to ucs-2 in "unicodebuf".
6104 */ 6012 */
6105 static void 6013 static void