Check window angle before sending gesture event 58/106958/3 accepted/tizen/3.0/common/20161229.113431 accepted/tizen/3.0/mobile/20161229.054502 accepted/tizen/3.0/wearable/20161229.054609 submit/tizen_3.0/20161229.023141
authorShinwoo Kim <cinoo.kim@samsung.com>
Mon, 26 Dec 2016 02:11:49 +0000 (11:11 +0900)
committerjunsu choi <jsuya.choi@samsung.com>
Wed, 28 Dec 2016 06:05:41 +0000 (22:05 -0800)
The top e_client could not take care the angle of device.
So checking window angle at module initialization time is not proper.
This commit will check window angle before sending gesture event.

Change-Id: I36ce00431f2101bf51b3ade6cfa91442264faaba

src/e_screen_reader_gestures.c

index e791eda..9389380 100644 (file)
@@ -179,11 +179,51 @@ static void _emit_mouse_move_event ( Ecore_Event_Mouse_Button *ev_btn)
    ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev_move, NULL, NULL);
 }
 
-void __transform_coordinates(int *ax, int *ay, int win_angle)
+int __get_window_angle(void)
 {
-    int w, h, tmp;
+   E_Client *ec;
+   E_Zone *zone;
+   int x = 0, y = 0, w = 0, h = 0;
+   E_Comp_Wl_Client_Data *cdata;
+
+   zone = e_zone_current_get();
+
+   E_CLIENT_REVERSE_FOREACH(ec)
+     {
+        if (e_object_is_del(E_OBJECT(ec))) continue;
+        if (e_client_util_ignored_get(ec)) continue;
+        if (zone && ec->zone != zone) continue;
+        if (!ec->frame) continue;
+        cdata = (E_Comp_Wl_Client_Data *)ec->comp_data;
+        if (cdata && cdata->sub.data) continue;
+
+        e_client_geometry_get(ec, &x, &y, &w, &h);
+        Eina_Bool vis = evas_object_visible_get(ec->frame);
+        if (!vis) continue;
+
+        if (E_INTERSECTS(x, y, w, h,
+                         zone->x, zone->y, zone->w, zone->h))
+             break;
+     }
 
+   if (ec)
+     {
+        cover->angle = ec->e.state.rot.ang.curr;
+        DEBUG("Window angle: %d", cover->angle);
+     }
+   else
+        ERROR("Cannot find window");
+
+   return cover->angle;
+}
+
+void __transform_coordinates(int *ax, int *ay)
+{
+    int win_angle, w, h, tmp;
+
+    win_angle = __get_window_angle();
     ecore_wl_screen_size_get(&w, &h);
+
     switch (win_angle) {
        case 90:
           tmp = *ax;
@@ -198,13 +238,13 @@ void __transform_coordinates(int *ax, int *ay, int win_angle)
     }
 }
 
-static void _event_emit(Gesture g, int x, int y, int x_e, int y_e, gesture_state_e state, unsigned int event_time, int angle)
+static void _event_emit(Gesture g, int x, int y, int x_e, int y_e, gesture_state_e state, unsigned int event_time)
 {
    Gesture_Info *info = calloc(sizeof(Gesture_Info), 1);
    EINA_SAFETY_ON_NULL_RETURN(info);
 
-   __transform_coordinates(&x, &y, angle);
-   __transform_coordinates(&x_e, &y_e, angle);
+   __transform_coordinates(&x, &y);
+   __transform_coordinates(&x_e, &y_e);
 
    info->type = g;
    info->x_beg = x;
@@ -408,7 +448,7 @@ _flick_event_emit(Cover *cov)
         if (cov->flick_gesture.n_fingers == 3)
           type = THREE_FINGERS_FLICK_RIGHT_RETURN;
      }
-   _event_emit(type, ax, ay, axe, aye, GESTURE_FINISHED, cov->event_time, cov->angle);
+   _event_emit(type, ax, ay, axe, aye, GESTURE_FINISHED, cov->event_time);
 }
 
 static void
@@ -832,11 +872,13 @@ _hover_gesture_mouse_up(Ecore_Event_Mouse_Button *ev, Cover *cov)
      cov->hover_gesture.state = GESTURE_NOT_STARTED;
 }
 
-void __inverse_transform_coordinates(int *ax, int *ay, int win_angle)
+void __inverse_transform_coordinates(int *ax, int *ay)
 {
-   int w, h, tmp;
+   int win_angle, w, h, tmp;
 
+   win_angle = __get_window_angle();
    ecore_wl_screen_size_get(&w, &h);
+
    switch (win_angle) {
       case 90:
          tmp = *ax;
@@ -858,7 +900,7 @@ _hover_event_emit(Cover *cov, gesture_state_e state)
      {
         if (highlighted_object_x != -1 && highlighted_object_y != -1)
           {
-             __inverse_transform_coordinates(&highlighted_object_x, &highlighted_object_y, cov->angle);
+             __inverse_transform_coordinates(&highlighted_object_x, &highlighted_object_y);
              cov->tap_n_hold_gesture_data.ev_down->x = highlighted_object_x;
              cov->tap_n_hold_gesture_data.ev_down->y = highlighted_object_y;
              cov->tap_n_hold_gesture_data.ev_down->root.x = highlighted_object_x;
@@ -886,10 +928,10 @@ _hover_event_emit(Cover *cov, gesture_state_e state)
    switch (cov->hover_gesture.n_fingers)
      {
       case 1:
-         _event_emit(ONE_FINGER_HOVER, ax, ay, ax, ay, state, cov->event_time, cov->angle);
+         _event_emit(ONE_FINGER_HOVER, ax, ay, ax, ay, state, cov->event_time);
          break;
       case 2:
-         _event_emit(TWO_FINGERS_HOVER, ax, ay, ax, ay, state, cov->event_time, cov->angle);
+         _event_emit(TWO_FINGERS_HOVER, ax, ay, ax, ay, state, cov->event_time);
          break;
       default:
          break;
@@ -935,7 +977,7 @@ _tap_event_emit(Cover *cov, gesture_state_e state)
                _event_emit(ONE_FINGER_SINGLE_TAP,
                      cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
                      cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
-                     state, cov->event_time, cov->angle);
+                     state, cov->event_time);
             }
          else if(cov->tap_gesture_data.tap_type == TWO_FINGERS_GESTURE)
             {
@@ -943,7 +985,7 @@ _tap_event_emit(Cover *cov, gesture_state_e state)
                _event_emit(TWO_FINGERS_SINGLE_TAP,
                      cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
                      cov->tap_gesture_data.x_org[1], cov->tap_gesture_data.y_org[1],
-                     state, cov->event_time, cov->angle);
+                     state, cov->event_time);
             }
          else if(cov->tap_gesture_data.tap_type == THREE_FINGERS_GESTURE)
             {
@@ -951,7 +993,7 @@ _tap_event_emit(Cover *cov, gesture_state_e state)
                _event_emit(THREE_FINGERS_SINGLE_TAP,
                      cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
                      cov->tap_gesture_data.x_org[2], cov->tap_gesture_data.y_org[2],
-                     state, cov->event_time, cov->angle);
+                     state, cov->event_time);
             }
          else
             {
@@ -965,7 +1007,7 @@ _tap_event_emit(Cover *cov, gesture_state_e state)
                _event_emit(ONE_FINGER_DOUBLE_TAP,
                      cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
                      cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
-                     state, cov->event_time, cov->angle);
+                     state, cov->event_time);
             }
          else if(cov->tap_gesture_data.tap_type == TWO_FINGERS_GESTURE)
             {
@@ -973,7 +1015,7 @@ _tap_event_emit(Cover *cov, gesture_state_e state)
                _event_emit(TWO_FINGERS_DOUBLE_TAP,
                      cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
                      cov->tap_gesture_data.x_org[1], cov->tap_gesture_data.y_org[1],
-                     state, cov->event_time, cov->angle);
+                     state, cov->event_time);
             }
          else if(cov->tap_gesture_data.tap_type == THREE_FINGERS_GESTURE)
             {
@@ -981,7 +1023,7 @@ _tap_event_emit(Cover *cov, gesture_state_e state)
                _event_emit(THREE_FINGERS_DOUBLE_TAP,
                      cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
                      cov->tap_gesture_data.x_org[2], cov->tap_gesture_data.y_org[2],
-                     state, cov->event_time, cov->angle);
+                     state, cov->event_time);
             }
          else
             {
@@ -995,7 +1037,7 @@ _tap_event_emit(Cover *cov, gesture_state_e state)
                _event_emit(ONE_FINGER_TRIPLE_TAP,
                      cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
                      cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
-                     state, cov->event_time, cov->angle);
+                     state, cov->event_time);
             }
          else if(cov->tap_gesture_data.tap_type == TWO_FINGERS_GESTURE)
             {
@@ -1003,7 +1045,7 @@ _tap_event_emit(Cover *cov, gesture_state_e state)
                _event_emit(TWO_FINGERS_TRIPLE_TAP,
                      cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
                      cov->tap_gesture_data.x_org[1], cov->tap_gesture_data.y_org[1],
-                     state, cov->event_time, cov->angle);
+                     state, cov->event_time);
             }
          else if(cov->tap_gesture_data.tap_type == THREE_FINGERS_GESTURE)
             {
@@ -1011,7 +1053,7 @@ _tap_event_emit(Cover *cov, gesture_state_e state)
                _event_emit(THREE_FINGERS_TRIPLE_TAP,
                      cov->tap_gesture_data.x_org[0], cov->tap_gesture_data.y_org[0],
                      cov->tap_gesture_data.x_org[2], cov->tap_gesture_data.y_org[2],
-                     state, cov->event_time, cov->angle);
+                     state, cov->event_time);
             }
          else
             {