Input event and device enums (#17514)

* Switch deviceID from int to enum InputDeviceID, globally

* Switch axisId to enum InputAxis

* Change int keycodes to InputKeyCode where it makes sense.

* SDL input buildfix

* SDL keycode buildfix

* Switch on enum warning fixes

* Qt keycode buildfix

* iOS keycode buildfix

* UWP keycode buildfix

* More iOS buildfix

* More iOS buildfix

* Update DinputDevice.cpp
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2023-05-26 18:40:13 +02:00
1 parent 6f380a7a0a
commit 2675d6ea43
32 files changed
+129 -133

No files matched your search

+3 -3
View File
@@ -2063,7 +2063,7 @@ void HostnameSelectScreen::CreatePopupContents(UI::ViewGroup *parent) {
progressView_->SetVisibility(UI::V_GONE);
}
void HostnameSelectScreen::SendEditKey(int keyCode, int flags) {
void HostnameSelectScreen::SendEditKey(InputKeyCode keyCode, int flags) {
auto oldView = UI::GetFocusedView();
UI::SetFocusedView(addrView_);
KeyInput fakeKey{ DEVICE_ID_KEYBOARD, keyCode, KEY_DOWN | flags };
@@ -2074,13 +2074,13 @@ void HostnameSelectScreen::SendEditKey(int keyCode, int flags) {
UI::EventReturn HostnameSelectScreen::OnNumberClick(UI::EventParams &e) {
std::string text = e.v ? e.v->Tag() : "";
if (text.length() == 1 && text[0] >= '0' && text[0] <= '9') {
SendEditKey(text[0], KEY_CHAR);
SendEditKey((InputKeyCode)text[0], KEY_CHAR); // ASCII for digits match keycodes.
}
return UI::EVENT_DONE;
}
UI::EventReturn HostnameSelectScreen::OnPointClick(UI::EventParams &e) {
SendEditKey('.', KEY_CHAR);
SendEditKey(NKCODE_PERIOD, KEY_CHAR);
return UI::EVENT_DONE;
}