diff options
| author | 2022-07-14 20:41:41 -0400 | |
|---|---|---|
| committer | 2022-07-14 20:41:41 -0400 | |
| commit | 2fed6dd7e18b638d5108eacb7ebd535707f95453 (patch) | |
| tree | e830cb8e73f176e1fadc8804f43f183c343b82a8 | |
| parent | Merge pull request #8510 from german77/vibration (diff) | |
| parent | qt_web_browser: Fix button inputs with QtWebEngine (diff) | |
| download | yuzu-2fed6dd7e18b638d5108eacb7ebd535707f95453.tar.gz yuzu-2fed6dd7e18b638d5108eacb7ebd535707f95453.tar.xz yuzu-2fed6dd7e18b638d5108eacb7ebd535707f95453.zip | |
Merge pull request #8536 from Morph1984/fix-webapplet-input
qt_web_browser: Fix button inputs with QtWebEngine
| -rw-r--r-- | src/yuzu/applets/qt_web_browser.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/yuzu/applets/qt_web_browser.cpp b/src/yuzu/applets/qt_web_browser.cpp index 790edbb2a..89bd482e0 100644 --- a/src/yuzu/applets/qt_web_browser.cpp +++ b/src/yuzu/applets/qt_web_browser.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #ifdef YUZU_USE_QT_WEB_ENGINE | 4 | #ifdef YUZU_USE_QT_WEB_ENGINE |
| 5 | #include <bit> | ||
| 6 | |||
| 5 | #include <QApplication> | 7 | #include <QApplication> |
| 6 | #include <QKeyEvent> | 8 | #include <QKeyEvent> |
| 7 | 9 | ||
| @@ -211,8 +213,10 @@ template <Core::HID::NpadButton... T> | |||
| 211 | void QtNXWebEngineView::HandleWindowFooterButtonPressedOnce() { | 213 | void QtNXWebEngineView::HandleWindowFooterButtonPressedOnce() { |
| 212 | const auto f = [this](Core::HID::NpadButton button) { | 214 | const auto f = [this](Core::HID::NpadButton button) { |
| 213 | if (input_interpreter->IsButtonPressedOnce(button)) { | 215 | if (input_interpreter->IsButtonPressedOnce(button)) { |
| 216 | const auto button_index = std::countr_zero(static_cast<u64>(button)); | ||
| 217 | |||
| 214 | page()->runJavaScript( | 218 | page()->runJavaScript( |
| 215 | QStringLiteral("yuzu_key_callbacks[%1] == null;").arg(static_cast<u8>(button)), | 219 | QStringLiteral("yuzu_key_callbacks[%1] == null;").arg(button_index), |
| 216 | [this, button](const QVariant& variant) { | 220 | [this, button](const QVariant& variant) { |
| 217 | if (variant.toBool()) { | 221 | if (variant.toBool()) { |
| 218 | switch (button) { | 222 | switch (button) { |
| @@ -236,7 +240,7 @@ void QtNXWebEngineView::HandleWindowFooterButtonPressedOnce() { | |||
| 236 | 240 | ||
| 237 | page()->runJavaScript( | 241 | page()->runJavaScript( |
| 238 | QStringLiteral("if (yuzu_key_callbacks[%1] != null) { yuzu_key_callbacks[%1](); }") | 242 | QStringLiteral("if (yuzu_key_callbacks[%1] != null) { yuzu_key_callbacks[%1](); }") |
| 239 | .arg(static_cast<u8>(button))); | 243 | .arg(button_index)); |
| 240 | } | 244 | } |
| 241 | }; | 245 | }; |
| 242 | 246 | ||