From 1e536bf80dfab7beb924a92ebb6b14fe7d9f84cc Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Sat, 23 Mar 2024 20:21:24 -0400 Subject: [PATCH 1/2] prev/next page on wheel scroll --- fcitx5-webview | 2 +- webpanel/webpanel.cpp | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/fcitx5-webview b/fcitx5-webview index 2ee93b6..328379e 160000 --- a/fcitx5-webview +++ b/fcitx5-webview @@ -1 +1 @@ -Subproject commit 2ee93b6dcf097d1d051bf18af5c1ef778eb2d9e7 +Subproject commit 328379e803205c695ecd1de11daff4cecb2892c0 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(); }); } From b1f512617a35d5a1430be3a866092e42a82704d3 Mon Sep 17 00:00:00 2001 From: ksqsf Date: Sun, 24 Mar 2024 20:43:03 +0800 Subject: [PATCH 2/2] update submodule --- fcitx5-webview | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fcitx5-webview b/fcitx5-webview index 328379e..cfcb499 160000 --- a/fcitx5-webview +++ b/fcitx5-webview @@ -1 +1 @@ -Subproject commit 328379e803205c695ecd1de11daff4cecb2892c0 +Subproject commit cfcb49970144c3f933b0d17bb0c734e2a223952f