Display and control your Android device
Add relative mode flag to mouse processors
Romain Vimontb5855e5deb74
diff --git a/app/src/input_manager.c b/app/src/input_manager.cindex 64922f28..5cfb5b7e 100644--- a/app/src/input_manager.c+++ b/app/src/input_manager.c@@ -659,7 +659,11 @@ input_manager_process_mouse_motion(struct input_manager *im,assert(im->mp->ops->process_mouse_motion);im->mp->ops->process_mouse_motion(im->mp, &evt);+ // vfinger must never be used in relative mode+ assert(!im->mp->relative_mode || !im->vfinger_down);+if (im->vfinger_down) {+ assert(!im->mp->relative_mode); // assert one more timestruct sc_point mouse =screen_convert_window_to_frame_coords(im->screen, event->x,event->y);@@ -772,6 +776,12 @@ input_manager_process_mouse_button(struct input_manager *im,assert(im->mp->ops->process_mouse_click);im->mp->ops->process_mouse_click(im->mp, &evt);+ if (im->mp->relative_mode) {+ assert(!im->vfinger_down); // vfinger must not be used in relative mode+ // No pinch-to-zoom simulation+ return;+ }+// Pinch-to-zoom simulation.//// If Ctrl is hold when the left-click button is pressed, thendiff --git a/app/src/mouse_inject.c b/app/src/mouse_inject.cindex 38bfa404..dcb4f611 100644--- a/app/src/mouse_inject.c+++ b/app/src/mouse_inject.c@@ -151,4 +151,6 @@ sc_mouse_inject_init(struct sc_mouse_inject *mi,};mi->mouse_processor.ops = &ops;++ mi->mouse_processor.relative_mode = false;}diff --git a/app/src/trait/mouse_processor.h b/app/src/trait/mouse_processor.hindex 0252d2c6..6e0b596e 100644--- a/app/src/trait/mouse_processor.h+++ b/app/src/trait/mouse_processor.h@@ -16,6 +16,13 @@*/struct sc_mouse_processor {const struct sc_mouse_processor_ops *ops;++ /**+ * If set, the mouse processor works in relative mode (the absolute+ * position is irrelevant). In particular, it indicates that the mouse+ * pointer must be "captured" by the UI.+ */+ bool relative_mode;};struct sc_mouse_processor_ops {