forked from EasyIME/PIME
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathHACKING.txt
84 lines (67 loc) · 3.17 KB
/
HACKING.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
For those who want to hack PIME, here is a simple hacking guide.
PIME has a server/client architecture.
The client part is a text service dll file written in C++ and Windows TSF.
The server part can be written in any scripting language (currently python and node.js).
The text service dll is just a thin client and is only responsible for passing
key events to the server process, and then retrieve the composition results
of current input from the server.
Hence all input method modules are implemented in the server side.
When the user select an input method, Windows loads our dll in the app process.
Then, the client dll communicate with the server process via IPC.
The data sent over IPC are all in json format encoded in UTF-8.
------------------------------------------------------------------------------
The IPC (Inter-Process Communication) Architecture
<user input>
|
(via windows TSF)
|
PIMETextService.dll (client)
|
(via Windows named pipe)
|
PIMELauncher.exe (middleware)
|
(via http REST api)
|
backend web services (python or node.js)
------------------------------------------------------------------------------
Directory structure
* PIME:
The main TSF text service dll written in C++.
This will be loaded into every app process that uses PIME input methods.
Therefore the dll must support the same CPU architecture as the app processes.
So, you need to build both 64-bit and 32-bit versions of the dll.
Please refer to README.md for details about how to do it with cmake.
* PIMELauncher:
Launches and the backend server processes on demand and monitor their status.
If the backend servers crash, PIMELauncher is responsible for restarting them.
After installation, PIMELauncher will be launched automatically upon every login.
* cmake:
Contains some cmake rules used to override the default configurations.
* installer:
A nice GUI windows installer written with NSIS.
This will handle all the details of registering TSF input methods to Windows and
write some config values to the Windows registry.
* libIME:
A nice C++ wrapper library for TSF. If you want to implement a TSF input method,
consider using this library instead of do all the hard work yourself.
This is an independent library which can be used outside PIME.
* jsoncpp:
Third party library used to handle json data in C++.
* backends.json:
A list of supported backend engines and their parameters.
Currently only python and node.js are supported.
* python:
The python backend of PIME
* python/python3:
The embedable version of python 3.5 32-bit.
We force the use of this version to avoid any potential conflicts with
existing python installations.
* python/input_methods:
All input method modules implemented using Python 3. If you're trying to implement your
own input method, you should put your module in this directory.
* node
node.js backend of PIME, including node.js 6.3 binaries.
* node/input_methods:
All input method modules implemented using node.js. If you're trying to implement your
own input method, you should put your module in this directory.