diff --git a/fcitx5-webview b/fcitx5-webview index 2ee93b6..cfcb499 160000 --- a/fcitx5-webview +++ b/fcitx5-webview @@ -1 +1 @@ -Subproject commit 2ee93b6dcf097d1d051bf18af5c1ef778eb2d9e7 +Subproject commit cfcb49970144c3f933b0d17bb0c734e2a223952f diff --git a/webpanel/webpanel.cpp b/webpanel/webpanel.cpp index f645923..65e48c7 100644 --- a/webpanel/webpanel.cpp +++ b/webpanel/webpanel.cpp @@ -17,12 +17,31 @@ WebPanel::WebPanel(Instance *instance) if (!list) return; try { + // Engine is responsible for updating UI list->candidate(index).select(ic); } catch (const std::invalid_argument &e) { FCITX_ERROR() << "select candidate index out of range"; } }); }); + window_->set_page_callback([this](bool next) { + with_fcitx([&](Fcitx &fcitx) { + auto ic = instance_->mostRecentInputContext(); + const auto &list = ic->inputPanel().candidateList(); + if (!list) + return; + auto *pageableList = list->toPageable(); + if (!pageableList) + return; + if (next) { + pageableList->next(); + } else { + pageableList->prev(); + } + // UI is responsible for updating UI + ic->updateUserInterface(UserInterfaceComponent::InputPanel); + }); + }); window_->set_init_callback([this]() { reloadConfig(); }); }