Apply mouse press / release action 13/244413/7
authorHyunsoo Park <hance.park@samsung.com>
Fri, 18 Sep 2020 08:00:22 +0000 (17:00 +0900)
committerHyunsoo Park <hance.park@samsung.com>
Mon, 5 Oct 2020 07:59:01 +0000 (07:59 +0000)
Change-Id: I75c4220e0a1c5dd6550caa941c7f13c382afecf9
Signed-off-by: Hyunsoo Park <hance.park@samsung.com>
test/testsuites/stream_handpose_browser/stream_handpose_browser.c

index 7a973095c21317fa8c9977b716e4c9fb663d6ffd..10da01ca8c375a1960c3d1bd3a85bfccf1cfc3c5 100644 (file)
@@ -231,8 +231,8 @@ static int poseCropSize = 0;
 
 #define VOLUME_INTERVAL 10
 
-void send_mouse_event_efl(int x, int y){
-       efl_util_input_generate_pointer(my_cursor, 1, EFL_UTIL_INPUT_POINTER_MOVE, x, y);
+void send_mouse_event_efl(int x, int y, efl_util_input_pointer_type_e event){
+       efl_util_input_generate_pointer(my_cursor, 1, event, x, y);
 }
 struct timespec diff(struct timespec start, struct timespec end)
 {
@@ -838,7 +838,6 @@ draw_overlay_hand (GstElement * overlay, cairo_t * cr, guint64 timestamp,
        cairo_set_source_rgba(cr, 0.0, 0.0, 1.0, 0.7);
        cairo_set_line_width(cr, 2.0);
 
-
        if (!humanSkeleton.IsDetected)
                return;
 
@@ -849,16 +848,40 @@ draw_overlay_hand (GstElement * overlay, cairo_t * cr, guint64 timestamp,
                cairo_move_to(cr, 320.0, 48.0);
                cairo_show_text(cr, gHandGestureLabel[humanSkeleton.label]);
        }*/
+
 #define MOUSE_CONTROLLER
 #ifdef MOUSE_CONTROLLER
        static int move_x = 0;
        static int move_y = 0;
+       static bool flag = true;
+       static bool click_flag = true;
+
        move_x = (WIDTH - humanSkeleton.pose[9].x)*3;
-       move_y = humanSkeleton.pose[9].y*2;
+       move_y = humanSkeleton.pose[9].y*2.5;
+
+       send_mouse_event_efl(move_x, move_y, EFL_UTIL_INPUT_POINTER_MOVE);
+
+       if(!g_strcmp0(gHandGestureLabel[humanSkeleton.label], "One") && click_flag){
+               send_mouse_event_efl(move_x, move_y, EFL_UTIL_INPUT_POINTER_BUTTON_DOWN);
+               send_mouse_event_efl(move_x, move_y, EFL_UTIL_INPUT_POINTER_BUTTON_UP);
+               click_flag = false;
+       }
 
-       send_mouse_event_efl(move_x, move_y);
+       if (g_strcmp0(gHandGestureLabel[humanSkeleton.label], "One")){
+               click_flag = true;
+       }
+
+       if (flag && (!g_strcmp0(gHandGestureLabel[humanSkeleton.label], "DisLike") || !g_strcmp0(gHandGestureLabel[humanSkeleton.label], "Fist") )) {
+               send_mouse_event_efl(move_x, move_y, EFL_UTIL_INPUT_POINTER_BUTTON_DOWN);
+               flag = false;
+       }
+
+       if (!flag && !g_strcmp0(gHandGestureLabel[humanSkeleton.label], "Five")) {
+               send_mouse_event_efl(move_x, move_y, EFL_UTIL_INPUT_POINTER_BUTTON_UP);
+               flag = true;
+       }
 
-#elif REMOTE_CONTROLLER        
+#elif REMOTE_CONTROLLER
        int fd = -1;
        //int signal = 8;
 
@@ -2004,7 +2027,7 @@ static int app_create(void *data)
        g_signal_connect (coverlay, "caps-changed", G_CALLBACK (prepare_overlay), overlay_state);
 
        if (!ad->filename) {
-               g_object_set(G_OBJECT(source), "device", "/dev/video252", NULL); // 252
+               g_object_set(G_OBJECT(source), "device", "/dev/video8", NULL);
        } else {
                g_object_set(G_OBJECT(source), "location", ad->filename, NULL);
                //g_object_set(G_OBJECT(source), "num-buffers", ad->numbuffers, NULL);