Skip to content
Snippets Groups Projects
Commit b4162f10 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

WIP Some fixes to X11 mouse click

parent baeaeee9
No related branches found
No related tags found
1 merge request!316Resolves #343 GUI and Frame Refactor
...@@ -155,6 +155,7 @@ void Camera::touch(int id, ftl::codecs::TouchType t, int x, int y, float d) { ...@@ -155,6 +155,7 @@ void Camera::touch(int id, ftl::codecs::TouchType t, int x, int y, float d) {
if (auto ptr = std::atomic_load(&latest_)) { if (auto ptr = std::atomic_load(&latest_)) {
auto response = ptr->frames[frame_idx].response(); auto response = ptr->frames[frame_idx].response();
auto &data = response.create<std::vector<ftl::codecs::Touch>>(Channel::Touch); auto &data = response.create<std::vector<ftl::codecs::Touch>>(Channel::Touch);
data.resize(0);
auto &pt = data.emplace_back(); auto &pt = data.emplace_back();
pt.id = id; pt.id = id;
pt.type = t; pt.type = t;
......
...@@ -200,15 +200,27 @@ ScreenCapture::~ScreenCapture() { ...@@ -200,15 +200,27 @@ ScreenCapture::~ScreenCapture() {
void ScreenCapture::_mouseClick(int button, int x, int y) { void ScreenCapture::_mouseClick(int button, int x, int y) {
#ifdef HAVE_X11 #ifdef HAVE_X11
auto &s = *impl_state_; auto &s = *impl_state_;
//ftl::pool.push([this,x,y](int id) {
//auto &s = *impl_state_;
//std::this_thread::sleep_for(std::chrono::milliseconds(100));
XTestFakeMotionEvent (s.display, 0, x, y, CurrentTime); XTestFakeMotionEvent (s.display, 0, x, y, CurrentTime);
XSync(s.display, 0); XSync(s.display, 0);
std::this_thread::sleep_for(std::chrono::milliseconds(10));
XTestFakeButtonEvent (s.display, button, True, CurrentTime); //std::this_thread::sleep_for(std::chrono::milliseconds(100));
//XTestFakeButtonEvent (s.display, Button1, False, CurrentTime);
//XSync(s.display, 0); //XSync(s.display, 0);
//std::this_thread::sleep_for(std::chrono::milliseconds(10));
XTestFakeButtonEvent (s.display, button, False, CurrentTime); XTestFakeButtonEvent (s.display, Button1, True, CurrentTime);
//XSync(s.display, 0);
XTestFakeButtonEvent (s.display, Button1, False, CurrentTime);
//XSync(s.display, 0);
//});
#endif #endif
} }
...@@ -222,7 +234,9 @@ bool ScreenCapture::retrieve(ftl::rgbd::Frame &frame) { ...@@ -222,7 +234,9 @@ bool ScreenCapture::retrieve(ftl::rgbd::Frame &frame) {
const auto &touches = frame.get<std::vector<ftl::codecs::Touch>>(Channel::Touch); const auto &touches = frame.get<std::vector<ftl::codecs::Touch>>(Channel::Touch);
for (const auto &t : touches) { for (const auto &t : touches) {
LOG(INFO) << " -- " << t.x << "," << t.y; LOG(INFO) << " -- " << t.x << "," << t.y;
_mouseClick(1, t.x, t.y); }
if (touches.size() > 0) {
_mouseClick(1, touches[0].x, touches[0].y);
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment