mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Add return value to UnsyncTouch
This commit is contained in:
parent
005b072fdc
commit
109205a56a
@ -94,11 +94,14 @@ 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)) {
|
||||
overlayScreen_->UnsyncTouch(overlayScreen_->transformTouch(touch));
|
||||
skip = overlayScreen_->UnsyncTouch(overlayScreen_->transformTouch(touch));
|
||||
}
|
||||
if (!skip) {
|
||||
Screen *screen = stack_.back().screen;
|
||||
stack_.back().screen->UnsyncTouch(screen->transformTouch(touch));
|
||||
}
|
||||
Screen *screen = stack_.back().screen;
|
||||
stack_.back().screen->UnsyncTouch(screen->transformTouch(touch));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,9 @@ public:
|
||||
virtual void deviceLost() {}
|
||||
virtual void deviceRestored() {}
|
||||
|
||||
virtual void UnsyncTouch(const TouchInput &touch) = 0;
|
||||
// Return value of UnsyncTouch is only used to let the overlay screen block touches.
|
||||
virtual bool UnsyncTouch(const TouchInput &touch) = 0;
|
||||
// Return value of UnsyncKey is used to not block certain system keys like volume when unhandled, on Android.
|
||||
virtual bool UnsyncKey(const KeyInput &touch) = 0;
|
||||
virtual void UnsyncAxis(const AxisInput &touch) = 0;
|
||||
|
||||
|
@ -81,7 +81,7 @@ bool UIScreen::key(const KeyInput &key) {
|
||||
}
|
||||
}
|
||||
|
||||
void UIScreen::UnsyncTouch(const TouchInput &touch) {
|
||||
bool UIScreen::UnsyncTouch(const TouchInput &touch) {
|
||||
if (ClickDebug && root_ && (touch.flags & TOUCH_DOWN)) {
|
||||
INFO_LOG(SYSTEM, "Touch down!");
|
||||
std::vector<UI::View *> views;
|
||||
@ -96,6 +96,7 @@ void UIScreen::UnsyncTouch(const TouchInput &touch) {
|
||||
ev.type = QueuedEventType::TOUCH;
|
||||
ev.touch = touch;
|
||||
eventQueue_.push_back(ev);
|
||||
return false;
|
||||
}
|
||||
|
||||
void UIScreen::UnsyncAxis(const AxisInput &axis) {
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
virtual bool key(const KeyInput &key);
|
||||
virtual void axis(const AxisInput &axis);
|
||||
|
||||
void UnsyncTouch(const TouchInput &touch) override;
|
||||
bool UnsyncTouch(const TouchInput &touch) override;
|
||||
bool UnsyncKey(const KeyInput &key) override;
|
||||
void UnsyncAxis(const AxisInput &axis) override;
|
||||
|
||||
|
@ -563,14 +563,14 @@ void EmuScreen::sendMessage(const char *message, const char *value) {
|
||||
}
|
||||
}
|
||||
|
||||
void EmuScreen::UnsyncTouch(const TouchInput &touch) {
|
||||
bool EmuScreen::UnsyncTouch(const TouchInput &touch) {
|
||||
System_Notify(SystemNotification::ACTIVITY);
|
||||
|
||||
if (chatMenu_ && chatMenu_->GetVisibility() == UI::V_VISIBLE) {
|
||||
// Avoid pressing touch button behind the chat
|
||||
if (chatMenu_->Contains(touch.x, touch.y)) {
|
||||
chatMenu_->Touch(touch);
|
||||
return;
|
||||
return true;
|
||||
} else if ((touch.flags & TOUCH_DOWN) != 0) {
|
||||
chatMenu_->Close();
|
||||
if (chatButton_)
|
||||
@ -582,6 +582,7 @@ void EmuScreen::UnsyncTouch(const TouchInput &touch) {
|
||||
if (root_) {
|
||||
root_->Touch(touch);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void EmuScreen::onVKey(int virtualKeyCode, bool down) {
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
|
||||
// Note: Unlike your average boring UIScreen, here we override the Unsync* functions
|
||||
// to get minimal latency and full control. We forward to UIScreen when needed.
|
||||
void UnsyncTouch(const TouchInput &touch) override;
|
||||
bool UnsyncTouch(const TouchInput &touch) override;
|
||||
bool UnsyncKey(const KeyInput &key) override;
|
||||
void UnsyncAxis(const AxisInput &axis) override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user