From: giwoong.kim Date: Sat, 8 Dec 2012 07:50:33 +0000 (+0900) Subject: touch: Added multi-touch control scenario X-Git-Tag: TizenStudio_2.0_p2.3~1172 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bc9e1491dd5292ae1817eb3bb88e6307fd34a0d7;p=sdk%2Femulator%2Fqemu.git touch: Added multi-touch control scenario Add a finger before start the multi-touch processing if already exist the pressed touch in display. Signed-off-by: GiWoong Kim --- diff --git a/tizen/src/maru_finger.c b/tizen/src/maru_finger.c index c42dbca..7a10ae2 100644 --- a/tizen/src/maru_finger.c +++ b/tizen/src/maru_finger.c @@ -221,7 +221,7 @@ int get_multi_touch_enable(void) 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(); @@ -302,7 +302,7 @@ void maru_finger_processing_1(int touch_type, int origin_x, int origin_y, int x, 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); @@ -332,7 +332,7 @@ void maru_finger_processing_1(int touch_type, int origin_x, int origin_y, int x, } 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); } @@ -400,7 +400,7 @@ void maru_finger_processing_2(int touch_type, int origin_x, int origin_y, int x, 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); @@ -417,7 +417,7 @@ void maru_finger_processing_2(int touch_type, int origin_x, int origin_y, int x, } 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); } diff --git a/tizen/src/maru_finger.h b/tizen/src/maru_finger.h index e004fd8..96b7290 100644 --- a/tizen/src/maru_finger.h +++ b/tizen/src/maru_finger.h @@ -64,6 +64,8 @@ void set_multi_touch_enable(int enable); 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); diff --git a/tizen/src/skin/maruskin_operation.c b/tizen/src/skin/maruskin_operation.c index c3e8dcd..27fc0da 100644 --- a/tizen/src/skin/maruskin_operation.c +++ b/tizen/src/skin/maruskin_operation.c @@ -68,7 +68,12 @@ MULTI_DEBUG_CHANNEL(qemu, skin_operation); #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); @@ -109,8 +114,11 @@ void do_mouse_event(int button_type, int event_type, 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); @@ -118,6 +126,9 @@ void do_mouse_event(int button_type, int event_type, 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); @@ -128,6 +139,7 @@ void do_mouse_event(int button_type, int event_type, 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); @@ -165,6 +177,18 @@ void do_key_event(int event_type, int keycode, int state_mask, int key_location) { 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"); } } @@ -173,6 +197,18 @@ void do_key_event(int event_type, int keycode, int state_mask, int key_location) { 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)) {