core/frontend/emu_window: return true when TouchPressed is consumed

This commit is contained in:
SachinVin 2020-05-30 18:58:34 +05:30
parent 60235827c5
commit 666787bf4d
3 changed files with 6 additions and 4 deletions

View File

@ -111,9 +111,9 @@ std::tuple<unsigned, unsigned> EmuWindow::ClipToTouchScreen(unsigned new_x, unsi
return std::make_tuple(new_x, new_y); 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)) if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y))
return; return false;
if (framebuffer_x >= framebuffer_layout.width / 2) { if (framebuffer_x >= framebuffer_layout.width / 2) {
if (Settings::values.render_3d == Settings::StereoRenderOption::SideBySide) 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; touch_state->touch_pressed = true;
return true;
} }
void EmuWindow::TouchReleased() { void EmuWindow::TouchReleased() {

View File

@ -115,8 +115,9 @@ public:
* Signal that a touch pressed event has occurred (e.g. mouse click pressed) * Signal that a touch pressed event has occurred (e.g. mouse click pressed)
* @param framebuffer_x Framebuffer x-coordinate that was pressed * @param framebuffer_x Framebuffer x-coordinate that was pressed
* @param framebuffer_y Framebuffer y-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) /// Signal that a touch released event has occurred (e.g. mouse click released)
void TouchReleased(); void TouchReleased();

View File

@ -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 * @tparam InputDeviceType the type of input devices to create
* @param params a serialized ParamPackage string contains all parameters for creating the device * @param params a serialized ParamPackage string contains all parameters for creating the device
*/ */