summaryrefslogtreecommitdiffstats
path: root/src/input_common
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-11-01 21:17:53 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2021-11-25 03:30:26 +0100
commit77fa4d4bf60526826ef8b53ee3870f7d2a761976 (patch)
tree3c6c07d535bd912ed085be9b826103a6eabe718f /src/input_common
parentsettings: Fix Debug controller type options (diff)
downloadyuzu-77fa4d4bf60526826ef8b53ee3870f7d2a761976.tar
yuzu-77fa4d4bf60526826ef8b53ee3870f7d2a761976.tar.gz
yuzu-77fa4d4bf60526826ef8b53ee3870f7d2a761976.tar.bz2
yuzu-77fa4d4bf60526826ef8b53ee3870f7d2a761976.tar.lz
yuzu-77fa4d4bf60526826ef8b53ee3870f7d2a761976.tar.xz
yuzu-77fa4d4bf60526826ef8b53ee3870f7d2a761976.tar.zst
yuzu-77fa4d4bf60526826ef8b53ee3870f7d2a761976.zip
Diffstat (limited to 'src/input_common')
-rw-r--r--src/input_common/drivers/keyboard.cpp6
-rw-r--r--src/input_common/drivers/keyboard.h7
-rw-r--r--src/input_common/drivers/mouse.cpp5
-rw-r--r--src/input_common/drivers/mouse.h5
-rw-r--r--src/input_common/drivers/touch_screen.cpp6
-rw-r--r--src/input_common/drivers/touch_screen.h8
-rw-r--r--src/input_common/input_engine.cpp5
7 files changed, 21 insertions, 21 deletions
diff --git a/src/input_common/drivers/keyboard.cpp b/src/input_common/drivers/keyboard.cpp
index 85a781a30..549704e89 100644
--- a/src/input_common/drivers/keyboard.cpp
+++ b/src/input_common/drivers/keyboard.cpp
@@ -7,6 +7,12 @@
namespace InputCommon {
+constexpr PadIdentifier identifier = {
+ .guid = Common::UUID{Common::INVALID_UUID},
+ .port = 0,
+ .pad = 0,
+};
+
Keyboard::Keyboard(const std::string& input_engine_) : InputEngine(input_engine_) {
PreSetController(identifier);
}
diff --git a/src/input_common/drivers/keyboard.h b/src/input_common/drivers/keyboard.h
index 58df15050..46fe78576 100644
--- a/src/input_common/drivers/keyboard.h
+++ b/src/input_common/drivers/keyboard.h
@@ -32,13 +32,6 @@ public:
/// Used for automapping features
std::vector<Common::ParamPackage> GetInputDevices() const override;
-
-private:
- const PadIdentifier identifier = {
- .guid = Common::UUID{Common::INVALID_UUID},
- .port = 0,
- .pad = 0,
- };
};
} // namespace InputCommon
diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp
index 1c32b54be..afa92b458 100644
--- a/src/input_common/drivers/mouse.cpp
+++ b/src/input_common/drivers/mouse.cpp
@@ -14,6 +14,11 @@
namespace InputCommon {
constexpr int touch_axis_x = 10;
constexpr int touch_axis_y = 11;
+constexpr PadIdentifier identifier = {
+ .guid = Common::UUID{Common::INVALID_UUID},
+ .port = 0,
+ .pad = 0,
+};
Mouse::Mouse(const std::string input_engine_) : InputEngine(input_engine_) {
PreSetController(identifier);
diff --git a/src/input_common/drivers/mouse.h b/src/input_common/drivers/mouse.h
index cf0918409..1be362b94 100644
--- a/src/input_common/drivers/mouse.h
+++ b/src/input_common/drivers/mouse.h
@@ -62,11 +62,6 @@ private:
void UpdateThread(std::stop_token stop_token);
void StopPanning();
- const PadIdentifier identifier = {
- .guid = Common::UUID{Common::INVALID_UUID},
- .port = 0,
- .pad = 0,
- };
Common::Vec2<int> mouse_origin;
Common::Vec2<int> last_mouse_position;
Common::Vec2<float> last_mouse_change;
diff --git a/src/input_common/drivers/touch_screen.cpp b/src/input_common/drivers/touch_screen.cpp
index e13835e9f..377c9ee2b 100644
--- a/src/input_common/drivers/touch_screen.cpp
+++ b/src/input_common/drivers/touch_screen.cpp
@@ -7,6 +7,12 @@
namespace InputCommon {
+constexpr PadIdentifier identifier = {
+ .guid = Common::UUID{Common::INVALID_UUID},
+ .port = 0,
+ .pad = 0,
+};
+
TouchScreen::TouchScreen(const std::string input_engine_) : InputEngine(input_engine_) {
PreSetController(identifier);
}
diff --git a/src/input_common/drivers/touch_screen.h b/src/input_common/drivers/touch_screen.h
index d297d253c..0f4cd0e7a 100644
--- a/src/input_common/drivers/touch_screen.h
+++ b/src/input_common/drivers/touch_screen.h
@@ -37,14 +37,8 @@ public:
*/
void TouchReleased(std::size_t finger);
+ /// Resets all inputs to their initial value
void ReleaseAllTouch();
-
-private:
- const PadIdentifier identifier = {
- .guid = Common::UUID{Common::INVALID_UUID},
- .port = 0,
- .pad = 0,
- };
};
} // namespace InputCommon
diff --git a/src/input_common/input_engine.cpp b/src/input_common/input_engine.cpp
index 965a2bdf1..139d8d2e6 100644
--- a/src/input_common/input_engine.cpp
+++ b/src/input_common/input_engine.cpp
@@ -353,11 +353,12 @@ void InputEngine::SetMappingCallback(MappingCallback callback) {
void InputEngine::DeleteCallback(int key) {
std::lock_guard lock{mutex_callback};
- if (!callback_list.contains(key)) {
+ const auto& iterator = callback_list.find(key);
+ if (iterator == callback_list.end()) {
LOG_ERROR(Input, "Tried to delete non-existent callback {}", key);
return;
}
- callback_list.erase(key);
+ callback_list.erase(iterator);
}
} // namespace InputCommon