|
4 | 4 | #include "../macosfrontend/macosfrontend.h" |
5 | 5 | #include "config/config.h" |
6 | 6 | #include "webpanel.h" |
7 | | -#include "webview_candidate_window.hpp" |
8 | 7 |
|
9 | 8 | namespace fcitx { |
10 | 9 |
|
@@ -148,9 +147,7 @@ WebPanel::WebPanel(Instance *instance) |
148 | 147 | if (keyEvent.isRelease()) { |
149 | 148 | return; |
150 | 149 | } |
151 | | - static_cast<candidate_window::WebviewCandidateWindow *>( |
152 | | - window_.get()) |
153 | | - ->copy_html(); |
| 150 | + window_->copy_html(); |
154 | 151 | return keyEvent.filterAndAccept(); |
155 | 152 | } |
156 | 153 | if (scrollState_ == candidate_window::scroll_state_t::ready && |
@@ -265,15 +262,12 @@ void WebPanel::updateConfig() { |
265 | 262 | // window_->set_native_shadow(config_.background->shadow.value()); |
266 | 263 | auto style = configValueToJson(config_).dump(); |
267 | 264 | window_->set_style(style.c_str()); |
268 | | - if (auto web = dynamic_cast<candidate_window::WebviewCandidateWindow *>( |
269 | | - window_.get())) { |
270 | | - web->unload_plugins(); |
271 | | - using namespace candidate_window; |
272 | | - uint64_t apis = (config_.advanced->unsafeAPI->curl.value() ? kCurl : 0); |
273 | | - web->set_api(apis); |
274 | | - if (*config_.advanced->pluginNotice) { |
275 | | - web->load_plugins({*config_.advanced->plugins}); |
276 | | - } |
| 265 | + window_->unload_plugins(); |
| 266 | + using namespace candidate_window; |
| 267 | + uint64_t apis = (config_.advanced->unsafeAPI->curl.value() ? kCurl : 0); |
| 268 | + window_->set_api(apis); |
| 269 | + if (*config_.advanced->pluginNotice) { |
| 270 | + window_->load_plugins({*config_.advanced->plugins}); |
277 | 271 | } |
278 | 272 | } |
279 | 273 |
|
@@ -473,7 +467,8 @@ void WebPanel::updateClient(InputContext *ic) { |
473 | 467 | /// Before calling this, the panel states must already be initialized |
474 | 468 | /// synchronously, by using set_candidates, etc. |
475 | 469 | void WebPanel::showAsync(bool show) { |
476 | | - std::weak_ptr<candidate_window::CandidateWindow> weakWindow = window_; |
| 470 | + std::weak_ptr<candidate_window::WebviewCandidateWindow> weakWindow = |
| 471 | + window_; |
477 | 472 | dispatch_async(dispatch_get_main_queue(), ^void() { |
478 | 473 | if (auto window = weakWindow.lock()) { |
479 | 474 | if (show) { |
|
0 commit comments