Make quickpanel open/close easy by sending mouse down event directly at top/bottom... 30/93230/3
authorShinwoo Kim <cinoo.kim@samsung.com>
Fri, 21 Oct 2016 05:42:36 +0000 (14:42 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Tue, 25 Oct 2016 02:47:54 +0000 (11:47 +0900)
Change-Id: Iadec916bea8a2669ef18e660a3b842b467dbd891

src/e_screen_reader_gestures.c

index c973c8e..4206ca6 100644 (file)
@@ -2,7 +2,7 @@
 #include "e_comp.h"
 #include "e_screen_reader_private.h"
 
-
+#define QUICKPANEL_AREA_SIZE 40 /* area size to open/close quickpanel */
 #define HISTORY_MAX 8
 #define LONGPRESS_TIMEOUT 0.4
 double MAGIC_NUMBER = 987654321.0;
@@ -38,6 +38,7 @@ struct _Cover
    unsigned int    n_taps; /**< Number of fingers touching screen */
    unsigned int    event_time;
    int angle;
+   Eina_Rectangle zone; // keeps E_Zone size
    struct {
         gesture_state_e state;     // current state of gesture
         unsigned int timestamp[3]; // time of gesture;
@@ -58,7 +59,7 @@ struct _Cover
    } flick_gesture;
 
    struct {
-        gesture_state_e state;   // currest gesture state
+        gesture_state_e state;   // current gesture state
         int x[2], y[2];
         int n_fingers;
         int finger[2];
@@ -750,12 +751,37 @@ _hover_gesture_mouse_down(Ecore_Event_Mouse_Button *ev, Cover *cov)
         cov->hover_gesture.y[1] = ev->root.y;
         cov->hover_gesture.finger[1] = ev->multi.device;
         cov->hover_gesture.n_fingers = 2;
+
+        /* Make Quickpanel Open Easy */
+        if (((cov->hover_gesture.y[0] < cov->zone.y + QUICKPANEL_AREA_SIZE)
+             && (cov->hover_gesture.y[1] < cov->zone.y + QUICKPANEL_AREA_SIZE)) ||
+            ((cov->hover_gesture.y[0] > cov->zone.y + cov->zone.h - QUICKPANEL_AREA_SIZE)
+             && (cov->hover_gesture.y[1] > cov->zone.y + cov->zone.h - QUICKPANEL_AREA_SIZE)))
+          {
+             /* Do what _on_hover_timeout does */
+             cov->hover_gesture.longpressed = EINA_TRUE;
+             if (cov->hover_gesture.timer)
+               ecore_timer_del(cov->hover_gesture.timer);
+             cov->hover_gesture.timer = NULL;
+
+             if (cov->hover_gesture.last_emission_time == -1)
+               {
+                  _hover_event_emit(cov, GESTURE_NOT_STARTED);
+                  cov->hover_gesture.last_emission_time = cov->event_time;
+               }
+
+               /* start_scroll is necessary for mouse down event */
+               if (!cov->flick_gesture.flick_to_scroll) {
+                  start_scroll(ev->x, ev->y, cov);
+                  cov->flick_gesture.flick_to_scroll = EINA_TRUE;
+               }
+          }
      }
    // abort gesture if more then 2 fingers touched screen
    if ((cov->hover_gesture.state == GESTURE_ONGOING) &&
        cov->n_taps > 2)
      {
-        DEBUG("More then 2 finged. Abort hover gesture");
+        DEBUG("More than 2 fingers. Abort hover gesture");
         _hover_event_emit(cov, GESTURE_FINISHED);
         goto abort;
      }
@@ -1345,6 +1371,7 @@ _events_shutdown(void)
 static void
 _gesture_init()
 {
+   E_Zone *ez;
    E_Client *ec;
    cover = E_NEW(Cover, 1);
    if (!cover)
@@ -1352,17 +1379,29 @@ _gesture_init()
         ERROR("Fatal Memory error!");
         return;
      }
-    is_slider = EINA_FALSE;
-    is_screen_reader_support = EINA_TRUE;
-    highlighted_object_x = -1;
-    highlighted_object_y = -1;
-    scrolling = EINA_FALSE;
-    ec = e_client_top_get();
-    if (ec)
-      {
-         cover->angle = ec->e.state.rot.ang.curr;
-         DEBUG("Default angle: %d", cover->angle);
-      }
+   is_slider = EINA_FALSE;
+   is_screen_reader_support = EINA_TRUE;
+   highlighted_object_x = -1;
+   highlighted_object_y = -1;
+   scrolling = EINA_FALSE;
+
+   /* Initialize angle value */
+   ec = e_client_top_get();
+   if (ec)
+     {
+        cover->angle = ec->e.state.rot.ang.curr;
+        DEBUG("Default angle: %d", cover->angle);
+     }
+
+   /* Keep device geometry information */
+   ez = e_zone_current_get();
+   if (ez)
+     {
+        cover->zone.x = ez->x;
+        cover->zone.y = ez->y;
+        cover->zone.w = ez->w;
+        cover->zone.h = ez->h;
+     }
 }
 
 static void