mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Support Ctrl+Tab / Ctrl+Shift+Tab to switch tabs in the UI
This commit is contained in:
@@ -165,6 +165,10 @@ struct TouchInput {
|
||||
double timestamp;
|
||||
};
|
||||
|
||||
#undef MOD_CTRL
|
||||
#undef MOD_ALT
|
||||
#undef MOD_SHIFT
|
||||
|
||||
enum class KeyInputFlags {
|
||||
DOWN = 1 << 0,
|
||||
UP = 1 << 1,
|
||||
|
||||
@@ -333,6 +333,24 @@ bool ChoiceStrip::Key(const KeyInput &input) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Support Ctrl+Tab / Ctrl+Shift+Tab as well, as these are common shortcuts for tab switching even outside of browsers.
|
||||
if (input.keyCode == NKCODE_TAB && (input.flags & KeyInputFlags::MOD_CTRL)) {
|
||||
if (input.flags & KeyInputFlags::MOD_SHIFT) {
|
||||
if (selected_ > 0) {
|
||||
SetSelection(selected_ - 1, true);
|
||||
} else if (!choices_.empty()) {
|
||||
SetSelection(choices_.size() - 1, true);
|
||||
}
|
||||
} else {
|
||||
if (selected_ < (int)choices_.size() - 1) {
|
||||
SetSelection(selected_ + 1, true);
|
||||
} else {
|
||||
SetSelection(0, true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return ViewGroup::Key(input);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string_view>
|
||||
#include <functional>
|
||||
|
||||
#include "Common/UI/View.h"
|
||||
#include "Common/UI/ViewGroup.h"
|
||||
|
||||
Reference in New Issue
Block a user