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[{[hCAEgð U.S. Éú»·é
+ KLGetKeyboardLayoutWithIdentifier(0, &kbd);
+ KLSetCurrentKeyboardLayout(kbd);
+}
+
// O[oÈlðú»µAMj
[ð\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);
- // ú{êXNvgðLøÉ·é
- long keyboardID = GetScriptVariable(smCurrentScript, smScriptKeys);
- SetScriptVariable(smJapanese, smScriptKeys, keyboardID);
- KeyScript(smJapanese);
+ // L[{[hCAEgðú»·é
+ InitializeKeyboardLayout();
} else {
result = memFullErr;
}
@@ -260,9 +266,8 @@
ComponentResult BIMSessionActivate(BIMSessionHandle inSessionHandle) {
ActiveSession::theInstance().Add((CFIndex)inSessionHandle);
- // ú{êXNvgðLøÉ·é
- long keyboardID = GetScriptVariable(smCurrentScript, smScriptKeys);
- SetScriptVariable(smJapanese, smScriptKeys, keyboardID);
+ // L[{[hCAEgðú»·é
+ InitializeKeyboardLayout();
// ANeBuÉÈÁ½ð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 @@
}
// Mj
[ðÔ·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øÉ·éÆVXeªñíÉ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;
}