[macemacsjp-cvs 219] CVS update: CarbonEmacsPackage/GPL/patch/inline_patch-20041229

Back to archive index

Seiji Zenitani zenit****@users*****
2005年 12月 29日 (木) 19:12:41 JST


Index: CarbonEmacsPackage/GPL/patch/inline_patch-20041229/ChangeLog
diff -u CarbonEmacsPackage/GPL/patch/inline_patch-20041229/ChangeLog:1.1 CarbonEmacsPackage/GPL/patch/inline_patch-20041229/ChangeLog:removed
--- CarbonEmacsPackage/GPL/patch/inline_patch-20041229/ChangeLog:1.1	Sun Oct 23 13:18:04 2005
+++ CarbonEmacsPackage/GPL/patch/inline_patch-20041229/ChangeLog	Thu Dec 29 19:12:41 2005
@@ -1,26 +0,0 @@
-2005-01-02  HASHIMOTO Taiichi  <taiic****@cl*****>
-
-	* macim.c: •ÏŠ·’†‚É Emacs ‚É“ü—Í‚ð“n‚³‚È‚¢‚悤‚É‚·‚éD
-
-2004-12-30  HASHIMOTO Taiichi  <taiic****@cl*****>
-
-	* macim.c: Dialog ‚ª•\Ž¦‚³‚ꂽŒã‚ÉTSM‚ª”ñƒAƒNƒeƒBƒu‚É‚È‚ç‚È‚¢‚悤
-	‚ɏC³D
-	* macterm.c: Œó•âƒEƒBƒ“ƒhƒE‚̈ʒu‚𒲐®D
-	* macim.c: ‘S–ʏ‘‚«’¼‚µD
-	* mac-im.el: unread-command-events ‚É‚æ‚é“ü—͂ɐ؂è‘Ö‚¦‚éDsystem
-	‚Ö“ü—Í‚ð“n‚·‚©‚Ç‚¤‚©‚𐧌äD
-	* macterm.c: system ‚Ö“ü—Í‚ð“n‚·‚©‚Ç‚¤‚©‚𐧌äD
-	
-2004-11-09  HASHIMOTO Taiichi  <taiic****@cl*****>
-
-	* macim.c: •ÏŠ·’†‚É Emacs ‚É“ü—Í‚ð“n‚³‚È‚¢‚悤‚É‚·‚éD
-	* macterm.c: •ÏŠ·’†‚Å‚È‚¢‚Æ‚«‚ɁCƒVƒXƒeƒ€‚ª“ü—Í‚ðŽó‚¯Žæ‚ç‚È‚¢‚悤‚É
-	‚·‚éD
-	* mac-im.el: •ÏŠ·ˆÊ’u‚Ì‹L‰¯‚É mark ‚ðŽg—p‚·‚é‚悤‚ɕύXD
-	
-2004-10-15  HASHIMOTO Taiichi  <taiic****@cl*****>
-
-	* macim.c: BLOCK_INPUT ‚ð’ljÁD
-	* mac-im.el: ‘S–Ê“I‘‚«’¼‚µD
-
Index: CarbonEmacsPackage/GPL/patch/inline_patch-20041229/emacs-inline.patch
diff -u CarbonEmacsPackage/GPL/patch/inline_patch-20041229/emacs-inline.patch:1.1 CarbonEmacsPackage/GPL/patch/inline_patch-20041229/emacs-inline.patch:removed
--- CarbonEmacsPackage/GPL/patch/inline_patch-20041229/emacs-inline.patch:1.1	Sun Oct 23 13:18:04 2005
+++ CarbonEmacsPackage/GPL/patch/inline_patch-20041229/emacs-inline.patch	Thu Dec 29 19:12:41 2005
@@ -1,746 +0,0 @@
-diff -N -r -p emacs.orig/lisp/loadup.el emacs/lisp/loadup.el
-*** emacs.orig/lisp/loadup.el	Fri May  6 20:25:26 2005
---- emacs/lisp/loadup.el	Sat Jun  4 18:26:52 2005
-***************
-*** 188,193 ****
---- 188,196 ----
-  (if (fboundp 'atan)	; preload some constants and
-      (progn		; floating pt. functions if we have float support.
-        (load "emacs-lisp/float-sup")))
-+ (if (eq system-type 'darwin)
-+     (progn
-+       (load "term/mac-im")))
-  (message "%s" (garbage-collect))
-  
-  (load "vc-hooks")
-diff -N -r -p emacs.orig/lisp/term/mac-im.el emacs/lisp/term/mac-im.el
-*** emacs.orig/lisp/term/mac-im.el	Thu Jan  1 09:00:00 1970
---- emacs/lisp/term/mac-im.el	Sat Jun  4 18:26:52 2005
-***************
-*** 0 ****
---- 1,196 ----
-+ ;;; mac-im.el --- Input Method for Mac OS X
-+ 
-+ ;; Licensed to the Free Software Foundation.
-+ ;; Copyright (C) 2004 Free Software Foundation, Inc.
-+ 
-+ ;; Keywords: input method, Mac OS X
-+ 
-+ ;; This file is part of GNU Emacs.
-+ 
-+ ;; GNU Emacs is free software; you can redistribute it and/or modify
-+ ;; it under the terms of the GNU General Public License as published by
-+ ;; the Free Software Foundation; either version 2, or (at your option)
-+ ;; any later version.
-+ 
-+ ;; GNU Emacs is distributed in the hope that it will be useful,
-+ ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ ;; GNU General Public License for more details.
-+ 
-+ ;; You should have received a copy of the GNU General Public License
-+ ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-+ ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+ ;; Boston, MA 02111-1307, USA.
-+ 
-+ ;; Written by Taiichi Hashimoto (taiic****@mac*****).
-+ 
-+ (make-face 'mac-im-face)
-+ (set-face-underline-p 'mac-im-face t)
-+ 
-+ (make-face 'mac-im-selection-face)
-+ (set-face-foreground 'mac-im-selection-face "black")
-+ (set-face-background 'mac-im-selection-face "light sky blue")
-+ (set-face-underline-p 'mac-im-selection-face t)
-+ 
-+ (defconst mac-im-keystroke " ")
-+ 
-+ (defvar mac-im-strings nil)
-+ (defvar mac-im-face-alist
-+   '((caret-position . nil)
-+     (raw-text . mac-im-face)
-+     (selected-raw-text . mac-im-face)
-+     (converted-text . mac-im-face)
-+     (selected-converted-text . mac-im-selection-face)))
-+ (defvar mac-im-property-function-alist
-+   '((caret-position . mac-im-move-caret)
-+     (raw-text . mac-im-set-face)
-+     (selected-raw-text . mac-im-set-face)
-+     (converted-text . mac-im-set-face)
-+     (selected-converted-text . mac-im-set-face)))
-+ 
-+ (defvar mac-im-start-position (make-marker))
-+ (make-variable-buffer-local 'mac-im-start-position)
-+ (defvar mac-im-end-position (make-marker))
-+ (make-variable-buffer-local 'mac-im-end-position)
-+ 
-+ 
-+ (add-hook 'mac-im-update-active-input-text-hook
-+  	  (lambda (str fix &rest text-properties)
-+  	    (if isearch-mode
-+  		(mac-im-isearch-mode str fix text-properties)
-+  	      (mac-im-mode str fix text-properties))))
-+ 
-+ 
-+ (defun mac-im-mode (str fix text-properties)
-+   (setq mac-im-strings (append mac-im-strings (list (list str fix text-properties))))
-+   (setq unread-command-events (append (string-to-list mac-im-keystroke) unread-command-events))
-+   )
-+ 
-+ (defun mac-im-update ()
-+   (interactive)
-+   (if mac-im-strings
-+       (unwind-protect
-+ 	  (let* ((arg (car mac-im-strings))
-+ 		 (str (nth 0 arg))
-+ 		 (fix (nth 1 arg))
-+ 		 (text-properties (nth 2 arg)))
-+ 	    (if (and (marker-position mac-im-start-position)
-+ 		     (marker-position mac-im-end-position))
-+ 		(delete-region mac-im-start-position mac-im-end-position)
-+ 	      (progn
-+ 		(setq mac-im-active t)
-+ 		(set-marker mac-im-start-position (point) (current-buffer))
-+ 		(set-marker mac-im-end-position (point) (current-buffer))
-+ 		(set-marker-insertion-type mac-im-start-position nil)
-+ 		(set-marker-insertion-type mac-im-end-position t)))
-+ 	    (insert str)
-+ 	    (if text-properties
-+ 		(mac-im-set-properties text-properties)
-+ 	      (progn
-+ 		(set-marker mac-im-start-position nil nil)
-+ 		(set-marker mac-im-end-position nil nil)))
-+ 	      )
-+ 	(setq mac-im-strings (cdr mac-im-strings))
-+ 	)))
-+ 
-+ (defun mac-im-set-face (property)
-+   (let* ((type (car property))
-+ 	 (face (assq type mac-im-face-alist))
-+ 	 (pos (marker-position mac-im-start-position))
-+ 	 (beg (+ pos (car (cdr property))))
-+  	 (end (+ pos (car (cddr property))))
-+ 	 (obj (make-overlay beg end)))
-+     (if (and face (cdr face) beg end)
-+ 	(overlay-put obj 'face (cdr face))
-+       )))
-+ 
-+ (defun mac-im-move-caret (property)
-+   (let* ((type (car property))
-+ 	 (pos (car (cdr property))))
-+     (goto-char mac-im-start-position)
-+     (forward-char pos)))
-+ 
-+ (defun mac-im-set-property (property)
-+   (let* ((type (car property))
-+ 	 (func (assq type mac-im-property-function-alist)))
-+     (and func (cdr func) (funcall (cdr func) property))))
-+ 
-+ (defun mac-im-set-properties (properties)
-+   (mapcar 'mac-im-set-property properties))
-+ 
-+ 
-+ ;;
-+ ;; isearch-mode for MacOSX System Input Method
-+ ;;
-+ (defun mac-im-isearch-mode (str fix text-properties)
-+   (interactive)
-+   (let ((prefix isearch-string))
-+     (if (> fix 0)
-+ 	(mac-im-isearch-complete prefix str)
-+       (mac-im-isearch-incomplete prefix str text-properties))))
-+ 
-+ (defun mac-im-isearch-complete (prefix str)
-+   (interactive)
-+   (let ((unread-command-events nil)
-+ 	(l (string-to-list str))
-+ 	s)
-+     (setq isearch-message prefix)
-+     (isearch-update)
-+     (while l
-+       (setq s (char-to-string (car l))
-+ 	    l (cdr l))
-+       (isearch-process-search-string s s))
-+     (isearch-update)))
-+ 
-+ (defun mac-im-isearch-incomplete (prefix str text-properties)
-+   (interactive)
-+   (mac-im-isearch-set-faces text-properties str)
-+   (setq isearch-message (concat prefix str))
-+   (isearch-update))
-+ 
-+ (defun mac-im-isearch-set-face (property object)
-+   (let* ((type (car property))
-+ 	 (face (assq type mac-im-face-alist))
-+ 	 (beg (car (cdr property)))
-+ 	 (end (car (cddr property))))
-+   (if (not (null face))
-+       (progn
-+ 	(put (cdr face) 'face (cdr face))
-+ 	(put-text-property beg end 'category (cdr face) object)))
-+   object))
-+ 
-+ (defun mac-im-isearch-set-faces (properties object)
-+   (if (null properties)
-+       object
-+     (mac-im-isearch-set-faces (cdr properties)
-+ 			      (mac-im-isearch-set-face (car properties) object))))
-+ 
-+ 
-+ (defun mac-im-isearch-mode-setup ()
-+   (interactive)
-+   (setq mac-im-isearch-message ""))
-+ 
-+ (defun mac-im-isearch-mode-cleanup ()
-+   (interactive)
-+   (setq mac-im-isearch-message ""))
-+ 
-+ 
-+ ;;
-+ ;; 
-+ ;;
-+ (defun mac-im-toggle-input-method (&optional arg)
-+   (if arg
-+       (progn
-+ 	(setq inactivate-current-input-method-function
-+               'mac-im-toggle-input-method)
-+ 	(mac-im-set-key-script -1))
-+     (progn
-+       (setq current-input-method nil)
-+       (mac-im-set-key-script -1))))
-+ 
-+ 
-+ (register-input-method "MacOSX-IM" "Japanese" 'mac-im-toggle-input-method
-+ 		       "" "MacOSX System IM")
-+ (global-set-key mac-im-keystroke 'mac-im-update)
-+ 
-+ 
-diff -N -r -p emacs.orig/src/Makefile.in emacs/src/Makefile.in
-*** emacs.orig/src/Makefile.in	Fri May  6 20:28:34 2005
---- emacs/src/Makefile.in	Sat Jun  4 18:31:53 2005
-*************** CYGWIN_OBJ = sheap.o
-*** 570,576 ****
-  
-  #ifdef HAVE_CARBON
-  mac = $(dot)$(dot)/mac/
-! MAC_OBJ = mac.o macterm.o macfns.o macmenu.o macselect.o fontset.o fringe.o image.o
-  emacsapp = $(PWD)/$(mac)Emacs.app/
-  emacsappsrc = ${srcdir}/../mac/Emacs.app/
-  #endif
---- 570,576 ----
-  
-  #ifdef HAVE_CARBON
-  mac = $(dot)$(dot)/mac/
-! MAC_OBJ = mac.o macterm.o macfns.o macmenu.o macselect.o fontset.o fringe.o image.o macim.o
-  emacsapp = $(PWD)/$(mac)Emacs.app/
-  emacsappsrc = ${srcdir}/../mac/Emacs.app/
-  #endif
-*************** obj=    dispnew.o frame.o scroll.o xdisp
-*** 597,603 ****
-     in case they are needed there.  */
-  SOME_MACHINE_OBJECTS = sunfns.o dosfns.o msdos.o \
-    xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
-!   mac.o macterm.o macfns.o macmenu.o macselect.o fontset.o \
-    w32.o w32bdf.o w32console.o w32fns.o w32heap.o w32inevt.o \
-    w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o
-  
---- 597,603 ----
-     in case they are needed there.  */
-  SOME_MACHINE_OBJECTS = sunfns.o dosfns.o msdos.o \
-    xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
-!   mac.o macterm.o macfns.o macmenu.o macselect.o macim.o fontset.o \
-    w32.o w32bdf.o w32console.o w32fns.o w32heap.o w32inevt.o \
-    w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o
-  
-*************** macterm.o: blockinput.h atimer.h systime
-*** 1247,1252 ****
---- 1247,1256 ----
-    frame.h charset.h ccl.h dispextern.h fontset.h termhooks.h termopts.h \
-    termchar.h gnu.h disptab.h buffer.h window.h keyboard.h $(INTERVAL_SRC) \
-    process.h coding.h $(config_h)
-+ macim.o: blockinput.h atimer.h systime.h syssignal.h macterm.h macgui.h \
-+   frame.h charset.h ccl.h dispextern.h fontset.h termhooks.h termopts.h \
-+   termchar.h gnu.h disptab.h buffer.h window.h keyboard.h $(INTERVAL_SRC) \
-+   process.h coding.h $(config_h)
-  macselect.o: blockinput.h macterm.h macgui.h frame.h $(config_h)
-  
-  ${emacsapp}Contents/Resources/English.lproj:
-diff -N -r -p emacs.orig/src/emacs.c emacs/src/emacs.c
-*** emacs.orig/src/emacs.c	Sat May 14 08:28:35 2005
---- emacs/src/emacs.c	Sat Jun  4 18:30:42 2005
-*************** main (argc, argv
-*** 1640,1645 ****
---- 1640,1646 ----
-        syms_of_macmenu ();
-        syms_of_macselect ();
-        syms_of_fontset ();
-+       syms_of_macim ();
-  #endif /* MAC_OSX && HAVE_CARBON */
-  
-  #ifdef SYMS_SYSTEM
-diff -N -r -p emacs.orig/src/macim.c emacs/src/macim.c
-*** emacs.orig/src/macim.c	Thu Jan  1 09:00:00 1970
---- emacs/src/macim.c	Sat Jun  4 18:26:52 2005
-***************
-*** 0 ****
---- 1,414 ----
-+ /* Implementation of Inline Input Method for MacOS X.
-+    Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-+ 
-+ This file is part of GNU Emacs.
-+ 
-+ GNU Emacs is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+ 
-+ GNU Emacs is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ GNU General Public License for more details.
-+ 
-+ You should have received a copy of the GNU General Public License
-+ along with GNU Emacs; see the file COPYING.  If not, write to
-+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+ Boston, MA 02111-1307, USA.  */
-+ 
-+ /* Written by Taiichi Hashimoto (taiic****@mac*****).  */
-+ 
-+ 
-+ #include <config.h>
-+ #include <signal.h>
-+ #include <stdio.h>
-+ #include <stdlib.h>
-+ #include "lisp.h"
-+ #include "charset.h"
-+ #include "blockinput.h"
-+ 
-+ #include "macterm.h"
-+ 
-+ #ifndef MAC_OSX
-+ #include <alloca.h>
-+ #endif
-+ 
-+ #ifdef MAC_OSX
-+ #undef mktime
-+ #undef DEBUG
-+ #undef free
-+ #undef malloc
-+ #undef realloc
-+ /* Macros max and min defined in lisp.h conflict with those in
-+    precompiled header Carbon.h.  */
-+ #undef max
-+ #undef min
-+ #undef init_process
-+ #include <Carbon/Carbon.h>
-+ #undef free
-+ #define free unexec_free
-+ #undef malloc
-+ #define malloc unexec_malloc
-+ #undef realloc
-+ #define realloc unexec_realloc
-+ #undef min
-+ #define min(a, b) ((a) < (b) ? (a) : (b))
-+ #undef max
-+ #define max(a, b) ((a) > (b) ? (a) : (b))
-+ #undef init_process
-+ #define init_process emacs_init_process
-+ /* USE_CARBON_EVENTS determines if the Carbon Event Manager is used to
-+    obtain events from the event queue.  If set to 0, WaitNextEvent is
-+    used instead.  */
-+ #define USE_CARBON_EVENTS 1
-+ #else /* not MAC_OSX */
-+ #include <Quickdraw.h>
-+ #include <ToolUtils.h>
-+ #include <Sound.h>
-+ #include <Events.h>
-+ #include <Script.h>
-+ #include <Resources.h>
-+ #include <Fonts.h>
-+ #include <TextUtils.h>
-+ #include <LowMem.h>
-+ #include <Controls.h>
-+ #if defined (__MRC__) || (__MSL__ >= 0x6000)
-+ #include <ControlDefinitions.h>
-+ #endif
-+ #include <Gestalt.h>
-+ 
-+ #if __profile__
-+ #include <profiler.h>
-+ #endif
-+ #endif /* not MAC_OSX */
-+ 
-+ #include "systty.h"
-+ #include "systime.h"
-+ #include "atimer.h"
-+ #include "keymap.h"
-+ 
-+ #include <ctype.h>
-+ #include <errno.h>
-+ #include <setjmp.h>
-+ #include <sys/stat.h>
-+ 
-+ #include "keyboard.h"
-+ #include "frame.h"
-+ #include "dispextern.h"
-+ #include "fontset.h"
-+ #include "termhooks.h"
-+ #include "termopts.h"
-+ #include "termchar.h"
-+ #include "gnu.h"
-+ #include "disptab.h"
-+ #include "buffer.h"
-+ #include "window.h"
-+ #include "intervals.h"
-+ #include "composite.h"
-+ #include "coding.h"
-+ 
-+ #ifdef MAC_OSX
-+ 
-+ static EventTypeSpec events[] = {
-+   { kEventClassTextInput, kEventTextInputOffsetToPos },
-+   { kEventClassTextInput, kEventTextInputUpdateActiveInputArea },
-+   { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent },
-+   { kEventClassTextInput, kEventTextInputPosToOffset },
-+   { kEventClassTextInput, kEventTextInputGetSelectedText }
-+ };
-+ 
-+ static EventHandlerRef mac_im_handler = NULL;
-+ static EventHandlerUPP mac_im_handlerUPP = NULL;
-+ static TSMDocumentID mac_tsm_doc_id;
-+ 
-+ static Lisp_Object Qmac_im_offset_to_pos_hook;
-+ static Lisp_Object Qmac_im_pos_to_offset_hook;
-+ static Lisp_Object Qmac_im_update_active_input_text_hook;
-+ static Lisp_Object Qmac_im_get_selected_text_hook;
-+ static Lisp_Object Vmac_im_inline_input_mode;
-+ 
-+ static int mac_im_active = FALSE;
-+ static Point mac_im_pt;
-+ 
-+ pascal OSStatus mac_handle_im_event(EventHandlerCallRef, EventRef, void *);
-+ void mac_im_initialize(void);
-+ 
-+ void mac_im_set_cursor_position(int x, int y, int height)
-+ {
-+   mac_im_pt.h = x;
-+   mac_im_pt.v = y + height;
-+   LocalToGlobal(&mac_im_pt);
-+ }
-+ 
-+ DEFUN ("mac-im-set-inline-input-method", Fmac_im_set_inline_input_method,
-+        Smac_im_set_inline_input_method, 1, 1, 0,
-+        doc: )
-+      (on_p)
-+      Lisp_Object on_p;
-+ {
-+   OSStatus err;
-+   
-+   if (NILP(on_p)) {
-+     err = DeactivateTSMDocument(mac_tsm_doc_id);
-+     Vmac_im_inline_input_mode = Qnil;
-+   } else {
-+     err = ActivateTSMDocument(mac_tsm_doc_id);
-+     Vmac_im_inline_input_mode = Qt;
-+   }
-+ 
-+   if (err != noErr) abort ();
-+ 
-+   return Qnil;
-+ }
-+ 
-+ 
-+ DEFUN ("mac-im-set-key-script", Fmac_im_set_key_script,
-+        Smac_im_set_key_script, 1, 1, 0,
-+        doc: )
-+      (code)
-+      Lisp_Object code;
-+ {
-+ 
-+   KeyScript(XINT(code));
-+ 
-+   return Qnil;
-+ }
-+ 
-+ DEFUN ("mac-im-get-key-script", Fmac_im_get_key_script,
-+        Smac_im_get_key_script, 0, 0, 0,
-+        doc: )
-+      ()
-+ {
-+   return make_number(GetScriptManagerVariable(smKeyScript));
-+ }
-+ 
-+ pascal OSStatus
-+ mac_handle_im_event(EventHandlerCallRef er, EventRef event, void *data)
-+ {
-+   UInt32 ekind = GetEventKind(event), eclass = GetEventClass(event);
-+   OSStatus ret = noErr, err;
-+   Lisp_Object argv[1024];
-+   int argc = 0;
-+ 
-+   switch(eclass) {
-+   case kEventClassTextInput:
-+     switch(ekind) {
-+     case kEventTextInputOffsetToPos:
-+       {
-+ 	err = SetEventParameter(event, kEventParamTextInputReplyPoint,
-+ 				typeQDPoint, sizeof(mac_im_pt), &mac_im_pt);
-+ 	if(!err == noErr) abort();
-+ 	argv[argc++] = Qmac_im_offset_to_pos_hook;
-+       }
-+       break;
-+     case kEventTextInputPosToOffset:
-+       argv[argc++] = Qmac_im_pos_to_offset_hook;
-+       break;
-+     case kEventTextInputUpdateActiveInputArea:
-+       {
-+ 	UInt32 src_nbytes = 0, des_nbytes = 0, array_nbytes = 0, fixed_nbytes = 0;
-+ 	char *src = NULL, *des = NULL;
-+ 	TextRangeArray *array = NULL;
-+ 	Lisp_Object triple[3];
-+ 	int i;
-+ 
-+ 	err = GetEventParameter(event, kEventParamTextInputSendText,
-+ 				typeChar,
-+ 				NULL, 0, &src_nbytes, NULL);
-+ 	
-+ 	if (err == noErr && src_nbytes) {
-+ 	  src = (char *)xmalloc(src_nbytes + 1);
-+ 	  memset(src, 0, src_nbytes + 1);
-+ 	  err = GetEventParameter(event, kEventParamTextInputSendText,
-+ 				  typeChar,
-+ 				  NULL, src_nbytes, NULL, src);
-+ 	  if (err == noErr) {
-+ 	    des_nbytes = decoding_buffer_size(&keyboard_coding, src_nbytes);
-+ 	    des = (char *)xmalloc(des_nbytes + 1);
-+ 	    memset(des, 0, des_nbytes + 1);
-+ 	  
-+ 	    /* CString -> String for Emacs */
-+ 	    decode_coding(&keyboard_coding, src, des, src_nbytes, des_nbytes);
-+ 
-+ 	    /* add arguments for hook */
-+ 	    argv[argc++] = Qmac_im_update_active_input_text_hook;
-+ 	    argv[argc++] = make_string(des, strlen(des));
-+ 	    
-+ 	    /* get Fixed String Length (bytes) from TSM */
-+ 	    err = GetEventParameter(event, kEventParamTextInputSendFixLen,
-+ 				    typeLongInteger, 
-+ 				    NULL, sizeof(fixed_nbytes), NULL, &fixed_nbytes);
-+ 	
-+ 	    /* add arguments for hook */
-+ 	    if (err == noErr && fixed_nbytes > 0) {
-+ 	      memset(des, 0, des_nbytes);
-+ 	      decode_coding(&keyboard_coding,
-+ 			    src, des,
-+ 			    fixed_nbytes, des_nbytes);
-+ 	      argv[argc++] = Flength(make_string(des, strlen(des)));
-+ 	      mac_im_active = FALSE;
-+ 	    } else {
-+ 	      fixed_nbytes = 0;
-+ 	      argv[argc++] = make_number(0);
-+ 	      mac_im_active = TRUE;
-+ 	    }
-+ 	  
-+ 	    err = GetEventParameter(event, kEventParamTextInputSendHiliteRng,
-+ 				    typeTextRangeArray,
-+ 				    NULL, 0, &array_nbytes, NULL);
-+ 	  
-+ 	    if (err == noErr && array_nbytes) {
-+ 	      array = (TextRangeArray *)xmalloc(array_nbytes);
-+ 	    
-+ 	      err = GetEventParameter(event, kEventParamTextInputSendHiliteRng,
-+ 				      typeTextRangeArray,
-+ 				      NULL, array_nbytes, NULL, array);
-+ 	      if (err == noErr) {
-+ 		for (i = 0; i < array->fNumOfRanges; i++) {
-+ 		  if (argc < 1024) {
-+ 		    if (fixed_nbytes <= array->fRange[i].fStart
-+ 			&& array->fRange[i].fStart <= array->fRange[i].fEnd
-+ 			&& array->fRange[i].fEnd <= src_nbytes) {
-+ 
-+ 		      memset(des, 0, des_nbytes);
-+ 		      decode_coding(&keyboard_coding,
-+ 				    src, des,
-+ 				    array->fRange[i].fStart, des_nbytes);
-+ 		      triple[1] = Flength(make_string(des, strlen(des)));
-+ 		      
-+ 		      memset(des, 0, des_nbytes);
-+ 		      decode_coding(&keyboard_coding,
-+ 				    src, des,
-+ 				    array->fRange[i].fEnd, des_nbytes);
-+ 		      triple[2] = Flength(make_string(des, strlen(des)));
-+ 		      
-+ 		      switch (array->fRange[i].fHiliteStyle) {
-+ 		      case kCaretPosition:
-+ 			triple[0] = intern("caret-position");
-+ 			argv[argc++] = Flist(3, triple);
-+ 			break;
-+ 		      case kRawText:
-+ 			triple[0] = intern("raw-text");
-+ 			argv[argc++] = Flist(3, triple);
-+ 			break;
-+ 		      case kSelectedRawText:
-+ 			triple[0] = intern("selected-raw-text");
-+ 			argv[argc++] = Flist(3, triple);
-+ 			break;
-+ 		      case kConvertedText:
-+ 			triple[0] = intern("converted-text");
-+ 			argv[argc++] = Flist(3, triple);
-+ 			break;
-+ 		      case kSelectedConvertedText:
-+ 			triple[0] = intern("selected-converted-text");
-+ 			argv[argc++] = Flist(3, triple);
-+ 			break;
-+ 		      default:
-+ 			break;
-+ 		      }
-+ 		    }
-+ 		  }
-+ 		}
-+ 	      }
-+ 	    }
-+ 	  }
-+ 	  if (src) xfree(src);
-+ 	  if (des) xfree(des);
-+ 	  if (array) xfree(array);
-+ 	} else { /* src_nbytes == 0 */
-+ 	  /* run hook */
-+ 	  mac_im_active = FALSE;
-+ 	  argv[argc++] = Qmac_im_update_active_input_text_hook;
-+ 	  argv[argc++] = make_string("", 0);
-+ 	  argv[argc++] = make_number(0);
-+ 	}
-+       }
-+       break;
-+     case kEventTextInputGetSelectedText:
-+       break;
-+     case kEventTextInputUnicodeForKeyEvent:
-+       if (!mac_im_active)
-+ 	ret = eventNotHandledErr;
-+       break;
-+     default:
-+       break;
-+     }
-+     break;
-+   default:
-+     break;
-+   }
-+ 
-+   if (argc) {
-+     Frun_hook_with_args(argc, argv);
-+   }
-+   redisplay();
-+   
-+   return ret;
-+ }
-+ 
-+ int mac_im_throw_input_to_system(void)
-+ {
-+   int ret = TRUE;
-+ 
-+   Fmac_im_set_inline_input_method(Vmac_im_inline_input_mode);
-+   if (this_command_key_count)
-+     ret = FALSE;
-+   else if (!NILP(current_buffer->read_only))
-+     ret = FALSE;
-+   else if (cursor_in_echo_area)
-+     ret = FALSE;
-+ 
-+   return ret;
-+ }
-+ 
-+ void syms_of_macim(void)
-+ {
-+   staticpro (&Qmac_im_offset_to_pos_hook);
-+   Qmac_im_offset_to_pos_hook = intern("mac-im-offset-to-pos-hook");
-+ 
-+   staticpro (&Qmac_im_pos_to_offset_hook);
-+   Qmac_im_pos_to_offset_hook = intern("mac-im-pos-to-offset-hook");
-+ 
-+   staticpro (&Qmac_im_update_active_input_text_hook);
-+   Qmac_im_update_active_input_text_hook = intern("mac-im-update-active-input-text-hook");
-+ 
-+   staticpro (&Qmac_im_get_selected_text_hook);
-+   Qmac_im_get_selected_text_hook = intern("mac-im-get-selected-text-hook");
-+ 
-+   DEFVAR_LISP ("mac-im-inline-input-mode", &Vmac_im_inline_input_mode,
-+ 	       doc: /**/);
-+   Vmac_im_inline_input_mode = Qt;
-+ }
-+ 
-+ void mac_im_initialize(void)
-+ {
-+   if(!mac_im_handler) {
-+     OSErr err;
-+     InterfaceTypeList itl = { kTextService };
-+ 
-+     err = NewTSMDocument(1, itl, &mac_tsm_doc_id, 715);
-+     if (err != noErr) abort ();
-+     
-+     err = ActivateTSMDocument(mac_tsm_doc_id);
-+     if (err != noErr) abort ();
-+     
-+     err = InstallEventHandler(GetApplicationEventTarget(),
-+ 			      NewEventHandlerUPP(mac_handle_im_event),
-+ 			      GetEventTypeCount(events),
-+ 			      events,
-+ 			      NULL,
-+ 			      &mac_im_handler);
-+     if (err != noErr) abort ();
-+   }
-+   
-+   mac_im_pt.h = 0;
-+   mac_im_pt.v = 0;
-+ 
-+   defsubr (&Smac_im_set_inline_input_method);
-+   defsubr (&Smac_im_set_key_script);
-+   defsubr (&Smac_im_get_key_script);
-+ }
-+ 
-+ #endif
-diff -N -r -p emacs.orig/src/macterm.c emacs/src/macterm.c
-*** emacs.orig/src/macterm.c	Wed Jun  1 17:20:50 2005
---- emacs/src/macterm.c	Sat Jun  4 18:29:11 2005
-*************** mac_draw_window_cursor (w, glyph_row, x,
-*** 5278,5283 ****
---- 5277,5288 ----
-  	default:
-  	  abort ();
-  	}
-+ 
-+ #ifdef MAC_OSX
-+       if (active_p)
-+ 	mac_im_set_cursor_position(x, y, glyph_row->height);
-+ #endif
-+ 
-      }
-  }
-  
-*************** XTread_socket (sd, expected, hold_quit)
-*** 9240,9246 ****
-  		    || !(er.modifiers & controlKey))
-  		&& (!NILP (Vmac_command_key_is_meta)
-  		    && NILP (Vmac_option_modifier)
-! 		    || !(er.modifiers & optionKey)))
-  	      if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
-  		  != eventNotHandledErr)
-  		break;
---- 9245,9252 ----
-  		    || !(er.modifiers & controlKey))
-  		&& (!NILP (Vmac_command_key_is_meta)
-  		    && NILP (Vmac_option_modifier)
-! 		    || !(er.modifiers & optionKey))
-! 		&& mac_im_throw_input_to_system())
-  	      if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
-  		  != eventNotHandledErr)
-  		break;
-*************** mac_initialize ()
-*** 10107,10112 ****
---- 10113,10119 ----
-    init_service_handler ();
-  
-    init_quit_char_handler ();
-+   mac_im_initialize();
-  #endif	/* MAC_OSX */
-  
-    init_command_handler ();
Index: CarbonEmacsPackage/GPL/patch/inline_patch-20041229/emacs-inline.patch.orig
diff -u CarbonEmacsPackage/GPL/patch/inline_patch-20041229/emacs-inline.patch.orig:1.1 CarbonEmacsPackage/GPL/patch/inline_patch-20041229/emacs-inline.patch.orig:removed
--- CarbonEmacsPackage/GPL/patch/inline_patch-20041229/emacs-inline.patch.orig:1.1	Sun Oct 23 13:18:04 2005
+++ CarbonEmacsPackage/GPL/patch/inline_patch-20041229/emacs-inline.patch.orig	Thu Dec 29 19:12:41 2005
@@ -1,765 +0,0 @@
-diff -r -N -p --exclude=*.elc ../emacs-1229/lisp/loadup.el lisp/loadup.el
-*** ../emacs-1229/lisp/loadup.el	Tue Dec 28 01:24:54 2004
---- lisp/loadup.el	Sun Jan  2 13:18:03 2005
-***************
-*** 188,193 ****
---- 188,196 ----
-  (if (fboundp 'atan)	; preload some constants and
-      (progn		; floating pt. functions if we have float support.
-        (load "emacs-lisp/float-sup")))
-+ (if (eq system-type 'darwin)
-+     (progn
-+       (load "term/mac-im")))
-  (message "%s" (garbage-collect))
-  
-  (load "vc-hooks")
-diff -r -N -p --exclude=*.elc ../emacs-1229/lisp/term/mac-im.el lisp/term/mac-im.el
-*** ../emacs-1229/lisp/term/mac-im.el	Thu Jan  1 09:00:00 1970
---- lisp/term/mac-im.el	Sun Jan  2 13:25:14 2005
-***************
-*** 0 ****
---- 1,196 ----
-+ ;;; mac-im.el --- Input Method for Mac OS X
-+ 
-+ ;; Licensed to the Free Software Foundation.
-+ ;; Copyright (C) 2004 Free Software Foundation, Inc.
-+ 
-+ ;; Keywords: input method, Mac OS X
-+ 
-+ ;; This file is part of GNU Emacs.
-+ 
-+ ;; GNU Emacs is free software; you can redistribute it and/or modify
-+ ;; it under the terms of the GNU General Public License as published by
-+ ;; the Free Software Foundation; either version 2, or (at your option)
-+ ;; any later version.
-+ 
-+ ;; GNU Emacs is distributed in the hope that it will be useful,
-+ ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ ;; GNU General Public License for more details.
-+ 
-+ ;; You should have received a copy of the GNU General Public License
-+ ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-+ ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+ ;; Boston, MA 02111-1307, USA.
-+ 
-+ ;; Written by Taiichi Hashimoto (taiic****@mac*****).
-+ 
-+ (make-face 'mac-im-face)
-+ (set-face-underline-p 'mac-im-face t)
-+ 
-+ (make-face 'mac-im-selection-face)
-+ (set-face-foreground 'mac-im-selection-face "black")
-+ (set-face-background 'mac-im-selection-face "light sky blue")
-+ (set-face-underline-p 'mac-im-selection-face t)
-+ 
-+ (defconst mac-im-keystroke " ")
-+ 
-+ (defvar mac-im-strings nil)
-+ (defvar mac-im-face-alist
-+   '((caret-position . nil)
-+     (raw-text . mac-im-face)
-+     (selected-raw-text . mac-im-face)
-+     (converted-text . mac-im-face)
-+     (selected-converted-text . mac-im-selection-face)))
-+ (defvar mac-im-property-function-alist
-+   '((caret-position . mac-im-move-caret)
-+     (raw-text . mac-im-set-face)
-+     (selected-raw-text . mac-im-set-face)
-+     (converted-text . mac-im-set-face)
-+     (selected-converted-text . mac-im-set-face)))
-+ 
-+ (defvar mac-im-start-position (make-marker))
-+ (make-variable-buffer-local 'mac-im-start-position)
-+ (defvar mac-im-end-position (make-marker))
-+ (make-variable-buffer-local 'mac-im-end-position)
-+ 
-+ 
-+ (add-hook 'mac-im-update-active-input-text-hook
-+  	  (lambda (str fix &rest text-properties)
-+  	    (if isearch-mode
-+  		(mac-im-isearch-mode str fix text-properties)
-+  	      (mac-im-mode str fix text-properties))))
-+ 
-+ 
-+ (defun mac-im-mode (str fix text-properties)
-+   (setq mac-im-strings (append mac-im-strings (list (list str fix text-properties))))
-+   (setq unread-command-events (append (string-to-list mac-im-keystroke) unread-command-events))
-+   )
-+ 
-+ (defun mac-im-update ()
-+   (interactive)
-+   (if mac-im-strings
-+       (unwind-protect
-+ 	  (let* ((arg (car mac-im-strings))
-+ 		 (str (nth 0 arg))
-+ 		 (fix (nth 1 arg))
-+ 		 (text-properties (nth 2 arg)))
-+ 	    (if (and (marker-position mac-im-start-position)
-+ 		     (marker-position mac-im-end-position))
-+ 		(delete-region mac-im-start-position mac-im-end-position)
-+ 	      (progn
-+ 		(setq mac-im-active t)
-+ 		(set-marker mac-im-start-position (point) (current-buffer))
-+ 		(set-marker mac-im-end-position (point) (current-buffer))
-+ 		(set-marker-insertion-type mac-im-start-position nil)
-+ 		(set-marker-insertion-type mac-im-end-position t)))
-+ 	    (insert str)
-+ 	    (if text-properties
-+ 		(mac-im-set-properties text-properties)
-+ 	      (progn
-+ 		(set-marker mac-im-start-position nil nil)
-+ 		(set-marker mac-im-end-position nil nil)))
-+ 	      )
-+ 	(setq mac-im-strings (cdr mac-im-strings))
-+ 	)))
-+ 
-+ (defun mac-im-set-face (property)
-+   (let* ((type (car property))
-+ 	 (face (assq type mac-im-face-alist))
-+ 	 (pos (marker-position mac-im-start-position))
-+ 	 (beg (+ pos (car (cdr property))))
-+  	 (end (+ pos (car (cddr property))))
-+ 	 (obj (make-overlay beg end)))
-+     (if (and face (cdr face) beg end)
-+ 	(overlay-put obj 'face (cdr face))
-+       )))
-+ 
-+ (defun mac-im-move-caret (property)
-+   (let* ((type (car property))
-+ 	 (pos (car (cdr property))))
-+     (goto-char mac-im-start-position)
-+     (forward-char pos)))
-+ 
-+ (defun mac-im-set-property (property)
-+   (let* ((type (car property))
-+ 	 (func (assq type mac-im-property-function-alist)))
-+     (and func (cdr func) (funcall (cdr func) property))))
-+ 
-+ (defun mac-im-set-properties (properties)
-+   (mapcar 'mac-im-set-property properties))
-+ 
-+ 
-+ ;;
-+ ;; isearch-mode for MacOSX System Input Method
-+ ;;
-+ (defun mac-im-isearch-mode (str fix text-properties)
-+   (interactive)
-+   (let ((prefix isearch-string))
-+     (if (> fix 0)
-+ 	(mac-im-isearch-complete prefix str)
-+       (mac-im-isearch-incomplete prefix str text-properties))))
-+ 
-+ (defun mac-im-isearch-complete (prefix str)
-+   (interactive)
-+   (let ((unread-command-events nil)
-+ 	(l (string-to-list str))
-+ 	s)
-+     (setq isearch-message prefix)
-+     (isearch-update)
-+     (while l
-+       (setq s (char-to-string (car l))
-+ 	    l (cdr l))
-+       (isearch-process-search-string s s))
-+     (isearch-update)))
-+ 
-+ (defun mac-im-isearch-incomplete (prefix str text-properties)
-+   (interactive)
-+   (mac-im-isearch-set-faces text-properties str)
-+   (setq isearch-message (concat prefix str))
-+   (isearch-update))
-+ 
-+ (defun mac-im-isearch-set-face (property object)
-+   (let* ((type (car property))
-+ 	 (face (assq type mac-im-face-alist))
-+ 	 (beg (car (cdr property)))
-+ 	 (end (car (cddr property))))
-+   (if (not (null face))
-+       (progn
-+ 	(put (cdr face) 'face (cdr face))
-+ 	(put-text-property beg end 'category (cdr face) object)))
-+   object))
-+ 
-+ (defun mac-im-isearch-set-faces (properties object)
-+   (if (null properties)
-+       object
-+     (mac-im-isearch-set-faces (cdr properties)
-+ 			      (mac-im-isearch-set-face (car properties) object))))
-+ 
-+ 
-+ (defun mac-im-isearch-mode-setup ()
-+   (interactive)
-+   (setq mac-im-isearch-message ""))
-+ 
-+ (defun mac-im-isearch-mode-cleanup ()
-+   (interactive)
-+   (setq mac-im-isearch-message ""))
-+ 
-+ 
-+ ;;
-+ ;; 
-+ ;;
-+ (defun mac-im-toggle-input-method (&optional arg)
-+   (if arg
-+       (progn
-+ 	(setq inactivate-current-input-method-function
-+               'mac-im-toggle-input-method)
-+ 	(mac-im-set-key-script -1))
-+     (progn
-+       (setq current-input-method nil)
-+       (mac-im-set-key-script -1))))
-+ 
-+ 
-+ (register-input-method "MacOSX-IM" "Japanese" 'mac-im-toggle-input-method
-+ 		       "" "MacOSX System IM")
-+ (global-set-key mac-im-keystroke 'mac-im-update)
-+ 
-+ 
-diff -r -N -p --exclude=*.orig ../emacs-1229/src/Makefile.in src/Makefile.in
-*** ../emacs-1229/src/Makefile.in	Tue Nov 30 14:57:27 2004
---- src/Makefile.in	Sun Jan  2 13:18:03 2005
-*************** CYGWIN_OBJ = sheap.o
-*** 570,576 ****
-  
-  #ifdef HAVE_CARBON
-  mac = $(dot)$(dot)/mac/
-! MAC_OBJ = mac.o macterm.o macfns.o macmenu.o fontset.o fringe.o image.o
-  emacsapp = $(PWD)/$(mac)Emacs.app/
-  emacsappsrc = ${srcdir}/../mac/Emacs.app/
-  #endif
---- 570,576 ----
-  
-  #ifdef HAVE_CARBON
-  mac = $(dot)$(dot)/mac/
-! MAC_OBJ = mac.o macterm.o macfns.o macmenu.o fontset.o fringe.o image.o macim.o
-  emacsapp = $(PWD)/$(mac)Emacs.app/
-  emacsappsrc = ${srcdir}/../mac/Emacs.app/
-  #endif
-*************** obj=    dispnew.o frame.o scroll.o xdisp
-*** 597,603 ****
-     in case they are needed there.  */
-  SOME_MACHINE_OBJECTS = sunfns.o dosfns.o msdos.o \
-    xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
-!   mac.o macterm.o macfns.o macmenu.o fontset.o \
-    w32.o w32bdf.o w32console.o w32fns.o w32heap.o w32inevt.o \
-    w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o
-  
---- 597,603 ----
-     in case they are needed there.  */
-  SOME_MACHINE_OBJECTS = sunfns.o dosfns.o msdos.o \
-    xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
-!   mac.o macterm.o macfns.o macmenu.o macim.o fontset.o \
-    w32.o w32bdf.o w32console.o w32fns.o w32heap.o w32inevt.o \
-    w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o
-  
-*************** macfns.o: macfns.c charset.h macterm.h m
-*** 1233,1238 ****
---- 1233,1242 ----
-  macmenu.o: macmenu.c termhooks.h frame.h window.h dispextern.h macgui.h \
-    keyboard.h blockinput.h atimer.h systime.h buffer.h macterm.h $(config_h)
-  macterm.o: blockinput.h atimer.h systime.h syssignal.h macterm.h macgui.h \
-+   frame.h charset.h ccl.h dispextern.h fontset.h termhooks.h termopts.h \
-+   termchar.h gnu.h disptab.h buffer.h window.h keyboard.h $(INTERVAL_SRC) \
-+   process.h coding.h $(config_h)
-+ macim.o: blockinput.h atimer.h systime.h syssignal.h macterm.h macgui.h \
-    frame.h charset.h ccl.h dispextern.h fontset.h termhooks.h termopts.h \
-    termchar.h gnu.h disptab.h buffer.h window.h keyboard.h $(INTERVAL_SRC) \
-    process.h coding.h $(config_h)
-diff -r -N -p --exclude=*.orig ../emacs-1229/src/emacs.c src/emacs.c
-*** ../emacs-1229/src/emacs.c	Tue Dec 28 02:27:30 2004
---- src/emacs.c	Sun Jan  2 13:18:03 2005
-*************** main (argc, argv
-*** 1629,1634 ****
---- 1629,1635 ----
-        syms_of_macfns ();
-        syms_of_macmenu ();
-        syms_of_fontset ();
-+       syms_of_macim ();
-  #endif /* HAVE_CARBON */
-  
-  #ifdef SYMS_SYSTEM
-diff -r -N -p --exclude=*.orig ../emacs-1229/src/macim.c src/macim.c
-*** ../emacs-1229/src/macim.c	Thu Jan  1 09:00:00 1970
---- src/macim.c	Sun Jan  2 13:18:03 2005
-***************
-*** 0 ****
---- 1,414 ----
-+ /* Implementation of Inline Input Method for MacOS X.
-+    Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-+ 
-+ This file is part of GNU Emacs.
-+ 
-+ GNU Emacs is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 2, or (at your option)
-+ any later version.
-+ 
-+ GNU Emacs is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ GNU General Public License for more details.
-+ 
-+ You should have received a copy of the GNU General Public License
-+ along with GNU Emacs; see the file COPYING.  If not, write to
-+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+ Boston, MA 02111-1307, USA.  */
-+ 
-+ /* Written by Taiichi Hashimoto (taiic****@mac*****).  */
-+ 
-+ 
-+ #include <config.h>
-+ #include <signal.h>
-+ #include <stdio.h>
-+ #include <stdlib.h>
-+ #include "lisp.h"
-+ #include "charset.h"
-+ #include "blockinput.h"
-+ 
-+ #include "macterm.h"
-+ 
-+ #ifndef MAC_OSX
-+ #include <alloca.h>
-+ #endif
-+ 
-+ #ifdef MAC_OSX
-+ #undef mktime
-+ #undef DEBUG
-+ #undef free
-+ #undef malloc
-+ #undef realloc
-+ /* Macros max and min defined in lisp.h conflict with those in
-+    precompiled header Carbon.h.  */
-+ #undef max
-+ #undef min
-+ #undef init_process
-+ #include <Carbon/Carbon.h>
-+ #undef free
-+ #define free unexec_free
-+ #undef malloc
-+ #define malloc unexec_malloc
-+ #undef realloc
-+ #define realloc unexec_realloc
-+ #undef min
-+ #define min(a, b) ((a) < (b) ? (a) : (b))
-+ #undef max
-+ #define max(a, b) ((a) > (b) ? (a) : (b))
-+ #undef init_process
-+ #define init_process emacs_init_process
-+ /* USE_CARBON_EVENTS determines if the Carbon Event Manager is used to
-+    obtain events from the event queue.  If set to 0, WaitNextEvent is
-+    used instead.  */
-+ #define USE_CARBON_EVENTS 1
-+ #else /* not MAC_OSX */
-+ #include <Quickdraw.h>
-+ #include <ToolUtils.h>
-+ #include <Sound.h>
-+ #include <Events.h>
-+ #include <Script.h>
-+ #include <Resources.h>
-+ #include <Fonts.h>
-+ #include <TextUtils.h>
-+ #include <LowMem.h>
-+ #include <Controls.h>
-+ #if defined (__MRC__) || (__MSL__ >= 0x6000)
-+ #include <ControlDefinitions.h>
-+ #endif
-+ #include <Gestalt.h>
-+ 
-+ #if __profile__
-+ #include <profiler.h>
-+ #endif
-+ #endif /* not MAC_OSX */
-+ 
-+ #include "systty.h"
-+ #include "systime.h"
-+ #include "atimer.h"
-+ #include "keymap.h"
-+ 
-+ #include <ctype.h>
-+ #include <errno.h>
-+ #include <setjmp.h>
-+ #include <sys/stat.h>
-+ 
-+ #include "keyboard.h"
-+ #include "frame.h"
-+ #include "dispextern.h"
-+ #include "fontset.h"
-+ #include "termhooks.h"
-+ #include "termopts.h"
-+ #include "termchar.h"
-+ #include "gnu.h"
-+ #include "disptab.h"
-+ #include "buffer.h"
-+ #include "window.h"
-+ #include "intervals.h"
-+ #include "composite.h"
-+ #include "coding.h"
-+ 
-+ #ifdef MAC_OSX
-+ 
-+ static EventTypeSpec events[] = {
-+   { kEventClassTextInput, kEventTextInputOffsetToPos },
-+   { kEventClassTextInput, kEventTextInputUpdateActiveInputArea },
-+   { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent },
-+   { kEventClassTextInput, kEventTextInputPosToOffset },
-+   { kEventClassTextInput, kEventTextInputGetSelectedText }
-+ };
-+ 
-+ static EventHandlerRef mac_im_handler = NULL;
-+ static EventHandlerUPP mac_im_handlerUPP = NULL;
-+ static TSMDocumentID mac_tsm_doc_id;
-+ 
-+ static Lisp_Object Qmac_im_offset_to_pos_hook;
-+ static Lisp_Object Qmac_im_pos_to_offset_hook;
-+ static Lisp_Object Qmac_im_update_active_input_text_hook;
-+ static Lisp_Object Qmac_im_get_selected_text_hook;
-+ static Lisp_Object Vmac_im_inline_input_mode;
-+ 
-+ static int mac_im_active = FALSE;
-+ static Point mac_im_pt;
-+ 
-+ pascal OSStatus mac_handle_im_event(EventHandlerCallRef, EventRef, void *);
-+ void mac_im_initialize(void);
-+ 
-+ void mac_im_set_cursor_position(int x, int y, int height)
-+ {
-+   mac_im_pt.h = x;
-+   mac_im_pt.v = y + height;
-+   LocalToGlobal(&mac_im_pt);
-+ }
-+ 
-+ DEFUN ("mac-im-set-inline-input-method", Fmac_im_set_inline_input_method,
-+        Smac_im_set_inline_input_method, 1, 1, 0,
-+        doc: )
-+      (on_p)
-+      Lisp_Object on_p;
-+ {
-+   OSStatus err;
-+   
-+   if (NILP(on_p)) {
-+     err = DeactivateTSMDocument(mac_tsm_doc_id);
-+     Vmac_im_inline_input_mode = Qnil;
-+   } else {
-+     err = ActivateTSMDocument(mac_tsm_doc_id);
-+     Vmac_im_inline_input_mode = Qt;
-+   }
-+ 
-+   if (err != noErr) abort ();
-+ 
-+   return Qnil;
-+ }
-+ 
-+ 
-+ DEFUN ("mac-im-set-key-script", Fmac_im_set_key_script,
-+        Smac_im_set_key_script, 1, 1, 0,
-+        doc: )
-+      (code)
-+      Lisp_Object code;
-+ {
-+ 
-+   KeyScript(XINT(code));
-+ 
-+   return Qnil;
-+ }
-+ 
-+ DEFUN ("mac-im-get-key-script", Fmac_im_get_key_script,
-+        Smac_im_get_key_script, 0, 0, 0,
-+        doc: )
-+      ()
-+ {
-+   return make_number(GetScriptManagerVariable(smKeyScript));
-+ }
-+ 
-+ pascal OSStatus
-+ mac_handle_im_event(EventHandlerCallRef er, EventRef event, void *data)
-+ {
-+   UInt32 ekind = GetEventKind(event), eclass = GetEventClass(event);
-+   OSStatus ret = noErr, err;
-+   Lisp_Object argv[1024];
-+   int argc = 0;
-+ 
-+   switch(eclass) {
-+   case kEventClassTextInput:
-+     switch(ekind) {
-+     case kEventTextInputOffsetToPos:
-+       {
-+ 	err = SetEventParameter(event, kEventParamTextInputReplyPoint,
-+ 				typeQDPoint, sizeof(mac_im_pt), &mac_im_pt);
-+ 	if(!err == noErr) abort();
-+ 	argv[argc++] = Qmac_im_offset_to_pos_hook;
-+       }
-+       break;
-+     case kEventTextInputPosToOffset:
-+       argv[argc++] = Qmac_im_pos_to_offset_hook;
-+       break;
-+     case kEventTextInputUpdateActiveInputArea:
-+       {
-+ 	UInt32 src_nbytes = 0, des_nbytes = 0, array_nbytes = 0, fixed_nbytes = 0;
-+ 	char *src = NULL, *des = NULL;
-+ 	TextRangeArray *array = NULL;
-+ 	Lisp_Object triple[3];
-+ 	int i;
-+ 
-+ 	err = GetEventParameter(event, kEventParamTextInputSendText,
-+ 				typeChar,
-+ 				NULL, 0, &src_nbytes, NULL);
-+ 	
-+ 	if (err == noErr && src_nbytes) {
-+ 	  src = (char *)xmalloc(src_nbytes + 1);
-+ 	  memset(src, 0, src_nbytes + 1);
-+ 	  err = GetEventParameter(event, kEventParamTextInputSendText,
-+ 				  typeChar,
-+ 				  NULL, src_nbytes, NULL, src);
-+ 	  if (err == noErr) {
-+ 	    des_nbytes = decoding_buffer_size(&keyboard_coding, src_nbytes);
-+ 	    des = (char *)xmalloc(des_nbytes + 1);
-+ 	    memset(des, 0, des_nbytes + 1);
-+ 	  
-+ 	    /* CString -> String for Emacs */
-+ 	    decode_coding(&keyboard_coding, src, des, src_nbytes, des_nbytes);
-+ 
-+ 	    /* add arguments for hook */
-+ 	    argv[argc++] = Qmac_im_update_active_input_text_hook;
-+ 	    argv[argc++] = make_string(des, strlen(des));
-+ 	    
-+ 	    /* get Fixed String Length (bytes) from TSM */
-+ 	    err = GetEventParameter(event, kEventParamTextInputSendFixLen,
-+ 				    typeLongInteger, 
-+ 				    NULL, sizeof(fixed_nbytes), NULL, &fixed_nbytes);
-+ 	
-+ 	    /* add arguments for hook */
-+ 	    if (err == noErr && fixed_nbytes > 0) {
-+ 	      memset(des, 0, des_nbytes);
-+ 	      decode_coding(&keyboard_coding,
-+ 			    src, des,
-+ 			    fixed_nbytes, des_nbytes);
-+ 	      argv[argc++] = Flength(make_string(des, strlen(des)));
-+ 	      mac_im_active = FALSE;
-+ 	    } else {
-+ 	      fixed_nbytes = 0;
-+ 	      argv[argc++] = make_number(0);
-+ 	      mac_im_active = TRUE;
-+ 	    }
-+ 	  
-+ 	    err = GetEventParameter(event, kEventParamTextInputSendHiliteRng,
-+ 				    typeTextRangeArray,
-+ 				    NULL, 0, &array_nbytes, NULL);
-+ 	  
-+ 	    if (err == noErr && array_nbytes) {
-+ 	      array = (TextRangeArray *)xmalloc(array_nbytes);
-+ 	    
-+ 	      err = GetEventParameter(event, kEventParamTextInputSendHiliteRng,
-+ 				      typeTextRangeArray,
-+ 				      NULL, array_nbytes, NULL, array);
-+ 	      if (err == noErr) {
-+ 		for (i = 0; i < array->fNumOfRanges; i++) {
-+ 		  if (argc < 1024) {
-+ 		    if (fixed_nbytes <= array->fRange[i].fStart
-+ 			&& array->fRange[i].fStart <= array->fRange[i].fEnd
-+ 			&& array->fRange[i].fEnd <= src_nbytes) {
-+ 
-+ 		      memset(des, 0, des_nbytes);
-+ 		      decode_coding(&keyboard_coding,
-+ 				    src, des,
-+ 				    array->fRange[i].fStart, des_nbytes);
-+ 		      triple[1] = Flength(make_string(des, strlen(des)));
-+ 		      
-+ 		      memset(des, 0, des_nbytes);
-+ 		      decode_coding(&keyboard_coding,
-+ 				    src, des,
-+ 				    array->fRange[i].fEnd, des_nbytes);
-+ 		      triple[2] = Flength(make_string(des, strlen(des)));
-+ 		      
-+ 		      switch (array->fRange[i].fHiliteStyle) {
-+ 		      case kCaretPosition:
-+ 			triple[0] = intern("caret-position");
-+ 			argv[argc++] = Flist(3, triple);
-+ 			break;
-+ 		      case kRawText:
-+ 			triple[0] = intern("raw-text");
-+ 			argv[argc++] = Flist(3, triple);
-+ 			break;
-+ 		      case kSelectedRawText:
-+ 			triple[0] = intern("selected-raw-text");
-+ 			argv[argc++] = Flist(3, triple);
-+ 			break;
-+ 		      case kConvertedText:
-+ 			triple[0] = intern("converted-text");
-+ 			argv[argc++] = Flist(3, triple);
-+ 			break;
-+ 		      case kSelectedConvertedText:
-+ 			triple[0] = intern("selected-converted-text");
-+ 			argv[argc++] = Flist(3, triple);
-+ 			break;
-+ 		      default:
-+ 			break;
-+ 		      }
-+ 		    }
-+ 		  }
-+ 		}
-+ 	      }
-+ 	    }
-+ 	  }
-+ 	  if (src) xfree(src);
-+ 	  if (des) xfree(des);
-+ 	  if (array) xfree(array);
-+ 	} else { /* src_nbytes == 0 */
-+ 	  /* run hook */
-+ 	  mac_im_active = FALSE;
-+ 	  argv[argc++] = Qmac_im_update_active_input_text_hook;
-+ 	  argv[argc++] = make_string("", 0);
-+ 	  argv[argc++] = make_number(0);
-+ 	}
-+       }
-+       break;
-+     case kEventTextInputGetSelectedText:
-+       break;
-+     case kEventTextInputUnicodeForKeyEvent:
-+       if (!mac_im_active)
-+ 	ret = eventNotHandledErr;
-+       break;
-+     default:
-+       break;
-+     }
-+     break;
-+   default:
-+     break;
-+   }
-+ 
-+   if (argc) {
-+     Frun_hook_with_args(argc, argv);
-+   }
-+   redisplay();
-+   
-+   return ret;
-+ }
-+ 
-+ int mac_im_throw_input_to_system(void)
-+ {
-+   int ret = TRUE;
-+ 
-+   Fmac_im_set_inline_input_method(Vmac_im_inline_input_mode);
-+   if (this_command_key_count)
-+     ret = FALSE;
-+   else if (!NILP(current_buffer->read_only))
-+     ret = FALSE;
-+   else if (cursor_in_echo_area)
-+     ret = FALSE;
-+ 
-+   return ret;
-+ }
-+ 
-+ void syms_of_macim(void)
-+ {
-+   staticpro (&Qmac_im_offset_to_pos_hook);
-+   Qmac_im_offset_to_pos_hook = intern("mac-im-offset-to-pos-hook");
-+ 
-+   staticpro (&Qmac_im_pos_to_offset_hook);
-+   Qmac_im_pos_to_offset_hook = intern("mac-im-pos-to-offset-hook");
-+ 
-+   staticpro (&Qmac_im_update_active_input_text_hook);
-+   Qmac_im_update_active_input_text_hook = intern("mac-im-update-active-input-text-hook");
-+ 
-+   staticpro (&Qmac_im_get_selected_text_hook);
-+   Qmac_im_get_selected_text_hook = intern("mac-im-get-selected-text-hook");
-+ 
-+   DEFVAR_LISP ("mac-im-inline-input-mode", &Vmac_im_inline_input_mode,
-+ 	       doc: /**/);
-+   Vmac_im_inline_input_mode = Qt;
-+ }
-+ 
-+ void mac_im_initialize(void)
-+ {
-+   if(!mac_im_handler) {
-+     OSErr err;
-+     InterfaceTypeList itl = { kTextService };
-+ 
-+     err = NewTSMDocument(1, itl, &mac_tsm_doc_id, 715);
-+     if (err != noErr) abort ();
-+     
-+     err = ActivateTSMDocument(mac_tsm_doc_id);
-+     if (err != noErr) abort ();
-+     
-+     err = InstallEventHandler(GetApplicationEventTarget(),
-+ 			      NewEventHandlerUPP(mac_handle_im_event),
-+ 			      GetEventTypeCount(events),
-+ 			      events,
-+ 			      NULL,
-+ 			      &mac_im_handler);
-+     if (err != noErr) abort ();
-+   }
-+   
-+   mac_im_pt.h = 0;
-+   mac_im_pt.v = 0;
-+ 
-+   defsubr (&Smac_im_set_inline_input_method);
-+   defsubr (&Smac_im_set_key_script);
-+   defsubr (&Smac_im_get_key_script);
-+ }
-+ 
-+ #endif
-diff -r -N -p --exclude=*.orig ../emacs-1229/src/macterm.c src/macterm.c
-*** ../emacs-1229/src/macterm.c	Tue Dec 28 02:27:30 2004
---- src/macterm.c	Sun Jan  2 13:18:03 2005
-*************** extern int inhibit_window_system;
-*** 244,250 ****
-  QDGlobals qd;  /* QuickDraw global information structure.  */
-  #endif
-  
-- 
-  struct frame * x_window_to_frame (struct mac_display_info *, WindowPtr);
-  struct mac_display_info *mac_display_info_for_display (Display *);
-  static void x_update_window_end P_ ((struct window *, int, int));
---- 244,249 ----
-*************** mac_draw_window_cursor (w, glyph_row, x,
-*** 4857,4862 ****
---- 4856,4867 ----
-  	default:
-  	  abort ();
-  	}
-+ 
-+ #ifdef MAC_OSX
-+       if (active_p)
-+ 	mac_im_set_cursor_position(x, y, glyph_row->height);
-+ #endif
-+ 
-      }
-  }
-  
-*************** XTread_socket (sd, expected, hold_quit)
-*** 8740,8746 ****
-  	    if ((!NILP (Vmac_pass_command_to_system)
-  		 || !(er.modifiers & cmdKey))
-  		&& (!NILP (Vmac_pass_control_to_system)
-! 		    || !(er.modifiers & controlKey)))
-  	      if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
-  		  != eventNotHandledErr)
-  		break;
---- 8745,8752 ----
-  	    if ((!NILP (Vmac_pass_command_to_system)
-  		 || !(er.modifiers & cmdKey))
-  		&& (!NILP (Vmac_pass_control_to_system)
-! 		    || !(er.modifiers & controlKey))
-! 		&& mac_im_throw_input_to_system())
-  	      if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
-  		  != eventNotHandledErr)
-  		break;
-*************** mac_initialize ()
-*** 9586,9592 ****
-    init_service_handler ();
-  
-    init_quit_char_handler ();
-! #endif
-  
-    DisableMenuCommand (NULL, kHICommandQuit);
-  
---- 9592,9600 ----
-    init_service_handler ();
-  
-    init_quit_char_handler ();
-! 
-!   mac_im_initialize();
-! #endif  
-  
-    DisableMenuCommand (NULL, kHICommandQuit);
-  


macemacsjp-cvs メーリングリストの案内
Back to archive index