elm_panel: add exception handling in _drawer_close() 85/167185/3
authorJaeun Choi <jaeun12.choi@samsung.com>
Tue, 16 Jan 2018 05:45:36 +0000 (14:45 +0900)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Thu, 18 Jan 2018 05:39:27 +0000 (05:39 +0000)
this fixes a bug with scrollable panel not being blocked
when it is closed. scroll is blocked in _anim_stop_cb(),
which is called after elm_interface_scrollable_region_bring_in().
but if panel content is already at the target position, _anim_stop_cb()
is not called. so there is a need to check content's position and
handle the exceptional case.

Change-Id: I9b993dd4d5f776511b5f0b1006cfc6302cadaf76
origin: upstream (d36c849e2003aaa54432b74bcabe9f838d992a36)

src/lib/elm_panel.c

index cfd83fb6c8040af315d357ba6d70021372652178..174ae073881fbe827fd74bf5684e7532fca5589b 100644 (file)
@@ -427,7 +427,7 @@ static void
 _drawer_close(Evas_Object *obj, Evas_Coord w, Evas_Coord h, Eina_Bool anim)
 {
    ELM_PANEL_DATA_GET(obj, sd);
-   int x = 0, y = 0;
+   int x = 0, y = 0, cx, cy;
    Eina_Bool horizontal = EINA_FALSE;
 
    elm_widget_tree_unfocusable_set(obj, EINA_TRUE);
@@ -453,6 +453,25 @@ _drawer_close(Evas_Object *obj, Evas_Coord w, Evas_Coord h, Eina_Bool anim)
          break;
      }
 
+   eo_do(obj, elm_interface_scrollable_content_pos_get(&cx, &cy));
+
+   if ((x == cx) && (y == cy))
+     {
+        if (!sd->freeze)
+          {
+             if (horizontal)
+               eo_do(obj, elm_interface_scrollable_movement_block_set
+                     (ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL));
+             else
+               eo_do(obj, elm_interface_scrollable_movement_block_set
+                     (ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL));
+             sd->freeze = EINA_TRUE;
+             elm_layout_signal_emit(sd->scr_ly, "elm,state,content,hidden", "elm");
+          }
+
+        return;
+     }
+
    if (anim)
      {
         if (sd->freeze)