Skip to content

Commit

Permalink
Merge branch 'hotfix/0.9.26.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
lotem committed Dec 23, 2014
2 parents 4ff0db0 + c9a8ea0 commit 357c17f
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 45 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

RIME 主葉:https://rimeime.github.io

鼠鬚管 0.9.26.2 <2014-12-23>
---

* 修復:安裝後輸入法在一些 app 中無法啓用 [#43](https://github.com/lotem/squirrel/issues/43)

鼠鬚管 0.9.26.1 <2014-12-22>
---

Expand Down
11 changes: 5 additions & 6 deletions Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.9.26.1</string>
<string>0.9.26.2</string>
<key>InputMethodConnectionName</key>
<string>Squirrel_1_Connection</string>
<key>InputMethodServerControllerClass</key>
Expand All @@ -44,20 +44,19 @@
<key>SUPublicDSAKeyFile</key>
<string>dsa_pub.pem</string>
<key>SUFeedURL</key>
<string>http://rimeime.github.io/release/squirrel/appcast.xml</string>
<string>http://rimeime.github.io/release/squirrel/appcast.xml</string>
<key>SUEnableAutomaticChecks</key>
<true/>

<key>ComponentInputModeDict</key>
<dict>
<key>tsInputModeListKey</key>
<dict>
<key>com.googlecode.rimeime.inputmethod.Squirrel</key>
<dict>
<key>TISInputSourceID</key>
<string>com.googlecode.rimeime.inputmethod.Squirrel</string>
<string>com.googlecode.rimeime.inputmethod.Squirrel.Rime</string>
<key>TISIntendedLanguage</key>
<string>zh-Hans</string>
<string>zh</string>
<key>tsInputModeAlternateMenuIconFileKey</key>
<string>rime.pdf</string>
<key>tsInputModeCharacterRepertoireKey</key>
Expand All @@ -83,7 +82,7 @@
</dict>
<key>tsVisibleInputModeOrderedArrayKey</key>
<array>
<string>com.googlecode.rimeime.inputmethod.Squirrel</string>
<string>com.googlecode.rimeime.inputmethod.Squirrel.Rime</string>
</array>
</dict>
</dict>
Expand Down
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,19 @@ debug: $(DEPENDS)
rm -f build/Squirrel.app
cd build ; ln -s Debug/Squirrel.app Squirrel.app

SQUIRREL_APP_PATH = /Library/Input Methods/Squirrel.app

install-debug:
rm -rf "/Library/Input Methods/Squirrel.app/Contents/Frameworks"
rm -rf "/Library/Input Methods/Squirrel.app/Contents/MacOS"
rm -rf "$(SQUIRREL_APP_PATH)/Contents/Frameworks"
rm -rf "$(SQUIRREL_APP_PATH)/Contents/MacOS"

cp -R build/Debug/Squirrel.app "/Library/Input Methods"
"/Library/Input Methods/Squirrel.app/Contents/Resources/postflight"
"$(SQUIRREL_APP_PATH)/Contents/Resources/postflight"

install-release:
rm -rf "/Library/Input Methods/Squirrel.app"
rm -rf "$(SQUIRREL_APP_PATH)"
cp -R build/Release/Squirrel.app "/Library/Input Methods"
"/Library/Input Methods/Squirrel.app/Contents/Resources/postflight"
"$(SQUIRREL_APP_PATH)/Contents/Resources/postflight"

clean:
rm -rf build > /dev/null 2>&1 || true
Expand Down
4 changes: 4 additions & 0 deletions Squirrel.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
44F01538152B2D9300EFDAC3 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 44F01492152AF6AF00EFDAC3 /* Sparkle.framework */; };
44F7708F152B3334005CF491 /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = 44F7708E152B3334005CF491 /* dsa_pub.pem */; };
44F84AD714E94C490005D70B /* SquirrelPanel.m in Sources */ = {isa = PBXBuildFile; fileRef = 44F84AD614E94C490005D70B /* SquirrelPanel.m */; };
44FED9BA1A48502900037B05 /* preflight in Resources */ = {isa = PBXBuildFile; fileRef = 44FED9B91A48502900037B05 /* preflight */; };
7B53068F1A30104000486AC2 /* double_pinyin_pyjj.schema.yaml in Copy Shared Support Files */ = {isa = PBXBuildFile; fileRef = 7B53068D1A30102D00486AC2 /* double_pinyin_pyjj.schema.yaml */; };
7BD9C04C1A2C689B008C0913 /* bopomofo_tw.schema.yaml in Copy Shared Support Files */ = {isa = PBXBuildFile; fileRef = 7BD9BFF61A2C686C008C0913 /* bopomofo_tw.schema.yaml */; };
7BD9C04D1A2C689B008C0913 /* bopomofo.schema.yaml in Copy Shared Support Files */ = {isa = PBXBuildFile; fileRef = 7BD9BFF71A2C686C008C0913 /* bopomofo.schema.yaml */; };
Expand Down Expand Up @@ -232,6 +233,7 @@
44F84AD614E94C490005D70B /* SquirrelPanel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SquirrelPanel.m; sourceTree = "<group>"; };
44FA4D891685997300116C1F /* zh_CN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_CN; path = zh_CN.lproj/Localizable.strings; sourceTree = "<group>"; };
44FA4D8E16859B2900116C1F /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_TW; path = zh_TW.lproj/Localizable.strings; sourceTree = "<group>"; };
44FED9B91A48502900037B05 /* preflight */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = preflight; sourceTree = "<group>"; };
7B53068D1A30102D00486AC2 /* double_pinyin_pyjj.schema.yaml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = double_pinyin_pyjj.schema.yaml; path = data/brise/double_pinyin_pyjj.schema.yaml; sourceTree = "<group>"; };
7BD9BF631A2C63AD008C0913 /* HKVariants.ocd */ = {isa = PBXFileReference; lastKnownFileType = file; path = HKVariants.ocd; sourceTree = "<group>"; };
7BD9BF641A2C63AD008C0913 /* s2t.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = s2t.json; sourceTree = "<group>"; };
Expand Down Expand Up @@ -381,6 +383,7 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
44FED9B91A48502900037B05 /* preflight */,
44986A93184B421700B3278D /* LICENSE.txt */,
44986A94184B421700B3278D /* README.txt */,
44CD7D9E1828D981006E9222 /* rime.pdf */,
Expand Down Expand Up @@ -552,6 +555,7 @@
44986A96184B421700B3278D /* README.txt in Resources */,
44943BB815066A540005EE85 /* postflight in Resources */,
44F7708F152B3334005CF491 /* dsa_pub.pem in Resources */,
44FED9BA1A48502900037B05 /* preflight in Resources */,
44CD7D9F1828D981006E9222 /* rime.pdf in Resources */,
4493402B158A4ABC0041A35A /* squirrel-app.icns in Resources */,
448CCCDD166B2E0500337E78 /* Growl Registration Ticket.growlRegDict in Resources */,
Expand Down
52 changes: 39 additions & 13 deletions input_source.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
"/Library/Input Methods/Squirrel.app";
static NSString *const kSourceID =
@"com.googlecode.rimeime.inputmethod.Squirrel";
static NSString *const kInputModeID =
@"com.googlecode.rimeime.inputmethod.Squirrel.Rime";

void RegisterInputSource() {
NSLog(@"RegisterInputSource.");
CFURLRef installedLocationURL = CFURLCreateFromFileSystemRepresentation(
NULL, kInstalledLocation, strlen((const char *)kInstalledLocation), NO);
if (installedLocationURL) {
Expand All @@ -14,40 +17,63 @@ void RegisterInputSource() {
}

void ActivateInputSource() {
NSLog(@"ActivateInputSource.");
CFArrayRef sourceList = TISCreateInputSourceList(NULL, true);
for (int i = 0; i < CFArrayGetCount(sourceList); ++i) {
TISInputSourceRef inputSource = (TISInputSourceRef)(CFArrayGetValueAtIndex(
sourceList, i));
NSString *sourceID = (NSString *)(TISGetInputSourceProperty(
inputSource, kTISPropertyInputSourceID));
if ([sourceID isEqualToString:kSourceID]) {
//NSLog(@"examining input source '%@", sourceID);
if ([sourceID isEqualToString:kSourceID] ||
[sourceID isEqualToString:kInputModeID]) {
TISEnableInputSource(inputSource);
TISSelectInputSource(inputSource);
break;
CFBooleanRef isSelectable = (CFBooleanRef)TISGetInputSourceProperty(
inputSource, kTISPropertyInputSourceIsSelectCapable);
if (CFBooleanGetValue(isSelectable)) {
NSLog(@"selecting input source '%@'.", sourceID);
TISSelectInputSource(inputSource);
}
NSLog(@"'%@' should have been activated.", sourceID);
}
}
}

void DeactivateInputSource() {
NSLog(@"DeactivateInputSource.");
CFArrayRef sourceList = TISCreateInputSourceList(NULL, true);
for (int i = CFArrayGetCount(sourceList); i > 0; --i) {
TISInputSourceRef inputSource = (TISInputSourceRef)(CFArrayGetValueAtIndex(
sourceList, i - 1));
NSString *sourceID = (NSString *)(TISGetInputSourceProperty(
inputSource, kTISPropertyInputSourceID));
//NSLog(@"examining input source '%@", sourceID);
if ([sourceID isEqualToString:kSourceID] ||
[sourceID isEqualToString:kInputModeID]) {
TISDisableInputSource(inputSource);
NSLog(@"'%@' should have been deactivated.", sourceID);
}
}
}

BOOL IsInputSourceActive() {
BOOL isActive = NO;
int active = 0;
CFArrayRef sourceList = TISCreateInputSourceList(NULL, true);
for (int i = 0; i < CFArrayGetCount(sourceList); ++i) {
TISInputSourceRef inputSource = (TISInputSourceRef)(CFArrayGetValueAtIndex(
sourceList, i));
NSString *sourceID = (NSString *)(TISGetInputSourceProperty(
inputSource, kTISPropertyInputSourceID));
if ([sourceID isEqualToString:kSourceID]) {
NSLog(@"examining input source '%@'", sourceID);
if ([sourceID isEqualToString:kSourceID] ||
[sourceID isEqualToString:kInputModeID]) {
CFBooleanRef isEnabled = (CFBooleanRef)(TISGetInputSourceProperty(
inputSource, kTISPropertyInputSourceIsEnabled));
CFBooleanRef isSelected = (CFBooleanRef)(TISGetInputSourceProperty(
inputSource, kTISPropertyInputSourceIsEnabled));
if (CFBooleanGetValue(isEnabled) || CFBooleanGetValue(isSelected)) {
isActive = YES;
break;
if (CFBooleanGetValue(isEnabled)) {
++active;
}
}
}
return isActive;
NSLog(@"IsInputSourceActive: %d / 2", active);
return active == 2; // 1 active input method + 1 active input mode
}


10 changes: 5 additions & 5 deletions main.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

void RegisterInputSource();
void ActivateInputSource();
BOOL IsInputSourceActive();
void DeactivateInputSource();
//BOOL IsInputSourceActive();

// Each input method needs a unique connection name.
// Note that periods and spaces are not allowed in the connection name.
Expand Down Expand Up @@ -35,10 +36,9 @@ int main(int argc, char *argv[])

if (argc > 1 && !strcmp("--install", argv[1])) {
// register and enable Squirrel
if (!IsInputSourceActive()) {
RegisterInputSource();
ActivateInputSource();
}
RegisterInputSource();
DeactivateInputSource();
ActivateInputSource();
return 0;
}

Expand Down
3 changes: 2 additions & 1 deletion package/Package.pmdoc/01squirrel-contents.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<pkg-contents spec="1.12">
<f n="Squirrel.app" o="root" g="wheel" p="16877" pt="/Users/lotem/squirrel/build/Release/Squirrel.app" m="true" t="file">
<f n="Squirrel.app" o="root" g="wheel" p="16877" pt="/Users/lotem/work/squirrel/build/Release/Squirrel.app" m="true" t="file">
<f n="Contents" o="root" g="wheel" p="16877">
<f n="Frameworks" o="root" g="wheel" p="16877">
<f n="Growl.framework" o="root" g="wheel" p="16877">
Expand Down Expand Up @@ -578,6 +578,7 @@
<f n="Growl Registration Ticket.growlRegDict" o="root" g="wheel" p="33188"/>
<f n="LICENSE.txt" o="root" g="wheel" p="33188"/>
<f n="postflight" o="root" g="wheel" p="33261"/>
<f n="preflight" o="root" g="wheel" p="33261"/>
<f n="README.txt" o="root" g="wheel" p="33188"/>
<f n="rime.pdf" o="root" g="wheel" p="33188"/>
<f n="squirrel-app.icns" o="root" g="wheel" p="33188"/>
Expand Down
15 changes: 8 additions & 7 deletions package/Package.pmdoc/01squirrel.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0"?>
<pkgref spec="1.12" uuid="1EE5C324-906B-44CD-BE11-21352CB4606C">
<pkgref spec="1.12" uuid="B0722148-4346-435C-820C-A061B907E4BC">
<config>
<identifier>com.googlecode.rimeime.Squirrel.pkg</identifier>
<version>0.9.26.1</version>
<version>0.9.26.2</version>
<description/>
<post-install type="req-logout"/>
<requireAuthorization/>
<installFrom mod="true" includeRoot="true">/Users/lotem/squirrel/build/Release/Squirrel.app</installFrom>
<installFrom includeRoot="true">/Users/lotem/work/squirrel/build/Release/Squirrel.app</installFrom>
<installTo mod="true">/Library/Input Methods</installTo>
<flags>
<followSymbolicLinks/>
Expand All @@ -15,21 +15,22 @@
<mod>installTo</mod>
<mod>postInstall</mod>
<mod>relocatable</mod>
<mod>installFrom.path</mod>
<mod>scripts.postinstall.path</mod>
<mod>scripts.preinstall.path</mod>
<mod>identifier</mod>
<mod>parent</mod>
<mod>version</mod>
<mod>installTo.path</mod>
</config>
<scripts>
<preinstall relative="true" mod="true">../preflight</preinstall>
<postinstall relative="true" mod="true">../postflight</postinstall>
</scripts>
<contents>
<file-list>01squirrel-contents.xml</file-list>
<component id="com.googlecode.rimeime.inputmethod.Squirrel" path="/Users/lotem/squirrel/build/Release/Squirrel.app" version="0.9.26.1" isDowngradeable="true">
<component id="com.growl.growlframework" path="/Users/lotem/squirrel/build/Release/Squirrel.app/Contents/Frameworks/Growl.framework" version="1.3.1"/>
<component id="org.andymatuschak.Sparkle" path="/Users/lotem/squirrel/build/Release/Squirrel.app/Contents/Frameworks/Sparkle.framework" version="313"/>
<component id="com.googlecode.rimeime.inputmethod.Squirrel" path="/Users/lotem/work/squirrel/build/Release/Squirrel.app" version="0.9.26.1" isDowngradeable="true">
<component id="com.growl.growlframework" path="/Users/lotem/work/squirrel/build/Release/Squirrel.app/Contents/Frameworks/Growl.framework" version="1.3.1"/>
<component id="org.andymatuschak.Sparkle" path="/Users/lotem/work/squirrel/build/Release/Squirrel.app/Contents/Frameworks/Sparkle.framework" version="313"/>
</component>
<filter>/CVS$</filter>
<filter>/\.svn$</filter>
Expand Down
13 changes: 9 additions & 4 deletions package/Package.pmdoc/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

&#x4ECA;&#x7531;&#x3014;RIME&#xFF0F;&#x4E2D;&#x5DDE;&#x97FB;&#x8F38;&#x5165;&#x6CD5;&#x5F15;&#x64CE;&#x3015;&#x5F37;&#x529B;&#x9A45;&#x52D5;</description>
<contents>
<choice title="Squirrel" id="choice0" starts_selected="true" starts_enabled="true" starts_hidden="false">
<choice title="Squirrel" id="choice0" starts_selected="true" starts_enabled="true" starts_hidden="true">
<pkgref id="com.googlecode.rimeime.Squirrel.pkg"/>
</choice>
</contents>
Expand Down Expand Up @@ -63,7 +63,7 @@
-------------------------------------------------\
\f1 \'a1\'69\'b9\'ab\'c5\'bd\'ba\'de\'a1\'6a\'bf\'e9\'a4\'4a\'aa\'6b
\f0 0.9.26.1\
\f0 0.9.26.2\
\
\f1 \'a6\'a1\'ae\'a4\'b0\'f3\'aa\'a9\'c5\'76\'a9\'d2\'b5\'4c
Expand Down Expand Up @@ -149,7 +149,12 @@ http://code.google.com/p/rimeime/wiki/CustomizationGuide\
\f0 \
\
\f2 \'ca\'f3\'f4\'50\'b9\'dc 0.9.26.1 <2014-12-22>\
\f2 \'ca\'f3\'f4\'50\'b9\'dc 0.9.26.2 <2014-12-23>\
---\
\
* \'d0\'de\'8f\'cd\'a3\'ba\'b0\'b2\'d1\'62\'e1\'e1\'dd\'94\'c8\'eb\'b7\'a8\'d4\'da\'d2\'bb\'d0\'a9 app \'d6\'d0\'9f\'6f\'b7\'a8\'86\'99\'d3\'c3 #43\
\
\'ca\'f3\'f4\'50\'b9\'dc 0.9.26.1 <2014-12-22>\
---\
\
* \'d0\'de\'8f\'cd\'a3\'ba0.9.26 \'b0\'e6\'b1\'be\'d4\'4f\'d6\'c3 `translator/enable_user_dict: false` \'b0\'6c\'c9\'fa\'b1\'c0\'9d\'a2\
Expand Down Expand Up @@ -366,7 +371,7 @@ Rime \'cb\'e3\'b7\'a8\'8e\'ec\'d7\'83\'b8\'fc\'bc\'af\
<mod>properties.systemDomain</mod>
<mod>properties.title</mod>
<mod>properties.customizeOption</mod>
<mod>description</mod>
<mod>properties.userDomain</mod>
<mod>properties.anywhereDomain</mod>
<mod>description</mod>
</pkmkdoc>
6 changes: 6 additions & 0 deletions preflight
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
SQUIRREL_APP_PATH="/Library/Input Methods/Squirrel.app"

echo "uninstalling previous version."
rm -Rf "$SQUIRREL_APP_PATH"
/usr/bin/true
8 changes: 4 additions & 4 deletions update/appcast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
<description>鼠鬚管 Appcast 更新頻道</description>
<language>zh</language>
<item>
<title>鼠鬚管 0.9.26.1</title>
<title>鼠鬚管 0.9.26.2</title>
<sparkle:releaseNotesLink>http://rimeime.github.io/release/squirrel/</sparkle:releaseNotesLink>
<sparkle:minimumSystemVersion>10.7.0</sparkle:minimumSystemVersion>
<pubDate>Mon, 22 Dec 2014 12:00:00 +0800</pubDate>
<enclosure url="http://dl.bintray.com/lotem/rime/Squirrel-0.9.26.1.zip"
<enclosure url="http://dl.bintray.com/lotem/rime/Squirrel-0.9.26.2.zip"
sparkle:version="0.9.26.1"
sparkle:dsaSignature="MCwCFEqGaqRq/AoLV7IBX07zACAAJKMoAhQ1spXgkrwrSQ7kcaCnqIiIkQA5iw=="
length="9578791"
sparkle:dsaSignature="MC0CFBfjsjotU9lBev3WMt63ACedLiivAhUAgabxzAoM1MrrU8qnVP5Nqts+xx0="
length="9579976"
type="application/octet-stream"/>
</item>
</channel>
Expand Down

0 comments on commit 357c17f

Please sign in to comment.