HASHIMOTO Taiichi
taiic****@users*****
2006年 5月 26日 (金) 00:00:41 JST
Index: inline_patch/ChangeLog diff -u inline_patch/ChangeLog:1.22 inline_patch/ChangeLog:1.23 --- inline_patch/ChangeLog:1.22 Mon Mar 20 15:09:31 2006 +++ inline_patch/ChangeLog Fri May 26 00:00:41 2006 @@ -1,3 +1,10 @@ +2006-05-25 HASHIMOTO Taiichi <taiic****@mac*****> + + * macim.c: ¶pbgªJ¢Ä¢éÆ«ÉNbV ·éoOðð + KeyScriptª0ÌCüÍð³µÈ¢æ¤ÌÏX + (French, German Keyboard ÅüÍÅ«ÈÈéâè̽ß) + * mac-im.el: + 2006-03-20 HASHIMOTO Taiichi <taiic****@cl*****> * macim.c: ϼðÏX mac-ignore-shortcut Index: inline_patch/emacs-inline.patch diff -u inline_patch/emacs-inline.patch:1.27 inline_patch/emacs-inline.patch:1.28 --- inline_patch/emacs-inline.patch:1.27 Mon Mar 20 15:09:31 2006 +++ inline_patch/emacs-inline.patch Fri May 26 00:00:41 2006 @@ -1,6 +1,5 @@ -diff -prN -x '*.orig' ../emacs-20060319-0/lisp/loadup.el lisp/loadup.el -*** ../emacs-20060319-0/lisp/loadup.el Mon Mar 20 15:03:33 2006 ---- lisp/loadup.el Mon Mar 20 15:04:18 2006 +*** ../emacs-20060517-0/lisp/loadup.el Wed May 17 22:57:20 2006 +--- lisp/loadup.el Wed May 17 22:58:25 2006 *************** *** 206,211 **** --- 206,214 ---- @@ -13,12 +12,11 @@ (message "%s" (garbage-collect)) (load "vc-hooks") -diff -prN -x '*.orig' ../emacs-20060319-0/lisp/term/mac-im.el lisp/term/mac-im.el -*** ../emacs-20060319-0/lisp/term/mac-im.el Thu Jan 1 09:00:00 1970 ---- lisp/term/mac-im.el Mon Mar 20 15:04:18 2006 +*** ../emacs-20060517-0/lisp/term/mac-im.el Thu Jan 1 09:00:00 1970 +--- lisp/term/mac-im.el Thu May 25 20:35:34 2006 *************** *** 0 **** ---- 1,349 ---- +--- 1,339 ---- + ;; mac-im.el --- Input Method for Mac OS X -*-coding: iso-2022-7bit;-*- + + ;; Copyright (C) 2005, 2006 HASHIMOTO Taiichi <taiic****@mac*****> @@ -85,16 +83,12 @@ + (9 . nil)) ; kTSMHiliteNoteHilite + "An alist of property type of input method vs function.") + -+ (defun mac-set-input-method-property (str coding-system prop) ++ (defun mac-set-input-method-property (str prop) + "Function to add property to string inserted on buffer." + (let* ((type (nth 0 prop)) + (pos (marker-position mac-input-method-preedit-start)) -+ (beg (+ pos (length (decode-coding-string -+ (substring str 0 (nth 1 prop)) -+ coding-system)))) -+ (end (+ pos (length (decode-coding-string -+ (substring str 0 (nth 2 prop)) -+ coding-system)))) ++ (beg (+ pos (nth 1 prop))) ++ (end (+ pos (nth 2 prop))) + (func (assq type mac-input-method-property-function-alist))) + (and func (cdr func) (funcall (cdr func) type beg end)))) + @@ -113,9 +107,8 @@ + "Function to insert input method preedit string and set property of it." + (interactive "e") + -+ (let* ((coding-system (keyboard-coding-system)) -+ (arg (cdr event)) -+ (str (car arg)) ++ (let* ((arg (cdr event)) ++ (str (mac-TEXT-to-string (car arg))) + (fix (cadr arg)) + (prop (cddr arg))) + @@ -126,24 +119,19 @@ + (set-marker mac-input-method-preedit-end (point)) + (set-marker-insertion-type mac-input-method-preedit-start nil) + (set-marker-insertion-type mac-input-method-preedit-end t)) -+ (delete-region mac-input-method-preedit-start mac-input-method-preedit-end)) ++ (delete-region mac-input-method-preedit-start ++ mac-input-method-preedit-end)) + + ;; insert character to current buffer -+ (let ((l (string-to-list (decode-coding-string str coding-system)))) -+ (while l -+ (insert (if (and (eq coding-system 'japanese-shift-jis) -+ (eq (car l) ?\x80)) -+ ?\\ -+ (car l))) -+ (setq l (cdr l)))) -+ -+ (if (= fix (length str)) ++ (insert str) ++ ++ (if (or (> fix 0) (= (length str) 0)) + (progn + (set-marker mac-input-method-preedit-start nil nil) + (set-marker mac-input-method-preedit-end nil nil)) + (let ((p prop)) + (while p -+ (mac-set-input-method-property str coding-system (car p)) ++ (mac-set-input-method-property str (car p)) + (setq p (cdr p))))))) + + @@ -368,9 +356,9 @@ + (define-key special-event-map + [mac-change-input-method] 'mac-handle-input-method-change) + -diff -prN -x '*.orig' ../emacs-20060319-0/src/Makefile.in src/Makefile.in -*** ../emacs-20060319-0/src/Makefile.in Mon Mar 20 15:03:40 2006 ---- src/Makefile.in Mon Mar 20 15:04:18 2006 +diff -prN -x '*.orig' ../emacs-20060517-0/src/Makefile.in src/Makefile.in +*** ../emacs-20060517-0/src/Makefile.in Wed May 17 22:57:26 2006 +--- src/Makefile.in Wed May 17 22:58:25 2006 *************** CYGWIN_OBJ = sheap.o *** 568,574 **** @@ -418,9 +406,9 @@ macselect.o: blockinput.h macterm.h macgui.h frame.h keymap.h $(config_h) ${emacsapp}Contents/Resources/English.lproj: -diff -prN -x '*.orig' ../emacs-20060319-0/src/keyboard.c src/keyboard.c -*** ../emacs-20060319-0/src/keyboard.c Mon Mar 20 15:03:39 2006 ---- src/keyboard.c Mon Mar 20 15:04:18 2006 +diff -prN -x '*.orig' ../emacs-20060517-0/src/keyboard.c src/keyboard.c +*** ../emacs-20060517-0/src/keyboard.c Wed May 17 22:57:26 2006 +--- src/keyboard.c Wed May 17 22:58:26 2006 *************** Lisp_Object Qmouse_click; *** 528,533 **** --- 528,537 ---- @@ -460,8 +448,8 @@ { obj = Fcons (Qsave_session, Qnil); *************** syms_of_keyboard () -*** 10907,10912 **** ---- 10927,10938 ---- +*** 10898,10903 **** +--- 10918,10929 ---- Qlanguage_change = intern ("language-change"); staticpro (&Qlanguage_change); #endif @@ -474,12 +462,12 @@ Qdrag_n_drop = intern ("drag-n-drop"); staticpro (&Qdrag_n_drop); -diff -prN -x '*.orig' ../emacs-20060319-0/src/macim.c src/macim.c -*** ../emacs-20060319-0/src/macim.c Thu Jan 1 09:00:00 1970 ---- src/macim.c Mon Mar 20 15:04:18 2006 +diff -prN -x '*.orig' ../emacs-20060517-0/src/macim.c src/macim.c +*** ../emacs-20060517-0/src/macim.c Thu Jan 1 09:00:00 1970 +--- src/macim.c Wed May 24 07:05:18 2006 *************** *** 0 **** ---- 1,447 ---- +--- 1,466 ---- + /* Implementation of Inline Input Method for MacOS X. + Copyright (C) 2004, 2005, 2006 Taiichi Hashimoto <taiic****@mac*****>. + @@ -602,7 +590,8 @@ + { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent }, + { kEventClassTextInput, kEventTextInputPosToOffset }, + { kEventClassTextInput, kEventTextInputGetSelectedText }, -+ { kEventClassApplication, kEventAppActivated } ++ { kEventClassApplication, kEventAppActivated }, ++ { kEventClassApplication, kEventAppDeactivated } + }; + + static EventHandlerRef mac_input_method_handler = NULL; @@ -721,6 +710,12 @@ + } + + last_key_script = current_key_script; ++ ++ if (mac_use_inline_input_method) ++ if (current_key_script) ++ ActivateTSMDocument (mac_tsm_doc_id); ++ else ++ DeactivateTSMDocument (mac_tsm_doc_id); + } + + UNBLOCK_INPUT; @@ -730,9 +725,11 @@ + int + mac_pass_key_to_system (int xkeysym, UInt32 modifiers) + { -+ if (this_command_key_count ++ if (GetScriptManagerVariable (smKeyScript) ++ && (this_command_key_count + || !NILP (current_buffer->read_only) + || cursor_in_echo_area) ++ ) + return FALSE; + else if (mac_use_inline_input_method && !converting) + { @@ -816,7 +813,7 @@ + typeLongInteger, + NULL, sizeof(fixed_nbytes), + NULL, &fixed_nbytes); -+ argv[argc++] = make_number (fixed_nbytes); ++ argv[argc++] = make_number (fixed_nbytes / sizeof (UniChar)); + + /* get properties of string from TSM */ + GetEventParameter (event, kEventParamTextInputSendHiliteRng, @@ -835,10 +832,13 @@ + + for (i = 0; i < array->fNumOfRanges && argc < 1024; i++) + { -+ argv[argc++] = -+ list3 (make_number (array->fRange[i].fHiliteStyle), -+ make_number (array->fRange[i].fStart), -+ make_number (array->fRange[i].fEnd)); ++ int hilite = array->fRange[i].fHiliteStyle; ++ int start = array->fRange[i].fStart / sizeof (UniChar); ++ int end = array->fRange[i].fEnd / sizeof (UniChar); ++ ++ argv[argc++] = list3 (make_number (hilite), ++ make_number (start), ++ make_number (end)); + } + } + if (src) xfree(src); @@ -879,8 +879,14 @@ + case kEventClassApplication: + switch (ekind) { + case kEventAppActivated: -+ mac_reset_tsm_document (); ++ { ++ ActivateTSMDocument (mac_tsm_doc_id); ++ } + break; ++ case kEventAppDeactivated: ++ { ++ DeactivateTSMDocument (mac_tsm_doc_id); ++ } + default: + break; + } @@ -898,7 +904,8 @@ + { + if(!mac_input_method_handler) { + OSErr err; -+ InterfaceTypeList itl = { kTextService }; ++ //InterfaceTypeList itl = { kTextService }; ++ InterfaceTypeList itl = { kUnicodeDocument }; + + BLOCK_INPUT; + err = NewTSMDocument (1, itl, &mac_tsm_doc_id, 715); @@ -927,11 +934,11 @@ + + #endif + -diff -prN -x '*.orig' ../emacs-20060319-0/src/macterm.c src/macterm.c -*** ../emacs-20060319-0/src/macterm.c Mon Mar 20 15:03:39 2006 ---- src/macterm.c Mon Mar 20 15:04:18 2006 +diff -prN -x '*.orig' ../emacs-20060517-0/src/macterm.c src/macterm.c +*** ../emacs-20060517-0/src/macterm.c Wed May 17 22:57:26 2006 +--- src/macterm.c Wed May 17 22:58:26 2006 *************** static unsigned char keycode_to_xkeysym_ -*** 9731,9738 **** +*** 9611,9618 **** /*0x5C*/ 0xb9 /*kp-9*/, 0, 0, 0, /*0x60*/ 0xc2 /*f5*/, 0xc3 /*f6*/, 0xc4 /*f7*/, 0xc0 /*f3*/, @@ -940,7 +947,7 @@ /*0x6C*/ 0, 0xc7 /*f10*/, 0x0a /*fn+enter on laptops*/, 0xc9 /*f12*/, /*0x70*/ 0, 0xcc /*f15*/, 0x6a /*help*/, 0x50 /*home*/, ---- 9731,9738 ---- +--- 9611,9618 ---- /*0x5C*/ 0xb9 /*kp-9*/, 0, 0, 0, /*0x60*/ 0xc2 /*f5*/, 0xc3 /*f6*/, 0xc4 /*f7*/, 0xc0 /*f3*/, @@ -950,8 +957,8 @@ /*0x70*/ 0, 0xcc /*f15*/, 0x6a /*help*/, 0x50 /*home*/, *************** XTread_socket (sd, expected, hold_quit) -*** 10407,10412 **** ---- 10407,10413 ---- +*** 10338,10343 **** +--- 10338,10344 ---- int keycode = (er.message & keyCodeMask) >> 8; int xkeysym; @@ -960,8 +967,8 @@ /* When using Carbon Events, we need to pass raw keyboard events to the TSM ourselves. If TSM handles it, it *************** XTread_socket (sd, expected, hold_quit) -*** 10423,10428 **** ---- 10424,10430 ---- +*** 10354,10359 **** +--- 10355,10361 ---- != eventNotHandledErr) break; #endif @@ -970,8 +977,8 @@ #if 0 if (dpyinfo->x_focus_frame == NULL) *************** XTread_socket (sd, expected, hold_quit) -*** 10489,10494 **** ---- 10491,10518 ---- +*** 10423,10428 **** +--- 10425,10452 ---- er.message & charCodeMask); inev.kind = ASCII_KEYSTROKE_EVENT; } @@ -1001,8 +1008,8 @@ #if USE_CARBON_EVENTS *************** XTread_socket (sd, expected, hold_quit) -*** 10546,10551 **** ---- 10570,10576 ---- +*** 10480,10485 **** +--- 10504,10510 ---- count++; } @@ -1011,8 +1018,8 @@ /* If the focus was just given to an autoraising frame, *************** mac_initialize () -*** 11067,11072 **** ---- 11092,11099 ---- +*** 11000,11005 **** +--- 11025,11032 ---- init_service_handler (); init_quit_char_handler (); @@ -1021,9 +1028,9 @@ #endif /* MAC_OSX */ init_command_handler (); -diff -prN -x '*.orig' ../emacs-20060319-0/src/termhooks.h src/termhooks.h -*** ../emacs-20060319-0/src/termhooks.h Mon Mar 20 15:03:40 2006 ---- src/termhooks.h Mon Mar 20 15:04:18 2006 +diff -prN -x '*.orig' ../emacs-20060517-0/src/termhooks.h src/termhooks.h +*** ../emacs-20060517-0/src/termhooks.h Wed May 17 22:57:27 2006 +--- src/termhooks.h Wed May 17 22:58:26 2006 *************** enum event_kind *** 260,265 **** --- 260,271 ----