[aquaskk-changes 104] CVS update: AquaSKK

Zurück zum Archiv-Index

Tomotaka SUWA t-suw****@users*****
2005年 12月 11日 (日) 09:32:32 JST


Index: AquaSKK/BIM.cpp
diff -u AquaSKK/BIM.cpp:1.10 AquaSKK/BIM.cpp:1.11
--- AquaSKK/BIM.cpp:1.10	Wed Dec  7 22:49:07 2005
+++ AquaSKK/BIM.cpp	Sun Dec 11 09:32:31 2005
@@ -1,5 +1,5 @@
 /*
-  $Id: BIM.cpp,v 1.10 2005/12/07 13:49:07 t-suwa Exp $
+  $Id: BIM.cpp,v 1.11 2005/12/11 00:32:31 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -152,6 +152,14 @@
     }
 };
 
+static void InitializeKeyboardLayout() {
+    KeyboardLayoutRef kbd;
+
+    // ƒL[ƒ{[ƒhƒŒƒCƒAƒEƒg‚ð U.S. ‚ɏ‰Šú‰»‚·‚é
+    KLGetKeyboardLayoutWithIdentifier(0, &kbd);
+    KLSetCurrentKeyboardLayout(kbd);
+}
+
 // ƒOƒ[ƒoƒ‹‚È’l‚ð‰Šú‰»‚µA‰”•Mƒƒjƒ…[‚ð\’z‚·‚éB
 ComponentResult BIMInitialize(ComponentInstance inComponentInstance, MenuRef *outTextServiceMenu) {
     ComponentResult result;
@@ -226,10 +234,8 @@
 	(**outSessionHandle)->terminate_disabled = false;
 	(**outSessionHandle)->imsession_input_mode = new IMSessionInputMode(*outSessionHandle);
 
-	// “ú–{ŒêƒXƒNƒŠƒvƒg‚ð—LŒø‚É‚·‚é
-	long keyboardID = GetScriptVariable(smCurrentScript, smScriptKeys);
-	SetScriptVariable(smJapanese, smScriptKeys, keyboardID);
-	KeyScript(smJapanese);
+	// ƒL[ƒ{[ƒhƒŒƒCƒAƒEƒg‚ð‰Šú‰»‚·‚é
+	InitializeKeyboardLayout();
     } else {
 	result = memFullErr;
     }
@@ -260,9 +266,8 @@
 ComponentResult BIMSessionActivate(BIMSessionHandle inSessionHandle) {
     ActiveSession::theInstance().Add((CFIndex)inSessionHandle);
 
-    // “ú–{ŒêƒXƒNƒŠƒvƒg‚ð—LŒø‚É‚·‚é
-    long keyboardID = GetScriptVariable(smCurrentScript, smScriptKeys);
-    SetScriptVariable(smJapanese, smScriptKeys, keyboardID);
+    // ƒL[ƒ{[ƒhƒŒƒCƒAƒEƒg‚ð‰Šú‰»‚·‚é
+    InitializeKeyboardLayout();
 
     // ƒAƒNƒeƒBƒu‚É‚È‚Á‚½Ž–‚ðŽI‚É“`‚¦‚éB
     ServerConnectionFactory::theInstance().newConnection().send(kBasicMessageActivated);
Index: AquaSKK/BIMComponent.cpp
diff -u AquaSKK/BIMComponent.cpp:1.3 AquaSKK/BIMComponent.cpp:1.4
--- AquaSKK/BIMComponent.cpp:1.3	Sat Oct  8 00:08:36 2005
+++ AquaSKK/BIMComponent.cpp	Sun Dec 11 09:32:31 2005
@@ -1,5 +1,5 @@
 /*
-	$Id: BIMComponent.cpp,v 1.3 2005/10/07 15:08:36 t-suwa Exp $
+	$Id: BIMComponent.cpp,v 1.4 2005/12/11 00:32:31 t-suwa Exp $
 	---------
 	
     MacOS X implementation of the SKK input method.
@@ -47,7 +47,6 @@
 
 static long		gInstanceRefCount = 0;
 static MenuRef		gTextServiceMenu = NULL;
-static CFDictionaryRef	gInputModes = NULL;
 
 static ComponentResult CallBIMFunction( ComponentParameters *inParams, ProcPtr inProcPtr,
                                         SInt32 inProcInfo );
@@ -221,7 +220,7 @@
             result = true;
             break;
 
-        case kCMGetScriptLangSupport:
+	case kCMGetScriptLangSupport:
         case kCMInitiateTextService:
         case kCMTerminateTextService:
         case kCMActivateTextService:
@@ -230,7 +229,7 @@
         case kCMGetTextServiceMenu:
         case kCMFixTextService:
         case kCMHidePaletteWindows:
-	    //case kCMCopyTextServiceInputModeList:
+	case kCMCopyTextServiceInputModeList:
 	case kCMSetTextServiceProperty:
             result = true;
             break;
@@ -303,10 +302,6 @@
 {
 #pragma unused (inSessionHandle)
 
-    if(gInputModes) {
-	CFRelease(gInputModes);
-    }
-
     return noErr;
 }
 
@@ -329,9 +324,9 @@
 }
 
 // ‰”•Mƒƒjƒ…[‚ð•Ô‚·B
-pascal ComponentResult BIMGetTextServiceMenu( Handle inSessionHandle, MenuHandle *outMenuHandle )
-{
+pascal ComponentResult BIMGetTextServiceMenu(Handle inSessionHandle, MenuHandle *outMenuHandle) {
     *outMenuHandle = gTextServiceMenu;
+
     return noErr;
 }
 
@@ -348,40 +343,26 @@
 }
 
 // “ü—̓‚[ƒh‚̈ꗗ‚ð•Ô‚·
-pascal ComponentResult BIMCopyTextServiceInputModeList(
-    Handle inSessionHandle, CFDictionaryRef* outInputModes)
-{
-/*
-‚±‚̃R[ƒh‚ð—LŒø‚É‚·‚é‚ƃVƒXƒeƒ€‚ª”ñí‚É•sˆÀ’è‚ɂȂ邽‚߁A••ˆóB
-Tiger ‚ł́A‚±‚Ì‚Ü‚Ü‚Å‚à‚¤‚Ü‚­“®ì‚µ‚Ä‚µ‚Ü‚¤‚Ì‚ª“äB
-*/
-#if 0
-    // ‚Ü‚¾ƒ[ƒh‚³‚ê‚Ä‚¢‚È‚¢H
-    if(!gInputModes) {
-	CFBundleRef	bundleRef;
-	CFDictionaryRef	bundleDic;
-
-	bundleRef = CFBundleGetBundleWithIdentifier(CFSTR(kIMBundleIdentifier));
-	if(bundleRef) {
-	    bundleDic = CFBundleGetInfoDictionary(bundleRef);
-	    if(bundleDic) {
-		CFRetain(bundleDic);
-		gInputModes = (CFDictionaryRef)CFDictionaryGetValue(
-		    bundleDic, kComponentBundleInputModeDictKey);
-		CFRelease(bundleDic);
-
-		if(gInputModes) {
-		    CFRetain(gInputModes); // Šm•Û
-		    BIMLog("kComponentBundleInputModeDictKey loaded.\n");
-		} else {
-		    BIMLog("can't get kComponentBundleInputModeDictKey\n");
-		}
+pascal ComponentResult BIMCopyTextServiceInputModeList(Handle inSessionHandle, CFDictionaryRef* outInputModes) {
+    CFBundleRef bundleRef = CFBundleGetBundleWithIdentifier(CFSTR(kIMBundleIdentifier));
+    if(bundleRef) {
+	CFDictionaryRef bundleDict = CFBundleGetInfoDictionary(bundleRef);
+	if(bundleDict) {
+	    CFRetain(bundleDict);
+	    CFDictionaryRef tmpModes
+		= (CFDictionaryRef)CFDictionaryGetValue(bundleDict, kComponentBundleInputModeDictKey);
+	    if(tmpModes) {
+		*outInputModes = CFDictionaryCreateCopy(kCFAllocatorDefault, tmpModes);
+	    } else {
+		BIMLog("CFDictionaryCreateCopy() failed\n");
 	    }
+	    CFRelease(bundleDict);
+	} else {
+	    BIMLog("CFBundleGetInfoDictionary() failed\n");
 	}
+    } else {
+	BIMLog("CFBundleGetBundleWithIdentifier() failed\n");
     }
-#endif
-
-    *outInputModes = gInputModes;
 
     return noErr;
 }


aquaskk-changes メーリングリストの案内
Zurück zum Archiv-Index