-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow client-only architecture #71
Conversation
Please create a shim layer and make it a compile time switch. |
26f6c97
to
d463270
Compare
864d499
to
b585a9c
Compare
src/unix/fcitx5/BUILD.bazel
Outdated
"@fcitx5", | ||
], | ||
) | ||
|
||
mozc_cc_library( | ||
name = "mozc_client_impl", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- create mozc_client_interface target, things like mozc_engine can depend on it.
- Create two mozc_client_impl target one with server, one without.
- use select() on target, not on source files or deps, if possible.
src/unix/fcitx5/BUILD.bazel
Outdated
"//client", | ||
"//protocol:commands_cc_proto", | ||
], | ||
config_setting( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can see how it defines a flag and have a sane default value. (Hint: string_flag & "//conditions:default" ).
Also, "server" as a name is too generic. Better to define a name with "fcitx" in it so it's unique to fcitx (if you use string_flag you will get it for free, since flag is now --//unix/fcitx5:...
src/unix/fcitx5/mozc_client.cc
Outdated
return false; | ||
} | ||
|
||
#if defined(_WIN32) || defined(__linux__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check may break BSD.
Android, iOS and Web cannot use the C-S architecture as-is. The core part of server is SessionHandler. Created a static global variable so server is not needed.
Created
MozcClientInterface
to allow both architectures.MozcClient
is a simplified version ofmozc::client::Client
, which keeps all APIs used by fcitx and discards those not used.MozcClientHolder
becomes a proxy ofmozc::client::Client
.--define server=1
to keep existing C-S arch and--define server=0
for simplified arch.Note: only Linux C-S should still be preferred because mozc_tool also talks to mozc_server. Only other platforms there is no mozc_tool yet so this is not a concern compared to not having fcitx5-mozc running at all.