Sync with upstream
authorMike McCormack <mj.mccormack@samsung.com>
Tue, 22 Nov 2011 06:28:10 +0000 (15:28 +0900)
committerMike McCormack <mj.mccormack@samsung.com>
Wed, 23 Nov 2011 00:39:32 +0000 (09:39 +0900)
src/bin/test_gesture_layer.c
src/bin/test_naviframe.c
src/bin/test_table.c
src/bin/test_tooltip.c
src/bin/test_transit.c
src/lib/elm_win.c

index e59167c..f72b415 100644 (file)
@@ -173,9 +173,6 @@ zoom_start(void *_po, void *event_info)
         po->zoom_out = NULL;
      }
 
-
-   po->dx = p->x - po->bx;
-   po->dy = p->y - po->by;
    /* Give it a "lift" effect right from the start */
    po->base_zoom = BASE_ZOOM * LIFT_FACTOR;
    po->zoom = po->base_zoom;
@@ -192,8 +189,6 @@ zoom_move(void *_po, void *event_info)
    Elm_Gesture_Zoom_Info *p = (Elm_Gesture_Zoom_Info *) event_info;
    printf("zoom move <%d,%d> <%f>\n", p->x, p->y, p->zoom);
    po->zoom = po->base_zoom * p->zoom;
-   po->bx = p->x - po->dx;
-   po->by = p->y - po->dy;
    apply_changes(po);
    return EVAS_EVENT_FLAG_NONE;
 }
@@ -205,6 +200,52 @@ zoom_end(void *_po, void *event_info)
    Elm_Gesture_Zoom_Info *p = (Elm_Gesture_Zoom_Info *) event_info;
    printf("zoom end/abort <%d,%d> <%f>\n", p->x, p->y, p->zoom);
 
+   /* Apply the zoom out animator */
+   po->shadow_zoom = 1.3;
+   po->base_zoom = po->zoom;
+   po->zoom_out = elm_transit_add();
+   elm_transit_duration_set(po->zoom_out, zoom_out_animation_duration);
+   elm_transit_effect_add(po->zoom_out, zoom_out_animation_operation, po, zoom_out_animation_end);
+   elm_transit_go(po->zoom_out);
+   return EVAS_EVENT_FLAG_NONE;
+}
+
+static Evas_Event_Flags
+momentum_start(void *_po, void *event_info)
+{
+   Photo_Object *po = (Photo_Object *) _po;
+   Elm_Gesture_Momentum_Info *p = (Elm_Gesture_Momentum_Info *) event_info;
+   printf("momentum_start <%d,%d>\n", p->x2, p->y2);
+
+   po->dx = p->x2 - po->bx;
+   po->dy = p->y2 - po->by;
+   apply_changes(po);
+
+   return EVAS_EVENT_FLAG_NONE;
+}
+
+static Evas_Event_Flags
+momentum_move(void *_po, void *event_info)
+{
+   Photo_Object *po = (Photo_Object *) _po;
+   Elm_Gesture_Momentum_Info *p = (Elm_Gesture_Momentum_Info *) event_info;
+   printf("momentum move <%d,%d>\n", p->x2, p->y2);
+
+   po->bx = p->x2 - po->dx;
+   po->by = p->y2 - po->dy;
+   apply_changes(po);
+
+   return EVAS_EVENT_FLAG_NONE;
+}
+
+static Evas_Event_Flags
+momentum_end(void *_po, void *event_info)
+{
+   Photo_Object *po = (Photo_Object *) _po;
+   Elm_Gesture_Momentum_Info *p = (Elm_Gesture_Momentum_Info *) event_info;
+   printf("momentum end/abort <%d,%d> <%d,%d>\n", p->x2, p->y2, p->mx, p->my);
+   (void) po;
+   (void) p;
    /* Make sure middle is in the screen, if not, fix it. */
      {
         /* FIXME: Use actual window sizes instead of the hardcoded
@@ -222,17 +263,29 @@ zoom_end(void *_po, void *event_info)
         else if (my > 800)
            po->by = 800 - (po->bh / 2);
      }
+   apply_changes(po);
 
-   /* Apply the zoom out animator */
-   po->shadow_zoom = 1.3;
-   po->base_zoom = po->zoom;
-   po->zoom_out = elm_transit_add();
-   elm_transit_duration_set(po->zoom_out, zoom_out_animation_duration);
-   elm_transit_effect_add(po->zoom_out, zoom_out_animation_operation, po, zoom_out_animation_end);
-   elm_transit_go(po->zoom_out);
    return EVAS_EVENT_FLAG_NONE;
 }
 
+static void
+_win_del_req(void *data, Evas_Object *obj __UNUSED__,
+      void *event_info __UNUSED__)
+{
+   Photo_Object **photo_array = (Photo_Object **) data;
+
+   if (!photo_array)
+      return;
+
+   /* The content of the photo object is automatically deleted when the win
+    * is deleted. */
+   for ( ; *photo_array ; photo_array++)
+      free(*photo_array);
+
+   free(data);
+}
+
+
 Photo_Object *
 photo_object_add(Evas_Object *parent, Evas_Object *ic, const char *icon, Evas_Coord x,
       Evas_Coord y, Evas_Coord w, Evas_Coord h, int angle)
@@ -288,6 +341,10 @@ photo_object_add(Evas_Object *parent, Evas_Object *ic, const char *icon, Evas_Co
    elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_MOVE, zoom_move, po);
    elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_END, zoom_end, po);
    elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_ZOOM, ELM_GESTURE_STATE_ABORT, zoom_end, po);
+   elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_MOMENTUM, ELM_GESTURE_STATE_START, momentum_start, po);
+   elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_MOMENTUM, ELM_GESTURE_STATE_MOVE, momentum_move, po);
+   elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_MOMENTUM, ELM_GESTURE_STATE_END, momentum_end, po);
+   elm_gesture_layer_cb_set(po->gl, ELM_GESTURE_MOMENTUM, ELM_GESTURE_STATE_ABORT, momentum_end, po);
 
    po->rotate = po->base_rotate = angle;
    po->shadow_zoom = 1.3;
@@ -303,6 +360,9 @@ test_gesture_layer(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
    Evas_Coord w, h;
    Evas_Object *win, *bg;
    char buf[PATH_MAX];
+   int ind = 0;
+   Photo_Object **photo_array;
+   photo_array = calloc(sizeof(*photo_array), 4);
 
    w = 480;
    h = 800;
@@ -315,14 +375,14 @@ test_gesture_layer(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
    bg = elm_bg_add(win);
    snprintf(buf, sizeof(buf), "%s/images/wood_01.jpg", elm_app_data_dir_get());
    elm_bg_file_set(bg, buf, NULL);
-   elm_win_resize_object_add(win, bg);
    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   elm_win_resize_object_add(win, bg);
    evas_object_show(bg);
 
-    snprintf(buf, sizeof(buf), "%s/images/pol_sky.png", elm_app_data_dir_get());
-   photo_object_add(win, NULL, buf, 200, 200, 365, 400, 0);
+   snprintf(buf, sizeof(buf), "%s/images/pol_sky.png", elm_app_data_dir_get());
+   photo_array[ind++] = photo_object_add(win, NULL, buf, 200, 200, 365, 400, 0);
    snprintf(buf, sizeof(buf), "%s/images/pol_twofish.png", elm_app_data_dir_get());
-   photo_object_add(win, NULL, buf, 40, 300, 365, 400, 45);
+   photo_array[ind++] = photo_object_add(win, NULL, buf, 40, 300, 365, 400, 45);
 
    Evas_Object *en = elm_entry_add(win);
    elm_entry_entry_set(en, "You can use whatever object you want, "
@@ -334,8 +394,11 @@ test_gesture_layer(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
    elm_layout_file_set(postit, buf, "main");
    elm_object_part_content_set(postit, "ent", en);
 
-   photo_object_add(win, postit, NULL, 50, 50, 382, 400, 355);
+   photo_array[ind++] = photo_object_add(win, postit, NULL, 50, 50, 382, 400, 355);
 
+   photo_array[ind] = NULL;
+   evas_object_smart_callback_add(win, "delete,request", _win_del_req,
+         photo_array);
    evas_object_show(win);
 }
 
index 1ebd538..57d4664 100644 (file)
@@ -32,7 +32,6 @@ _navi_it_del(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED_
    elm_naviframe_item_del(data);
 }
 
-
 void
 _title_clicked(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
index 47f8bf3..f5900bb 100644 (file)
@@ -54,14 +54,14 @@ test_table(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
    elm_object_text_set(bt, "Button 5");
    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
-   elm_table_pack(tb, bt, 2, 1, 1, 3);
+   elm_table_pack(tb, bt, 2, 1, 1, 2);
    evas_object_show(bt);
 
    bt = elm_button_add(win);
-   elm_object_text_set(bt, "Button 6");
+   elm_object_text_set(bt, "Button a");
    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
-   elm_table_pack(tb, bt, 0, 2, 2, 2);
+   elm_table_pack(tb, bt, 0, 2, 2, 1);
    evas_object_show(bt);
 
    evas_object_show(win);
index 025f821..f2f71fe 100644 (file)
@@ -27,8 +27,8 @@ grdt_lbl_get(void            *data,
 
 Evas_Object *
 grdt_content_get(void        *data,
-                 Evas_Object *obj,
-                 const char  *part)
+              Evas_Object *obj,
+              const char  *part)
 {
    const Testitem *ti = data;
    if (!strcmp(part, "elm.swallow.icon"))
index c4d6c18..79bc9d7 100644 (file)
@@ -106,6 +106,12 @@ _transit_wipe(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED
 }
 
 static void
+_transit_del_cb(void *data, Elm_Transit *transit __UNUSED__)
+{
+   evas_object_freeze_events_set(data, EINA_FALSE);
+}
+
+static void
 _transit_image_animation(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
    Eina_List *images = NULL;
@@ -126,12 +132,13 @@ _transit_image_animation(void *data, Evas_Object *obj __UNUSED__, void *event_in
    images = eina_list_append(images, eina_stringshare_add(buf));
 
    trans = elm_transit_add();
+   elm_transit_del_cb_set(trans, _transit_del_cb, obj);
    elm_transit_object_add(trans, ic);
-
    elm_transit_effect_image_animation_add(trans, images);
-
    elm_transit_duration_set(trans, 5.0);
    elm_transit_go(trans);
+
+   evas_object_freeze_events_set(obj, EINA_TRUE);
 }
 
 static void
@@ -286,7 +293,6 @@ test_transit2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    win = elm_win_add(NULL, "transit2", ELM_WIN_BASIC);
    elm_win_title_set(win, "Transit 2");
    elm_win_autodel_set(win, EINA_TRUE);
-   evas_object_resize(win, 400, 400);
 
    bg = elm_bg_add(win);
    elm_win_resize_object_add(win, bg);
@@ -300,6 +306,7 @@ test_transit2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    evas_object_resize(bt, 100, 50);
    evas_object_smart_callback_add(bt, "clicked", _transit_resizing, NULL);
 
+   evas_object_resize(win, 400, 400);
    evas_object_show(win);
 }
 
@@ -312,7 +319,6 @@ test_transit3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    win = elm_win_add(NULL, "transit3", ELM_WIN_BASIC);
    elm_win_title_set(win, "Transit 3");
    elm_win_autodel_set(win, EINA_TRUE);
-   evas_object_resize(win, 300, 300);
 
    bg = elm_bg_add(win);
    elm_win_resize_object_add(win, bg);
@@ -330,6 +336,7 @@ test_transit3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    evas_object_move(bt2, 50, 50);
    evas_object_resize(bt2, 200, 200);
 
+   evas_object_resize(win, 300, 300);
    evas_object_show(win);
 
    evas_object_smart_callback_add(bt, "clicked", _transit_flip, bt2);
@@ -345,7 +352,6 @@ test_transit4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    win = elm_win_add(NULL, "transit4", ELM_WIN_BASIC);
    elm_win_title_set(win, "Transit 4");
    elm_win_autodel_set(win, EINA_TRUE);
-   evas_object_resize(win, 300, 300);
 
    bg = elm_bg_add(win);
    elm_win_resize_object_add(win, bg);
@@ -360,6 +366,7 @@ test_transit4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
 
    evas_object_smart_callback_add(bt, "clicked", _transit_zoom, NULL);
 
+   evas_object_resize(win, 300, 300);
    evas_object_show(win);
 }
 
@@ -373,7 +380,6 @@ test_transit5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    win = elm_win_add(NULL, "transit5", ELM_WIN_BASIC);
    elm_win_title_set(win, "Transit 5");
    elm_win_autodel_set(win, EINA_TRUE);
-   evas_object_resize(win, 300, 300);
 
    bg = elm_bg_add(win);
    elm_win_resize_object_add(win, bg);
@@ -403,6 +409,7 @@ test_transit5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    evas_object_move(bt2, 25, 125);
    evas_object_resize(bt2, 250, 50);
 
+   evas_object_resize(win, 300, 300);
    evas_object_show(win);
 
    evas_object_smart_callback_add(bt, "clicked", _transit_blend, bt2);
@@ -419,7 +426,6 @@ test_transit6(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    win = elm_win_add(NULL, "transit6", ELM_WIN_BASIC);
    elm_win_title_set(win, "Transit 6");
    elm_win_autodel_set(win, EINA_TRUE);
-   evas_object_resize(win, 300, 300);
 
    bg = elm_bg_add(win);
    elm_win_resize_object_add(win, bg);
@@ -449,6 +455,7 @@ test_transit6(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    evas_object_move(bt2, 25, 125);
    evas_object_resize(bt2, 250, 50);
 
+   evas_object_resize(win, 300, 300);
    evas_object_show(win);
 
    evas_object_smart_callback_add(bt, "clicked", _transit_fade, bt2);
@@ -464,7 +471,6 @@ test_transit7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    win = elm_win_add(NULL, "transit7", ELM_WIN_BASIC);
    elm_win_title_set(win, "Transit 7");
    elm_win_autodel_set(win, EINA_TRUE);
-   evas_object_resize(win, 400, 400);
 
    bg = elm_bg_add(win);
    elm_win_resize_object_add(win, bg);
@@ -482,6 +488,7 @@ test_transit7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    evas_object_move(bt2, 50, 100);
    evas_object_resize(bt2, 300, 200);
 
+   evas_object_resize(win, 400, 400);
    evas_object_show(win);
 
    evas_object_smart_callback_add(bt, "clicked", _transit_resizable_flip, bt2);
@@ -499,8 +506,6 @@ test_transit8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    win = elm_win_add(NULL, "transit8", ELM_WIN_BASIC);
    elm_win_title_set(win, "Transit 8");
    elm_win_autodel_set(win, EINA_TRUE);
-   evas_object_resize(win, 400, 400);
-   evas_object_show(win);
 
    bg = elm_bg_add(win);
    elm_win_resize_object_add(win, bg);
@@ -525,6 +530,9 @@ test_transit8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    elm_transit_duration_set(trans, 5.0);
    elm_transit_repeat_times_set(trans, -1);
    elm_transit_go(trans);
+
+   evas_object_resize(win, 400, 400);
+   evas_object_show(win);
 }
 
 /* Chain Transit Effect */
@@ -537,8 +545,6 @@ test_transit9(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    win = elm_win_add(NULL, "transit9", ELM_WIN_BASIC);
    elm_win_title_set(win, "Transit 9");
    elm_win_autodel_set(win, EINA_TRUE);
-   evas_object_resize(win, 400, 400);
-   evas_object_show(win);
 
    bg = elm_bg_add(win);
    elm_win_resize_object_add(win, bg);
@@ -600,6 +606,9 @@ test_transit9(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    elm_transit_duration_set(trans4, 1);
    elm_transit_objects_final_state_keep_set(trans4, EINA_TRUE);
    elm_transit_chain_transit_add(trans3, trans4);
+
+   evas_object_resize(win, 400, 400);
+   evas_object_show(win);
 }
 
 
index 9cc8b10..027632a 100644 (file)
@@ -1598,7 +1598,7 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
 
    Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
                                         EINA_TRUE);
-   printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
+   printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
 #endif
 
    evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
@@ -2118,6 +2118,8 @@ elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
    _elm_win_xwindow_get(win);
    if (win->xwin)
      ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
+#else
+   (void) is_keyboard;
 #endif
 }
 
@@ -2158,6 +2160,8 @@ elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
    _elm_win_xwindow_get(win);
    if (win->xwin)
      ecore_x_e_illume_conformant_set(win->xwin, conformant);
+#else
+   (void) conformant;
 #endif
 }
 
@@ -2198,6 +2202,8 @@ elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
              ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
           }
      }
+#else
+   (void) quickpanel;
 #endif
 }
 
@@ -2227,6 +2233,8 @@ elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
    _elm_win_xwindow_get(win);
    if (win->xwin)
      ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
+#else
+   (void) priority;
 #endif
 }
 
@@ -2256,6 +2264,8 @@ elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
    _elm_win_xwindow_get(win);
    if (win->xwin)
      ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
+#else
+   (void) priority;
 #endif
 }
 
@@ -2285,6 +2295,8 @@ elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
    _elm_win_xwindow_get(win);
    if (win->xwin)
      ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
+#else
+   (void) zone;
 #endif
 }
 
@@ -2324,6 +2336,8 @@ elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
              ecore_x_netwm_window_state_set(win->xwin, states, 2);
           }
      }
+#else
+   (void) skip;
 #endif
 }
 
@@ -2356,6 +2370,8 @@ elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *
               break;
           }
      }
+#else
+   (void) command;
 #endif
 }