From 3b85735a2d42d149403881c25c9a6302734e9a13 Mon Sep 17 00:00:00 2001 From: Cristi Mitrana <31816814+cmitu@users.noreply.github.com> Date: Mon, 23 Dec 2019 16:12:35 +0200 Subject: [PATCH] InputManager: replace pageUp/Down with left/rightShoulder and create an alias (via `isMappedLike`) to accomodate existing configs that use the PageUp/Down buttons. --- es-app/src/components/TextListComponent.h | 6 +++--- es-app/src/views/gamelist/GridGameListView.cpp | 4 ++-- es-core/src/InputConfig.cpp | 4 ++++ es-core/src/InputManager.cpp | 4 ++-- es-core/src/components/ComponentList.cpp | 4 ++-- es-core/src/components/DateTimeEditComponent.cpp | 4 ++-- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/es-app/src/components/TextListComponent.h b/es-app/src/components/TextListComponent.h index b9c0f3670..002fe5535 100644 --- a/es-app/src/components/TextListComponent.h +++ b/es-app/src/components/TextListComponent.h @@ -269,20 +269,20 @@ bool TextListComponent::input(InputConfig* config, Input input) listInput(-1); return true; } - if(config->isMappedTo("pagedown", input)) + if(config->isMappedLike("rightshoulder", input)) { listInput(10); return true; } - if(config->isMappedTo("pageup", input)) + if(config->isMappedLike("leftshoulder", input)) { listInput(-10); return true; } }else{ if(config->isMappedLike("down", input) || config->isMappedLike("up", input) || - config->isMappedTo("pagedown", input) || config->isMappedTo("pageup", input)) + config->isMappedLike("rightshoulder", input) || config->isMappedTo("leftshoulder", input)) { stopScrolling(); } diff --git a/es-app/src/views/gamelist/GridGameListView.cpp b/es-app/src/views/gamelist/GridGameListView.cpp index 636c885d6..d2ab178bd 100644 --- a/es-app/src/views/gamelist/GridGameListView.cpp +++ b/es-app/src/views/gamelist/GridGameListView.cpp @@ -94,12 +94,12 @@ void GridGameListView::setCursor(FileData* file) std::string GridGameListView::getQuickSystemSelectRightButton() { - return "pagedown"; //rightshoulder + return "rightshoulder"; } std::string GridGameListView::getQuickSystemSelectLeftButton() { - return "pageup"; //leftshoulder + return "leftshoulder"; } bool GridGameListView::input(InputConfig* config, Input input) diff --git a/es-core/src/InputConfig.cpp b/es-core/src/InputConfig.cpp index 7cb669746..eb5e59cec 100644 --- a/es-core/src/InputConfig.cpp +++ b/es-core/src/InputConfig.cpp @@ -122,6 +122,10 @@ bool InputConfig::isMappedLike(const std::string& name, Input input) return isMappedTo("up", input) || isMappedTo("leftanalogup", input) || isMappedTo("rightanalogup", input); }else if(name == "down"){ return isMappedTo("down", input) || isMappedTo("leftanalogdown", input) || isMappedTo("rightanalogdown", input); + }else if(name == "leftshoulder"){ + return isMappedTo("leftshoulder", input) || isMappedTo("pageup", input); + }else if(name == "rightshoulder"){ + return isMappedTo("rightshoulder", input) || isMappedTo("pagedown", input); } return isMappedTo(name, input); } diff --git a/es-core/src/InputManager.cpp b/es-core/src/InputManager.cpp index 441812ca9..57c64b404 100644 --- a/es-core/src/InputManager.cpp +++ b/es-core/src/InputManager.cpp @@ -328,8 +328,8 @@ void InputManager::loadDefaultKBConfig() cfg->mapInput("start", Input(DEVICE_KEYBOARD, TYPE_KEY, SDLK_F1, 1, true)); cfg->mapInput("select", Input(DEVICE_KEYBOARD, TYPE_KEY, SDLK_F2, 1, true)); - cfg->mapInput("pageup", Input(DEVICE_KEYBOARD, TYPE_KEY, SDLK_RIGHTBRACKET, 1, true)); - cfg->mapInput("pagedown", Input(DEVICE_KEYBOARD, TYPE_KEY, SDLK_LEFTBRACKET, 1, true)); + cfg->mapInput("leftshoulder", Input(DEVICE_KEYBOARD, TYPE_KEY, SDLK_LEFTBRACKET, 1, true)); + cfg->mapInput("rightshoulder", Input(DEVICE_KEYBOARD, TYPE_KEY, SDLK_RIGHTBRACKET, 1, true)); } void InputManager::writeDeviceConfig(InputConfig* config) diff --git a/es-core/src/components/ComponentList.cpp b/es-core/src/components/ComponentList.cpp index 1a3524f78..1ae1c6756 100644 --- a/es-core/src/components/ComponentList.cpp +++ b/es-core/src/components/ComponentList.cpp @@ -80,10 +80,10 @@ bool ComponentList::input(InputConfig* config, Input input) { return listInput(input.value != 0 ? 1 : 0); - }else if(config->isMappedTo("pageup", input)) + }else if(config->isMappedLike("leftshoulder", input)) { return listInput(input.value != 0 ? -6 : 0); - }else if(config->isMappedTo("pagedown", input)){ + }else if(config->isMappedLike("rightshoulder", input)){ return listInput(input.value != 0 ? 6 : 0); } diff --git a/es-core/src/components/DateTimeEditComponent.cpp b/es-core/src/components/DateTimeEditComponent.cpp index bc6cf482d..91787c18d 100644 --- a/es-core/src/components/DateTimeEditComponent.cpp +++ b/es-core/src/components/DateTimeEditComponent.cpp @@ -53,9 +53,9 @@ bool DateTimeEditComponent::input(InputConfig* config, Input input) } int incDir = 0; - if(config->isMappedLike("up", input) || config->isMappedTo("pageup", input)) + if(config->isMappedLike("up", input) || config->isMappedLike("leftshoulder", input)) incDir = 1; - else if(config->isMappedLike("down", input) || config->isMappedTo("pagedown", input)) + else if(config->isMappedLike("down", input) || config->isMappedLike("rightshoulder", input)) incDir = -1; if(incDir != 0)