Merge pull request #21078 from hrydgard/ui-fixes

More UI fixes, code cleanup
This commit is contained in:
Henrik Rydgård
2025-12-19 23:27:57 +01:00
committed by GitHub
102 changed files with 475 additions and 386 deletions
+2 -5
View File
@@ -41,9 +41,6 @@ typedef signed __int64 s64;
#define NO_INLINE __attribute__((noinline))
#ifdef __SWITCH__
// Some HID conflicts
#define KEY_UP PKEY_UP
#define KEY_DOWN PKEY_DOWN
// Other conflicts
#define Event _Event
#define Framebuffer _Framebuffer
@@ -51,8 +48,8 @@ typedef signed __int64 s64;
#define ThreadContext _ThreadContext
#include <switch.h>
// Cleanup
#undef KEY_UP
#undef KEY_DOWN
#undef KeyInputFlags::UP
#undef KeyInputFlags::DOWN
#undef Event
#undef Framebuffer
#undef Waitable
+4 -4
View File
@@ -19,7 +19,7 @@ TouchInput GestureDetector::Update(const TouchInput &touch, const Bounds &bounds
}
// Mouse / 1-finger-touch control.
Pointer &p = pointers[touch.id];
if ((touch.flags & TOUCH_DOWN) && bounds.Contains(touch.x, touch.y)) {
if ((touch.flags & TouchInputFlags::DOWN) && bounds.Contains(touch.x, touch.y)) {
p.down = true;
p.downTime = time_now_d();
p.downX = touch.x;
@@ -30,7 +30,7 @@ TouchInput GestureDetector::Update(const TouchInput &touch, const Bounds &bounds
p.distanceY = 0.0f;
p.estimatedInertiaX = 0.0f;
p.estimatedInertiaY = 0.0f;
} else if (touch.flags & TOUCH_UP) {
} else if (touch.flags & TouchInputFlags::UP) {
p.down = false;
} else {
p.distanceX += fabsf(touch.x - p.lastX);
@@ -52,7 +52,7 @@ TouchInput GestureDetector::Update(const TouchInput &touch, const Bounds &bounds
p.active |= GESTURE_DRAG_VERTICAL;
// Kill the drag. TODO: Only cancel the drag in one direction.
TouchInput inp2 = touch;
inp2.flags = TOUCH_UP | TOUCH_CANCEL;
inp2.flags = TouchInputFlags::UP | TouchInputFlags::CANCEL;
return inp2;
}
} else {
@@ -67,7 +67,7 @@ TouchInput GestureDetector::Update(const TouchInput &touch, const Bounds &bounds
p.active |= GESTURE_DRAG_HORIZONTAL;
// Kill the drag. TODO: Only cancel the drag in one direction.
TouchInput inp2 = touch;
inp2.flags = TOUCH_UP | TOUCH_CANCEL;
inp2.flags = TouchInputFlags::UP | TouchInputFlags::CANCEL;
return inp2;
}
} else {
+35 -32
View File
@@ -7,6 +7,7 @@
#include <vector>
#include <string>
#include "Common/Common.h"
#include "Common/Input/KeyCodes.h"
#include "Common/Log.h"
@@ -128,64 +129,66 @@ public:
void FormatDebug(char *buffer, size_t bufSize) const;
};
enum {
TOUCH_MOVE = 1 << 0,
TOUCH_DOWN = 1 << 1,
TOUCH_UP = 1 << 2,
TOUCH_CANCEL = 1 << 3, // Sent by scrollviews to their children when they detect a scroll
TOUCH_WHEEL = 1 << 4, // Scrollwheel event. Usually only affects Y but can potentially affect X.
TOUCH_MOUSE = 1 << 5, // Identifies that this touch event came from a mouse. Id is now set to the mouse button for DOWN/UP commands.
TOUCH_RELEASE_ALL = 1 << 6, // Useful for app focus switches when events may be lost.
TOUCH_HOVER = 1 << 7,
// Be careful about changing these values as some are set on the Android java side!
enum class TouchInputFlags {
MOVE = 1 << 0,
DOWN = 1 << 1,
UP = 1 << 2,
CANCEL = 1 << 3, // Sent by scrollviews to their children when they detect a scroll
WHEEL = 1 << 4, // Scrollwheel event. Usually only affects Y but can potentially affect X.
MOUSE = 1 << 5, // Identifies that this touch event came from a mouse. Id is now set to the mouse button for DOWN/UP commands.
RELEASE_ALL = 1 << 6, // Useful for app focus switches when events may be lost.
HOVER = 1 << 7,
// These are the Android getToolType() codes, shifted by 10. Unused currently.
TOUCH_TOOL_MASK = 7 << 10,
TOUCH_TOOL_UNKNOWN = 0 << 10,
TOUCH_TOOL_FINGER = 1 << 10,
TOUCH_TOOL_STYLUS = 2 << 10,
TOUCH_TOOL_MOUSE = 3 << 10,
TOUCH_TOOL_ERASER = 4 << 10,
TOUCH_MAX_POINTERS = 10,
// TOOL_MASK = 7 << 10,
// TOOL_UNKNOWN = 0 << 10,
// TOOL_FINGER = 1 << 10,
// TOOL_STYLUS = 2 << 10,
// TOOL_MOUSE = 3 << 10,
// TOOL_ERASER = 4 << 10,
};
ENUM_CLASS_BITOPS(TouchInputFlags);
constexpr int TOUCH_MAX_POINTERS = 10;
// Used for asynchronous touch input.
// DOWN is always on its own.
// MOVE and UP can be combined.
// TODO: As this handles both mouse and touch, should probably rename to PointerInput or something.
struct TouchInput {
float x;
float y;
int id; // Needs to be <= GestureDetector::MAX_PTRS (10.)
int buttons; // bit mask
int flags;
TouchInputFlags flags;
double timestamp;
};
#undef KEY_DOWN
#undef KEY_UP
enum {
KEY_DOWN = 1 << 0,
KEY_UP = 1 << 1,
KEY_HASWHEELDELTA = 1 << 2,
KEY_IS_REPEAT = 1 << 3,
KEY_CHAR = 1 << 4, // Unicode character input. Cannot detect keyups of these so KEY_DOWN and KEY_UP are zero when this is set.
enum class KeyInputFlags {
DOWN = 1 << 0,
UP = 1 << 1,
HAS_WHEEL_DELTA = 1 << 2,
IS_REPEAT = 1 << 3,
CHAR = 1 << 4, // Unicode character input. Cannot detect keyups of these so KeyInputFlags::DOWN and KeyInputFlags::UP are zero when this is set.
};
ENUM_CLASS_BITOPS(KeyInputFlags);
struct KeyInput {
KeyInput() {}
KeyInput(InputDeviceID devId, InputKeyCode code, int fl) : deviceId(devId), keyCode(code), flags(fl) {}
KeyInput(InputDeviceID devId, int unicode) : deviceId(devId), unicodeChar(unicode), flags(KEY_CHAR) {}
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;
union {
InputKeyCode keyCode; // Android keycodes are the canonical keycodes, everyone else map to them.
int unicodeChar; // for KEY_CHAR
int unicodeChar; // for KeyInputFlags::CHAR
};
int flags;
KeyInputFlags flags;
// Used by mousewheel events. The delta is packed in the upper 16 bits of flags.
// TODO: Move mousewheel events to TouchInput?
int Delta() const {
return flags >> 16;
return (s32)flags >> 16;
}
};
+2 -2
View File
@@ -29,7 +29,7 @@ PopupScreen::PopupScreen(std::string_view title, std::string_view button1, std::
}
void PopupScreen::touch(const TouchInput &touch) {
if (!box_ || (touch.flags & TOUCH_DOWN) == 0) {
if (!box_ || (touch.flags & TouchInputFlags::DOWN) == 0) {
// Handle down-presses here.
UIDialogScreen::touch(touch);
return;
@@ -46,7 +46,7 @@ void PopupScreen::touch(const TouchInput &touch) {
}
bool PopupScreen::key(const KeyInput &key) {
if (key.flags & KEY_DOWN) {
if (key.flags & KeyInputFlags::DOWN) {
if ((key.keyCode == NKCODE_ENTER || key.keyCode == NKCODE_NUMPAD_ENTER) && defaultButton_) {
UI::EventParams e{};
defaultButton_->OnClick.Trigger(e);
+9 -9
View File
@@ -186,7 +186,7 @@ bool IsScrollKey(const KeyInput &input) {
static KeyEventResult KeyEventToFocusMoves(const KeyInput &key) {
KeyEventResult retval = KeyEventResult::PASS_THROUGH;
// Ignore repeats for focus moves.
if ((key.flags & (KEY_DOWN | KEY_IS_REPEAT)) == KEY_DOWN) {
if ((key.flags & KeyInputFlags::DOWN) && !(key.flags & KeyInputFlags::IS_REPEAT)) {
if (IsDPadKey(key) || IsScrollKey(key)) {
// Let's only repeat DPAD initially.
HeldKey hk;
@@ -205,7 +205,7 @@ static KeyEventResult KeyEventToFocusMoves(const KeyInput &key) {
retval = KeyEventResult::ACCEPT;
}
}
if (key.flags & KEY_UP) {
if (key.flags & KeyInputFlags::UP) {
// We ignore the device ID here (in the comparator for HeldKey), due to the Ouya quirk mentioned above.
if (!heldKeys.empty()) {
HeldKey hk;
@@ -232,7 +232,7 @@ KeyEventResult UnsyncKeyEvent(const KeyInput &key, ViewGroup *root) {
retval = KeyEventResult::PASS_THROUGH;
break;
default:
if (!(key.flags & KEY_IS_REPEAT)) {
if (!(key.flags & KeyInputFlags::IS_REPEAT)) {
// If a repeat, we follow what KeyEventToFocusMoves set it to.
// Otherwise we signal that we used the key, always.
retval = KeyEventResult::ACCEPT;
@@ -249,7 +249,7 @@ bool KeyEvent(const KeyInput &key, ViewGroup *root) {
void TouchEvent(const TouchInput &touch, ViewGroup *root) {
focusForced = false;
root->Touch(touch);
if ((touch.flags & TOUCH_DOWN) && !focusForced) {
if ((touch.flags & TouchInputFlags::DOWN) && !focusForced) {
EnableFocusMovement(false);
}
}
@@ -289,14 +289,14 @@ void AxisEvent(const AxisInput &axis, ViewGroup *root) {
if (old == cur)
return;
if (old == DirState::POS) {
FakeKeyEvent(KeyInput{ DEVICE_ID_KEYBOARD, pos_key, KEY_UP }, root);
FakeKeyEvent(KeyInput{ DEVICE_ID_KEYBOARD, pos_key, KeyInputFlags::UP }, root);
} else if (old == DirState::NEG) {
FakeKeyEvent(KeyInput{ DEVICE_ID_KEYBOARD, neg_key, KEY_UP }, root);
FakeKeyEvent(KeyInput{ DEVICE_ID_KEYBOARD, neg_key, KeyInputFlags::UP }, root);
}
if (cur == DirState::POS) {
FakeKeyEvent(KeyInput{ DEVICE_ID_KEYBOARD, pos_key, KEY_DOWN }, root);
FakeKeyEvent(KeyInput{ DEVICE_ID_KEYBOARD, pos_key, KeyInputFlags::DOWN }, root);
} else if (cur == DirState::NEG) {
FakeKeyEvent(KeyInput{ DEVICE_ID_KEYBOARD, neg_key, KEY_DOWN }, root);
FakeKeyEvent(KeyInput{ DEVICE_ID_KEYBOARD, neg_key, KeyInputFlags::DOWN }, root);
}
};
@@ -357,7 +357,7 @@ restart:
KeyInput key;
key.keyCode = iter->key;
key.deviceId = iter->deviceId;
key.flags = KEY_DOWN;
key.flags = KeyInputFlags::DOWN;
KeyEvent(key, root);
focusMoves.push_back(key.keyCode);
+5 -5
View File
@@ -148,7 +148,7 @@ void ScreenManager::switchToNext() {
void ScreenManager::touch(const TouchInput &touch) {
std::lock_guard<std::recursive_mutex> guard(inputLock_);
// Send release all events to every screen layer.
if (touch.flags & TOUCH_RELEASE_ALL) {
if (touch.flags & TouchInputFlags::RELEASE_ALL) {
for (auto &layer : stack_) {
Screen *screen = layer.screen;
layer.screen->UnsyncTouch(screen->transformTouch(touch));
@@ -156,7 +156,7 @@ void ScreenManager::touch(const TouchInput &touch) {
} else if (!stack_.empty()) {
// Let the overlay know about touch-downs, to be able to dismiss popups.
bool skip = false;
if (overlayScreen_ && (touch.flags & TOUCH_DOWN)) {
if (overlayScreen_ && (touch.flags & TouchInputFlags::DOWN)) {
skip = overlayScreen_->UnsyncTouch(overlayScreen_->transformTouch(touch));
}
if (!skip) {
@@ -170,7 +170,7 @@ bool ScreenManager::key(const KeyInput &key) {
std::lock_guard<std::recursive_mutex> guard(inputLock_);
bool result = false;
// Send key up to every screen layer, to avoid stuck keys.
if (key.flags & KEY_UP) {
if (key.flags & KeyInputFlags::UP) {
for (auto &layer : stack_) {
result = layer.screen->UnsyncKey(key);
}
@@ -300,7 +300,7 @@ void ScreenManager::sendMessage(UIMessage message, const char *value) {
TouchInput input{};
input.x = -50000.0f;
input.y = -50000.0f;
input.flags = TOUCH_RELEASE_ALL;
input.flags = TouchInputFlags::RELEASE_ALL;
input.timestamp = time_now_d();
input.id = 0;
touch(input);
@@ -345,7 +345,7 @@ void ScreenManager::push(Screen *screen, int layerFlags) {
TouchInput input{};
input.x = -50000.0f;
input.y = -50000.0f;
input.flags = TOUCH_RELEASE_ALL;
input.flags = TouchInputFlags::RELEASE_ALL;
input.timestamp = time_now_d();
input.id = 0;
touch(input);
+22 -17
View File
@@ -16,16 +16,20 @@ ScrollView::~ScrollView() {
lastScrollPosY = 0;
}
void ScrollView::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert) {
// Respect margins
Margins margins;
Margins ScrollView::GetMargins() const {
if (views_.size()) {
const LinearLayoutParams *linLayoutParams = views_[0]->GetLayoutParams()->As<LinearLayoutParams>();
if (linLayoutParams) {
margins = linLayoutParams->margins;
return linLayoutParams->margins;
}
}
return Margins(0);
}
void ScrollView::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert) {
// Respect margins
const Margins margins = GetMargins();
// The scroll view itself simply obeys its parent - but also tries to fit the child if possible.
MeasureBySpec(layoutParams_->width, horiz.size, horiz, &measuredWidth_);
MeasureBySpec(layoutParams_->height, vert.size, vert, &measuredHeight_);
@@ -68,11 +72,7 @@ void ScrollView::Layout() {
Bounds scrolled;
// Respect margins
Margins margins;
const LinearLayoutParams *linLayoutParams = views_[0]->GetLayoutParams()->As<LinearLayoutParams>();
if (linLayoutParams) {
margins = linLayoutParams->margins;
}
const Margins margins = GetMargins();
scrolled.w = views_[0]->GetMeasuredWidth() - margins.horiz();
scrolled.h = views_[0]->GetMeasuredHeight() - margins.vert();
@@ -118,10 +118,10 @@ bool ScrollView::Key(const KeyInput &input) {
break;
}
if (input.flags & KEY_DOWN) {
if ((input.flags & KeyInputFlags::DOWN) && mouseHover_) {
if ((input.keyCode == NKCODE_EXT_MOUSEWHEEL_UP || input.keyCode == NKCODE_EXT_MOUSEWHEEL_DOWN) &&
(input.flags & KEY_HASWHEELDELTA)) {
scrollSpeed = (float)(short)(input.flags >> 16) * 1.25f; // Fudge factor. TODO: Should be moved to the backends.
(input.flags & KeyInputFlags::HAS_WHEEL_DELTA)) {
scrollSpeed = (float)((s32)input.flags >> 16) * 1.25f; // Fudge factor. TODO: Should be moved to the backends.
}
switch (input.keyCode) {
@@ -142,7 +142,7 @@ const float friction = 0.92f;
const float stop_threshold = 0.1f;
bool ScrollView::Touch(const TouchInput &input) {
if ((input.flags & TOUCH_DOWN) && scrollTouchId_ == -1 && bounds_.Contains(input.x, input.y)) {
if ((input.flags & TouchInputFlags::DOWN) && scrollTouchId_ == -1 && bounds_.Contains(input.x, input.y)) {
if (orientation_ == ORIENT_VERTICAL) {
Bob bob = ComputeBob();
float internalY = input.y - bounds_.y;
@@ -159,7 +159,7 @@ bool ScrollView::Touch(const TouchInput &input) {
Gesture gesture = orientation_ == ORIENT_VERTICAL ? GESTURE_DRAG_VERTICAL : GESTURE_DRAG_HORIZONTAL;
if ((input.flags & TOUCH_UP) && input.id == scrollTouchId_) {
if ((input.flags & TouchInputFlags::UP) && input.id == scrollTouchId_) {
float info[4];
if (gesture_.GetGestureInfo(gesture, input.id, info)) {
inertia_ = info[1];
@@ -168,12 +168,17 @@ bool ScrollView::Touch(const TouchInput &input) {
draggingBob_ = false;
}
if (input.flags & TouchInputFlags::MOUSE) {
// Kinda hacky, we should make a proper hover mechanism.
mouseHover_ = bounds_.Contains(input.x, input.y);
}
// We modify the input2 we send to children, so we can cancel drags if we start scrolling, and stuff like that.
TouchInput input2;
if (CanScroll()) {
if (draggingBob_) {
// Cancel any drags/holds on the children instantly to avoid accidental click-throughs.
input2.flags = TOUCH_UP | TOUCH_CANCEL;
input2.flags = TouchInputFlags::UP | TouchInputFlags::CANCEL;
// Skip the gesture manager, do calculations directly.
// Might switch to the gesture later.
Bob bob = ComputeBob();
@@ -190,7 +195,7 @@ bool ScrollView::Touch(const TouchInput &input) {
} else {
input2 = gesture_.Update(input, bounds_);
float info[4];
if (input.id == scrollTouchId_ && gesture_.GetGestureInfo(gesture, input.id, info) && !(input.flags & TOUCH_DOWN)) {
if (input.id == scrollTouchId_ && gesture_.GetGestureInfo(gesture, input.id, info) && !(input.flags & TouchInputFlags::DOWN)) {
float pos = scrollStart_ - info[0];
scrollPos_ = pos;
scrollTarget_ = pos;
@@ -203,7 +208,7 @@ bool ScrollView::Touch(const TouchInput &input) {
scrollToTarget_ = false;
}
if (!(input.flags & TOUCH_DOWN) || bounds_.Contains(input.x, input.y)) {
if (!(input.flags & TouchInputFlags::DOWN) || bounds_.Contains(input.x, input.y)) {
return ViewGroup::Touch(input2);
} else {
return false;
+2
View File
@@ -47,6 +47,7 @@ public:
NeighborResult FindScrollNeighbor(View *view, const Point2D &target, FocusDirection direction, NeighborResult best) override;
private:
Margins GetMargins() const;
float ChildSize() const; // in the scrolled direction
float ScrollMax() const;
float HardClampedScrollPos(float pos) const;
@@ -79,6 +80,7 @@ private:
float *rememberPos_ = nullptr;
bool alignOpposite_ = false;
bool draggingBob_ = false;
bool mouseHover_ = false;
float barDragStart_ = 0.0f;
float barDragOffset_ = 0.0f;
+1 -1
View File
@@ -316,7 +316,7 @@ void ChoiceStrip::EnableChoice(int choice, bool enabled) {
bool ChoiceStrip::Key(const KeyInput &input) {
bool ret = false;
if (topTabs_ && (input.flags & KEY_DOWN)) {
if (topTabs_ && (input.flags & KeyInputFlags::DOWN)) {
if (IsTabLeftKey(input)) {
if (selected_ > 0) {
SetSelection(selected_ - 1, true);
+3 -3
View File
@@ -87,7 +87,7 @@ bool UIScreen::key(const KeyInput &key) {
}
bool UIScreen::UnsyncTouch(const TouchInput &touch) {
if (ClickDebug && root_ && (touch.flags & TOUCH_DOWN)) {
if (ClickDebug && root_ && (touch.flags & TouchInputFlags::DOWN)) {
INFO_LOG(Log::System, "Touch down!");
std::vector<UI::View *> views;
root_->Query(touch.x, touch.y, views);
@@ -173,7 +173,7 @@ void UIScreen::update() {
key(ev.key);
break;
case QueuedEventType::TOUCH:
if (ClickDebug && (ev.touch.flags & TOUCH_DOWN)) {
if (ClickDebug && (ev.touch.flags & TouchInputFlags::DOWN)) {
INFO_LOG(Log::System, "Touch down!");
std::vector<UI::View *> views;
root_->Query(ev.touch.x, ev.touch.y, views);
@@ -267,7 +267,7 @@ void UIScreen::TriggerFinish(DialogResult result) {
bool UIDialogScreen::key(const KeyInput &key) {
bool retval = UIScreen::key(key);
if (!retval && (key.flags & KEY_DOWN) && UI::IsEscapeKey(key)) {
if (!retval && (key.flags & KeyInputFlags::DOWN) && UI::IsEscapeKey(key)) {
if (finished_) {
ERROR_LOG(Log::System, "Screen already finished");
} else {
+32 -28
View File
@@ -244,11 +244,11 @@ bool Clickable::Touch(const TouchInput &input) {
}
// Ignore buttons other than the left one.
if ((input.flags & TOUCH_MOUSE) && (input.buttons & 1) == 0) {
if ((input.flags & TouchInputFlags::MOUSE) && (input.buttons & 1) == 0) {
return contains;
}
if (input.flags & TOUCH_DOWN) {
if (input.flags & TouchInputFlags::DOWN) {
if (bounds_.Contains(input.x, input.y)) {
if (IsFocusMovementEnabled())
SetFocusedView(this);
@@ -258,12 +258,12 @@ bool Clickable::Touch(const TouchInput &input) {
down_ = false;
dragging_ = false;
}
} else if (input.flags & TOUCH_MOVE) {
} else if (input.flags & TouchInputFlags::MOVE) {
if (dragging_)
down_ = bounds_.Contains(input.x, input.y);
}
if (input.flags & TOUCH_UP) {
if ((input.flags & TOUCH_CANCEL) == 0 && dragging_ && bounds_.Contains(input.x, input.y)) {
if (input.flags & TouchInputFlags::UP) {
if ((input.flags & TouchInputFlags::CANCEL) == 0 && dragging_ && bounds_.Contains(input.x, input.y)) {
ClickInternal();
}
down_ = false;
@@ -361,13 +361,13 @@ bool Clickable::Key(const KeyInput &key) {
// TODO: Replace most of Update with this.
bool ret = false;
if (key.flags & KEY_DOWN) {
if (key.flags & KeyInputFlags::DOWN) {
if (IsAcceptKey(key)) {
down_ = true;
ret = true;
}
}
if (key.flags & KEY_UP) {
if (key.flags & KeyInputFlags::UP) {
if (IsAcceptKey(key)) {
if (down_) {
ClickInternal();
@@ -389,7 +389,7 @@ bool StickyChoice::Touch(const TouchInput &touch) {
return contains;
}
if (touch.flags & TOUCH_DOWN) {
if (touch.flags & TouchInputFlags::DOWN) {
if (contains) {
if (IsFocusMovementEnabled())
SetFocusedView(this);
@@ -407,7 +407,7 @@ bool StickyChoice::Key(const KeyInput &key) {
}
// TODO: Replace most of Update with this.
if (key.flags & KEY_DOWN) {
if (key.flags & KeyInputFlags::DOWN) {
if (IsAcceptKey(key)) {
down_ = true;
UI::PlayUISound(UI::UISound::TOGGLE_ON);
@@ -475,7 +475,9 @@ void Choice::GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz,
int paddingLeft = 12;
int paddingRight = 12;
if (rightIconImage_.isValid()) {
paddingRight = ITEM_HEIGHT;
float imgW, imgH;
dc.Draw()->GetAtlas()->measureImage(rightIconImage_, &imgW, &imgH);
paddingRight = std::max(ITEM_HEIGHT, imgW);
}
float availWidth = horiz.size - paddingLeft - paddingRight - textPadding_.horiz() - totalW;
@@ -540,7 +542,9 @@ void Choice::Draw(UIContext &dc) {
}
if (rightIconImage_.isValid()) {
paddingRight = bounds_.h;
float imgW, imgH;
dc.Draw()->GetAtlas()->measureImage(rightIconImage_, &imgW, &imgH);
paddingRight = std::max(ITEM_HEIGHT, imgW);
}
float availWidth = bounds_.w - (paddingLeft + paddingRight + textPadding_.horiz());
@@ -616,7 +620,7 @@ void ItemHeader::Draw(UIContext &dc) {
const UI::Style &style = popupStyle_ ? dc.GetTheme().popupStyle : dc.GetTheme().headerStyle;
dc.FillRect(style.background, bounds_);
dc.DrawText(text_, bounds_.x + 4, bounds_.centerY(), style.fgColor, ALIGN_LEFT | ALIGN_VCENTER);
dc.DrawText(text_, bounds_.x + 8, bounds_.centerY(), style.fgColor, ALIGN_LEFT | ALIGN_VCENTER);
dc.Draw()->DrawImageCenterTexel(dc.GetTheme().whiteImage, bounds_.x, bounds_.y2()-2, bounds_.x2(), bounds_.y2(), style.fgColor);
}
@@ -1163,11 +1167,11 @@ bool ClickableTextView::Touch(const TouchInput &input) {
bool contains = bounds_.Contains(input.x, input.y);
// Ignore buttons other than the left one.
if ((input.flags & TOUCH_MOUSE) && (input.buttons & 1) == 0) {
if ((input.flags & TouchInputFlags::MOUSE) && (input.buttons & 1) == 0) {
return contains;
}
if (input.flags & TOUCH_DOWN) {
if (input.flags & TouchInputFlags::DOWN) {
if (bounds_.Contains(input.x, input.y)) {
if (IsFocusMovementEnabled())
SetFocusedView(this);
@@ -1177,12 +1181,12 @@ bool ClickableTextView::Touch(const TouchInput &input) {
down_ = false;
dragging_ = false;
}
} else if (input.flags & TOUCH_MOVE) {
} else if (input.flags & TouchInputFlags::MOVE) {
if (dragging_)
down_ = bounds_.Contains(input.x, input.y);
}
if (input.flags & TOUCH_UP) {
if ((input.flags & TOUCH_CANCEL) == 0 && dragging_ && bounds_.Contains(input.x, input.y)) {
if (input.flags & TouchInputFlags::UP) {
if ((input.flags & TouchInputFlags::CANCEL) == 0 && dragging_ && bounds_.Contains(input.x, input.y)) {
EventParams e{};
e.v = this;
OnClick.Trigger(e);
@@ -1279,7 +1283,7 @@ static std::string FirstLine(const std::string &text) {
}
bool TextEdit::Touch(const TouchInput &touch) {
if (touch.flags & TOUCH_DOWN) {
if (touch.flags & TouchInputFlags::DOWN) {
if (bounds_.Contains(touch.x, touch.y)) {
SetFocusedView(this, true);
return true;
@@ -1293,7 +1297,7 @@ bool TextEdit::Key(const KeyInput &input) {
return false;
bool textChanged = false;
// Process hardcoded navigation keys. These aren't chars.
if (input.flags & KEY_DOWN) {
if (input.flags & KeyInputFlags::DOWN) {
switch (input.keyCode) {
case NKCODE_CTRL_LEFT:
case NKCODE_CTRL_RIGHT:
@@ -1396,7 +1400,7 @@ bool TextEdit::Key(const KeyInput &input) {
}
}
if (input.flags & KEY_UP) {
if (input.flags & KeyInputFlags::UP) {
switch (input.keyCode) {
case NKCODE_CTRL_LEFT:
case NKCODE_CTRL_RIGHT:
@@ -1408,7 +1412,7 @@ bool TextEdit::Key(const KeyInput &input) {
}
// Process chars.
if (input.flags & KEY_CHAR) {
if (input.flags & KeyInputFlags::CHAR) {
const int unichar = input.keyCode;
if (unichar >= 0x20 && !ctrlDown_) { // Ignore control characters.
// Insert it! (todo: do it with a string insert)
@@ -1485,20 +1489,20 @@ void Spinner::Draw(UIContext &dc) {
bool TriggerButton::Touch(const TouchInput &input) {
bool contains = bounds_.Contains(input.x, input.y);
if (input.flags & TOUCH_DOWN) {
if (input.flags & TouchInputFlags::DOWN) {
if (contains) {
down_ |= 1 << input.id;
}
}
if (input.flags & TOUCH_MOVE) {
if (input.flags & TouchInputFlags::MOVE) {
if (contains)
down_ |= 1 << input.id;
else
down_ &= ~(1 << input.id);
}
if (input.flags & TOUCH_UP) {
if (input.flags & TouchInputFlags::UP) {
down_ &= ~(1 << input.id);
}
@@ -1521,7 +1525,7 @@ void TriggerButton::GetContentDimensions(const UIContext &dc, float &w, float &h
}
bool Slider::Key(const KeyInput &input) {
if (HasFocus() && (input.flags & (KEY_DOWN | KEY_IS_REPEAT)) == KEY_DOWN) {
if (HasFocus() && (input.flags & KeyInputFlags::DOWN) && !(input.flags & KeyInputFlags::IS_REPEAT)) {
if (ApplyKey(input.keyCode)) {
Clamp();
repeat_ = 0;
@@ -1529,7 +1533,7 @@ bool Slider::Key(const KeyInput &input) {
return true;
}
return false;
} else if ((input.flags & KEY_UP) && input.keyCode == repeatCode_) {
} else if ((input.flags & KeyInputFlags::UP) && input.keyCode == repeatCode_) {
repeat_ = -1;
return false;
} else {
@@ -1722,7 +1726,7 @@ void Slider::GetContentDimensions(const UIContext &dc, float &w, float &h) const
}
bool SliderFloat::Key(const KeyInput &input) {
if (HasFocus() && (input.flags & (KEY_DOWN | KEY_IS_REPEAT)) == KEY_DOWN) {
if (HasFocus() && (input.flags & KeyInputFlags::DOWN) && !(input.flags & KeyInputFlags::IS_REPEAT)) {
if (ApplyKey(input.keyCode)) {
Clamp();
repeat_ = 0;
@@ -1730,7 +1734,7 @@ bool SliderFloat::Key(const KeyInput &input) {
return true;
}
return false;
} else if ((input.flags & KEY_UP) && input.keyCode == repeatCode_) {
} else if ((input.flags & KeyInputFlags::UP) && input.keyCode == repeatCode_) {
repeat_ = -1;
return false;
} else {
+1 -1
View File
@@ -109,7 +109,7 @@ bool ViewGroup::Touch(const TouchInput &input) {
if (view->GetVisibility() == V_VISIBLE) {
bool touch = view->Touch(input);
any = any || touch;
if (exclusiveTouch_ && touch && (input.flags & TOUCH_DOWN)) {
if (exclusiveTouch_ && touch && (input.flags & TouchInputFlags::DOWN)) {
break;
}
}
+8 -8
View File
@@ -236,7 +236,7 @@ void UpdateVRInput(bool haptics, float dp_xscale, float dp_yscale) {
//fill KeyInput structure
bool pressed = status & m.ovr;
keyInput.flags = pressed ? KEY_DOWN : KEY_UP;
keyInput.flags = pressed ? KeyInputFlags::DOWN : KeyInputFlags::UP;
keyInput.keyCode = m.keycode;
keyInput.deviceId = controllerIds[j];
@@ -250,7 +250,7 @@ void UpdateVRInput(bool haptics, float dp_xscale, float dp_yscale) {
m.pressed = pressed;
m.repeat = 0;
} else if (pressed && (m.repeat > 30)) {
keyInput.flags |= KEY_IS_REPEAT;
keyInput.flags |= KeyInputFlags::IS_REPEAT;
cbNativeKey(keyInput);
m.repeat = 0;
} else {
@@ -332,9 +332,9 @@ void UpdateVRInput(bool haptics, float dp_xscale, float dp_yscale) {
bool pressed = IN_VRGetButtonState(mouseController) & ovrButton_Trigger;
if (mousePressed != pressed) {
if (pressed) {
touch.flags = TOUCH_DOWN;
touch.flags = TouchInputFlags::DOWN;
cbNativeTouch(touch);
touch.flags = TOUCH_UP;
touch.flags = TouchInputFlags::UP;
cbNativeTouch(touch);
}
mousePressed = pressed;
@@ -345,10 +345,10 @@ void UpdateVRInput(bool haptics, float dp_xscale, float dp_yscale) {
for (int j = 0; j < 2; j++) {
keyInput.deviceId = controllerIds[j];
float scroll = -IN_VRGetJoystickState(j).y;
keyInput.flags = scroll < -0.5f ? KEY_DOWN : KEY_UP;
keyInput.flags = scroll < -0.5f ? KeyInputFlags::DOWN : KeyInputFlags::UP;
keyInput.keyCode = NKCODE_EXT_MOUSEWHEEL_UP;
cbNativeKey(keyInput);
keyInput.flags = scroll > 0.5f ? KEY_DOWN : KEY_UP;
keyInput.flags = scroll > 0.5f ? KeyInputFlags::DOWN : KeyInputFlags::UP;
keyInput.keyCode = NKCODE_EXT_MOUSEWHEEL_DOWN;
cbNativeKey(keyInput);
}
@@ -375,7 +375,7 @@ bool UpdateVRKeys(const KeyInput &key) {
bool wasCameraAdjustOn = pspKeys[VIRTKEY_VR_CAMERA_ADJUST];
if (KeyMap::InputMappingToPspButton(InputMapping(key.deviceId, key.keyCode), &nativeKeys)) {
for (int& nativeKey : nativeKeys) {
pspKeys[nativeKey] = key.flags & KEY_DOWN;
pspKeys[nativeKey] = key.flags & KeyInputFlags::DOWN;
}
}
@@ -406,7 +406,7 @@ bool UpdateVRKeys(const KeyInput &key) {
if (!wasCameraAdjustOn && pspKeys[VIRTKEY_VR_CAMERA_ADJUST]) {
KeyInput keyUp;
keyUp.deviceId = key.deviceId;
keyUp.flags = KEY_UP;
keyUp.flags = KeyInputFlags::UP;
pspKeys[VIRTKEY_VR_CAMERA_ADJUST] = false;
for (auto& pspKey : pspKeys) {
+10 -10
View File
@@ -250,7 +250,7 @@ void ControlMapper::ReleaseAll() {
if (input.second.value != 0.0) {
KeyInput key;
key.deviceId = input.first.deviceId;
key.flags = KEY_UP;
key.flags = KeyInputFlags::UP;
key.keyCode = (InputKeyCode)input.first.keyCode;
keys.push_back(key);
}
@@ -538,7 +538,7 @@ bool ControlMapper::UpdatePSPState(const InputMapping &changedMapping, double no
}
bool ControlMapper::Key(const KeyInput &key, bool *pauseTrigger) {
if (key.flags & KEY_IS_REPEAT) {
if (key.flags & KeyInputFlags::IS_REPEAT) {
// Claim that we handled this. Prevents volume key repeats from popping up the volume control on Android.
return true;
}
@@ -552,14 +552,14 @@ bool ControlMapper::Key(const KeyInput &key, bool *pauseTrigger) {
deviceTimestamps_[(int)key.deviceId] = now;
}
if (key.flags & KEY_DOWN) {
if (key.flags & KeyInputFlags::DOWN) {
curInput_[mapping] = { 1.0f, now };
} else if (key.flags & KEY_UP) {
} else if (key.flags & KeyInputFlags::UP) {
curInput_[mapping] = { 0.0f, now};
}
// TODO: See if this can be simplified further somehow.
if ((key.flags & KEY_DOWN) && key.keyCode == NKCODE_BACK) {
if ((key.flags & KeyInputFlags::DOWN) && key.keyCode == NKCODE_BACK) {
bool mappingFound = KeyMap::InputMappingToPspButton(mapping, nullptr);
DEBUG_LOG(Log::System, "Key: %d DeviceId: %d", key.keyCode, key.deviceId);
if (!mappingFound || key.deviceId == DEVICE_ID_DEFAULT) {
@@ -666,25 +666,25 @@ void ControlMapper::Update(const DisplayLayoutConfig &config, double now) {
}
}
void ControlMapper::PSPKey(int deviceId, int pspKeyCode, int flags) {
void ControlMapper::PSPKey(int deviceId, int pspKeyCode, KeyInputFlags flags) {
std::lock_guard<std::mutex> guard(mutex_);
if (pspKeyCode >= VIRTKEY_FIRST) {
int vk = pspKeyCode - VIRTKEY_FIRST;
if (flags & KEY_DOWN) {
if (flags & KeyInputFlags::DOWN) {
virtKeys_[vk] = 1.0f;
onVKey((VirtKey)pspKeyCode, true);
onVKeyAnalog(deviceId, (VirtKey)pspKeyCode, 1.0f);
}
if (flags & KEY_UP) {
if (flags & KeyInputFlags::UP) {
virtKeys_[vk] = 0.0f;
onVKey((VirtKey)pspKeyCode, false);
onVKeyAnalog(deviceId, (VirtKey)pspKeyCode, 0.0f);
}
} else {
// INFO_LOG(Log::System, "pspKey %d %d", pspKeyCode, flags);
if (flags & KEY_DOWN)
if (flags & KeyInputFlags::DOWN)
updatePSPButtons_(pspKeyCode, 0);
if (flags & KEY_UP)
if (flags & KeyInputFlags::UP)
updatePSPButtons_(0, pspKeyCode);
}
}
+1 -1
View File
@@ -31,7 +31,7 @@ public:
// Inject raw PSP key input directly, such as from touch screen controls.
// Combined with the mapped input. Unlike __Ctrl APIs, this supports
// virtual key codes, including analog mappings.
void PSPKey(int deviceId, int pspKeyCode, int flags);
void PSPKey(int deviceId, int pspKeyCode, KeyInputFlags flags);
// Toggle swapping DPAD and Analog. Useful on some input devices with few buttons.
void ToggleSwapAxes();
+11 -11
View File
@@ -599,14 +599,14 @@ bool MainUI::event(QEvent *e) {
case Qt::TouchPointReleased:
input.x = touchPoint.pos().x() * g_display.dpi_scale_x * xscale;
input.y = touchPoint.pos().y() * g_display.dpi_scale_y * yscale;
input.flags = (touchPoint.state() == Qt::TouchPointPressed) ? TOUCH_DOWN : TOUCH_UP;
input.flags = (touchPoint.state() == Qt::TouchPointPressed) ? TouchInputFlags::DOWN : TouchInputFlags::UP;
input.id = touchPoint.id();
NativeTouch(input);
break;
case Qt::TouchPointMoved:
input.x = touchPoint.pos().x() * g_display.dpi_scale_x * xscale;
input.y = touchPoint.pos().y() * g_display.dpi_scale_y * yscale;
input.flags = TOUCH_MOVE;
input.flags = TouchInputFlags::MOVE;
input.id = touchPoint.id();
NativeTouch(input);
break;
@@ -625,21 +625,21 @@ bool MainUI::event(QEvent *e) {
case Qt::LeftButton:
input.x = ((QMouseEvent*)e)->pos().x() * g_display.dpi_scale_x * xscale;
input.y = ((QMouseEvent*)e)->pos().y() * g_display.dpi_scale_y * yscale;
input.flags = ((e->type() == QEvent::MouseButtonPress) ? TOUCH_DOWN : TOUCH_UP) | TOUCH_MOUSE;
input.flags = ((e->type() == QEvent::MouseButtonPress) ? TouchInputFlags::DOWN : TouchInputFlags::UP) | TouchInputFlags::MOUSE;
input.id = 0;
NativeTouch(input);
break;
case Qt::RightButton:
NativeKey(KeyInput(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_2, (e->type() == QEvent::MouseButtonPress) ? KEY_DOWN : KEY_UP));
NativeKey(KeyInput(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_2, (e->type() == QEvent::MouseButtonPress) ? KeyInputFlags::DOWN : KeyInputFlags::UP));
break;
case Qt::MiddleButton:
NativeKey(KeyInput(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_3, (e->type() == QEvent::MouseButtonPress) ? KEY_DOWN : KEY_UP));
NativeKey(KeyInput(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_3, (e->type() == QEvent::MouseButtonPress) ? KeyInputFlags::DOWN : KeyInputFlags::UP));
break;
case Qt::ExtraButton1:
NativeKey(KeyInput(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_4, (e->type() == QEvent::MouseButtonPress) ? KEY_DOWN : KEY_UP));
NativeKey(KeyInput(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_4, (e->type() == QEvent::MouseButtonPress) ? KeyInputFlags::DOWN : KeyInputFlags::UP));
break;
case Qt::ExtraButton2:
NativeKey(KeyInput(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_5, (e->type() == QEvent::MouseButtonPress) ? KEY_DOWN : KEY_UP));
NativeKey(KeyInput(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_5, (e->type() == QEvent::MouseButtonPress) ? KeyInputFlags::DOWN : KeyInputFlags::UP));
break;
default:
break;
@@ -648,12 +648,12 @@ bool MainUI::event(QEvent *e) {
case QEvent::MouseMove:
input.x = ((QMouseEvent*)e)->pos().x() * g_display.dpi_scale_x * xscale;
input.y = ((QMouseEvent*)e)->pos().y() * g_display.dpi_scale_y * yscale;
input.flags = TOUCH_MOVE | TOUCH_MOUSE;
input.flags = TouchInputFlags::MOVE | TouchInputFlags::MOUSE;
input.id = 0;
NativeTouch(input);
break;
case QEvent::Wheel:
NativeKey(KeyInput(DEVICE_ID_MOUSE, ((QWheelEvent*)e)->delta()<0 ? NKCODE_EXT_MOUSEWHEEL_DOWN : NKCODE_EXT_MOUSEWHEEL_UP, KEY_DOWN));
NativeKey(KeyInput(DEVICE_ID_MOUSE, ((QWheelEvent*)e)->delta()<0 ? NKCODE_EXT_MOUSEWHEEL_DOWN : NKCODE_EXT_MOUSEWHEEL_UP, KeyInputFlags::DOWN));
break;
case QEvent::KeyPress:
{
@@ -662,7 +662,7 @@ bool MainUI::event(QEvent *e) {
InputKeyCode nativeKeycode = NKCODE_UNKNOWN;
if (iter != KeyMapRawQttoNative.end()) {
nativeKeycode = iter->second;
NativeKey(KeyInput(DEVICE_ID_KEYBOARD, nativeKeycode, KEY_DOWN));
NativeKey(KeyInput(DEVICE_ID_KEYBOARD, nativeKeycode, KeyInputFlags::DOWN));
}
// Also get the unicode value.
@@ -686,7 +686,7 @@ bool MainUI::event(QEvent *e) {
}
break;
case QEvent::KeyRelease:
NativeKey(KeyInput(DEVICE_ID_KEYBOARD, KeyMapRawQttoNative.find(((QKeyEvent*)e)->key())->second, KEY_UP));
NativeKey(KeyInput(DEVICE_ID_KEYBOARD, KeyMapRawQttoNative.find(((QKeyEvent*)e)->key())->second, KeyInputFlags::UP));
break;
default:
+2 -2
View File
@@ -179,7 +179,7 @@ void SDLJoystick::ProcessInput(const SDL_Event &event){
auto code = getKeycodeForButton((SDL_GameControllerButton)event.cbutton.button);
if (code != NKCODE_UNKNOWN) {
KeyInput key;
key.flags = KEY_DOWN;
key.flags = KeyInputFlags::DOWN;
key.keyCode = code;
key.deviceId = DEVICE_ID_PAD_0 + getDeviceIndex(event.cbutton.which);
NativeKey(key);
@@ -191,7 +191,7 @@ void SDLJoystick::ProcessInput(const SDL_Event &event){
auto code = getKeycodeForButton((SDL_GameControllerButton)event.cbutton.button);
if (code != NKCODE_UNKNOWN) {
KeyInput key;
key.flags = KEY_UP;
key.flags = KeyInputFlags::UP;
key.keyCode = code;
key.deviceId = DEVICE_ID_PAD_0 + getDeviceIndex(event.cbutton.which);
NativeKey(key);
+27 -27
View File
@@ -1016,7 +1016,7 @@ static void ProcessSDLEvent(SDL_Window *window, const SDL_Event &event, InputSta
if (event.key.repeat > 0) { break;}
int k = event.key.keysym.sym;
KeyInput key;
key.flags = KEY_DOWN;
key.flags = KeyInputFlags::DOWN;
auto mapped = KeyMapRawSDLtoNative.find(k);
if (mapped == KeyMapRawSDLtoNative.end() || mapped->second == NKCODE_UNKNOWN) {
break;
@@ -1065,7 +1065,7 @@ static void ProcessSDLEvent(SDL_Window *window, const SDL_Event &event, InputSta
if (event.key.repeat > 0) { break;}
int k = event.key.keysym.sym;
KeyInput key;
key.flags = KEY_UP;
key.flags = KeyInputFlags::UP;
auto mapped = KeyMapRawSDLtoNative.find(k);
if (mapped == KeyMapRawSDLtoNative.end() || mapped->second == NKCODE_UNKNOWN) {
break;
@@ -1080,7 +1080,7 @@ static void ProcessSDLEvent(SDL_Window *window, const SDL_Event &event, InputSta
int pos = 0;
int c = u8_nextchar(event.text.text, &pos, strlen(event.text.text));
KeyInput key;
key.flags = KEY_CHAR;
key.flags = KeyInputFlags::CHAR;
key.unicodeChar = c;
key.deviceId = DEVICE_ID_KEYBOARD;
NativeKey(key);
@@ -1096,7 +1096,7 @@ static void ProcessSDLEvent(SDL_Window *window, const SDL_Event &event, InputSta
input.id = event.tfinger.fingerId;
input.x = event.tfinger.x * w * g_DesktopDPI * g_display.dpi_scale_x;
input.y = event.tfinger.y * h * g_DesktopDPI * g_display.dpi_scale_x;
input.flags = TOUCH_MOVE;
input.flags = TouchInputFlags::MOVE;
input.timestamp = event.tfinger.timestamp;
NativeTouch(input);
break;
@@ -1109,14 +1109,14 @@ static void ProcessSDLEvent(SDL_Window *window, const SDL_Event &event, InputSta
input.id = event.tfinger.fingerId;
input.x = event.tfinger.x * w * g_DesktopDPI * g_display.dpi_scale_x;
input.y = event.tfinger.y * h * g_DesktopDPI * g_display.dpi_scale_x;
input.flags = TOUCH_DOWN;
input.flags = TouchInputFlags::DOWN;
input.timestamp = event.tfinger.timestamp;
NativeTouch(input);
KeyInput key{};
key.deviceId = DEVICE_ID_MOUSE;
key.keyCode = NKCODE_EXT_MOUSEBUTTON_1;
key.flags = KEY_DOWN;
key.flags = KeyInputFlags::DOWN;
NativeKey(key);
break;
}
@@ -1128,14 +1128,14 @@ static void ProcessSDLEvent(SDL_Window *window, const SDL_Event &event, InputSta
input.id = event.tfinger.fingerId;
input.x = event.tfinger.x * w * g_DesktopDPI * g_display.dpi_scale_x;
input.y = event.tfinger.y * h * g_DesktopDPI * g_display.dpi_scale_x;
input.flags = TOUCH_UP;
input.flags = TouchInputFlags::UP;
input.timestamp = event.tfinger.timestamp;
NativeTouch(input);
KeyInput key;
key.deviceId = DEVICE_ID_MOUSE;
key.keyCode = NKCODE_EXT_MOUSEBUTTON_1;
key.flags = KEY_UP;
key.flags = KeyInputFlags::UP;
NativeKey(key);
break;
}
@@ -1148,11 +1148,11 @@ static void ProcessSDLEvent(SDL_Window *window, const SDL_Event &event, InputSta
TouchInput input{};
input.x = mx;
input.y = my;
input.flags = TOUCH_DOWN | TOUCH_MOUSE;
input.flags = TouchInputFlags::DOWN | TouchInputFlags::MOUSE;
input.buttons = 1;
input.id = 0;
NativeTouch(input);
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_1, KEY_DOWN);
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_1, KeyInputFlags::DOWN);
NativeKey(key);
}
break;
@@ -1162,29 +1162,29 @@ static void ProcessSDLEvent(SDL_Window *window, const SDL_Event &event, InputSta
TouchInput input{};
input.x = mx;
input.y = my;
input.flags = TOUCH_DOWN | TOUCH_MOUSE;
input.flags = TouchInputFlags::DOWN | TouchInputFlags::MOUSE;
input.buttons = 2;
input.id = 0;
NativeTouch(input);
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_2, KEY_DOWN);
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_2, KeyInputFlags::DOWN);
NativeKey(key);
}
break;
case SDL_BUTTON_MIDDLE:
{
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_3, KEY_DOWN);
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_3, KeyInputFlags::DOWN);
NativeKey(key);
}
break;
case SDL_BUTTON_X1:
{
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_4, KEY_DOWN);
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_4, KeyInputFlags::DOWN);
NativeKey(key);
}
break;
case SDL_BUTTON_X2:
{
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_5, KEY_DOWN);
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_5, KeyInputFlags::DOWN);
NativeKey(key);
}
break;
@@ -1194,18 +1194,18 @@ static void ProcessSDLEvent(SDL_Window *window, const SDL_Event &event, InputSta
{
KeyInput key{};
key.deviceId = DEVICE_ID_MOUSE;
key.flags = KEY_DOWN;
key.flags = KeyInputFlags::DOWN;
#if SDL_VERSION_ATLEAST(2, 0, 18)
if (event.wheel.preciseY != 0.0f) {
// Should the scale be DPI-driven?
const float scale = 30.0f;
key.keyCode = event.wheel.preciseY > 0 ? NKCODE_EXT_MOUSEWHEEL_UP : NKCODE_EXT_MOUSEWHEEL_DOWN;
key.flags |= KEY_HASWHEELDELTA;
key.flags |= KeyInputFlags::HAS_WHEEL_DELTA;
int wheelDelta = event.wheel.preciseY * scale;
if (event.wheel.preciseY < 0) {
wheelDelta = -wheelDelta;
}
key.flags |= wheelDelta << 16;
key.flags = (KeyInputFlags)((u32)key.flags | (wheelDelta << 16));
NativeKey(key);
break;
}
@@ -1224,7 +1224,7 @@ static void ProcessSDLEvent(SDL_Window *window, const SDL_Event &event, InputSta
TouchInput input{};
input.x = mx;
input.y = my;
input.flags = TOUCH_MOVE | TOUCH_MOUSE;
input.flags = TouchInputFlags::MOVE | TouchInputFlags::MOUSE;
input.buttons = inputTracker->mouseDown;
input.id = 0;
NativeTouch(input);
@@ -1241,10 +1241,10 @@ static void ProcessSDLEvent(SDL_Window *window, const SDL_Event &event, InputSta
TouchInput input{};
input.x = mx;
input.y = my;
input.flags = TOUCH_UP | TOUCH_MOUSE;
input.flags = TouchInputFlags::UP | TouchInputFlags::MOUSE;
input.buttons = 1;
NativeTouch(input);
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_1, KEY_UP);
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_1, KeyInputFlags::UP);
NativeKey(key);
}
break;
@@ -1256,28 +1256,28 @@ static void ProcessSDLEvent(SDL_Window *window, const SDL_Event &event, InputSta
TouchInput input{};
input.x = mx;
input.y = my;
input.flags = TOUCH_UP | TOUCH_MOUSE;
input.flags = TouchInputFlags::UP | TouchInputFlags::MOUSE;
input.buttons = 2;
NativeTouch(input);
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_2, KEY_UP);
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_2, KeyInputFlags::UP);
NativeKey(key);
}
break;
case SDL_BUTTON_MIDDLE:
{
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_3, KEY_UP);
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_3, KeyInputFlags::UP);
NativeKey(key);
}
break;
case SDL_BUTTON_X1:
{
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_4, KEY_UP);
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_4, KeyInputFlags::UP);
NativeKey(key);
}
break;
case SDL_BUTTON_X2:
{
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_5, KEY_UP);
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_5, KeyInputFlags::UP);
NativeKey(key);
}
break;
@@ -1755,7 +1755,7 @@ int main(int argc, char *argv[]) {
// Avoid the IME popup when holding keys. This doesn't affect all versions of SDL.
// Note: We re-enable it in text input fields! This is necessary otherwise we don't receive
// KEY_CHAR events.
// KeyInputFlags::CHAR events.
SDL_StopTextInput();
InitSDLAudioDevice();
+10 -10
View File
@@ -96,9 +96,9 @@ checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
[[package]]
name = "bumpalo"
version = "3.19.0"
version = "3.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510"
[[package]]
name = "bytes"
@@ -998,9 +998,9 @@ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
[[package]]
name = "reqwest"
version = "0.12.25"
version = "0.12.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6eff9328d40131d43bd911d42d79eb6a47312002a4daefc9e37f17e74a7701a"
checksum = "3b4c14b2d9afca6a60277086b0cc6a6ae0b568f6f7916c943a8cdc79f8be240f"
dependencies = [
"base64",
"bytes",
@@ -1080,9 +1080,9 @@ dependencies = [
[[package]]
name = "rustls-pki-types"
version = "1.13.1"
version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "708c0f9d5f54ba0272468c1d306a52c495b31fa155e91bc25371e6df7996908c"
checksum = "21e6f2ab2928ca4291b86736a8bd920a277a399bba1589409d72154ff87c1282"
dependencies = [
"zeroize",
]
@@ -1449,9 +1449,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
[[package]]
name = "tracing"
version = "0.1.43"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647"
checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
dependencies = [
"pin-project-lite",
"tracing-core",
@@ -1459,9 +1459,9 @@ dependencies = [
[[package]]
name = "tracing-core"
version = "0.1.35"
version = "0.1.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c"
checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
dependencies = [
"once_cell",
]
+8 -8
View File
@@ -57,8 +57,8 @@ enum Command {
key: String,
},
CopyKey {
old: String,
new: String,
old_section: String,
new_section: String,
key: String,
},
DupeKey {
@@ -789,11 +789,11 @@ fn execute_command(cmd: Command, ai: Option<&ChatGPT>, dry_run: bool, verbose: b
}
Command::CopyKey {
// Copies between sections
ref old,
ref new,
ref old_section,
ref new_section,
ref key,
} => {
copy_key(&mut target_ini, old, new, key).unwrap();
copy_key(&mut target_ini, old_section, new_section, key).unwrap();
}
Command::DupeKey {
ref section,
@@ -904,11 +904,11 @@ fn execute_command(cmd: Command, ai: Option<&ChatGPT>, dry_run: bool, verbose: b
}
Command::CopyKey {
// between sections
ref old,
ref new,
ref old_section,
ref new_section,
ref key,
} => {
copy_key(&mut reference_ini, old, new, key).unwrap();
copy_key(&mut reference_ini, old_section, new_section, key).unwrap();
}
Command::DupeKey {
// Inside a section, preserving a value
+5 -5
View File
@@ -346,7 +346,7 @@ bool KeyMappingNewKeyDialog::key(const KeyInput &key) {
if (time_now_d() < delayUntil_)
return true;
if (key.flags & KEY_DOWN) {
if (key.flags & KeyInputFlags::DOWN) {
if (key.keyCode == NKCODE_EXT_MOUSEBUTTON_1) {
// Don't map
return true;
@@ -359,7 +359,7 @@ bool KeyMappingNewKeyDialog::key(const KeyInput &key) {
InputMapping newMapping(key.deviceId, key.keyCode);
if (!(key.flags & KEY_IS_REPEAT)) {
if (!(key.flags & KeyInputFlags::IS_REPEAT)) {
if (!g_Config.bAllowMappingCombos && !mapping_.mappings.empty()) {
comboMappingsNotEnabled_->SetVisibility(UI::V_VISIBLE);
} else if (!mapping_.mappings.contains(newMapping)) {
@@ -368,7 +368,7 @@ bool KeyMappingNewKeyDialog::key(const KeyInput &key) {
}
}
}
if (key.flags & KEY_UP) {
if (key.flags & KeyInputFlags::UP) {
// If the key released wasn't part of the mapping, ignore it here. Some device can cause
// stray key-up events.
InputMapping upMapping(key.deviceId, key.keyCode);
@@ -401,7 +401,7 @@ bool KeyMappingNewMouseKeyDialog::key(const KeyInput &key) {
return false;
if (ignoreInput_)
return true;
if (key.flags & KEY_DOWN) {
if (key.flags & KeyInputFlags::DOWN) {
if (key.keyCode == NKCODE_ESCAPE) {
TriggerFinish(DR_OK);
g_IsMappingMouseInput = false;
@@ -913,7 +913,7 @@ void VisualMappingScreen::CreateViews() {
}
bool VisualMappingScreen::key(const KeyInput &key) {
if (key.flags & KEY_DOWN) {
if (key.flags & KeyInputFlags::DOWN) {
std::vector<int> pspKeys;
KeyMap::InputMappingToPspButton(InputMapping(key.deviceId, key.keyCode), &pspKeys);
for (int pspKey : pspKeys) {
+8 -8
View File
@@ -521,7 +521,7 @@ void ShaderViewScreen::CreateViews() {
}
bool ShaderViewScreen::key(const KeyInput &ki) {
if (ki.flags & KEY_CHAR) {
if (ki.flags & KeyInputFlags::CHAR) {
if (ki.unicodeChar == 'C' || ki.unicodeChar == 'c') {
System_CopyStringToClipboard(gpu->DebugGetShaderString(id_, type_, SHADER_STRING_SHORT_DESC));
}
@@ -605,7 +605,7 @@ void FrameDumpTestScreen::update() {
void TouchTestScreen::touch(const TouchInput &touch) {
UIBaseDialogScreen::touch(touch);
if (touch.flags & TOUCH_DOWN) {
if (touch.flags & TouchInputFlags::DOWN) {
bool found = false;
for (int i = 0; i < MAX_TOUCH_POINTS; i++) {
if (touches_[i].id == touch.id) {
@@ -626,7 +626,7 @@ void TouchTestScreen::touch(const TouchInput &touch) {
}
}
}
if (touch.flags & TOUCH_MOVE) {
if (touch.flags & TouchInputFlags::MOVE) {
bool found = false;
for (int i = 0; i < MAX_TOUCH_POINTS; i++) {
if (touches_[i].id == touch.id) {
@@ -639,7 +639,7 @@ void TouchTestScreen::touch(const TouchInput &touch) {
WARN_LOG(Log::System, "Move with buttons %d without touch down: %d", touch.buttons, touch.id);
}
}
if (touch.flags & TOUCH_UP) {
if (touch.flags & TouchInputFlags::UP) {
bool found = false;
for (int i = 0; i < MAX_TOUCH_POINTS; i++) {
if (touches_[i].id == touch.id) {
@@ -707,10 +707,10 @@ bool TouchTestScreen::key(const KeyInput &key) {
UIScreen::key(key);
char buf[512];
snprintf(buf, sizeof(buf), "%s (%d) Device ID: %d [%s%s%s%s]", KeyMap::GetKeyName(key.keyCode).c_str(), key.keyCode, key.deviceId,
(key.flags & KEY_IS_REPEAT) ? "REP" : "",
(key.flags & KEY_UP) ? "UP" : "",
(key.flags & KEY_DOWN) ? "DOWN" : "",
(key.flags & KEY_CHAR) ? "CHAR" : "");
(key.flags & KeyInputFlags::IS_REPEAT) ? "REP" : "",
(key.flags & KeyInputFlags::UP) ? "UP" : "",
(key.flags & KeyInputFlags::DOWN) ? "DOWN" : "",
(key.flags & KeyInputFlags::CHAR) ? "CHAR" : "");
keyEventLog_.push_back(buf);
UpdateLogView();
return true;
+3 -3
View File
@@ -68,7 +68,7 @@ public:
DisplayLayoutConfig &config = g_Config.GetDisplayLayoutConfig(orientation_);
if ((touch.flags & TOUCH_MOVE) != 0 && dragging_) {
if ((touch.flags & TouchInputFlags::MOVE) != 0 && dragging_) {
float relativeTouchX = touch.x - startX_;
float relativeTouchY = touch.y - startY_;
@@ -87,7 +87,7 @@ public:
}
}
if ((touch.flags & TOUCH_DOWN) != 0 && !dragging_) {
if ((touch.flags & TouchInputFlags::DOWN) != 0 && !dragging_) {
// Check that we're in the central 80% of the screen.
// If outside, it may be a drag from displaying the back button on phones
// where you have to drag from the side, etc.
@@ -102,7 +102,7 @@ public:
}
}
if ((touch.flags & TOUCH_UP) != 0 && dragging_) {
if ((touch.flags & TouchInputFlags::UP) != 0 && dragging_) {
dragging_ = false;
}
+8 -8
View File
@@ -680,7 +680,7 @@ bool EmuScreen::UnsyncTouch(const TouchInput &touch) {
}
}
if (touch.flags & TOUCH_DOWN) {
if (touch.flags & TouchInputFlags::DOWN) {
if (!(g_Config.bShowImDebugger && imguiInited_) && !ignoreGamepad) {
// This just prevents the gamepad from timing out.
GamepadTouch();
@@ -1071,8 +1071,8 @@ bool EmuScreen::UnsyncKey(const KeyInput &key) {
System_Notify(SystemNotification::ACTIVITY);
// Update imgui modifier flags
if (key.flags & (KEY_DOWN | KEY_UP)) {
bool down = (key.flags & KEY_DOWN) != 0;
if (key.flags & (KeyInputFlags::DOWN | KeyInputFlags::UP)) {
bool down = (key.flags & KeyInputFlags::DOWN) != 0;
switch (key.keyCode) {
case NKCODE_CTRL_LEFT: keyCtrlLeft_ = down; break;
case NKCODE_CTRL_RIGHT: keyCtrlRight_ = down; break;
@@ -1090,7 +1090,7 @@ bool EmuScreen::UnsyncKey(const KeyInput &key) {
// Note: Allow some Vkeys through, so we can toggle the imgui for example (since we actually block the control mapper otherwise in imgui mode).
// We need to manually implement it here :/
if (g_Config.bShowImDebugger && imguiInited_) {
if (key.flags & (KEY_UP | KEY_DOWN)) {
if (key.flags & (KeyInputFlags::UP | KeyInputFlags::DOWN)) {
InputMapping mapping(key.deviceId, key.keyCode);
std::vector<int> pspButtons;
bool mappingFound = KeyMap::InputMappingToPspButton(mapping, &pspButtons);
@@ -1121,7 +1121,7 @@ bool EmuScreen::UnsyncKey(const KeyInput &key) {
}
} else {
// Let up-events through to the controlMapper_ so input doesn't get stuck.
if (key.flags & KEY_UP) {
if (key.flags & KeyInputFlags::UP) {
controlMapper_.Key(key, &pauseTrigger_);
}
}
@@ -1148,7 +1148,7 @@ bool EmuScreen::key(const KeyInput &key) {
ImGui_ImplPlatform_KeyEvent(key);
}
if (!retval && (key.flags & KEY_DOWN) != 0 && UI::IsEscapeKey(key)) {
if (!retval && (key.flags & KeyInputFlags::DOWN) != 0 && UI::IsEscapeKey(key)) {
if (chatMenu_)
chatMenu_->Close();
if (chatButton_)
@@ -1166,7 +1166,7 @@ void EmuScreen::touch(const TouchInput &touch) {
if (!ImGui::GetIO().WantCaptureMouse) {
UIScreen::touch(touch);
}
} else if (g_Config.bMouseControl && !(touch.flags & TOUCH_UP) && (touch.flags & TOUCH_MOUSE)) {
} else if (g_Config.bMouseControl && !(touch.flags & TouchInputFlags::UP) && (touch.flags & TouchInputFlags::MOUSE)) {
// don't do anything as the mouse pointer is hidden in this case.
// But we let touch-up events through to avoid getting stuck if the user toggles mouse control.
} else {
@@ -1174,7 +1174,7 @@ void EmuScreen::touch(const TouchInput &touch) {
if (chatMenu_ && chatMenu_->GetVisibility() == UI::V_VISIBLE) {
// Avoid pressing touch button behind the chat
if (!chatMenu_->Contains(touch.x, touch.y)) {
if ((touch.flags & TOUCH_DOWN) != 0) {
if ((touch.flags & TouchInputFlags::DOWN) != 0) {
chatMenu_->Close();
if (chatButton_)
chatButton_->SetVisibility(UI::V_VISIBLE);
+7 -6
View File
@@ -998,7 +998,8 @@ void GameSettingsScreen::CreateNetworkingSettings(UI::ViewGroup *networkingSetti
networkingSettings->Add(new ItemHeader(ms->T("Networking")));
networkingSettings->Add(new Choice(n->T("Open PPSSPP Multiplayer Wiki Page")))->OnClick.Handle(this, &GameSettingsScreen::OnAdhocGuides);
Choice *wiki = networkingSettings->Add(new Choice(n->T("Open PPSSPP Multiplayer Wiki Page"), ImageID("I_LINK_OUT")));
wiki->OnClick.Handle(this, &GameSettingsScreen::OnAdhocGuides);
networkingSettings->Add(new CheckBox(&g_Config.bEnableWlan, n->T("Enable networking", "Enable networking/wlan (beta)")));
networkingSettings->Add(new MacAddressChooser(GetRequesterToken(), gamePath_, &g_Config.sMACAddress, n->T("Change Mac Address"), screenManager()));
@@ -1053,7 +1054,7 @@ void GameSettingsScreen::CreateNetworkingSettings(UI::ViewGroup *networkingSetti
qc->SetEnabledPtr(&g_Config.bEnableNetworkChat);
#endif
#if !defined(MOBILE_DEVICE) && !defined(USING_QT_UI) // TODO: Add all platforms where KEY_CHAR support is added
#if !defined(MOBILE_DEVICE) && !defined(USING_QT_UI) // TODO: Add all platforms where KeyInputFlags::CHAR support is added
PopupTextInputChoice *qc1 = networkingSettings->Add(new PopupTextInputChoice(GetRequesterToken(), &g_Config.sQuickChat0, n->T("Quick Chat 1"), "", 32, screenManager()));
PopupTextInputChoice *qc2 = networkingSettings->Add(new PopupTextInputChoice(GetRequesterToken(), &g_Config.sQuickChat1, n->T("Quick Chat 2"), "", 32, screenManager()));
PopupTextInputChoice *qc3 = networkingSettings->Add(new PopupTextInputChoice(GetRequesterToken(), &g_Config.sQuickChat2, n->T("Quick Chat 3"), "", 32, screenManager()));
@@ -1868,10 +1869,10 @@ void HostnameSelectScreen::CreatePopupContents(UI::ViewGroup *parent) {
progressView_->SetVisibility(UI::V_GONE);
}
void HostnameSelectScreen::SendEditKey(InputKeyCode keyCode, int flags) {
void HostnameSelectScreen::SendEditKey(InputKeyCode keyCode, KeyInputFlags flags) {
auto oldView = UI::GetFocusedView();
UI::SetFocusedView(addrView_);
KeyInput fakeKey{ DEVICE_ID_KEYBOARD, keyCode, KEY_DOWN | flags };
KeyInput fakeKey{ DEVICE_ID_KEYBOARD, keyCode, KeyInputFlags::DOWN | flags };
addrView_->Key(fakeKey);
UI::SetFocusedView(oldView);
}
@@ -1879,12 +1880,12 @@ void HostnameSelectScreen::SendEditKey(InputKeyCode keyCode, int flags) {
void HostnameSelectScreen::OnNumberClick(UI::EventParams &e) {
std::string text = e.v ? e.v->Tag() : "";
if (text.length() == 1 && text[0] >= '0' && text[0] <= '9') {
SendEditKey((InputKeyCode)text[0], KEY_CHAR); // ASCII for digits match keycodes.
SendEditKey((InputKeyCode)text[0], KeyInputFlags::CHAR); // ASCII for digits match keycodes.
}
}
void HostnameSelectScreen::OnPointClick(UI::EventParams &e) {
SendEditKey((InputKeyCode)'.', KEY_CHAR);
SendEditKey((InputKeyCode)'.', KeyInputFlags::CHAR);
}
void HostnameSelectScreen::OnDeleteClick(UI::EventParams &e) {
+1 -1
View File
@@ -150,7 +150,7 @@ protected:
private:
void ResolverThread();
void SendEditKey(InputKeyCode keyCode, int flags = 0);
void SendEditKey(InputKeyCode keyCode, KeyInputFlags flags = (KeyInputFlags)0);
void OnNumberClick(UI::EventParams &e);
void OnPointClick(UI::EventParams &e);
+35 -35
View File
@@ -111,14 +111,14 @@ bool MultiTouchButton::Touch(const TouchInput &input) {
_dbg_assert_(input.id >= 0 && input.id < TOUCH_MAX_POINTERS);
bool retval = GamepadView::Touch(input);
if ((input.flags & TOUCH_DOWN) && bounds_.Contains(input.x, input.y)) {
if ((input.flags & TouchInputFlags::DOWN) && bounds_.Contains(input.x, input.y)) {
pointerDownMask_ |= 1 << input.id;
usedPointerMask |= 1 << input.id;
if (CanGlide() && !primaryButton[input.id])
primaryButton[input.id] = this;
}
if (input.flags & TOUCH_MOVE) {
if (!(input.flags & TOUCH_MOUSE) || input.buttons) {
if (input.flags & TouchInputFlags::MOVE) {
if (!(input.flags & TouchInputFlags::MOUSE) || input.buttons) {
if (bounds_.Contains(input.x, input.y) && !(analogPointerMask & (1 << input.id))) {
if (CanGlide() && !primaryButton[input.id]) {
primaryButton[input.id] = this;
@@ -129,12 +129,12 @@ bool MultiTouchButton::Touch(const TouchInput &input) {
}
}
}
if (input.flags & TOUCH_UP) {
if (input.flags & TouchInputFlags::UP) {
pointerDownMask_ &= ~(1 << input.id);
usedPointerMask &= ~(1 << input.id);
primaryButton[input.id] = nullptr;
}
if (input.flags & TOUCH_RELEASE_ALL) {
if (input.flags & TouchInputFlags::RELEASE_ALL) {
pointerDownMask_ = 0;
usedPointerMask = 0;
}
@@ -233,7 +233,7 @@ bool CustomButton::Touch(const TouchInput &input) {
if (!repeat_) {
for (int i = 0; i < ARRAY_SIZE(g_customKeyList); i++) {
if (pspButtonBit_ & (1ULL << i)) {
controlMapper_->PSPKey(DEVICE_ID_TOUCH, g_customKeyList[i].c, (on_ && toggle_) ? KEY_UP : KEY_DOWN);
controlMapper_->PSPKey(DEVICE_ID_TOUCH, g_customKeyList[i].c, (on_ && toggle_) ? KeyInputFlags::UP : KeyInputFlags::DOWN);
}
}
}
@@ -242,7 +242,7 @@ bool CustomButton::Touch(const TouchInput &input) {
if (!repeat_) {
for (int i = 0; i < ARRAY_SIZE(g_customKeyList); i++) {
if (pspButtonBit_ & (1ULL << i)) {
controlMapper_->PSPKey(DEVICE_ID_TOUCH, g_customKeyList[i].c, KEY_UP);
controlMapper_->PSPKey(DEVICE_ID_TOUCH, g_customKeyList[i].c, KeyInputFlags::UP);
}
}
}
@@ -264,13 +264,13 @@ void CustomButton::Update() {
} else if (pressedFrames_ == DOWN_FRAME) {
for (int i = 0; i < ARRAY_SIZE(g_customKeyList); i++) {
if (pspButtonBit_ & (1ULL << i)) {
controlMapper_->PSPKey(DEVICE_ID_TOUCH, g_customKeyList[i].c, KEY_UP);
controlMapper_->PSPKey(DEVICE_ID_TOUCH, g_customKeyList[i].c, KeyInputFlags::UP);
}
}
} else if (on_ && pressedFrames_ == 0) {
for (int i = 0; i < ARRAY_SIZE(g_customKeyList); i++) {
if (pspButtonBit_ & (1ULL << i)) {
controlMapper_->PSPKey(DEVICE_ID_TOUCH, g_customKeyList[i].c, KEY_DOWN);
controlMapper_->PSPKey(DEVICE_ID_TOUCH, g_customKeyList[i].c, KeyInputFlags::DOWN);
}
}
pressedFrames_ = 1;
@@ -304,15 +304,15 @@ void PSPDpad::GetContentDimensions(const UIContext &dc, float &w, float &h) cons
bool PSPDpad::Touch(const TouchInput &input) {
bool retval = GamepadView::Touch(input);
if (input.flags & TOUCH_DOWN) {
if (input.flags & TouchInputFlags::DOWN) {
if (dragPointerId_ == -1 && bounds_.Contains(input.x, input.y)) {
dragPointerId_ = input.id;
usedPointerMask |= 1 << input.id;
ProcessTouch(input.x, input.y, true);
}
}
if (input.flags & TOUCH_MOVE) {
if (!(input.flags & TOUCH_MOUSE) || input.buttons) {
if (input.flags & TouchInputFlags::MOVE) {
if (!(input.flags & TouchInputFlags::MOUSE) || input.buttons) {
if (dragPointerId_ == -1 && bounds_.Contains(input.x, input.y) && !(analogPointerMask & (1 << input.id))) {
dragPointerId_ = input.id;
}
@@ -321,7 +321,7 @@ bool PSPDpad::Touch(const TouchInput &input) {
}
}
}
if (input.flags & TOUCH_UP) {
if (input.flags & TouchInputFlags::UP) {
if (input.id == dragPointerId_) {
dragPointerId_ = -1;
usedPointerMask &= ~(1 << input.id);
@@ -475,7 +475,7 @@ void PSPStick::Draw(UIContext &dc) {
bool PSPStick::Touch(const TouchInput &input) {
bool retval = GamepadView::Touch(input);
if (input.flags & TOUCH_RELEASE_ALL) {
if (input.flags & TouchInputFlags::RELEASE_ALL) {
dragPointerId_ = -1;
centerX_ = bounds_.centerX();
centerY_ = bounds_.centerY();
@@ -484,7 +484,7 @@ bool PSPStick::Touch(const TouchInput &input) {
analogPointerMask = 0;
return retval;
}
if (input.flags & TOUCH_DOWN) {
if (input.flags & TouchInputFlags::DOWN) {
const TouchControlConfig &config = g_Config.GetTouchControlsConfig(g_display.GetDeviceOrientation());
float fac = 0.5f * (stick_ ? config.fRightStickHeadScale : config.fLeftStickHeadScale)-0.5f;
if (dragPointerId_ == -1 && bounds_.Expand(bounds_.w*fac, bounds_.h*fac).Contains(input.x, input.y)) {
@@ -502,13 +502,13 @@ bool PSPStick::Touch(const TouchInput &input) {
retval = true;
}
}
if (input.flags & TOUCH_MOVE) {
if (input.flags & TouchInputFlags::MOVE) {
if (input.id == dragPointerId_) {
ProcessTouch(input.x, input.y, true);
retval = true;
}
}
if (input.flags & TOUCH_UP) {
if (input.flags & TouchInputFlags::UP) {
if (input.id == dragPointerId_) {
dragPointerId_ = -1;
centerX_ = bounds_.centerX();
@@ -586,7 +586,7 @@ void PSPCustomStick::Draw(UIContext &dc) {
bool PSPCustomStick::Touch(const TouchInput &input) {
bool retval = GamepadView::Touch(input);
if (input.flags & TOUCH_RELEASE_ALL) {
if (input.flags & TouchInputFlags::RELEASE_ALL) {
dragPointerId_ = -1;
centerX_ = bounds_.centerX();
centerY_ = bounds_.centerY();
@@ -596,7 +596,7 @@ bool PSPCustomStick::Touch(const TouchInput &input) {
analogPointerMask = 0;
return false;
}
if (input.flags & TOUCH_DOWN) {
if (input.flags & TouchInputFlags::DOWN) {
const TouchControlConfig &config = g_Config.GetTouchControlsConfig(g_display.GetDeviceOrientation());
float fac = 0.5f * config.fRightStickHeadScale - 0.5f;
if (dragPointerId_ == -1 && bounds_.Expand(bounds_.w*fac, bounds_.h*fac).Contains(input.x, input.y)) {
@@ -614,13 +614,13 @@ bool PSPCustomStick::Touch(const TouchInput &input) {
retval = true;
}
}
if (input.flags & TOUCH_MOVE) {
if (input.flags & TouchInputFlags::MOVE) {
if (input.id == dragPointerId_) {
ProcessTouch(input.x, input.y, true);
retval = true;
}
}
if (input.flags & TOUCH_UP) {
if (input.flags & TouchInputFlags::UP) {
if (input.id == dragPointerId_) {
dragPointerId_ = -1;
centerX_ = bounds_.centerX();
@@ -1034,12 +1034,12 @@ bool GestureGamepad::Touch(const TouchInput &input) {
return false;
}
if (input.flags & TOUCH_RELEASE_ALL) {
if (input.flags & TouchInputFlags::RELEASE_ALL) {
dragPointerId_ = -1;
return false;
}
if (input.flags & TOUCH_DOWN) {
if (input.flags & TouchInputFlags::DOWN) {
if (dragPointerId_ == -1) {
dragPointerId_ = input.id;
lastX_ = input.x;
@@ -1049,14 +1049,14 @@ bool GestureGamepad::Touch(const TouchInput &input) {
const float now = time_now_d();
if (now - lastTapRelease_ < 0.3f && !haveDoubleTapped_) {
if (g_Config.iDoubleTapGesture != 0 )
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iDoubleTapGesture-1], KEY_DOWN);
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iDoubleTapGesture-1], KeyInputFlags::DOWN);
haveDoubleTapped_ = true;
}
lastTouchDown_ = now;
}
}
if (input.flags & TOUCH_MOVE) {
if (input.flags & TouchInputFlags::MOVE) {
if (input.id == dragPointerId_) {
deltaX_ += input.x - lastX_;
deltaY_ += input.y - lastY_;
@@ -1073,7 +1073,7 @@ bool GestureGamepad::Touch(const TouchInput &input) {
}
}
}
if (input.flags & TOUCH_UP) {
if (input.flags & TouchInputFlags::UP) {
if (input.id == dragPointerId_) {
dragPointerId_ = -1;
if (time_now_d() - lastTouchDown_ < 0.3f)
@@ -1081,7 +1081,7 @@ bool GestureGamepad::Touch(const TouchInput &input) {
if (haveDoubleTapped_) {
if (g_Config.iDoubleTapGesture != 0)
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iDoubleTapGesture-1], KEY_UP);
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iDoubleTapGesture-1], KeyInputFlags::UP);
haveDoubleTapped_ = false;
}
@@ -1110,37 +1110,37 @@ void GestureGamepad::Update() {
float dy = deltaY_ * g_display.dpi_scale_y * g_Config.fSwipeSensitivity;
if (g_Config.iSwipeRight != 0) {
if (dx > th) {
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeRight-1], KEY_DOWN);
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeRight-1], KeyInputFlags::DOWN);
swipeRightReleased_ = false;
} else if (!swipeRightReleased_) {
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeRight-1], KEY_UP);
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeRight-1], KeyInputFlags::UP);
swipeRightReleased_ = true;
}
}
if (g_Config.iSwipeLeft != 0) {
if (dx < -th) {
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeLeft-1], KEY_DOWN);
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeLeft-1], KeyInputFlags::DOWN);
swipeLeftReleased_ = false;
} else if (!swipeLeftReleased_) {
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeLeft-1], KEY_UP);
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeLeft-1], KeyInputFlags::UP);
swipeLeftReleased_ = true;
}
}
if (g_Config.iSwipeUp != 0) {
if (dy < -th) {
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeUp-1], KEY_DOWN);
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeUp-1], KeyInputFlags::DOWN);
swipeUpReleased_ = false;
} else if (!swipeUpReleased_) {
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeUp-1], KEY_UP);
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeUp-1], KeyInputFlags::UP);
swipeUpReleased_ = true;
}
}
if (g_Config.iSwipeDown != 0) {
if (dy > th) {
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeDown-1], KEY_DOWN);
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeDown-1], KeyInputFlags::DOWN);
swipeDownReleased_ = false;
} else if (!swipeDownReleased_) {
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeDown-1], KEY_UP);
controlMapper_->PSPKey(DEVICE_ID_TOUCH, GestureKey::keyList[g_Config.iSwipeDown-1], KeyInputFlags::UP);
swipeDownReleased_ = true;
}
}
+1 -1
View File
@@ -485,7 +485,7 @@ void AddressPromptScreen::UpdatePreviewDigits() {
}
bool AddressPromptScreen::key(const KeyInput &key) {
if (key.flags & KEY_DOWN) {
if (key.flags & KeyInputFlags::DOWN) {
if (key.keyCode >= NKCODE_0 && key.keyCode <= NKCODE_9) {
AddDigit(key.keyCode - NKCODE_0);
} else if (key.keyCode >= NKCODE_A && key.keyCode <= NKCODE_F) {
+18 -12
View File
@@ -139,10 +139,10 @@ public:
bool Touch(const TouchInput &input) override {
bool retval = UI::Clickable::Touch(input);
hovering_ = bounds_.Contains(input.x, input.y);
if (hovering_ && (input.flags & TOUCH_DOWN)) {
if (hovering_ && (input.flags & TouchInputFlags::DOWN)) {
holdStart_ = time_now_d();
}
if (input.flags & TOUCH_UP) {
if (input.flags & TouchInputFlags::UP) {
holdStart_ = 0;
}
return retval;
@@ -153,15 +153,15 @@ public:
if (HasFocus() && UI::IsInfoKey(key)) {
// If the button mapped to triangle, then show the info.
if (key.flags & KEY_UP) {
if (key.flags & KeyInputFlags::UP) {
showInfo = true;
}
} else if (hovering_ && key.deviceId == DEVICE_ID_MOUSE && key.keyCode == NKCODE_EXT_MOUSEBUTTON_2) {
// If it's the right mouse button, and it's not otherwise mapped, show the info also.
if (key.flags & KEY_DOWN) {
if (key.flags & KeyInputFlags::DOWN) {
showInfoPressed_ = true;
}
if ((key.flags & KEY_UP) && showInfoPressed_) {
if ((key.flags & KeyInputFlags::UP) && showInfoPressed_) {
showInfo = true;
showInfoPressed_ = false;
}
@@ -1215,14 +1215,20 @@ void MainScreen::CreateMainButtons(UI::ViewGroup *parent, bool portrait) {
parent->Add(new Spacer(25.0));
}
#if !PPSSPP_PLATFORM(IOS_APP_STORE) && !PPSSPP_PLATFORM(ANDROID)
// Remove the exit button in vertical layout on all platforms, just no space.
bool showExitButton = !portrait;
// Also, always hide the exit button on mobile platforms that are not supposed to have one.
#if PPSSPP_PLATFORM(IOS_APP_STORE)
showExitButton = false;
#elif PPSSPP_PLATFORM(ANDROID)
// Allow it in Android TV only.
showExitButton = System_GetPropertyInt(SYSPROP_DEVICE_TYPE) == DEVICE_TYPE_TV;
#endif
// Officially, iOS apps should not have exit buttons. Remove it to maximize app store review chances.
// Additionally, the Exit button creates problems on Android.
// Also we remove it in the vertical layout on all platforms, just no space.
if (!portrait) {
parent->Add(new Choice(mm->T("Exit"), portrait ? new LinearLayoutParams() : nullptr))->OnClick.Handle(this, &MainScreen::OnExit);
if (showExitButton) {
parent->Add(new Choice(mm->T("Exit")))->OnClick.Handle(this, &MainScreen::OnExit);
}
#endif
}
void MainScreen::CreateViews() {
@@ -1369,7 +1375,7 @@ void MainScreen::CreateViews() {
}
bool MainScreen::key(const KeyInput &touch) {
if (touch.flags & KEY_DOWN) {
if (touch.flags & KeyInputFlags::DOWN) {
if (touch.keyCode == NKCODE_CTRL_LEFT || touch.keyCode == NKCODE_CTRL_RIGHT)
searchKeyModifier_ = true;
if (touch.keyCode == NKCODE_F && searchKeyModifier_ && System_GetPropertyBool(SYSPROP_HAS_TEXT_INPUT_DIALOG)) {
@@ -1379,7 +1385,7 @@ bool MainScreen::key(const KeyInput &touch) {
searchChanged_ = true;
});
}
} else if (touch.flags & KEY_UP) {
} else if (touch.flags & KeyInputFlags::UP) {
if (touch.keyCode == NKCODE_CTRL_LEFT || touch.keyCode == NKCODE_CTRL_RIGHT)
searchKeyModifier_ = false;
}
+5 -5
View File
@@ -409,7 +409,7 @@ void LogoScreen::sendMessage(UIMessage message, const char *value) {
}
bool LogoScreen::key(const KeyInput &key) {
if (key.deviceId != DEVICE_ID_MOUSE && (key.flags & KEY_DOWN)) {
if (key.deviceId != DEVICE_ID_MOUSE && (key.flags & KeyInputFlags::DOWN)) {
Next();
return true;
}
@@ -417,7 +417,7 @@ bool LogoScreen::key(const KeyInput &key) {
}
void LogoScreen::touch(const TouchInput &touch) {
if (touch.flags & TOUCH_DOWN) {
if (touch.flags & TouchInputFlags::DOWN) {
Next();
}
}
@@ -482,14 +482,14 @@ public:
bool Touch(const TouchInput &touch) override {
if (touch.id != 0)
return false;
if (touch.flags & TOUCH_DOWN) {
if (touch.flags & TouchInputFlags::DOWN) {
dragYStart_ = touch.y;
dragYOffsetStart_ = dragOffset_;
}
if (touch.flags & TOUCH_UP) {
if (touch.flags & TouchInputFlags::UP) {
dragYStart_ = -1.0f;
}
if (touch.flags & TOUCH_MOVE) {
if (touch.flags & TouchInputFlags::MOVE) {
if (dragYStart_ >= 0.0f) {
dragOffset_ = dragYOffsetStart_ + (touch.y - dragYStart_);
}
+2 -2
View File
@@ -134,7 +134,7 @@ PaneTitleBar::PaneTitleBar(const Path &gamePath, std::string_view title, const s
auto dlg = GetI18NCategory(I18NCat::DIALOG);
if (!title.empty()) {
SimpleTextView *titleView = Add(new SimpleTextView(title, new LinearLayoutParams(0.0f, Gravity::G_VCENTER, Margins(10, 0, 20, 0))));
SimpleTextView *titleView = Add(new SimpleTextView(title, new LinearLayoutParams(0.0f, Gravity::G_VCENTER, Margins(8, 0, 20, 0))));
titleView->SetBig(true);
// If using HCENTER, to balance the centering, add a spacer on the right.
}
@@ -153,7 +153,7 @@ PaneTitleBar::PaneTitleBar(const Path &gamePath, std::string_view title, const s
} else {
settingsUrl = join("https://www.ppsspp.org/docs/settings/", settingsCategory);
}
Choice *helpButton = Add(new Choice(ImageID("I_INFO"), new LinearLayoutParams()));
Choice *helpButton = Add(new Choice(ImageID("I_LINK_OUT_QUESTION"), new LinearLayoutParams()));
helpButton->OnClick.Add([settingsUrl](UI::EventParams &) {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, settingsUrl);
});
+5 -5
View File
@@ -1335,7 +1335,7 @@ static void ProcessWheelRelease(InputKeyCode keyCode, double now, bool keyPress)
KeyInput key{};
key.deviceId = DEVICE_ID_MOUSE;
key.keyCode = keyCode;
key.flags = KEY_UP;
key.flags = KeyInputFlags::UP;
NativeKey(key);
}
@@ -1356,7 +1356,7 @@ bool NativeKey(const KeyInput &key) {
#if PPSSPP_PLATFORM(UWP)
// Ignore if key sent from OnKeyDown/OnKeyUp/XInput while text edit active
// it's already handled by `OnCharacterReceived`
if (IgnoreInput(key.keyCode) && !(key.flags & KEY_CHAR)) {
if (IgnoreInput(key.keyCode) && !(key.flags & KeyInputFlags::CHAR)) {
return false;
}
#endif
@@ -1377,7 +1377,7 @@ bool NativeKey(const KeyInput &key) {
#ifdef _DEBUG
// Debug hack: Randomize the language with F9!
if (false && (key.keyCode == NKCODE_F9 && (key.flags & KEY_DOWN))) {
if (false && (key.keyCode == NKCODE_F9 && (key.flags & KeyInputFlags::DOWN))) {
std::vector<File::FileInfo> tempLangs;
g_VFS.GetFileListing("lang", &tempLangs, "ini");
int x = rand() % tempLangs.size();
@@ -1398,11 +1398,11 @@ bool NativeKey(const KeyInput &key) {
}
// Handle releases of mousewheel keys.
if ((key.flags & KEY_DOWN) && key.deviceId == DEVICE_ID_MOUSE && (key.keyCode == NKCODE_EXT_MOUSEWHEEL_UP || key.keyCode == NKCODE_EXT_MOUSEWHEEL_DOWN)) {
if ((key.flags & KeyInputFlags::DOWN) && key.deviceId == DEVICE_ID_MOUSE && (key.keyCode == NKCODE_EXT_MOUSEWHEEL_UP || key.keyCode == NKCODE_EXT_MOUSEWHEEL_DOWN)) {
ProcessWheelRelease(key.keyCode, now, true);
}
HLEPlugins::SetKey(key.keyCode, (key.flags & KEY_DOWN) ? 1 : 0);
HLEPlugins::SetKey(key.keyCode, (key.flags & KeyInputFlags::DOWN) ? 1 : 0);
// Dispatch the key event.
bool retval = g_screenManager->key(key);
+1 -1
View File
@@ -544,7 +544,7 @@ bool OnScreenMessagesView::Dismiss(float x, float y) {
bool OSDOverlayScreen::UnsyncTouch(const TouchInput &touch) {
// Don't really need to forward.
// UIScreen::UnsyncTouch(touch);
if ((touch.flags & TOUCH_DOWN) && osmView_) {
if ((touch.flags & TouchInputFlags::DOWN) && osmView_) {
return osmView_->Dismiss(touch.x, touch.y);
} else {
return false;
+1 -1
View File
@@ -342,7 +342,7 @@ GamePauseScreen::~GamePauseScreen() {
}
bool GamePauseScreen::key(const KeyInput &key) {
if (!UIScreen::key(key) && (key.flags & KEY_DOWN)) {
if (!UIScreen::key(key) && (key.flags & KeyInputFlags::DOWN)) {
// Special case to be able to unpause with a bound pause key.
// Normally we can't bind keys used in the UI.
InputMapping mapping(key.deviceId, key.keyCode);
+20 -6
View File
@@ -13,11 +13,25 @@ void UISimpleBaseDialogScreen::CreateViews() {
const bool portrait = GetDeviceOrientation() == DeviceOrientation::Portrait;
root_ = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT));
root_->Add(new TopBar(*screenManager()->getUIContext(), portrait ? TopBarFlags::Portrait : TopBarFlags::Default, GetTitle()));
TopBarFlags topBarFlags = portrait ? TopBarFlags::Portrait : TopBarFlags::Default;
if (flags_ & SimpleDialogFlags::CustomContextMenu) {
topBarFlags |= TopBarFlags::ContextMenuButton;
}
TopBar *topBar = root_->Add(new TopBar(*screenManager()->getUIContext(), topBarFlags, GetTitle()));
if (flags_ & SimpleDialogFlags::CustomContextMenu) {
View *menuButton = topBar->GetContextMenuButton();
topBar->OnContextMenuClick.Add([this, menuButton](UI::EventParams &e) {
this->screenManager()->push(new PopupCallbackScreen([this](UI::ViewGroup *parent) {
CreateContextMenu(parent);
}, menuButton));
});
}
if (canScroll) {
ScrollView *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT, 1.0f));
LinearLayout *contents = new LinearLayoutList(ORIENT_VERTICAL);
LinearLayout *contents = new LinearLayoutList(ORIENT_VERTICAL, new LinearLayoutParams(Margins(0, 0, 8, 0)));
contents->SetSpacing(0);
CreateDialogViews(contents);
scroll->Add(contents);
@@ -120,12 +134,12 @@ void UITwoPaneBaseDialogScreen::CreateViews() {
root->Add(columns);
// root_->Add(new TopBar(*screenManager()->getUIContext(), portrait, GetTitle(), new LayoutParams(FILL_PARENT, FILL_PARENT)));
ScrollView *settingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(SettingsWidth(), FILL_PARENT, 0.0f, Margins(8)));
LinearLayout *settingsPane = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT));
ScrollView *settingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(SettingsWidth(), FILL_PARENT, 0.0f, Margins(0, 8, 0, 0)));
LinearLayout *settingsPane = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, Margins(0, 8, 0, 0)));
settingsPane->SetSpacing(0.0f);
CreateSettingsViews(settingsPane);
settingsPane->Add(new BorderView(BORDER_BOTTOM, BorderStyle::HEADER_FG, 2.0f, new LayoutParams(FILL_PARENT, 40.0f)));
settingsPane->Add(new Choice(di->T("Back"), ImageID("I_NAVIGATE_BACK")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
// settingsPane->Add(new BorderView(BORDER_BOTTOM, BorderStyle::HEADER_FG, 2.0f, new LayoutParams(FILL_PARENT, 40.0f)));
// settingsPane->Add(new Choice(di->T("Back"), ImageID("I_NAVIGATE_BACK")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
settingsScroll->Add(settingsPane);
if (flags_ & TwoPaneFlags::SettingsToTheRight) {
+2
View File
@@ -7,6 +7,7 @@
enum class SimpleDialogFlags {
Default = 0,
CustomContextMenu = 1,
ContentsCanScroll = 8,
};
ENUM_CLASS_BITOPS(SimpleDialogFlags);
@@ -22,6 +23,7 @@ public:
// Override this, don't override CreateViews. And don't touch root_ directly.
virtual void CreateDialogViews(UI::ViewGroup *parent) = 0;
virtual void CreateContextMenu(UI::ViewGroup *parent) {} // only called if CustomContextMenu is set in flags.
virtual std::string_view GetTitle() const { return ""; }
private:
+13 -9
View File
@@ -24,6 +24,7 @@
#include "UI/SystemInfoScreen.h"
#include "UI/IconCache.h"
#include "UI/BaseScreens.h"
#include "UI/MiscViews.h"
#include "UI/OnScreenDisplay.h"
#include "android/jni/app-android.h"
@@ -110,6 +111,9 @@ void SystemInfoScreen::CreateDeviceInfoTab(UI::LinearLayout *deviceSpecs) {
auto si = GetI18NCategory(I18NCat::SYSINFO);
auto gr = GetI18NCategory(I18NCat::GRAPHICS);
// bool portrait = GetDeviceOrientation() == DeviceOrientation::Portrait;
// deviceSpecs->Add(new TopBar(*screenManager()->getUIContext(), portrait ? TopBarFlags::Portrait : TopBarFlags::Default, si->T("Device Info")));
UI::CollapsibleSection *systemInfo = deviceSpecs->Add(new UI::CollapsibleSection(si->T("System Information")));
systemInfo->Add(new Choice(si->T("Copy summary to clipboard"), ImageID("I_FILE_COPY")))->OnClick.Handle(this, &SystemInfoScreen::CopySummaryToClipboard);
@@ -411,12 +415,12 @@ void SystemInfoScreen::CreateDriverBugsTab(UI::LinearLayout *driverBugs) {
for (int i = 0; i < (int)draw->GetBugs().MaxBugIndex(); i++) {
if (draw->GetBugs().Has(i)) {
anyDriverBugs = true;
driverBugs->Add(new TextView(draw->GetBugs().GetBugName(i), new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
driverBugs->Add(new InfoItem(draw->GetBugs().GetBugName(i), "", new LayoutParams(FILL_PARENT, WRAP_CONTENT)));
}
}
if (!anyDriverBugs) {
driverBugs->Add(new TextView(si->T("No GPU driver bugs detected"), new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
driverBugs->Add(new InfoItem(si->T("No GPU driver bugs detected"), "", new LayoutParams(FILL_PARENT, WRAP_CONTENT)));
}
}
@@ -463,38 +467,38 @@ void SystemInfoScreen::CreateVulkanExtsTab(UI::LinearLayout *gpuExtensions) {
CollapsibleSection *vulkanFeatures = gpuExtensions->Add(new CollapsibleSection(si->T("Vulkan Features")));
std::vector<std::string> features = draw->GetFeatureList();
for (const auto &feature : features) {
vulkanFeatures->Add(new TextView(feature, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
vulkanFeatures->Add(new TextView(feature, FLAG_DYNAMIC_ASCII, true, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
}
CollapsibleSection *presentModes = gpuExtensions->Add(new CollapsibleSection(si->T("Present modes")));
for (const auto &mode : draw->GetPresentModeList(di->T("Current"))) {
presentModes->Add(new TextView(mode, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
presentModes->Add(new TextView(mode, FLAG_DYNAMIC_ASCII, true, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
}
CollapsibleSection *colorFormats = gpuExtensions->Add(new CollapsibleSection(si->T("Display Color Formats")));
for (const auto &format : draw->GetSurfaceFormatList()) {
colorFormats->Add(new TextView(format, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
colorFormats->Add(new TextView(format, FLAG_DYNAMIC_ASCII, true, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
}
CollapsibleSection *enabledExtensions = gpuExtensions->Add(new CollapsibleSection(std::string(si->T("Vulkan Extensions")) + " (" + std::string(di->T("Enabled")) + ")"));
std::vector<std::string> extensions = draw->GetExtensionList(true, true);
std::sort(extensions.begin(), extensions.end());
for (auto &extension : extensions) {
enabledExtensions->Add(new TextView(extension, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
enabledExtensions->Add(new TextView(extension, FLAG_DYNAMIC_ASCII, true, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
}
// Also get instance extensions
enabledExtensions->Add(new ItemHeader(si->T("Instance")));
extensions = draw->GetExtensionList(false, true);
std::sort(extensions.begin(), extensions.end());
for (auto &extension : extensions) {
enabledExtensions->Add(new TextView(extension, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
enabledExtensions->Add(new TextView(extension, FLAG_DYNAMIC_ASCII, true, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
}
CollapsibleSection *vulkanExtensions = gpuExtensions->Add(new CollapsibleSection(si->T("Vulkan Extensions")));
extensions = draw->GetExtensionList(true, false);
std::sort(extensions.begin(), extensions.end());
for (auto &extension : extensions) {
vulkanExtensions->Add(new TextView(extension, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
vulkanExtensions->Add(new TextView(extension, FLAG_DYNAMIC_ASCII, true, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
}
vulkanExtensions->Add(new ItemHeader(si->T("Instance")));
@@ -502,6 +506,6 @@ void SystemInfoScreen::CreateVulkanExtsTab(UI::LinearLayout *gpuExtensions) {
extensions = draw->GetExtensionList(false, false);
std::sort(extensions.begin(), extensions.end());
for (auto &extension : extensions) {
vulkanExtensions->Add(new TextView(extension, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
vulkanExtensions->Add(new TextView(extension, FLAG_DYNAMIC_ASCII, true, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
}
}
+2 -2
View File
@@ -26,7 +26,7 @@ void UITabbedBaseDialogScreen::AddTab(const char *tag, std::string_view title, I
scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
scroll->SetTag(tag);
}
LinearLayout *contents = new LinearLayoutList(ORIENT_VERTICAL);
LinearLayout *contents = new LinearLayoutList(ORIENT_VERTICAL, new LinearLayoutParams(Margins(0, 0, 8, 0)));
contents->SetSpacing(0);
if (dialogFlags & TabDialogFlags::AddAutoTitles) {
@@ -87,7 +87,7 @@ void UITabbedBaseDialogScreen::CreateViews() {
if (flags_ & TabDialogFlags::VerticalShowIcons) {
tabHolderFlags |= TabHolderFlags::VerticalShowIcons;
}
tabHolder_ = new TabHolder(ORIENT_VERTICAL, 300, tabHolderFlags, filterNotice_, nullptr, new AnchorLayoutParams(10, 0, 10, 0));
tabHolder_ = new TabHolder(ORIENT_VERTICAL, 300, tabHolderFlags, filterNotice_, nullptr, new AnchorLayoutParams(10, 0, 0, 0));
CreateExtraButtons(tabHolder_->Container(), 10);
tabHolder_->AddBack(this);
root_->Add(tabHolder_);
+3 -3
View File
@@ -386,7 +386,7 @@ static Point2D ClampTo(const Point2D &p, const Bounds &b) {
bool ControlLayoutView::Touch(const TouchInput &touch) {
using namespace UI;
if ((touch.flags & TOUCH_MOVE) && pickedControl_ != nullptr) {
if ((touch.flags & TouchInputFlags::MOVE) && pickedControl_ != nullptr) {
if (mode_ == 0) {
// Allow placing the control halfway outside the play area.
@@ -435,7 +435,7 @@ bool ControlLayoutView::Touch(const TouchInput &touch) {
pickedControl_->SetScale(newScale);
}
}
if ((touch.flags & TOUCH_DOWN) && pickedControl_ == 0) {
if ((touch.flags & TouchInputFlags::DOWN) && pickedControl_ == 0) {
pickedControl_ = getPickedControl(touch.x, touch.y);
if (pickedControl_) {
startDragX_ = touch.x;
@@ -448,7 +448,7 @@ bool ControlLayoutView::Touch(const TouchInput &touch) {
startScale_ = pickedControl_->GetScale();
}
}
if ((touch.flags & TOUCH_UP) && pickedControl_ != 0) {
if ((touch.flags & TouchInputFlags::UP) && pickedControl_ != 0) {
pickedControl_->SavePosition();
pickedControl_ = 0;
}
+2 -2
View File
@@ -51,7 +51,7 @@ std::string_view TouchControlVisibilityScreen::GetTitle() const {
return co->T("Touch Control Visibility");
}
void TouchControlVisibilityScreen::CreateSettingsViews(UI::ViewGroup *parent) {
void TouchControlVisibilityScreen::CreateContextMenu(UI::ViewGroup *parent) {
using namespace UI;
auto di = GetI18NCategory(I18NCat::DIALOG);
@@ -66,7 +66,7 @@ void TouchControlVisibilityScreen::CreateSettingsViews(UI::ViewGroup *parent) {
});
}
void TouchControlVisibilityScreen::CreateContentViews(UI::ViewGroup *parent) {
void TouchControlVisibilityScreen::CreateDialogViews(UI::ViewGroup *parent) {
using namespace UI;
using namespace CustomKeyData;
+4 -4
View File
@@ -34,11 +34,11 @@ struct TouchButtonToggle {
std::function<void(UI::EventParams&)> handle;
};
class TouchControlVisibilityScreen : public UITwoPaneBaseDialogScreen {
class TouchControlVisibilityScreen : public UISimpleBaseDialogScreen {
public:
TouchControlVisibilityScreen(const Path &gamePath) : UITwoPaneBaseDialogScreen(gamePath, TwoPaneFlags::SettingsInContextMenu | TwoPaneFlags::ContentsCanScroll) {}
void CreateContentViews(UI::ViewGroup *parent) override;
void CreateSettingsViews(UI::ViewGroup *parent) override;
TouchControlVisibilityScreen(const Path &gamePath) : UISimpleBaseDialogScreen(gamePath, SimpleDialogFlags::ContentsCanScroll | SimpleDialogFlags::CustomContextMenu) {}
void CreateDialogViews(UI::ViewGroup *parent) override;
void CreateContextMenu(UI::ViewGroup *parent) override;
void onFinish(DialogResult result) override;
const char *tag() const override { return "TouchControlVisibility"; }
+1
View File
@@ -171,6 +171,7 @@ static const ImageMeta imageIDs[] = {
{"I_DEVICE_ROTATION_PORTRAIT", false},
{"I_MOVE", false},
{"I_RESIZE", false},
{"I_LINK_OUT_QUESTION", false},
};
static std::string PNGNameFromID(std::string_view id) {
+3 -3
View File
@@ -203,7 +203,7 @@ void App::OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Cor
float X = args->CurrentPoint->Position.X;
float Y = args->CurrentPoint->Position.Y;
int64_t timestamp = args->CurrentPoint->Timestamp;
m_main->OnTouchEvent(TOUCH_MOVE, pointerId, X, Y, (double)timestamp);
m_main->OnTouchEvent(TouchInputFlags::MOVE, pointerId, X, Y, (double)timestamp);
}
void App::OnPointerEntered(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args) {
@@ -220,7 +220,7 @@ void App::OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::C
float X = args->CurrentPoint->Position.X;
float Y = args->CurrentPoint->Position.Y;
int64_t timestamp = args->CurrentPoint->Timestamp;
m_main->OnTouchEvent(TOUCH_DOWN|TOUCH_MOVE, pointerId, X, Y, (double)timestamp);
m_main->OnTouchEvent(TouchInputFlags::DOWN | TouchInputFlags::MOVE, pointerId, X, Y, (double)timestamp);
if (!m_isPhone) {
sender->SetPointerCapture();
}
@@ -233,7 +233,7 @@ void App::OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::
float X = args->CurrentPoint->Position.X;
float Y = args->CurrentPoint->Position.Y;
int64_t timestamp = args->CurrentPoint->Timestamp;
m_main->OnTouchEvent(TOUCH_UP|TOUCH_MOVE, pointerId, X, Y, (double)timestamp);
m_main->OnTouchEvent(TouchInputFlags::UP | TouchInputFlags::MOVE, pointerId, X, Y, (double)timestamp);
if (!m_isPhone) {
sender->ReleasePointerCapture();
}
+16 -14
View File
@@ -204,7 +204,9 @@ void PPSSPP_UWPMain::OnKeyDown(int scanCode, Windows::System::VirtualKey virtual
KeyInput key{};
key.deviceId = DEVICE_ID_KEYBOARD;
key.keyCode = iter->second;
key.flags = KEY_DOWN | (repeatCount > 1 ? KEY_IS_REPEAT : 0);
key.flags = KeyInputFlags::DOWN;
if (repeatCount > 1)
key.flags |= KeyInputFlags::IS_REPEAT;
NativeKey(key);
}
}
@@ -215,7 +217,7 @@ void PPSSPP_UWPMain::OnKeyUp(int scanCode, Windows::System::VirtualKey virtualKe
KeyInput key{};
key.deviceId = DEVICE_ID_KEYBOARD;
key.keyCode = iter->second;
key.flags = KEY_UP;
key.flags = KeyInputFlags::UP;
NativeKey(key);
}
}
@@ -227,9 +229,9 @@ void PPSSPP_UWPMain::OnCharacterReceived(int scanCode, unsigned int keyCode) {
KeyInput key{};
key.deviceId = DEVICE_ID_KEYBOARD;
key.keyCode = (InputKeyCode)keyCode;
// After many tests turns out for char just add `KEY_CHAR` for the flags
// any other flag like `KEY_DOWN` will cause conflict and trigger something else
key.flags = KEY_CHAR;
// After many tests turns out for char just add `KeyInputFlags::CHAR` for the flags
// any other flag like `KeyInputFlags::DOWN` will cause conflict and trigger something else
key.flags = KeyInputFlags::CHAR;
NativeKey(key);
}
}
@@ -245,16 +247,16 @@ void PPSSPP_UWPMain::OnMouseWheel(float delta) {
KeyInput keyInput{};
keyInput.keyCode = key;
keyInput.deviceId = DEVICE_ID_MOUSE;
keyInput.flags = KEY_DOWN;
keyInput.flags = KeyInputFlags::DOWN;
NativeKey(keyInput);
// KEY_UP is now sent automatically afterwards for mouse wheel events, see NativeKey.
// KeyInputFlags::UP is now sent automatically afterwards for mouse wheel events, see NativeKey.
}
bool PPSSPP_UWPMain::OnHardwareButton(HardwareButton button) {
KeyInput keyInput{};
keyInput.deviceId = DEVICE_ID_KEYBOARD;
keyInput.flags = KEY_DOWN | KEY_UP;
keyInput.flags = KeyInputFlags::DOWN | KeyInputFlags::UP;
switch (button) {
case HardwareButton::BACK:
keyInput.keyCode = NKCODE_BACK;
@@ -264,7 +266,7 @@ bool PPSSPP_UWPMain::OnHardwareButton(HardwareButton button) {
}
}
void PPSSPP_UWPMain::OnTouchEvent(int touchEvent, int touchId, float x, float y, double timestamp) {
void PPSSPP_UWPMain::OnTouchEvent(TouchInputFlags flags, int touchId, float x, float y, double timestamp) {
// We get the coordinate in Windows' device independent pixels already. So let's undo that,
// and then apply our own "dpi".
float dpiFactor_x = m_deviceResources->GetActualDpi() / 96.0f;
@@ -276,20 +278,20 @@ void PPSSPP_UWPMain::OnTouchEvent(int touchEvent, int touchId, float x, float y,
input.id = touchId;
input.x = x * dpiFactor_x;
input.y = y * dpiFactor_y;
input.flags = touchEvent;
input.flags = flags;
input.timestamp = timestamp;
NativeTouch(input);
KeyInput key{};
key.deviceId = DEVICE_ID_MOUSE;
if (touchEvent & TOUCH_DOWN) {
if (flags & TouchInputFlags::DOWN) {
key.keyCode = NKCODE_EXT_MOUSEBUTTON_1;
key.flags = KEY_DOWN;
key.flags = KeyInputFlags::DOWN;
NativeKey(key);
}
if (touchEvent & TOUCH_UP) {
if (flags & TouchInputFlags::UP) {
key.keyCode = NKCODE_EXT_MOUSEBUTTON_1;
key.flags = KEY_UP;
key.flags = KeyInputFlags::UP;
NativeKey(key);
}
}
+1 -1
View File
@@ -48,7 +48,7 @@ public:
void OnKeyUp(int scanCode, Windows::System::VirtualKey virtualKey);
void OnCharacterReceived(int scanCode,unsigned int keyCode);
void OnTouchEvent(int touchEvent, int touchId, float x, float y, double timestamp);
void OnTouchEvent(TouchInputFlags flags, int touchId, float x, float y, double timestamp);
void OnMouseWheel(float delta);
+6 -6
View File
@@ -263,7 +263,7 @@ void DinputDevice::ApplyButtons(DIJOYSTATE2 &state) {
bool down = (state.rgbButtons[i] & downMask) == downMask;
KeyInput key;
key.deviceId = DEVICE_ID_PAD_0 + pDevNum;
key.flags = down ? KEY_DOWN : KEY_UP;
key.flags = down ? KeyInputFlags::DOWN : KeyInputFlags::UP;
key.keyCode = dinput_buttons[i];
NativeKey(key);
@@ -275,7 +275,7 @@ void DinputDevice::ApplyButtons(DIJOYSTATE2 &state) {
KeyInput dpad[4]{};
for (int i = 0; i < 4; ++i) {
dpad[i].deviceId = DEVICE_ID_PAD_0 + pDevNum;
dpad[i].flags = KEY_UP;
dpad[i].flags = KeyInputFlags::UP;
}
dpad[0].keyCode = NKCODE_DPAD_UP;
dpad[1].keyCode = NKCODE_DPAD_LEFT;
@@ -285,16 +285,16 @@ void DinputDevice::ApplyButtons(DIJOYSTATE2 &state) {
if (LOWORD(state.rgdwPOV[0]) != JOY_POVCENTERED) {
// These are the edges, so we use or.
if (state.rgdwPOV[0] >= JOY_POVLEFT_FORWARD || state.rgdwPOV[0] <= JOY_POVFORWARD_RIGHT) {
dpad[0].flags = KEY_DOWN;
dpad[0].flags = KeyInputFlags::DOWN;
}
if (state.rgdwPOV[0] >= JOY_POVBACKWARD_LEFT && state.rgdwPOV[0] <= JOY_POVLEFT_FORWARD) {
dpad[1].flags = KEY_DOWN;
dpad[1].flags = KeyInputFlags::DOWN;
}
if (state.rgdwPOV[0] >= JOY_POVRIGHT_BACKWARD && state.rgdwPOV[0] <= JOY_POVBACKWARD_LEFT) {
dpad[2].flags = KEY_DOWN;
dpad[2].flags = KeyInputFlags::DOWN;
}
if (state.rgdwPOV[0] >= JOY_POVFORWARD_RIGHT && state.rgdwPOV[0] <= JOY_POVRIGHT_BACKWARD) {
dpad[3].flags = KEY_DOWN;
dpad[3].flags = KeyInputFlags::DOWN;
}
}
+3 -3
View File
@@ -649,7 +649,7 @@ void HidInputDevice::ReleaseAllKeys(const ButtonInputMapping *buttonMappings, in
const auto &mapping = buttonMappings[i];
KeyInput key;
key.deviceId = DEVICE_ID_XINPUT_0 + pad_;
key.flags = KEY_UP;
key.flags = KeyInputFlags::UP;
key.keyCode = mapping.keyCode;
NativeKey(key);
}
@@ -716,14 +716,14 @@ int HidInputDevice::UpdateState() {
if (downMask & mapping.button) {
KeyInput key;
key.deviceId = deviceID;
key.flags = KEY_DOWN;
key.flags = KeyInputFlags::DOWN;
key.keyCode = mapping.keyCode;
NativeKey(key);
}
if (upMask & mapping.button) {
KeyInput key;
key.deviceId = deviceID;
key.flags = KEY_UP;
key.flags = KeyInputFlags::UP;
key.keyCode = mapping.keyCode;
NativeKey(key);
}
+6 -6
View File
@@ -890,7 +890,7 @@ namespace MainWindow
key.keyCode = NKCODE_EXT_MOUSEWHEEL_UP;
}
// There's no release event, but we simulate it in NativeKey/NativeFrame.
key.flags = KEY_DOWN | KEY_HASWHEELDELTA | (wheelDelta << 16);
key.flags = (KeyInputFlags)((u32)KeyInputFlags::DOWN | (u32)KeyInputFlags::HAS_WHEEL_DELTA | (wheelDelta << 16));
NativeKey(key);
}
break;
@@ -1142,7 +1142,7 @@ namespace MainWindow
WindowsRawInput::SetMousePos(x, y);
TouchInput touch{};
touch.flags = TOUCH_DOWN | TOUCH_MOUSE;
touch.flags = TouchInputFlags::DOWN | TouchInputFlags::MOUSE;
touch.buttons = 1;
touch.x = x;
touch.y = y;
@@ -1191,7 +1191,7 @@ namespace MainWindow
// Mouse moves now happen also when no button is pressed.
TouchInput touch{};
touch.flags = TOUCH_MOVE | TOUCH_MOUSE;
touch.flags = TouchInputFlags::MOVE | TouchInputFlags::MOUSE;
if (wParam & MK_LBUTTON) {
touch.buttons |= 1;
}
@@ -1217,7 +1217,7 @@ namespace MainWindow
TouchInput touch{};
touch.buttons = 1;
touch.flags = TOUCH_UP | TOUCH_MOUSE;
touch.flags = TouchInputFlags::UP | TouchInputFlags::MOUSE;
touch.x = x;
touch.y = y;
NativeTouch(touch);
@@ -1236,7 +1236,7 @@ namespace MainWindow
TouchInput touch{};
touch.buttons = 2;
touch.flags = TOUCH_DOWN | TOUCH_MOUSE;
touch.flags = TouchInputFlags::DOWN | TouchInputFlags::MOUSE;
touch.x = x;
touch.y = y;
NativeTouch(touch);
@@ -1250,7 +1250,7 @@ namespace MainWindow
TouchInput touch{};
touch.buttons = 2;
touch.flags = TOUCH_UP | TOUCH_MOUSE;
touch.flags = TouchInputFlags::UP | TouchInputFlags::MOUSE;
touch.x = x;
touch.y = y;
NativeTouch(touch);
+9 -9
View File
@@ -260,7 +260,7 @@ namespace WindowsRawInput {
key.deviceId = DEVICE_ID_KEYBOARD;
if (raw->data.keyboard.Message == WM_KEYDOWN || raw->data.keyboard.Message == WM_SYSKEYDOWN) {
key.flags = KEY_DOWN;
key.flags = KeyInputFlags::DOWN;
key.keyCode = GetTrueVKey(raw->data.keyboard);
if (key.keyCode) {
@@ -268,7 +268,7 @@ namespace WindowsRawInput {
keyboardKeysDown.insert(key.keyCode);
}
} else if (raw->data.keyboard.Message == WM_KEYUP) {
key.flags = KEY_UP;
key.flags = KeyInputFlags::UP;
key.keyCode = GetTrueVKey(raw->data.keyboard);
if (key.keyCode) {
@@ -283,7 +283,7 @@ namespace WindowsRawInput {
LRESULT ProcessChar(HWND hWnd, WPARAM wParam, LPARAM lParam) {
KeyInput key;
key.unicodeChar = (int)wParam; // Note that this is NOT a NKCODE but a Unicode character!
key.flags = KEY_CHAR;
key.flags = KeyInputFlags::CHAR;
key.deviceId = DEVICE_ID_KEYBOARD;
NativeKey(key);
return 0;
@@ -308,7 +308,7 @@ namespace WindowsRawInput {
TouchInput touch;
touch.id = 0;
touch.flags = TOUCH_MOVE;
touch.flags = TouchInputFlags::MOVE;
touch.x = mouseX;
touch.y = mouseY;
@@ -342,7 +342,7 @@ namespace WindowsRawInput {
for (int i = 0; i < 5; i++) {
if (i > 0 || (g_Config.bMouseControl && (GetUIState() == UISTATE_INGAME || g_IsMappingMouseInput))) {
if (raw->data.mouse.usButtonFlags & rawInputDownID[i]) {
key.flags = KEY_DOWN;
key.flags = KeyInputFlags::DOWN;
key.keyCode = windowsTransTable[vkInputID[i]];
NativeTouch(touch);
if (MouseInWindow(hWnd)) {
@@ -350,16 +350,16 @@ namespace WindowsRawInput {
}
mouseDown[i] = true;
} else if (raw->data.mouse.usButtonFlags & rawInputUpID[i]) {
key.flags = KEY_UP;
key.flags = KeyInputFlags::UP;
key.keyCode = windowsTransTable[vkInputID[i]];
NativeTouch(touch);
if (MouseInWindow(hWnd)) {
if (!mouseDown[i]) {
// This means they were focused outside, and clicked inside.
// Seems intentional, so send a down first.
key.flags = KEY_DOWN;
key.flags = KeyInputFlags::DOWN;
NativeKey(key);
key.flags = KEY_UP;
key.flags = KeyInputFlags::UP;
NativeKey(key);
} else {
NativeKey(key);
@@ -428,7 +428,7 @@ namespace WindowsRawInput {
// Force-release all held keys on the keyboard to prevent annoying stray inputs.
KeyInput key;
key.deviceId = DEVICE_ID_KEYBOARD;
key.flags = KEY_UP;
key.flags = KeyInputFlags::UP;
for (auto i = keyboardKeysDown.begin(); i != keyboardKeysDown.end(); ++i) {
key.keyCode = *i;
NativeKey(key);
+3 -3
View File
@@ -116,7 +116,7 @@ void TouchInputHandler::touchUp(int id, float x, float y){
touchevent.id = id;
touchevent.x = x;
touchevent.y = y;
touchevent.flags = TOUCH_UP;
touchevent.flags = TouchInputFlags::UP;
NativeTouch(touchevent);
}
@@ -125,7 +125,7 @@ void TouchInputHandler::touchDown(int id, float x, float y){
touchevent.id = id;
touchevent.x = x;
touchevent.y = y;
touchevent.flags = TOUCH_DOWN;
touchevent.flags = TouchInputFlags::DOWN;
NativeTouch(touchevent);
}
@@ -134,7 +134,7 @@ void TouchInputHandler::touchMove(int id, float x, float y){
touchevent.id = id;
touchevent.x = x;
touchevent.y = y;
touchevent.flags = TOUCH_MOVE;
touchevent.flags = TouchInputFlags::MOVE;
NativeTouch(touchevent);
}
+2 -2
View File
@@ -243,14 +243,14 @@ void XinputDevice::ApplyButtons(int pad, const XINPUT_STATE &state) {
if (downMask & xinput_ctrl_map[i].from) {
KeyInput key;
key.deviceId = DEVICE_ID_XINPUT_0 + pad;
key.flags = KEY_DOWN;
key.flags = KeyInputFlags::DOWN;
key.keyCode = xinput_ctrl_map[i].to;
NativeKey(key);
}
if (upMask & xinput_ctrl_map[i].from) {
KeyInput key;
key.deviceId = DEVICE_ID_XINPUT_0 + pad;
key.flags = KEY_UP;
key.flags = KeyInputFlags::UP;
key.keyCode = xinput_ctrl_map[i].to;
NativeKey(key);
}
+9 -9
View File
@@ -1232,7 +1232,7 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_touch
touch.id = pointerId;
touch.x = x * display_scale_x * g_display.dpi_scale_x;
touch.y = y * display_scale_y * g_display.dpi_scale_y;
touch.flags = code;
touch.flags = (TouchInputFlags)code;
NativeTouch(touch);
}
@@ -1248,9 +1248,9 @@ extern "C" jboolean Java_org_ppsspp_ppsspp_NativeApp_keyDown(JNIEnv *, jclass, j
KeyInput keyInput;
keyInput.deviceId = (InputDeviceID)deviceId;
keyInput.keyCode = (InputKeyCode)key;
keyInput.flags = KEY_DOWN;
keyInput.flags = KeyInputFlags::DOWN;
if (isRepeat) {
keyInput.flags |= KEY_IS_REPEAT;
keyInput.flags |= KeyInputFlags::IS_REPEAT;
}
return NativeKey(keyInput);
}
@@ -1267,7 +1267,7 @@ extern "C" jboolean Java_org_ppsspp_ppsspp_NativeApp_keyUp(JNIEnv *, jclass, jin
KeyInput keyInput;
keyInput.deviceId = (InputDeviceID)deviceId;
keyInput.keyCode = (InputKeyCode)key;
keyInput.flags = KEY_UP;
keyInput.flags = KeyInputFlags::UP;
return NativeKey(keyInput);
}
@@ -1319,7 +1319,7 @@ extern "C" jboolean Java_org_ppsspp_ppsspp_NativeApp_mouse(
if (button == 0) {
// It's a pure mouse move.
input.flags = TOUCH_MOUSE | TOUCH_MOVE;
input.flags = TouchInputFlags::MOUSE | TouchInputFlags::MOVE;
input.x = x;
input.y = y;
input.id = 0;
@@ -1329,10 +1329,10 @@ extern "C" jboolean Java_org_ppsspp_ppsspp_NativeApp_mouse(
input.y = y;
switch (action) {
case 1:
input.flags = TOUCH_MOUSE | TOUCH_DOWN;
input.flags = TouchInputFlags::MOUSE | TouchInputFlags::DOWN;
break;
case 2:
input.flags = TOUCH_MOUSE | TOUCH_UP;
input.flags = TouchInputFlags::MOUSE | TouchInputFlags::UP;
break;
}
input.id = 0;
@@ -1350,7 +1350,7 @@ extern "C" jboolean Java_org_ppsspp_ppsspp_NativeApp_mouse(
case 3: input.keyCode = NKCODE_EXT_MOUSEBUTTON_3; break;
default: WARN_LOG(Log::System, "Unexpected mouse button %d", button);
}
input.flags = action == 1 ? KEY_DOWN : KEY_UP;
input.flags = action == 1 ? KeyInputFlags::DOWN : KeyInputFlags::UP;
if (input.keyCode != 0) {
NativeKey(input);
}
@@ -1377,7 +1377,7 @@ extern "C" jboolean Java_org_ppsspp_ppsspp_NativeApp_mouseWheelEvent(
}
// There's no separate keyup event for mousewheel events,
// so we release it with a slight delay.
key.flags = KEY_DOWN | KEY_HASWHEELDELTA | (wheelDelta << 16);
key.flags = (KeyInputFlags)((u32)KeyInputFlags::DOWN | (u32)KeyInputFlags::HAS_WHEEL_DELTA | (wheelDelta << 16));
NativeKey(key);
return true;
}
+1
View File
@@ -408,6 +408,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = إفتراضي
Delete = ‎مسح
Delete all = ‎مسح الكل
Delete completed = ‎المسح إكتمل.
+1
View File
@@ -404,6 +404,7 @@ ConnectionName = Qoşulma adı
Copied to clipboard: %1 = Kəsintiliyə köçürüldü: %1
Copy to clipboard = Kəsintiliyə köçürt
Corrupted Data = Korlanmış verilən
Default = Varsayılan
Delete = Sil
Delete all = Hamısını sil
Delete completed = Siliniş tamamlandı
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = Па змаўчанні
Delete = Delete
Delete all = Delete all
Delete completed = Delete completed.
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Копиране в клипборда
Corrupted Data = Повредени данни
Default = По подразбиране
Delete = Изтрий
Delete all = Изтрий всички
Delete completed = Изтриването завършето.
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Nom de la connexió
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Dades corruptes
Default = Per defecte
Delete = Eliminar
Delete all = Eliminar tot
Delete completed = Esborrat completat
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = Default
Delete = Smazat
Delete all = Smazat vše
Delete completed = Mazání dokončeno.
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = Default
Delete = Slet
Delete all = Slet alt
Delete completed = Slettet.
+1
View File
@@ -392,6 +392,7 @@ ConnectionName = Verbindungsname
Copied to clipboard: %1 = In Zwischenablage kopiert: %1
Copy to clipboard = In Zwischenablage kopieren
Corrupted Data = Beschädigte Daten
Default = Vorgabe
Delete = Löschen
Delete all = Alle löschen
Delete completed = Löschen abgeschlossen
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = Default
Delete = Hapusi
Delete all = Delete all
Delete completed = Terhapusmi.
+1
View File
@@ -424,6 +424,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = Default
Delete = Delete
Delete all = Delete all
Delete completed = Delete completed.
+1
View File
@@ -401,6 +401,7 @@ ConnectionName = Nombre de la conexión
Copied to clipboard: %1 = Copiado a portapapeles: %1
Copy to clipboard = Copiar a portapapeles
Corrupted Data = Datos corruptos
Default = Por defecto
Delete = Eliminar
Delete all = Eliminar todo
Delete completed = Eliminado completado.
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Nombre de conexión
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Datos dañados
Default = Por defecto
Delete = Borrar
Delete all = Borrar todos
Delete completed = Borrado terminado.
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = نام اتصال
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = داده‌ها خراب شده
Default = پیشفرض
Delete = ‎حذف
Delete all = حذف همه
Delete completed = .حذف شد
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Yhteyden nimi
Copied to clipboard: %1 = Kopioitu leikepöydälle: %1
Copy to clipboard = Kopioi leikepöydälle
Corrupted Data = Vioittuneet tiedot
Default = Oletus
Delete = Poista
Delete all = Poista kaikki
Delete completed = Poisto onnistui.
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Nom de la connexion
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Données corrompues
Default = Default
Delete = Supprimer
Delete all = Tout supprimer
Delete completed = Suppression terminée.
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = Default
Delete = Borrar
Delete all = Borrar todo
Delete completed = Borrado completado.
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = Default
Delete = ΔΙΑΓΡΑΦΗ
Delete all = ΔΙΑΓΡΑΦΗ ΟΛΩΝ
Delete completed = ΔΙΑΓΡΑΦΗ ΟΛΟΚΛΗΡΩΘΗΚΕ
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = Default
Delete = קחמ
Delete all = Delete all
Delete completed = .המלשוה הקיחמ
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = Default
Delete = קחמ
Delete all = Delete all
Delete completed = .המלשוה הקיחמ
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = Default
Delete = Izbriši
Delete all = Izbriši sve
Delete completed = Brisanje dovršeno.
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Vágolapra másolás
Corrupted Data = Sérült adat
Default = Alapértelmezett
Delete = Töröl
Delete all = Mindet töröl
Delete completed = Törölve.
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Nama koneksi
Copied to clipboard: %1 = Disalin ke papan klip: %1
Copy to clipboard = Salin ke papan klip
Corrupted Data = Data rusak
Default = Bawaan
Delete = Hapus
Delete all = Hapus semua
Delete completed = Selesai menghapus.
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Nome connessione
Copied to clipboard: %1 = Copiato negli appunti: %1
Copy to clipboard = Copia negli appunti
Corrupted Data = Dati corrotti
Default = Predefinito
Delete = Elimina
Delete all = Elimina tutto
Delete completed = Eliminazione completata.
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = 接続名
Copied to clipboard: %1 = クリップボードへコピー: %1
Copy to clipboard = クリップボードへコピー
Corrupted Data = 破損したデータ
Default = デフォルト
Delete = 削除
Delete all = 全て削除
Delete completed = 削除が完了しました。
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = Default
Delete = Mbusek
Delete all = Mbusek Kabeh
Delete completed = Mbusek rampung.
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = 연결 이름
Copied to clipboard: %1 = 클립보드에 복사됨: %1
Copy to clipboard = 클립보드에 복사
Corrupted Data = 손상된 데이터
Default = 기본
Delete = 삭제
Delete all = 모두 삭제
Delete completed = 삭제가 완료되었습니다.
+1
View File
@@ -414,6 +414,7 @@ ConnectionName = ناوی پەیوەندی
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = زانیاریەکە تێکچووە
Default = Default
Delete = سڕینەوە
Delete all = سڕینەوەی هەمووی
Delete completed = سڕینەوەکە سەرکەووتوو بوو
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = Default
Delete = ລຶບ
Delete all = ລຶບທັງໝົດ
Delete completed = ລຶບຂໍ້ມູນສຳເລັດ
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = Default
Delete = Ištrinti
Delete all = Ištrinti viską
Delete completed = Ištrinimas baigtas.
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = Default
Delete = Padam
Delete all = Padam semua
Delete completed = Pemadaman selesai.
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = Default
Delete = Wissen
Delete all = Alles wissen
Delete completed = Het verwijderen is voltooid.
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = Standard
Delete = Slett
Delete all = Delete all
Delete completed = Slettet!!
+1
View File
@@ -399,6 +399,7 @@ ConnectionName = Nazwa Połączenia
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Uszkodzone dane
Default = Domyślny
Delete = Usuń
Delete all = Usuń wszystko
Delete completed = Usuwanie zakończone.
+1
View File
@@ -423,6 +423,7 @@ ConnectionName = Nome da conexão
Copied to clipboard: %1 = Copiou para a área de transferência: %1
Copy to clipboard = Copiar para a área de transferência
Corrupted Data = Dados corrompidos
Default = Padrão
Delete = Apagar
Delete all = Apagar tudo
Delete completed = Exclusão completada.
+1
View File
@@ -424,6 +424,7 @@ ConnectionName = Nome da conexão
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Dados Corrompidos
Default = Padrão
Delete = Eliminar
Delete all = Eliminar tudo
Delete completed = Eliminação completa.
+1
View File
@@ -401,6 +401,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = Default
Delete = Șterge
Delete all = Șterge tot
Delete completed = Ștergere completă
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Имя повреждено
Copied to clipboard: %1 = Скопировано в буфер обмена: %1
Copy to clipboard = Копировать в буфер обмена
Corrupted Data = Данные повреждены
Default = По умолчанию
Delete = Удалить
Delete all = Удалить всё
Delete completed = Удаление завершено
+1
View File
@@ -401,6 +401,7 @@ Copied to clipboard: %1 = Kopierat till urklipp: %1
Copy to clipboard = Kopiera till urklipp
Corrupted Data = Korrupt data
#Default = Standard
Default = Standard
Delete = Radera
Delete all = Radera allt
Delete completed = Borttaget.
+1
View File
@@ -401,6 +401,7 @@ ConnectionName = Pangalan ng Koneksyon
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted ang data
Default = Default
Delete = Burahin
Delete all = Burahin Lahat
Delete completed = Burado na.
+1
View File
@@ -416,6 +416,7 @@ ConnectionName = ชื่อเครือข่าย
Copied to clipboard: %1 = คัดลอกไปยังคลิปบอร์ด: %1
Copy to clipboard = คัดลอกไปยังคลิปบอร์ด
Corrupted Data = ข้อมูลเสียหาย
Default = ค่าดั้งเดิม
Delete = ลบ
Delete all = ลบทั้งหมด
Delete completed = ลบข้อมูลสำเร็จ
+1
View File
@@ -402,6 +402,7 @@ ConnectionName = Bağlantı adı
Copied to clipboard: %1 = Panoya kopyalandı: %1
Copy to clipboard = Panoya kopyala
Corrupted Data = Bozuk veri
Default = Varsayılan
Delete = Sil
Delete all = Tümünü sil
Delete completed = Silme işlemi tamamlandı.
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Назва підключення
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Копіювати в буфер обміну
Corrupted Data = Пошкоджені дані
Default = Звичайна
Delete = Видалити
Delete all = Видалити все
Delete completed = Видалення завершено
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = Connection name
Copied to clipboard: %1 = Copied to clipboard: %1
Copy to clipboard = Copy to clipboard
Corrupted Data = Corrupted data
Default = Default
Delete = Xóa
Delete all = Xóa tất cả
Delete completed = Đã xóa xong.
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = 连接名称
Copied to clipboard: %1 = 已复制到剪贴板: %1
Copy to clipboard = 复制到剪贴板
Corrupted Data = 数据损坏
Default = 默认主题
Delete = 删除
Delete all = 清除
Delete completed = 已删除。
+1
View File
@@ -400,6 +400,7 @@ ConnectionName = 連線名稱
Copied to clipboard: %1 = 已複製到剪貼簿:%1
Copy to clipboard = 複製到剪貼簿
Corrupted Data = 已損毀的資料
Default = 預設
Delete = 刪除
Delete all = 全部刪除
Delete completed = 刪除完成
+8 -5
View File
@@ -7,7 +7,7 @@
viewBox="0 0 158.74998 185.20831"
version="1.1"
id="svg1"
inkscape:version="1.3.2 (091e20e, 2023-11-25, custom)"
inkscape:version="1.4.2 (f4327f4, 2025-05-13)"
sodipodi:docname="images.svg"
xml:space="preserve"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
@@ -24,9 +24,9 @@
inkscape:pagecheckerboard="true"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
inkscape:zoom="5.656855"
inkscape:cx="250.49255"
inkscape:cy="560.11689"
inkscape:zoom="16.000002"
inkscape:cx="338.78121"
inkscape:cy="626.46867"
inkscape:window-width="3840"
inkscape:window-height="2071"
inkscape:window-x="-9"
@@ -4426,7 +4426,10 @@
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.553509" /><path
id="I_RESIZE"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.645958"
d="m 73.353766,158.91621 v 2.9068 h 0.968933 v -1.25315 l 1.513086,1.51308 0.685229,-0.68523 -1.513086,-1.51257 h 1.252637 v -0.96893 z m 5.412589,0 v 0.96893 h 1.252636 l -1.551843,1.55185 0.68523,0.68471 1.551843,-1.55184 v 1.25315 h 0.968933 v -2.9068 z m -2.896981,5.11803 -1.546675,1.54668 v -1.25264 h -0.968933 v 2.9068 h 2.906799 v -0.96893 h -1.252637 l 1.547193,-1.54668 z m 3.303674,0.0155 -0.685229,0.68523 1.531172,1.53117 h -1.252636 v 0.96893 h 2.906799 v -2.9068 h -0.968933 v 1.25264 z" /></g><path
d="m 73.353766,158.91621 v 2.9068 h 0.968933 v -1.25315 l 1.513086,1.51308 0.685229,-0.68523 -1.513086,-1.51257 h 1.252637 v -0.96893 z m 5.412589,0 v 0.96893 h 1.252636 l -1.551843,1.55185 0.68523,0.68471 1.551843,-1.55184 v 1.25315 h 0.968933 v -2.9068 z m -2.896981,5.11803 -1.546675,1.54668 v -1.25264 h -0.968933 v 2.9068 h 2.906799 v -0.96893 h -1.252637 l 1.547193,-1.54668 z m 3.303674,0.0155 -0.685229,0.68523 1.531172,1.53117 h -1.252636 v 0.96893 h 2.906799 v -2.9068 h -0.968933 v 1.25264 z" /><path
id="I_LINK_OUT_QUESTION"
style="color:#000000;baseline-shift:baseline;display:inline;overflow:visible;visibility:visible;vector-effect:none;fill:#ffffff;stroke:none;stroke-width:0.70526;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate;stop-color:#000000"
d="M 95.057752 156.71186 L 90.723133 156.84622 L 92.339055 158.49211 L 91.223361 159.6631 L 92.174724 160.61447 L 93.289901 159.44296 L 94.924943 161.04751 L 95.057752 156.71186 z M 85.100738 157.98414 L 85.100738 166.83166 L 93.86816 166.83166 L 93.86816 161.78907 L 93.082679 161.78907 L 93.082679 166.04617 L 85.88622 166.04617 L 85.88622 158.76962 L 90.041521 158.76962 L 90.041521 157.98414 L 85.100738 157.98414 z M 89.34699 160.23671 C 89.143515 160.23671 88.946182 160.26034 88.755295 160.30854 C 88.564405 160.35684 88.38765 160.4291 88.226128 160.52558 L 88.226128 161.47333 C 88.383454 161.33492 88.550669 161.23198 88.726873 161.16482 C 88.903078 161.09562 89.072783 161.06095 89.236402 161.06095 C 89.311912 161.06095 89.380206 161.07237 89.441041 161.09557 C 89.503971 161.11857 89.556185 161.14972 89.598137 161.18962 C 89.642187 161.22952 89.675323 161.27825 89.69839 161.33483 C 89.72146 161.38923 89.73353 161.44909 89.73353 161.51415 C 89.73353 161.58965 89.722987 161.65899 89.702007 161.72189 C 89.681027 161.78279 89.649389 161.84249 89.607439 161.90121 C 89.565479 161.95791 89.514283 162.0151 89.453443 162.07381 C 89.394703 162.13041 89.325417 162.19218 89.245704 162.25933 C 89.170184 162.32223 89.103904 162.38651 89.047267 162.45156 C 88.990627 162.51456 88.943433 162.58177 88.905673 162.6531 C 88.867913 162.7223 88.839784 162.79663 88.820924 162.87634 C 88.802044 162.95604 88.792502 163.04391 88.792502 163.14041 C 88.792502 163.20131 88.797942 163.26653 88.808522 163.33575 C 88.821102 163.40285 88.837668 163.46364 88.858648 163.51816 L 89.685987 163.51816 C 89.662917 163.48246 89.64435 163.43879 89.62966 163.38639 C 89.61708 163.33399 89.611056 163.28274 89.611056 163.23239 C 89.611056 163.15899 89.620152 163.09368 89.638962 163.03706 C 89.657842 162.97836 89.68495 162.92359 89.72061 162.87324 C 89.75837 162.82084 89.804573 162.76807 89.859103 162.71563 C 89.915743 162.66313 89.981021 162.60693 90.05444 162.54613 C 90.16352 162.45593 90.25992 162.36855 90.343828 162.28465 C 90.427728 162.19865 90.49803 162.10978 90.554668 162.01748 C 90.611308 161.92518 90.654489 161.82777 90.683859 161.72499 C 90.713229 161.6201 90.727784 161.50361 90.727784 161.37566 C 90.727784 161.17428 90.692656 161.00205 90.621331 160.85941 C 90.552101 160.71467 90.453668 160.59618 90.327808 160.50388 C 90.204044 160.41168 90.058441 160.34431 89.890626 160.30234 C 89.722812 160.25834 89.542074 160.23671 89.34699 160.23671 z M 89.318568 163.85819 C 89.150754 163.85819 89.011166 163.90732 88.899989 164.00599 C 88.788812 164.10459 88.733074 164.22761 88.733074 164.37444 C 88.733074 164.51709 88.788816 164.64061 88.899989 164.74548 C 89.011166 164.84622 89.150754 164.89637 89.318568 164.89637 C 89.486383 164.89637 89.62445 164.84715 89.73353 164.74858 C 89.840512 164.64998 89.893726 164.52548 89.893726 164.37444 C 89.893726 164.22551 89.838996 164.10248 89.729912 164.00599 C 89.620833 163.90739 89.484284 163.85819 89.318568 163.85819 z " /></g><path
id="I_GEAR"
style="fill:#ececec;fill-opacity:1;stroke-width:0.019487"
class="st0"

Before

Width:  |  Height:  |  Size: 232 KiB

After

Width:  |  Height:  |  Size: 235 KiB

+8 -8
View File
@@ -15,7 +15,7 @@ Bounds g_imguiCentralNodeBounds;
void ImGui_ImplPlatform_KeyEvent(const KeyInput &key) {
ImGuiIO &io = ImGui::GetIO();
if (key.flags & KEY_DOWN) {
if (key.flags & KeyInputFlags::DOWN) {
// Specially handle scroll events and any other special keys.
switch (key.keyCode) {
case NKCODE_EXT_MOUSEWHEEL_UP:
@@ -34,13 +34,13 @@ void ImGui_ImplPlatform_KeyEvent(const KeyInput &key) {
}
}
}
if (key.flags & KEY_UP) {
if (key.flags & KeyInputFlags::UP) {
ImGuiKey keyCode = KeyCodeToImGui(key.keyCode);
if (keyCode != ImGuiKey_None) {
io.AddKeyEvent(keyCode, false);
}
}
if (key.flags & KEY_CHAR) {
if (key.flags & KeyInputFlags::CHAR) {
const int unichar = key.unicodeChar;
if (unichar >= 0x20) {
@@ -59,12 +59,12 @@ void ImGui_ImplPlatform_TouchEvent(const TouchInput &touch) {
float x = touch.x / g_display.dpi_scale_x;
float y = touch.y / g_display.dpi_scale_y;
if (touch.flags & TOUCH_MOVE) {
if (touch.flags & TouchInputFlags::MOVE) {
io.AddMousePosEvent(x, y);
}
if (touch.flags & TOUCH_DOWN) {
if (touch.flags & TouchInputFlags::DOWN) {
io.AddMousePosEvent(x, y);
if (touch.flags & TOUCH_MOUSE) {
if (touch.flags & TouchInputFlags::MOUSE) {
if (touch.buttons & 1)
io.AddMouseButtonEvent(0, true);
if (touch.buttons & 2)
@@ -73,9 +73,9 @@ void ImGui_ImplPlatform_TouchEvent(const TouchInput &touch) {
io.AddMouseButtonEvent(0, true);
}
}
if (touch.flags & TOUCH_UP) {
if (touch.flags & TouchInputFlags::UP) {
io.AddMousePosEvent(x, y);
if (touch.flags & TOUCH_MOUSE) {
if (touch.flags & TouchInputFlags::MOUSE) {
if (touch.buttons & 1)
io.AddMouseButtonEvent(0, false);
if (touch.buttons & 2)
+10 -10
View File
@@ -11,7 +11,7 @@
static void controllerButtonPressed(BOOL pressed, InputKeyCode keyCode) {
KeyInput key;
key.deviceId = DEVICE_ID_PAD_0;
key.flags = pressed ? KEY_DOWN : KEY_UP;
key.flags = pressed ? KeyInputFlags::DOWN : KeyInputFlags::UP;
key.keyCode = keyCode;
NativeKey(key);
}
@@ -177,9 +177,9 @@ void TouchTracker::SendTouchEvent(float x, float y, int code, int pointerId) {
input.x = scaledX;
input.y = scaledY;
switch (code) {
case 1: input.flags = TOUCH_DOWN; break;
case 2: input.flags = TOUCH_UP; break;
default: input.flags = TOUCH_MOVE; break;
case 1: input.flags = TouchInputFlags::DOWN; break;
case 2: input.flags = TouchInputFlags::UP; break;
default: input.flags = TouchInputFlags::MOVE; break;
}
input.id = pointerId;
NativeTouch(input);
@@ -297,7 +297,7 @@ void ICadeTracker::ButtonDown(iCadeState button) {
NativeAxis(&axis, 1);
} else {
KeyInput key;
key.flags = KEY_DOWN;
key.flags = KeyInputFlags::DOWN;
key.keyCode = iCadeToKeyMap[button];
key.deviceId = DEVICE_ID_PAD_0;
NativeKey(key);
@@ -322,7 +322,7 @@ void ICadeTracker::ButtonUp(iCadeState button) {
// Pressing Start twice within 1 second will take to the Emu menu
if ((lastStartPress + 1.0f) > time_now_d()) {
KeyInput key;
key.flags = KEY_DOWN;
key.flags = KeyInputFlags::DOWN;
key.keyCode = NKCODE_ESCAPE;
key.deviceId = DEVICE_ID_KEYBOARD;
NativeKey(key);
@@ -365,7 +365,7 @@ void ICadeTracker::ButtonUp(iCadeState button) {
NativeAxis(&axis, 1);
} else {
KeyInput key;
key.flags = KEY_UP;
key.flags = KeyInputFlags::UP;
key.keyCode = iCadeToKeyMap[button];
key.deviceId = DEVICE_ID_PAD_0;
NativeKey(key);
@@ -386,7 +386,7 @@ void SendKeyboardChars(std::string_view str) {
uint32_t codePoint = chars.next();
KeyInput input{};
input.deviceId = DEVICE_ID_KEYBOARD;
input.flags = KEY_CHAR;
input.flags = KeyInputFlags::CHAR;
input.unicodeChar = codePoint;
NativeKey(input);
}
@@ -404,7 +404,7 @@ void KeyboardPressesBegan(NSSet<UIPress *> *presses, UIPressesEvent *event) {
KeyInput input{};
input.deviceId = DEVICE_ID_KEYBOARD;
input.keyCode = code;
input.flags = KEY_DOWN;
input.flags = KeyInputFlags::DOWN;
NativeKey(input);
INFO_LOG(Log::System, "pressesBegan %d", code);
}
@@ -428,7 +428,7 @@ void KeyboardPressesEnded(NSSet<UIPress *> *presses, UIPressesEvent *event) {
KeyInput input{};
input.deviceId = DEVICE_ID_KEYBOARD;
input.keyCode = code;
input.flags = KEY_UP;
input.flags = KeyInputFlags::UP;
NativeKey(input);
INFO_LOG(Log::System, "pressesEnded %d", code);
}

Some files were not shown because too many files have changed in this diff Show More