From 666787bf4d923d14fd64377dc2f915f592f9994b Mon Sep 17 00:00:00 2001
From: SachinVin <sachinvinayak2000@gmail.com>
Date: Sat, 30 May 2020 18:58:34 +0530
Subject: [PATCH] core/frontend/emu_window: return true when TouchPressed is
 consumed

---
 src/core/frontend/emu_window.cpp | 5 +++--
 src/core/frontend/emu_window.h   | 3 ++-
 src/core/frontend/input.h        | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp
index 22eba7c0b..ff9ec53e2 100644
--- a/src/core/frontend/emu_window.cpp
+++ b/src/core/frontend/emu_window.cpp
@@ -111,9 +111,9 @@ std::tuple<unsigned, unsigned> EmuWindow::ClipToTouchScreen(unsigned new_x, unsi
     return std::make_tuple(new_x, new_y);
 }
 
-void EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y) {
+bool EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y) {
     if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y))
-        return;
+        return false;
 
     if (framebuffer_x >= framebuffer_layout.width / 2) {
         if (Settings::values.render_3d == Settings::StereoRenderOption::SideBySide)
@@ -143,6 +143,7 @@ void EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y) {
     }
 
     touch_state->touch_pressed = true;
+    return true;
 }
 
 void EmuWindow::TouchReleased() {
diff --git a/src/core/frontend/emu_window.h b/src/core/frontend/emu_window.h
index 65ee25bc9..326563655 100644
--- a/src/core/frontend/emu_window.h
+++ b/src/core/frontend/emu_window.h
@@ -115,8 +115,9 @@ public:
      * Signal that a touch pressed event has occurred (e.g. mouse click pressed)
      * @param framebuffer_x Framebuffer x-coordinate that was pressed
      * @param framebuffer_y Framebuffer y-coordinate that was pressed
+     * @returns True if the coordinates are within the touchpad, otherwise false
      */
-    void TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y);
+    bool TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y);
 
     /// Signal that a touch released event has occurred (e.g. mouse click released)
     void TouchReleased();
diff --git a/src/core/frontend/input.h b/src/core/frontend/input.h
index d7cb94b93..a1cc8d66a 100644
--- a/src/core/frontend/input.h
+++ b/src/core/frontend/input.h
@@ -76,7 +76,7 @@ void UnregisterFactory(const std::string& name) {
 }
 
 /**
- * Create an input device from given paramters.
+ * Create an input device from given parameters.
  * @tparam InputDeviceType the type of input devices to create
  * @param params a serialized ParamPackage string contains all parameters for creating the device
  */