forked from EasyIME/PIME
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HACKING.txt
63 lines (52 loc) · 2.79 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
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).
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.
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.
* server:
The main server process in which all input methods should be implemented.
Ideally this can be written in any languages and currently the implementation
is in python 3.
* server/input_methods:
All input method modules should go here. If you're trying to implement your
own input method, you should put your module in this directory.
* PIMELauncher:
Launches and monitors the python server process.
When the python server process crashes accidentally, the launcher tries to restart it.
If the server process crashes too often (exceeds 10 times), the launcher will stop
watching the server process and quit.
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.
* libpipe:
The IPC mechanism used by PIME server and client is Windows named pipe.
It's not provided by standard python. This library implement simple IPC
over named pipe and expose some public APIs for use with ctypes.
With this, we don't need to do Windows API programming in python.
* python:
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.
* rapidjson:
Third party library used to handle json data in C++.