Changeset 4005

Show
Ignore:
Timestamp:
2005年12月28日 01時30分53秒 (3 years ago)
Author:
horiguti
Message:

Modification related to IME control.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/ChangeLog.Meadow

    r4002 r4005  
     12005-12-28  Kyotaro HORIGUCHI  <horiguti@meadowy.org> 
     2 
     3        * international/meadow.el (mw32-input-method): Don't continue to 
     4        use FEP when length of the composition string is zero. Set 
     5        redisplay-dont-pause when calling sit-for. Preserve 
     6        buffer-modified-p. 
     7 
    182005-12-14  Hideyuki SHIRAI  <shirai@meadowy.org> 
    29 
  • trunk/lisp/international/meadow.el

    r4002 r4005  
    525525       (fep-get-mode)) 
    526526      (list key) 
    527     (sit-for 0) 
     527    (let ((redisplay-dont-pause t)) 
     528      (sit-for 0)) 
    528529    (fep-force-on) 
    529530    (let* ((pos (point)) 
     531           (modified-p (buffer-modified-p)) 
    530532           (ov (make-overlay (point) (1+ (point)))) 
    531533           (ret (mw32-ime-input-method-function (char-to-string key))) 
    532            (result (append (car ret) nil))) 
    533 ;;; Continue to conversion if composition string cannot be 
    534 ;;; convert into single ascii character. 
     534           (result (append (car ret) nil)) 
     535           (redisplay-dont-pause t)) 
     536      ;; Continue to conversion if composition string cannot be 
     537      ;; convert into single ascii character. 
    535538      (unwind-protect 
    536539          (while (or 
     
    538541                  (and 
    539542                   (cadr ret) 
     543                   (> (length (cadr ret)) 0) 
    540544                   (not (eq (string-to-char (japanese-hankaku (cadr ret))) 
    541545                            (car (cddr ret)))))) 
     
    555559        (fep-force-off) 
    556560        (delete-region pos (point)) 
    557         (delete-overlay ov)) 
     561        (delete-overlay ov) 
     562        (set-buffer-modified-p modified-p)) 
    558563      result))) 
    559564 
  • trunk/src/ChangeLog.Meadow

    r4004 r4005  
     12005-12-27  Kyotaro HORIGUCHI  <horiguti@meadowy.org> 
     2 
     3        * mw32ime.c (fep_switch_event): New sync object. 
     4        (mw32-fep-switch-by-key-event): New lisp variable. 
     5        (mw32_ime_control_init): Initialize fep_switch_event. 
     6        (mw32_ime_input_method_function_unwind): Set parameter properly to 
     7        call Ffep_force_off(). 
     8        (mw32-ime-input-method-function): call 
     9        redisplay_preserve_echo_area () before set the position of fep 
     10        window. 
     11        (fep-force-on): Add new mode that changes FEP state by internally 
     12        generated windows key event instead of IMM API. This mode is 
     13        activated when mw32-fep-switch-by-key-event is not nil. 
     14        (fep-force-off): Ditto. 
     15        (mw32-fep-switch-by-key-event): New function to control behavior 
     16        of fep-force-on and fep-force-off. 
     17 
     18        * mw32term.c (SendInputProc): New function pointer for Win32 API. 
     19        (mw32_send_key_event): New function. 
     20        (mw32_initialize): Initialize SendInputProc. 
     21 
     22        * mw32term.h (struct INPUT): New struct for SendInput. 
     23        (struct MOUSEINPUT): Ditto. 
     24        (struct KEYBDINUT): Ditto. 
     25        (struct HARDWAREINPUT): Ditto. 
     26        (SENDINPUTPROC): New typedef. 
     27 
     28        * mw32fns.c (fep_switch_state): New extern. 
     29        (mw32_WndProc<WM_IME_NOTIFY>): Set event when FEP switched. 
     30        (mw32_WndProc<WM_IME_REPORT>): Set event when FEP switched. 
     31 
    1322005-12-25  Masayuki FUJII  <boochang@m4.kcn.ne.jp> 
    233 
  • trunk/src/mw32fns.c

    r4003 r4005  
    19221922#ifdef IME_CONTROL 
    19231923  extern int IME_event_off_count; 
     1924  extern HANDLE fep_switch_event; 
    19241925#endif 
    19251926  extern void mw32_scroll_bar_store_event (WPARAM wParam, LPARAM lParam); 
     
    24122413        else 
    24132414          IME_event_off_count--; 
     2415        SetEvent (fep_switch_event); 
    24142416      } 
    24152417    goto dflt; 
     
    24992501        else 
    25002502          IME_event_off_count--; 
     2503        SetEvent (fep_switch_event); 
    25012504        return 0; 
    25022505      } 
     
    26652668                last_bitmap = MW32_FRAME_CARET_BITMAP (f); 
    26662669              } 
    2667              
     2670 
    26682671            SetCaretPos (caret_xpos, caret_ypos); 
    26692672 
  • trunk/src/mw32ime.c

    r4003 r4005  
    155155static int waiting_on_main_thread = FALSE; 
    156156static HANDLE input_method_function_string = INVALID_HANDLE_VALUE; 
     157HANDLE fep_switch_event = INVALID_HANDLE_VALUE; 
    157158 
    158159Lisp_Object Vime_control; 
    159160Lisp_Object VIME_command_off_flag; 
    160161Lisp_Object Qim_info; 
     162Lisp_Object Vmw32_fep_switch_by_key_event; 
    161163 
    162164int IME_event_off_count; 
     
    586588          Vime_control = Qt; 
    587589          input_method_function_event = CreateEvent (NULL, FALSE, FALSE, NULL); 
     590          fep_switch_event = CreateEvent (NULL, FALSE, FALSE, NULL); 
    588591        } 
    589592    } 
     
    811814 
    812815  if (NILP (arg)) 
    813     Ffep_force_off (); 
     816    Ffep_force_off (Qnil); 
    814817 
    815818  return Qnil; 
     
    848851 
    849852  result = Qnil; 
    850   Ffep_force_on (); 
     853  redisplay_preserve_echo_area (30); 
    851854 
    852855  /* If new ascii (expected..) key event comes after this function 
     
    871874                   (WPARAM)(SDATA (str)), 0); 
    872875    } 
     876  Ffep_force_on (Qnil); 
    873877 
    874878  mw32_set_ime_conv_window (hwnd, 
     
    950954DEFUN ("fep-force-on", Ffep_force_on, Sfep_force_on, 0, 1, 0, 
    951955       doc: /* Force status of IME open. 
    952 If EVENPT is not nil, this function also creates [kanji] key event. */) 
     956If EVENPT is not nil, this function also creates [kanji] key event. 
     957`mw32-fep-switch-by-key-event' controlls how activate IME.  */) 
    953958  (eventp) 
    954959     Lisp_Object eventp; 
     
    966971      hwnd = hwndConsole; 
    967972#endif 
    968       SendMessage (hwnd, WM_MULE_IMM_SET_STATUS, 1, 0); 
     973#ifdef HAVE_NTGUI 
     974      if (Vmw32_fep_switch_by_key_event) 
     975        { 
     976          ResetEvent (fep_switch_event); 
     977          mw32_send_key_input (VK_KANJI, 0, 0); 
     978          mw32_send_key_input (VK_KANJI, 0, KEYEVENTF_KEYUP); 
     979          WaitForSingleObject (fep_switch_event, 500L); 
     980        } 
     981      else 
     982#endif 
     983        SendMessage (hwnd, WM_MULE_IMM_SET_STATUS, 1, 0); 
    969984    } 
    970985  return Qnil; 
     
    974989DEFUN ("fep-force-off", Ffep_force_off, Sfep_force_off, 0, 1, 0, 
    975990       doc: /* Force status of IME close. 
    976 If EVENTP is not nil, this function also creates [kanji] key event. */) 
     991If EVENPT is not nil, this function also creates [kanji] key event. 
     992`mw32-fep-switch-by-key-event' controlls how deactivate IME.  */) 
    977993  (eventp) 
    978994     Lisp_Object eventp; 
     
    9901006      hwnd = hwndConsole; 
    9911007#endif 
    992       SendMessage (hwnd, WM_MULE_IMM_SET_STATUS, 0, 0); 
     1008#ifdef HAVE_NTGUI 
     1009      if (Vmw32_fep_switch_by_key_event) 
     1010        { 
     1011          ResetEvent (fep_switch_event); 
     1012          mw32_send_key_input (VK_KANJI, 0, 0); 
     1013          mw32_send_key_input (VK_KANJI, 0, KEYEVENTF_KEYUP); 
     1014          WaitForSingleObject (fep_switch_event, 500L); 
     1015        } 
     1016      else 
     1017#endif 
     1018        SendMessage (hwnd, WM_MULE_IMM_SET_STATUS, 0, 0); 
    9931019    } 
    9941020  return Qnil; 
     
    18361862 
    18371863  DEFVAR_LISP ("ime-control", &Vime_control, doc: /* IME control flag  */); 
     1864  DEFVAR_BOOL ("mw32-fep-switch-by-key-event", &Vmw32_fep_switch_by_key_event, 
     1865               doc: /* If non-nil, use windows key event instead of IMM API in `fep-force-on' 
     1866and `fep-force-off'. */); 
     1867  Vmw32_fep_switch_by_key_event = FALSE; 
    18381868 
    18391869  defsubr (&Simm_get_conversion_status); 
  • trunk/src/mw32term.c

    r4003 r4005  
    234234/* Layered Window */ 
    235235SETLAYEREDWINDOWATTRPROC SetLayeredWindowAttributes = NULL; 
     236 
     237SENDINPUTPROC SendInputProc = NULL; 
    236238 
    237239/* Incremented by XTread_socket whenever it really tries to read 
     
    36153617} 
    36163618 
     3619void 
     3620mw32_send_key_input (int vkeycode, int scancode, int flags) 
     3621{ 
     3622  INPUT in; 
     3623 
     3624  if (SendInputProc == NULL) return; 
     3625 
     3626  in.type = INPUT_KEYBOARD; 
     3627  in.ki.wVk = vkeycode; 
     3628  in.ki.wScan = scancode; 
     3629  in.ki.dwFlags = flags; 
     3630  in.ki.time = GetTickCount (); 
     3631  in.ki.dwExtraInfo = 0; 
     3632  SendInputProc (1, &in, sizeof (in)); 
     3633} 
     3634 
    36173635DEFUN ("mw32-get-window-position", Fmw32_get_window_position, 
    36183636       Smw32_get_window_position, 0, 2, 0, 
     
    62916309    SetLayeredWindowAttributes = (SETLAYEREDWINDOWATTRPROC) 
    62926310      GetProcAddress (user32_lib, "SetLayeredWindowAttributes"); 
     6311 
     6312    SendInputProc = (SENDINPUTPROC) 
     6313      GetProcAddress (user32_lib, "SendInput"); 
    62936314  } 
    62946315} 
  • trunk/src/mw32term.h

    r3998 r4005  
    12921292#endif 
    12931293 
     1294typedef struct{ 
     1295  LONG    dx; 
     1296  LONG    dy; 
     1297  DWORD   mouseData; 
     1298  DWORD   dwFlags; 
     1299  DWORD   time; 
     1300  ULONG_PTR dwExtraInfo; 
     1301} MOUSEINPUT; 
     1302 
     1303typedef struct { 
     1304  WORD    wVk; 
     1305  WORD    wScan; 
     1306  DWORD   dwFlags; 
     1307  DWORD   time; 
     1308  ULONG_PTR dwExtraInfo; 
     1309} KEYBDINPUT; 
     1310 
     1311typedef struct { 
     1312  DWORD   uMsg; 
     1313  WORD    wParamL; 
     1314  WORD    wParamH; 
     1315} HARDWAREINPUT; 
     1316 
     1317#define INPUT_MOUSE     0 
     1318#define INPUT_KEYBOARD  1 
     1319#define INPUT_HARDWARE  2 
     1320 
     1321typedef struct { 
     1322  DWORD   type; 
     1323  union 
     1324  { 
     1325    MOUSEINPUT      mi; 
     1326    KEYBDINPUT      ki; 
     1327    HARDWAREINPUT   hi; 
     1328  }; 
     1329} INPUT; 
     1330 
     1331typedef UINT (WINAPI *SENDINPUTPROC)(UINT, INPUT*, int); 
     1332 
    12941333#endif /* not _MW32TERM_H_ */