diff options
Diffstat (limited to 'src/yuzu')
-rw-r--r-- | src/yuzu/bootmanager.cpp | 8 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 13 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 1c61d419d..50938fb04 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -376,11 +376,15 @@ void GRenderWindow::closeEvent(QCloseEvent* event) { } void GRenderWindow::keyPressEvent(QKeyEvent* event) { - input_subsystem->GetKeyboard()->PressKey(event->key()); + if (!event->isAutoRepeat()) { + input_subsystem->GetKeyboard()->PressKey(event->key()); + } } void GRenderWindow::keyReleaseEvent(QKeyEvent* event) { - input_subsystem->GetKeyboard()->ReleaseKey(event->key()); + if (!event->isAutoRepeat()) { + input_subsystem->GetKeyboard()->ReleaseKey(event->key()); + } } void GRenderWindow::mousePressEvent(QMouseEvent* event) { diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 21d0d3449..e297eeffd 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp @@ -104,7 +104,9 @@ QString ButtonToText(const Common::ParamPackage& param) { } if (param.Get("engine", "") == "keyboard") { - return GetKeyName(param.Get("code", 0)); + const QString button_str = GetKeyName(param.Get("code", 0)); + const QString toggle = QString::fromStdString(param.Get("toggle", false) ? "~" : ""); + return QObject::tr("%1%2").arg(toggle, button_str); } if (param.Get("engine", "") == "gcpad") { @@ -412,6 +414,15 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i analogs_param[analog_id].Set("modifier", ""); analog_map_modifier_button[analog_id]->setText(tr("[not set]")); }); + context_menu.addAction(tr("Toggle button"), [&] { + Common::ParamPackage modifier_param = + Common::ParamPackage{analogs_param[analog_id].Get("modifier", "")}; + const bool toggle_value = !modifier_param.Get("toggle", false); + modifier_param.Set("toggle", toggle_value); + analogs_param[analog_id].Set("modifier", modifier_param.Serialize()); + analog_map_modifier_button[analog_id]->setText( + ButtonToText(modifier_param)); + }); context_menu.exec( analog_map_modifier_button[analog_id]->mapToGlobal(menu_location)); }); |