return get_emul_multi_touch_state()->multitouch_enable;
}
-static int _add_finger_point(int origin_x, int origin_y, int x, int y)
+int add_finger_point(int origin_x, int origin_y, int x, int y)
{
MultiTouchState *mts = get_emul_multi_touch_state();
if (mts->finger_cnt == 0)
{ //first finger touch input
- if (_add_finger_point(origin_x, origin_y, x, y) == -1) {
+ if (add_finger_point(origin_x, origin_y, x, y) == -1) {
return;
}
kbd_mouse_event(x, y, 0, QEMU_MOUSE_PRESSED);
}
else //one more finger
{
- _add_finger_point(origin_x, origin_y, x, y) ;
+ add_finger_point(origin_x, origin_y, x, y) ;
kbd_mouse_event(x, y, mts->finger_cnt - 1, QEMU_MOUSE_PRESSED);
}
if (mts->finger_cnt == 0)
{ //first finger touch input
- if (_add_finger_point(origin_x, origin_y, x, y) == -1) {
+ if (add_finger_point(origin_x, origin_y, x, y) == -1) {
return;
}
kbd_mouse_event(x, y, 0, QEMU_MOUSE_PRESSED);
}
else //one more finger
{
- _add_finger_point(origin_x, origin_y, x, y) ;
+ add_finger_point(origin_x, origin_y, x, y) ;
kbd_mouse_event(x, y, mts->finger_cnt - 1, QEMU_MOUSE_PRESSED);
}
int get_multi_touch_enable(void);
FingerPoint *get_finger_point_from_slot(int index);
FingerPoint *get_finger_point_search(int x, int y);
+int add_finger_point(int origin_x, int origin_y, int x, int y);
+
void maru_finger_processing_1(int touch_type, int origin_x, int origin_y, int x, int y);
void maru_finger_processing_2(int touch_type, int origin_x, int origin_y, int x, int y);
int rearrange_finger_points(int lcd_w, int lcd_h, double scale_factor, int rotaton_type);
#define TIMEOUT_FOR_SHUTDOWN 10 // seconds
static int requested_shutdown_qemu_gracefully = 0;
-static int guest_x, guest_y = 0;
+
+/* touch values */
+static int guest_x, guest_y;
+static int pressing_x = -1, pressing_y = -1;
+static int pressing_origin_x = -1, pressing_origin_y = -1;
+
static void* run_timed_shutdown_thread(void* args);
static void send_to_emuld(const char* request_type, int request_size, const char* send_buf, int buf_size);
switch(event_type) {
case MOUSE_DOWN:
case MOUSE_DRAG:
- guest_x = x;
- guest_y = y;
+ pressing_x = guest_x = x;
+ pressing_y = guest_y = y;
+ pressing_origin_x = origin_x;
+ pressing_origin_y = origin_y;
+
kbd_mouse_event(x, y, z, 1);
TRACE("mouse_event event_type:%d, origin:(%d, %d), x:%d, y:%d, z:%d\n\n",
event_type, origin_x, origin_y, x, y, z);
case MOUSE_UP:
guest_x = x;
guest_y = y;
+ pressing_x = pressing_y = -1;
+ pressing_origin_x = pressing_origin_y = -1;
+
kbd_mouse_event(x, y, z, 0);
TRACE("mouse_event event_type:%d, origin:(%d, %d), x:%d, y:%d, z:%d\n\n",
event_type, origin_x, origin_y, x, y, z);
y -= guest_y;
guest_x += x;
guest_y += y;
+
kbd_mouse_event(x, y, -z, event_type);
TRACE("mouse_event event_type:%d, origin:(%d, %d), x:%d, y:%d, z:%d\n\n",
event_type, origin_x, origin_y, x, y, z);
{
if (KEY_PRESSED == event_type) {
get_emul_multi_touch_state()->multitouch_enable = 2;
+
+ /* add a finger before start the multi-touch processing
+ if already exist the pressed touch in display */
+ if (pressing_x != -1 && pressing_y != -1 &&
+ pressing_origin_x != -1 && pressing_origin_y != -1) {
+ add_finger_point(
+ pressing_origin_x, pressing_origin_y,
+ pressing_x, pressing_y);
+ pressing_x = pressing_y = -1;
+ pressing_origin_x = pressing_origin_y = -1;
+ }
+
INFO("enable multi-touch = mode2\n");
}
}
{
if (KEY_PRESSED == event_type) {
get_emul_multi_touch_state()->multitouch_enable = 1;
+
+ /* add a finger before start the multi-touch processing
+ if already exist the pressed touch in display */
+ if (pressing_x != -1 && pressing_y != -1 &&
+ pressing_origin_x != -1 && pressing_origin_y != -1) {
+ add_finger_point(
+ pressing_origin_x, pressing_origin_y,
+ pressing_x, pressing_y);
+ pressing_x = pressing_y = -1;
+ pressing_origin_x = pressing_origin_y = -1;
+ }
+
INFO("enable multi-touch = mode1\n");
} else if (KEY_RELEASED == event_type) {
if (state_mask_temp == (JAVA_KEYCODE_BIT_CTRL | JAVA_KEYCODE_BIT_SHIFT)) {