mirror of
https://github.com/gentoo-mirror/gentoo-zh.git
synced 2025-04-19 07:48:56 -04:00
fcitx-rime: patch to -9999 :D
This commit is contained in:
parent
9e739699c7
commit
d79eb9cfd4
@ -23,8 +23,7 @@ RDEPEND=">=app-i18n/fcitx-4.2.7
|
||||
DEPEND="${RDEPEND}"
|
||||
|
||||
src_prepare(){
|
||||
epatch "${FILESDIR}/0001-rime-Fix-Issue-7.patch"
|
||||
epatch "${FILESDIR}/0002-rime-fix-preedit.patch"
|
||||
EPATCH_SOURCE="${FILESDIR}" EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" epatch
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
|
@ -0,0 +1,21 @@
|
||||
From d113968149fabca90d45ef92a68605112b17c53f Mon Sep 17 00:00:00 2001
|
||||
From: Weng Xuetian <wengxt@gmail.com>
|
||||
Date: Wed, 13 Feb 2013 10:11:59 -0500
|
||||
Subject: [PATCH 1/4] [rime] use load-local for rime
|
||||
|
||||
---
|
||||
src/fcitx-rime.conf.in | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/fcitx-rime.conf.in b/src/fcitx-rime.conf.in
|
||||
index 2ecd1ff..9eaa3e4 100644
|
||||
--- a/src/fcitx-rime.conf.in
|
||||
+++ b/src/fcitx-rime.conf.in
|
||||
@@ -7,3 +7,4 @@ Enabled=True
|
||||
Library=fcitx-rime.so
|
||||
Type=SharedLibrary
|
||||
IMRegisterMethod=ConfigFile
|
||||
+LoadLocal=True
|
||||
--
|
||||
1.8.1.5
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 915322cf296d63afb5281223707749ef464a619d Mon Sep 17 00:00:00 2001
|
||||
From: Weng Xuetian <wengxt@gmail.com>
|
||||
Date: Thu, 14 Feb 2013 09:08:00 -0500
|
||||
Subject: [PATCH 1/3] [rime] Fix Issue #7
|
||||
Subject: [PATCH 2/4] [rime] Fix Issue #7
|
||||
|
||||
---
|
||||
src/fcitx-rime.c | 56 ++++++++++++++++++++++++++++++++++++++++++++------------
|
@ -1,7 +1,7 @@
|
||||
From 0eb1fd90d2b8c6135e81acca1fb5066012bbba4d Mon Sep 17 00:00:00 2001
|
||||
From: Weng Xuetian <wengxt@gmail.com>
|
||||
Date: Sun, 24 Feb 2013 10:04:31 -0500
|
||||
Subject: [PATCH 2/3] [rime] fix preedit
|
||||
Subject: [PATCH 3/4] [rime] fix preedit
|
||||
|
||||
---
|
||||
src/fcitx-rime.c | 3 ---
|
@ -0,0 +1,310 @@
|
||||
From a75123f24157608c8fa984fcb7d560b7dbf4953a Mon Sep 17 00:00:00 2001
|
||||
From: Weng Xuetian <wengxt@gmail.com>
|
||||
Date: Mon, 25 Mar 2013 01:00:57 -0400
|
||||
Subject: [PATCH 4/4] [rime] implement status and add full check deploy/sync
|
||||
|
||||
---
|
||||
po/fcitx-rime.pot | 20 ++++++++-
|
||||
po/zh_CN.po | 26 +++++++++---
|
||||
src/fcitx-rime.c | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++---
|
||||
3 files changed, 158 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/po/fcitx-rime.pot b/po/fcitx-rime.pot
|
||||
index b0956d9..18898b4 100644
|
||||
--- a/po/fcitx-rime.pot
|
||||
+++ b/po/fcitx-rime.pot
|
||||
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
|
||||
-"POT-Creation-Date: 2012-12-24 14:16-0500\n"
|
||||
+"POT-Creation-Date: 2013-03-25 00:56-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -17,10 +17,26 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
-#: src/fcitx-rime.c:74 src/fcitx-rime.conf.in:3 src/rime.conf.in:3
|
||||
+#: src/fcitx-rime.c:84 src/fcitx-rime.conf.in:3 src/rime.conf.in:3
|
||||
msgid "Rime"
|
||||
msgstr ""
|
||||
|
||||
+#: src/fcitx-rime.c:104
|
||||
+msgid "⟲ Deploy"
|
||||
+msgstr ""
|
||||
+
|
||||
+#: src/fcitx-rime.c:105
|
||||
+msgid "Deploy"
|
||||
+msgstr ""
|
||||
+
|
||||
+#: src/fcitx-rime.c:113
|
||||
+msgid "⇅ Synchronize"
|
||||
+msgstr ""
|
||||
+
|
||||
+#: src/fcitx-rime.c:114
|
||||
+msgid "Synchronize"
|
||||
+msgstr ""
|
||||
+
|
||||
#: src/fcitx-rime.conf.in:4
|
||||
msgid "Rime Wrapper For Fcitx"
|
||||
msgstr ""
|
||||
diff --git a/po/zh_CN.po b/po/zh_CN.po
|
||||
index dc9a624..67c1b17 100644
|
||||
--- a/po/zh_CN.po
|
||||
+++ b/po/zh_CN.po
|
||||
@@ -1,23 +1,27 @@
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
#
|
||||
-# Weng Xuetian <wengxt@gmail.com>, 2012.
|
||||
+# Weng Xuetian <wengxt@gmail.com>, 2012, 2013.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: fcitx-dev@googlegroups.com\n"
|
||||
-"POT-Creation-Date: 2012-12-24 14:16-0500\n"
|
||||
-"PO-Revision-Date: 2012-12-24 14:17-0500\n"
|
||||
+"POT-Creation-Date: 2013-03-25 00:56-0400\n"
|
||||
+"PO-Revision-Date: 2013-03-25 00:56-0400\n"
|
||||
"Last-Translator: Weng Xuetian <wengxt@gmail.com>\n"
|
||||
"Language-Team: Chinese Simplified <kde-china@kde.org>\n"
|
||||
-"Language: LANG\n"
|
||||
+"Language: zh_CN\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: Lokalize 1.5\n"
|
||||
|
||||
-#: src/fcitx-rime.c:74 src/fcitx-rime.conf.in:3 src/rime.conf.in:3
|
||||
+#: src/fcitx-rime.c:105
|
||||
+msgid "Deploy"
|
||||
+msgstr "重新部署"
|
||||
+
|
||||
+#: src/fcitx-rime.c:84 src/fcitx-rime.conf.in:3 src/rime.conf.in:3
|
||||
msgid "Rime"
|
||||
msgstr "中州韻"
|
||||
|
||||
@@ -25,3 +29,15 @@ msgstr "中州韻"
|
||||
msgid "Rime Wrapper For Fcitx"
|
||||
msgstr "Fcitx 的中州韻封装"
|
||||
|
||||
+#: src/fcitx-rime.c:114
|
||||
+msgid "Synchronize"
|
||||
+msgstr "同步"
|
||||
+
|
||||
+#: src/fcitx-rime.c:113
|
||||
+msgid "⇅ Synchronize"
|
||||
+msgstr "⇅ 同步"
|
||||
+
|
||||
+#: src/fcitx-rime.c:104
|
||||
+msgid "⟲ Deploy"
|
||||
+msgstr "⟲ 重新部署"
|
||||
+
|
||||
diff --git a/src/fcitx-rime.c b/src/fcitx-rime.c
|
||||
index b515d89..6d291b5 100644
|
||||
--- a/src/fcitx-rime.c
|
||||
+++ b/src/fcitx-rime.c
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <fcitx/instance.h>
|
||||
#include <fcitx/context.h>
|
||||
#include <fcitx/candidate.h>
|
||||
+#include <fcitx/hook.h>
|
||||
#include <fcitx-config/xdg.h>
|
||||
#include <libintl.h>
|
||||
#include <rime_api.h>
|
||||
@@ -21,6 +22,12 @@ static INPUT_RETURN_VALUE FcitxRimeDoInput(void* arg, FcitxKeySym sym, unsigned
|
||||
static INPUT_RETURN_VALUE FcitxRimeDoReleaseInput(void* arg, FcitxKeySym sym, unsigned int state);
|
||||
static INPUT_RETURN_VALUE FcitxRimeDoInputReal(void* arg, FcitxKeySym _sym, unsigned int _state);
|
||||
static INPUT_RETURN_VALUE FcitxRimeGetCandWords(void* arg);
|
||||
+static void FcitxRimeToggleEnZh(void* arg);
|
||||
+static const char* FcitxRimeGetDummy(void* arg);
|
||||
+static void FcitxRimeToggleSync(void* arg);
|
||||
+static void FcitxRimeToggleDeploy(void* arg);
|
||||
+static void FcitxRimeResetUI(void* arg);
|
||||
+static void FcitxRimeUpdateStatus(FcitxRime* rime);
|
||||
|
||||
FCITX_EXPORT_API
|
||||
FcitxIMClass ime = {
|
||||
@@ -31,7 +38,7 @@ FcitxIMClass ime = {
|
||||
FCITX_EXPORT_API
|
||||
int ABI_VERSION = FCITX_ABI_VERSION;
|
||||
|
||||
-static void FcitxRimeStart(FcitxRime* rime) {
|
||||
+static void FcitxRimeStart(FcitxRime* rime, boolean fullcheck) {
|
||||
|
||||
char* user_path = NULL;
|
||||
FILE* fp = FcitxXDGGetFileUserWithPrefix("rime", ".place_holder", "w", NULL);
|
||||
@@ -48,7 +55,7 @@ static void FcitxRimeStart(FcitxRime* rime) {
|
||||
fcitx_rime_traits.distribution_code_name = "fcitx-rime";
|
||||
fcitx_rime_traits.distribution_version = "0.1";
|
||||
RimeInitialize(&fcitx_rime_traits);
|
||||
- if (RimeStartMaintenanceOnWorkspaceChange()) {
|
||||
+ if (RimeStartMaintenance(fullcheck)) {
|
||||
// TODO: notification...
|
||||
}
|
||||
|
||||
@@ -59,7 +66,7 @@ static void* FcitxRimeCreate(FcitxInstance* instance)
|
||||
{
|
||||
FcitxRime* rime = (FcitxRime*) fcitx_utils_malloc0(sizeof(FcitxRime));
|
||||
rime->owner = instance;
|
||||
- FcitxRimeStart(rime);
|
||||
+ FcitxRimeStart(rime, false);
|
||||
|
||||
FcitxIMIFace iface;
|
||||
memset(&iface, 0, sizeof(FcitxIMIFace));
|
||||
@@ -81,6 +88,42 @@ static void* FcitxRimeCreate(FcitxInstance* instance)
|
||||
"zh"
|
||||
);
|
||||
|
||||
+ FcitxUIRegisterComplexStatus(
|
||||
+ instance,
|
||||
+ rime,
|
||||
+ "rimeenzh",
|
||||
+ "",
|
||||
+ "",
|
||||
+ FcitxRimeToggleEnZh,
|
||||
+ FcitxRimeGetDummy);
|
||||
+
|
||||
+ FcitxUIRegisterComplexStatus(
|
||||
+ instance,
|
||||
+ rime,
|
||||
+ "rimedeploy",
|
||||
+ _("\xe2\x9f\xb2 Deploy"),
|
||||
+ _("Deploy"),
|
||||
+ FcitxRimeToggleDeploy,
|
||||
+ FcitxRimeGetDummy);
|
||||
+
|
||||
+ FcitxUIRegisterComplexStatus(
|
||||
+ instance,
|
||||
+ rime,
|
||||
+ "rimesync",
|
||||
+ _("\xe2\x87\x85 Synchronize"),
|
||||
+ _("Synchronize"),
|
||||
+ FcitxRimeToggleSync,
|
||||
+ FcitxRimeGetDummy);
|
||||
+
|
||||
+ FcitxUISetStatusVisable(instance, "rimeenzh", false);
|
||||
+ FcitxUISetStatusVisable(instance, "rimesync", false);
|
||||
+ FcitxUISetStatusVisable(instance, "rimedeploy", false);
|
||||
+ FcitxIMEventHook hk;
|
||||
+ hk.arg = rime;
|
||||
+ hk.func = FcitxRimeResetUI;
|
||||
+
|
||||
+ FcitxInstanceRegisterResetInputHook(instance, hk);
|
||||
+
|
||||
return rime;
|
||||
}
|
||||
|
||||
@@ -97,12 +140,14 @@ void FcitxRimeDestroy(void* arg)
|
||||
boolean FcitxRimeInit(void* arg)
|
||||
{
|
||||
FcitxRime* rime = (FcitxRime*) arg;
|
||||
- boolean flag = false;
|
||||
+ boolean flag = true;
|
||||
FcitxInstanceSetContext(rime->owner, CONTEXT_IM_KEYBOARD_LAYOUT, "us");
|
||||
FcitxInstanceSetContext(rime->owner, CONTEXT_DISABLE_AUTO_FIRST_CANDIDATE_HIGHTLIGHT, &flag);
|
||||
FcitxInstanceSetContext(rime->owner, CONTEXT_DISABLE_AUTOENG, &flag);
|
||||
FcitxInstanceSetContext(rime->owner, CONTEXT_DISABLE_QUICKPHRASE, &flag);
|
||||
|
||||
+ FcitxRimeUpdateStatus(rime);
|
||||
+
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -135,6 +180,26 @@ INPUT_RETURN_VALUE FcitxRimeDoReleaseInput(void* arg, FcitxKeySym _sym, unsigned
|
||||
return FcitxRimeDoInputReal(arg, sym, state | (1 << 30));
|
||||
}
|
||||
|
||||
+void FcitxRimeUpdateStatus(FcitxRime* rime)
|
||||
+{
|
||||
+ RimeStatus status = {0};
|
||||
+ RIME_STRUCT_INIT(RimeStatus, status);
|
||||
+ if (RimeGetStatus(rime->session_id, &status)) {
|
||||
+ char* text = "";
|
||||
+ if (status.is_disabled) {
|
||||
+ text = "\xe2\x8c\x9b";
|
||||
+ } else if (status.is_ascii_mode) {
|
||||
+ text = "A";
|
||||
+ } else if (status.schema_name &&
|
||||
+ status.schema_name[0] != '.') {
|
||||
+ text = status.schema_name;
|
||||
+ } else {
|
||||
+ text = "中";
|
||||
+ }
|
||||
+ FcitxUISetStatusString(rime->owner, "rimeenzh", text, text);
|
||||
+ RimeFreeStatus(&status);
|
||||
+ }
|
||||
+}
|
||||
|
||||
INPUT_RETURN_VALUE FcitxRimeDoInput(void* arg, FcitxKeySym _sym, unsigned int _state)
|
||||
{
|
||||
@@ -171,6 +236,9 @@ INPUT_RETURN_VALUE FcitxRimeDoInputReal(void* arg, FcitxKeySym sym, unsigned int
|
||||
FcitxInstanceCommitString(rime->owner, ic, commit.text);
|
||||
RimeFreeCommit(&commit);
|
||||
}
|
||||
+
|
||||
+ FcitxRimeUpdateStatus(rime);
|
||||
+
|
||||
if (!result) {
|
||||
FcitxRimeGetCandWords(rime);
|
||||
FcitxUIUpdateInputWindow(rime->owner);
|
||||
@@ -323,6 +391,52 @@ void FcitxRimeReloadConfig(void* arg)
|
||||
rime->session_id = 0;
|
||||
}
|
||||
RimeFinalize();
|
||||
- FcitxRimeStart(rime);
|
||||
+ FcitxRimeStart(rime, false);
|
||||
+
|
||||
+ FcitxRimeUpdateStatus(rime);
|
||||
+}
|
||||
+
|
||||
+const char* FcitxRimeGetDummy(void* arg)
|
||||
+{
|
||||
+ return "";
|
||||
+}
|
||||
+
|
||||
+void FcitxRimeToggleEnZh(void* arg)
|
||||
+{
|
||||
+
|
||||
+}
|
||||
+
|
||||
+void FcitxRimeResetUI(void* arg)
|
||||
+{
|
||||
+
|
||||
+ FcitxRime* rime = (FcitxRime*) arg;
|
||||
+ FcitxInstance* instance = rime->owner;
|
||||
+ FcitxIM* im = FcitxInstanceGetCurrentIM(instance);
|
||||
+ boolean visible;
|
||||
+ if (!im || strcmp(im->uniqueName, "rime") != 0)
|
||||
+ visible = false;
|
||||
+ else
|
||||
+ visible = true;
|
||||
+ FcitxUISetStatusVisable(instance, "rimeenzh", visible);
|
||||
+ FcitxUISetStatusVisable(instance, "rimesync", visible);
|
||||
+ FcitxUISetStatusVisable(instance, "rimedeploy", visible);
|
||||
+}
|
||||
+
|
||||
+void FcitxRimeToggleSync(void* arg)
|
||||
+{
|
||||
+ RimeSyncUserData();
|
||||
+}
|
||||
+
|
||||
+void FcitxRimeToggleDeploy(void* arg)
|
||||
+{
|
||||
+ FcitxRime* rime = (FcitxRime*) arg;
|
||||
+ if (rime->session_id) {
|
||||
+ RimeDestroySession(rime->session_id);
|
||||
+ rime->session_id = 0;
|
||||
+ }
|
||||
+ RimeFinalize();
|
||||
+ FcitxRimeStart(rime, true);
|
||||
+
|
||||
+ FcitxRimeUpdateStatus(rime);
|
||||
}
|
||||
|
||||
--
|
||||
1.8.1.5
|
||||
|
Loading…
x
Reference in New Issue
Block a user