diff options
Diffstat (limited to 'src/core/frontend/emu_window.cpp')
| -rw-r--r-- | src/core/frontend/emu_window.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp index f2f719cb9..cff49899a 100644 --- a/src/core/frontend/emu_window.cpp +++ b/src/core/frontend/emu_window.cpp | |||
| @@ -66,14 +66,14 @@ static bool IsWithinTouchscreen(const Layout::FramebufferLayout& layout, u32 fra | |||
| 66 | framebuffer_x >= layout.screen.left && framebuffer_x < layout.screen.right); | 66 | framebuffer_x >= layout.screen.left && framebuffer_x < layout.screen.right); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | std::tuple<u32, u32> EmuWindow::ClipToTouchScreen(u32 new_x, u32 new_y) const { | 69 | std::pair<u32, u32> EmuWindow::ClipToTouchScreen(u32 new_x, u32 new_y) const { |
| 70 | new_x = std::max(new_x, framebuffer_layout.screen.left); | 70 | new_x = std::max(new_x, framebuffer_layout.screen.left); |
| 71 | new_x = std::min(new_x, framebuffer_layout.screen.right - 1); | 71 | new_x = std::min(new_x, framebuffer_layout.screen.right - 1); |
| 72 | 72 | ||
| 73 | new_y = std::max(new_y, framebuffer_layout.screen.top); | 73 | new_y = std::max(new_y, framebuffer_layout.screen.top); |
| 74 | new_y = std::min(new_y, framebuffer_layout.screen.bottom - 1); | 74 | new_y = std::min(new_y, framebuffer_layout.screen.bottom - 1); |
| 75 | 75 | ||
| 76 | return std::make_tuple(new_x, new_y); | 76 | return std::make_pair(new_x, new_y); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | void EmuWindow::TouchPressed(u32 framebuffer_x, u32 framebuffer_y, size_t id) { | 79 | void EmuWindow::TouchPressed(u32 framebuffer_x, u32 framebuffer_y, size_t id) { |
| @@ -107,11 +107,14 @@ void EmuWindow::TouchMoved(u32 framebuffer_x, u32 framebuffer_y, size_t id) { | |||
| 107 | if (id >= touch_state->status.size()) { | 107 | if (id >= touch_state->status.size()) { |
| 108 | return; | 108 | return; |
| 109 | } | 109 | } |
| 110 | if (!std::get<2>(touch_state->status[id])) | 110 | |
| 111 | if (!std::get<2>(touch_state->status[id])) { | ||
| 111 | return; | 112 | return; |
| 113 | } | ||
| 112 | 114 | ||
| 113 | if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y)) | 115 | if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y)) { |
| 114 | std::tie(framebuffer_x, framebuffer_y) = ClipToTouchScreen(framebuffer_x, framebuffer_y); | 116 | std::tie(framebuffer_x, framebuffer_y) = ClipToTouchScreen(framebuffer_x, framebuffer_y); |
| 117 | } | ||
| 115 | 118 | ||
| 116 | TouchPressed(framebuffer_x, framebuffer_y, id); | 119 | TouchPressed(framebuffer_x, framebuffer_y, id); |
| 117 | } | 120 | } |