summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2022-07-04 11:39:27 +0200
committerMorph <39850852+Morph1984@users.noreply.github.com>2022-07-06 02:34:10 +0200
commitcbef6b1fca457b1a36df17c758eee94684020d6e (patch)
treee934df58ee6cc9ce3b073dd67c0b6950ff27ff6b
parentMerge pull request #8486 from liushuyu/github-actions-verify (diff)
downloadyuzu-cbef6b1fca457b1a36df17c758eee94684020d6e.tar
yuzu-cbef6b1fca457b1a36df17c758eee94684020d6e.tar.gz
yuzu-cbef6b1fca457b1a36df17c758eee94684020d6e.tar.bz2
yuzu-cbef6b1fca457b1a36df17c758eee94684020d6e.tar.lz
yuzu-cbef6b1fca457b1a36df17c758eee94684020d6e.tar.xz
yuzu-cbef6b1fca457b1a36df17c758eee94684020d6e.tar.zst
yuzu-cbef6b1fca457b1a36df17c758eee94684020d6e.zip
-rw-r--r--src/yuzu/applets/qt_web_browser.cpp8
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 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#ifdef YUZU_USE_QT_WEB_ENGINE
+#include <bit>
+
#include <QApplication>
#include <QKeyEvent>
@@ -211,8 +213,10 @@ template <Core::HID::NpadButton... T>
void QtNXWebEngineView::HandleWindowFooterButtonPressedOnce() {
const auto f = [this](Core::HID::NpadButton button) {
if (input_interpreter->IsButtonPressedOnce(button)) {
+ const auto button_index = std::countr_zero(static_cast<u64>(button));
+
page()->runJavaScript(
- QStringLiteral("yuzu_key_callbacks[%1] == null;").arg(static_cast<u8>(button)),
+ QStringLiteral("yuzu_key_callbacks[%1] == null;").arg(button_index),
[this, button](const QVariant& variant) {
if (variant.toBool()) {
switch (button) {
@@ -236,7 +240,7 @@ void QtNXWebEngineView::HandleWindowFooterButtonPressedOnce() {
page()->runJavaScript(
QStringLiteral("if (yuzu_key_callbacks[%1] != null) { yuzu_key_callbacks[%1](); }")
- .arg(static_cast<u8>(button)));
+ .arg(button_index));
}
};