Skip to content
This repository has been archived by the owner on Jun 5, 2018. It is now read-only.

手写输入 for fcitx 4.2.6.1 #1

Open
liuyug opened this issue Aug 28, 2013 · 7 comments
Open

手写输入 for fcitx 4.2.6.1 #1

liuyug opened this issue Aug 28, 2013 · 7 comments

Comments

@liuyug
Copy link

liuyug commented Aug 28, 2013

我发现 手写输入 的版本很老了,与 fcitx 4.2.6.1 不兼容。
我用 RHEL 6.4 ,好像只能用到 4.2.6.1 版本,再高就会编译错误。
我对 handwriting 做了一个补丁,使之可以在 4.2.6.1 上手写输入。
但是依然有一个bug,手写输入窗口不能自动关闭,一旦关闭后,也不能自动打开。希望提供一个 solution

下面是我做的补丁

diff -urN fcitx-handwriting-20110908/im/CMakeLists.txt fcitx-handwriting-20110908.new/im/CMakeLists.txt
--- fcitx-handwriting-20110908/im/CMakeLists.txt    2013-08-28 13:48:26.714595086 +0800
+++ fcitx-handwriting-20110908.new/im/CMakeLists.txt    2013-08-28 13:47:25.700113492 +0800
@@ -23,3 +23,4 @@
                       ${FCITX4_FCITX_UTILS_LIBRARIES}
 )
 fcitx_add_addon_conf_file(fcitx-handwriting.conf)
+fcitx_add_inputmethod_conf_file(handwriting.conf)
diff -urN fcitx-handwriting-20110908/im/fcitx-handwriting.conf.in fcitx-handwriting-20110908.new/im/fcitx-handwriting.conf.in
--- fcitx-handwriting-20110908/im/fcitx-handwriting.conf.in 2013-08-28 13:48:26.718595182 +0800
+++ fcitx-handwriting-20110908.new/im/fcitx-handwriting.conf.in 2013-08-28 13:43:05.855813046 +0800
@@ -8,3 +8,4 @@
 Type=SharedLibrary
 Dependency=fcitx-dbus
 SubConfig=
+IMRegisterMethod=ConfigFile
diff -urN fcitx-handwriting-20110908/im/handwriting.c fcitx-handwriting-20110908.new/im/handwriting.c
--- fcitx-handwriting-20110908/im/handwriting.c 2013-08-28 13:48:26.721595256 +0800
+++ fcitx-handwriting-20110908.new/im/handwriting.c 2013-08-28 13:25:06.731827820 +0800
@@ -6,9 +6,12 @@
 #include <fcitx/instance.h>
 #include <fcitx/module.h>
 #include <fcitx/candidate.h>
+#include <dbus/dbus.h>

 #define _(x) gettext(x)

+FCITX_EXPORT_API int ABI_VERSION = FCITX_ABI_VERSION;
+
 static void* HandWritingCreate ( FcitxInstance* instance );
 static void HandWritingDestroy ( void *arg );

@@ -16,7 +19,7 @@
 INPUT_RETURN_VALUE HandWritingDoInput ( void* arg, FcitxKeySym sym, unsigned int state );
 INPUT_RETURN_VALUE HandWritingGetCandWords ( void *arg );
 void HandWritingResetIM ( void *arg );
-INPUT_RETURN_VALUE HandWritingGetCandWord ( void *arg, CandidateWord* candWord );
+INPUT_RETURN_VALUE HandWritingGetCandWord ( void *arg, FcitxCandidateWord* candWord );
 void HandWritingSave ( void *arg );
 void HandWritingReloadConfig ( void *arg );
 DBusHandlerResult HandWritingDBusFilter ( DBusConnection* connection, DBusMessage* msg, void* user_data );
@@ -37,7 +40,7 @@

 void* HandWritingCreate ( FcitxInstance* instance )
 {
-   FcitxHandWriting* handwriting = fcitx_malloc0 ( sizeof ( FcitxHandWriting ) );
+   FcitxHandWriting* handwriting = fcitx_utils_malloc0 ( sizeof ( FcitxHandWriting ) );
    FcitxModuleFunctionArg arg;
    handwriting->owner = instance;
    handwriting->conn = InvokeFunction ( instance, FCITX_DBUS, GETCONNECTION, arg );
@@ -80,9 +83,10 @@
        return NULL;
    }

-   FcitxRegisterIM (
+   FcitxInstanceRegisterIM (
        instance,
        handwriting,
+       "handwriting",
        _ ( "HandWriting" ),
        "handwriting",
        HandWritingInit,
@@ -93,7 +97,8 @@
        HandWritingSave,
        HandWritingReloadConfig,
        NULL,
-       99
+       99,
+        "zh_CN" 
    );
    dbus_error_free ( &err );

@@ -115,7 +120,7 @@
    return IRV_TO_PROCESS;
 }

-INPUT_RETURN_VALUE HandWritingGetCandWord ( void* arg, CandidateWord* candWord )
+INPUT_RETURN_VALUE HandWritingGetCandWord ( void* arg, FcitxCandidateWord* candWord )
 {
    return IRV_TO_PROCESS;
 }
@@ -150,7 +155,7 @@
    {
        if ( dbus_message_get_args ( msg, &error, DBUS_TYPE_STRING, &s0 ,DBUS_TYPE_INVALID ) )
        {
-           CommitString ( handwriting->owner, GetCurrentIC ( handwriting->owner ), s0 );
+           FcitxInstanceCommitString ( handwriting->owner, FcitxInstanceGetCurrentIC ( handwriting->owner ), s0 );
        }
        return DBUS_HANDLER_RESULT_HANDLED;
    }
diff -urN fcitx-handwriting-20110908/im/handwriting.conf.in fcitx-handwriting-20110908.new/im/handwriting.conf.in
--- fcitx-handwriting-20110908/im/handwriting.conf.in   1970-01-01 08:00:00.000000000 +0800
+++ fcitx-handwriting-20110908.new/im/handwriting.conf.in   2013-08-28 13:46:08.436238489 +0800
@@ -0,0 +1,9 @@
+[InputMethod]
+UniqueName=handwriting
+Name=Hand Writing
+Name[zh_CN]=手写
+Name[zh_TW]=手写
+IconName=handwriting
+Priority=5
+LangCode=zh_CN
+Parent=fcitx-handwriting

@wengxt
Copy link
Member

wengxt commented Aug 29, 2013

这是目前个坑……竟然还有人用 ˊ_>ˋ

@liuyug
Copy link
Author

liuyug commented Aug 30, 2013

没有人力投入,也不能重写,当然是坑,好多开源软件都这样...
可有时候确实需要手写输入,在 android ios 上手写输入已经很流行,但反观PC。。。

手写输入主要用于古文,为汉字文化服务,不为日常书写

谁能用拼音输入这几个字?

There was an error creating your comment: Body contains unicode characters above 0xffff

@liuyug
Copy link
Author

liuyug commented Aug 30, 2013

好几个编码在 0xffff 以上的字不让输入,github 也不是万能的...

There was an error creating your comment: Body contains unicode characters above 0xffff

@wengxt
Copy link
Member

wengxt commented Aug 30, 2013

你要输入生僻字可以用fcitx那个笔画试试,用 hpszn 表示 横撇竖折捺,这个汉字反倒有 60000 个。对应你这个字也只要

nnhszhhs 就好了

知道 unicode 的话也可以 ctrl shift alt u,0x3ccc

再说一个问题也是这手写的数据里面本身可能就没你要的字啊,那手写数据里面也就 6700 个字,解决不了你什么问题
没什么开源的好手写引擎所以也没什么动力写…

而且我重新写估计也不会用那么老的gtk写了估计到时候你 centos 6.4 上编译不了…

@liuyug
Copy link
Author

liuyug commented Aug 30, 2013

hpszn 这个到要试试

手写的算法应当是固定的,就是 手写识别数据 需要加强,这个再看看,否则就没意义了。

@yuyichao
Copy link
Member

yuyichao commented Sep 2, 2013

patch 早就有了.... 但是这界面 / 结构很灵异, 所以感觉重用的意义没那么大..... 某人给平板写的那个看上去反倒更好点....

@lmq3342xja
Copy link

@wengxt zinnia的手写库只有6700个字么。。。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants