Skip to content

Commit 91b4053

Browse files
authored
update deps; auto collapse when no preedit (#55)
1 parent 4783e36 commit 91b4053

File tree

14 files changed

+180
-24
lines changed

14 files changed

+180
-24
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ jobs:
7979
- name: Build HAP
8080
run: |
8181
git apply --directory=entry/src/main/cpp/fcitx5 patches/fcitx5.patch
82+
git apply --directory=entry/src/main/cpp/fcitx5-chinese-addons patches/chinese-addons.patch
8283
git apply --directory=entry/src/main/cpp/libime patches/libime.patch
8384
# Install dependencies
8485
ohpm install --all

entry/src/main/cpp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ set(ENV{PKG_CONFIG_SYSROOT_DIR} "${PREBUILT_ROOT}")
2020
set(ENV{PKG_CONFIG_PATH} "${PREBUILT_USR}/lib/pkgconfig")
2121

2222
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
23+
set(Fcitx5Utils_DIR "${PROJECT_SOURCE_DIR}/cmake")
2324

2425
find_library(UV NAMES uv)
2526
add_library(ohos_uv SHARED IMPORTED)

entry/src/main/cpp/cmake/FindFcitx5Utils.cmake renamed to entry/src/main/cpp/cmake/Fcitx5UtilsConfig.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ set(FCITX_INSTALL_CMAKECONFIG_DIR "${CMAKE_CURRENT_LIST_DIR}")
77

88
# mimic fcitx5/src/lib/fcitx-utils/Fcitx5UtilsConfig.cmake.in
99
include("${CMAKE_CURRENT_LIST_DIR}/Fcitx5Utils/Fcitx5Macros.cmake")
10+
11+
# Install resources to entry/src/main/resources/resfile/usr/share/fcitx5
1012
set(FCITX_INSTALL_PKGDATADIR /usr/share/fcitx5)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
set(PACKAGE_VERSION_COMPATIBLE TRUE)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
set(Fcitx5Core_FOUND TRUE)
2-
find_package(Fcitx5Utils REQUIRED MODULE)
2+
find_package(Fcitx5Utils REQUIRED CONFIG)

entry/src/main/cpp/fcitx5

Submodule fcitx5 updated 159 files

entry/src/main/cpp/libime

Submodule libime updated 97 files

entry/src/main/cpp/webkeyboard/webkeyboard.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void WebKeyboard::update(UserInterfaceComponent component, InputContext *inputCo
5555
if (auxUp.empty() && preedit.empty() && candidates.empty()) {
5656
notify_main_async(R"JSON({"type":"CLEAR"})JSON");
5757
} else {
58-
setCandidatesAsync(candidates, highlighted, 0, false, false);
58+
setCandidatesAsync(candidates, highlighted, 0, false, false, !inputPanel.clientPreedit().empty());
5959
}
6060
break;
6161
}
@@ -66,14 +66,15 @@ void WebKeyboard::update(UserInterfaceComponent component, InputContext *inputCo
6666
}
6767

6868
void WebKeyboard::setCandidatesAsync(const std::vector<Candidate> &candidates, int highlighted, int scrollState,
69-
bool scrollStart, bool scrollEnd) {
69+
bool scrollStart, bool scrollEnd, bool hasClientPreedit) {
7070
auto j = json{{"type", "CANDIDATES"},
7171
{"data",
7272
{{"candidates", candidates},
7373
{"highlighted", highlighted},
7474
{"scrollState", scrollState},
7575
{"scrollStart", scrollStart},
76-
{"scrollEnd", scrollEnd}}}};
76+
{"scrollEnd", scrollEnd},
77+
{"hasClientPreedit", hasClientPreedit}}}};
7778
notify_main_async(j.dump());
7879
}
7980

@@ -105,7 +106,8 @@ void WebKeyboard::scroll(int start, int count) {
105106
break;
106107
}
107108
}
108-
setCandidatesAsync(candidates, start == 0 ? 0 : -1, 2, start == 0, endReached);
109+
setCandidatesAsync(candidates, start == 0 ? 0 : -1, 2, start == 0, endReached,
110+
!ic->inputPanel().clientPreedit().empty());
109111
}
110112

111113
static nlohmann::json actionToJson(Action *action, InputContext *ic) {

0 commit comments

Comments
 (0)