mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Some tweaks to avoid name collisions in upcoming commits
This commit is contained in:
@@ -35,7 +35,7 @@ enum class ShaderWriterFlags {
|
||||
};
|
||||
ENUM_CLASS_BITOPS(ShaderWriterFlags);
|
||||
|
||||
// TODO: Somehow merge with StringWriter from Parsers.h
|
||||
// TODO: Somehow merge with StringWriter from StringWriter.h
|
||||
class ShaderWriter {
|
||||
public:
|
||||
// Extensions are supported for both OpenGL ES and Vulkan (though of course, they're different).
|
||||
|
||||
@@ -165,11 +165,6 @@ struct TouchInput {
|
||||
double timestamp;
|
||||
};
|
||||
|
||||
#undef MOD_CTRL
|
||||
#undef MOD_ALT
|
||||
#undef MOD_SHIFT
|
||||
#undef MOD_META
|
||||
|
||||
enum class KeyInputFlags {
|
||||
DOWN = 1 << 0,
|
||||
UP = 1 << 1,
|
||||
@@ -178,16 +173,17 @@ enum class KeyInputFlags {
|
||||
CHAR = 1 << 4, // Unicode character input. Cannot detect keyups of these so KeyInputFlags::DOWN and KeyInputFlags::UP are zero when this is set.
|
||||
|
||||
// NOTE: These are only available in sync input.
|
||||
MOD_CTRL = 1 << 5,
|
||||
MOD_SHIFT = 1 << 6,
|
||||
MOD_ALT = 1 << 7,
|
||||
MOD_META = 1 << 8, // Windows key, command key, etc.
|
||||
ModCtrl = 1 << 5,
|
||||
ModShift = 1 << 6,
|
||||
ModAlt = 1 << 7,
|
||||
ModMeta = 1 << 8, // Windows key, command key, etc.
|
||||
};
|
||||
|
||||
ENUM_CLASS_BITOPS(KeyInputFlags);
|
||||
|
||||
struct KeyInput {
|
||||
KeyInput() {}
|
||||
// These utility constructors are used a lot in SDL/Qt.
|
||||
KeyInput(InputDeviceID devId, InputKeyCode code, KeyInputFlags fl) : deviceId(devId), keyCode(code), flags(fl) {}
|
||||
KeyInput(InputDeviceID devId, int unicode) : deviceId(devId), unicodeChar(unicode), flags(KeyInputFlags::CHAR) {}
|
||||
InputDeviceID deviceId;
|
||||
|
||||
@@ -362,8 +362,8 @@ bool ChoiceStrip::Key(const KeyInput &input) {
|
||||
}
|
||||
|
||||
// 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 (input.keyCode == NKCODE_TAB && (input.flags & KeyInputFlags::ModCtrl)) {
|
||||
if (input.flags & KeyInputFlags::ModShift) {
|
||||
if (selected_ > 0) {
|
||||
SetSelection(selected_ - 1, true);
|
||||
} else if (!choices_.empty()) {
|
||||
|
||||
+2
-2
@@ -1450,7 +1450,7 @@ bool TextEdit::Key(const KeyInput &input) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ((input.flags & KeyInputFlags::MOD_CTRL) || (input.flags & KeyInputFlags::MOD_META)) {
|
||||
if ((input.flags & KeyInputFlags::ModCtrl) || (input.flags & KeyInputFlags::ModMeta)) {
|
||||
switch (input.keyCode) {
|
||||
case NKCODE_C:
|
||||
// Just copy the entire text contents, until we get selection support.
|
||||
@@ -1501,7 +1501,7 @@ bool TextEdit::Key(const KeyInput &input) {
|
||||
// Process chars.
|
||||
if (input.flags & KeyInputFlags::CHAR) {
|
||||
const int unichar = input.keyCode;
|
||||
if (unichar >= 0x20 && !(input.flags & KeyInputFlags::MOD_CTRL)) { // Ignore control characters.
|
||||
if (unichar >= 0x20 && !(input.flags & KeyInputFlags::ModCtrl)) { // Ignore control characters.
|
||||
// Insert it! (todo: do it with a string insert)
|
||||
char buf[8];
|
||||
buf[u8_wc_toutf8(buf, unichar)] = '\0';
|
||||
|
||||
+7
-5
@@ -474,7 +474,7 @@ int ShaderListScreen::ListShaders(DebugShaderType shaderType, UI::LinearLayout *
|
||||
return count;
|
||||
}
|
||||
|
||||
struct { DebugShaderType type; const char *name; } shaderTypes[] = {
|
||||
static constexpr struct { DebugShaderType type; const char *name; } shaderTypes[] = {
|
||||
{ SHADER_TYPE_VERTEX, "Vertex" },
|
||||
{ SHADER_TYPE_FRAGMENT, "Fragment" },
|
||||
{ SHADER_TYPE_VERTEXLOADER, "VertexLoader" },
|
||||
@@ -729,10 +729,10 @@ bool TouchTestScreen::key(const KeyInput &key) {
|
||||
(key.flags & KeyInputFlags::UP) ? "UP " : "",
|
||||
(key.flags & KeyInputFlags::DOWN) ? "DOWN " : "",
|
||||
(key.flags & KeyInputFlags::CHAR) ? "CHAR " : "",
|
||||
(key.flags & KeyInputFlags::MOD_CTRL) ? "CTRL " : "",
|
||||
(key.flags & KeyInputFlags::MOD_SHIFT) ? "SHIFT " : "",
|
||||
(key.flags & KeyInputFlags::MOD_ALT) ? "ALT " : "",
|
||||
(key.flags & KeyInputFlags::MOD_META) ? "META " : "");
|
||||
(key.flags & KeyInputFlags::ModCtrl) ? "CTRL " : "",
|
||||
(key.flags & KeyInputFlags::ModShift) ? "SHIFT " : "",
|
||||
(key.flags & KeyInputFlags::ModAlt) ? "ALT " : "",
|
||||
(key.flags & KeyInputFlags::ModMeta) ? "META " : "");
|
||||
keyEventLog_.push_back(buf);
|
||||
UpdateLogView();
|
||||
return true;
|
||||
@@ -755,6 +755,8 @@ void TouchTestScreen::axis(const AxisInput &axis) {
|
||||
UpdateLogView();
|
||||
}
|
||||
|
||||
#undef DrawText
|
||||
|
||||
void TouchTestScreen::DrawForeground(UIContext &dc) {
|
||||
Bounds bounds = GetLayoutBounds(dc);
|
||||
|
||||
|
||||
+1
-1
@@ -516,7 +516,7 @@ void MainScreen::CreateViews() {
|
||||
|
||||
bool MainScreen::key(const KeyInput &key) {
|
||||
if (key.flags & KeyInputFlags::DOWN) {
|
||||
if (key.keyCode == NKCODE_F && (key.flags & KeyInputFlags::MOD_CTRL) && System_GetPropertyBool(SYSPROP_HAS_TEXT_INPUT_DIALOG)) {
|
||||
if (key.keyCode == NKCODE_F && (key.flags & KeyInputFlags::ModCtrl) && System_GetPropertyBool(SYSPROP_HAS_TEXT_INPUT_DIALOG)) {
|
||||
auto se = GetI18NCategory(I18NCat::SEARCH);
|
||||
System_InputBoxGetString(GetRequesterToken(), se->T("Search term"), searchFilter_, false, [this](std::string_view value, int) {
|
||||
searchFilter_ = StripSpaces(value);
|
||||
|
||||
+1
-1
@@ -458,7 +458,7 @@ bool ViewSearch::Key(UI::ViewGroup *viewGroup, const KeyInput &input) {
|
||||
} else if (input.flags & KeyInputFlags::DOWN) {
|
||||
if (input.keyCode == NKCODE_DEL) {
|
||||
if (!searchFilter.empty()) {
|
||||
if (input.flags & KeyInputFlags::MOD_CTRL) {
|
||||
if (input.flags & KeyInputFlags::ModCtrl) {
|
||||
// Ctrl+Backspace deletes the last word. Delete until the last space.
|
||||
size_t pos = searchFilter.find_last_of(' ');
|
||||
if (pos != searchFilter.npos) {
|
||||
|
||||
+4
-4
@@ -1521,16 +1521,16 @@ bool NativeKey(const KeyInput &key) {
|
||||
KeyInputFlags modifierFlags{};
|
||||
|
||||
if (g_modifiersPressed & (KeyModifier::LCTRL | KeyModifier::RCTRL)) {
|
||||
modifierFlags |= KeyInputFlags::MOD_CTRL;
|
||||
modifierFlags |= KeyInputFlags::ModCtrl;
|
||||
}
|
||||
if (g_modifiersPressed & (KeyModifier::LSHIFT | KeyModifier::RSHIFT)) {
|
||||
modifierFlags |= KeyInputFlags::MOD_SHIFT;
|
||||
modifierFlags |= KeyInputFlags::ModShift;
|
||||
}
|
||||
if (g_modifiersPressed & (KeyModifier::LALT | KeyModifier::RALT)) {
|
||||
modifierFlags |= KeyInputFlags::MOD_ALT;
|
||||
modifierFlags |= KeyInputFlags::ModAlt;
|
||||
}
|
||||
if (g_modifiersPressed & (KeyModifier::LMETA | KeyModifier::RMETA)) {
|
||||
modifierFlags |= KeyInputFlags::MOD_META;
|
||||
modifierFlags |= KeyInputFlags::ModMeta;
|
||||
}
|
||||
|
||||
KeyInput modKey = key;
|
||||
|
||||
Reference in New Issue
Block a user