Merge "toast_popup: restrict popup rotations" into tizen
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Wed, 2 Nov 2016 12:44:21 +0000 (05:44 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Wed, 2 Nov 2016 12:44:21 +0000 (05:44 -0700)
1  2 
src/ticker.c

diff --cc src/ticker.c
@@@ -605,48 -856,80 +605,48 @@@ static Evas_Object *_ticker_window_crea
        efl_util_set_notification_window_level(win, EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT);
        elm_win_prop_focus_skip_set(win, EINA_TRUE);
  
 -      /* This is for rotation issue */
 -      e = evas_object_evas_get(win);
 -      goto_if(!e, error);
 -
 -      ee = ecore_evas_ecore_evas_get(e);
 -      goto_if(!ee, error);
 -
 -      ecore_evas_name_class_set(ee, "APP_POPUP", "APP_POPUP");
 -
 -      /* you can use evas_object_resize() and evas_object_move() by using elm_win_aux_hint_add().
 -         elm_win_aux_hint_add() makes it possible to set the size and location of the notification window freely.
 -         if you do not use elm_win_aux_hint_add(), notification window is displayed full screen. */
        elm_win_aux_hint_add(win, "wm.policy.win.user.geometry", "1");
 -      evas_object_resize(win, ad->win.w, ad->win.h);
 +      evas_object_resize(win, ad->win.w, INDICATOR_HEIGHT);
        evas_object_move(win, 0, 0);
 -      evas_object_hide(win);
  
        if (elm_win_wm_rotation_supported_get(win)) {
-               int rots[4] = { 0, 90, 180, 270 };
-               elm_win_wm_rotation_available_rotations_set(win, rots, 4);
+               int rots[1] = { ad->win.angle };
+               elm_win_wm_rotation_available_rotations_set(win, rots, ARRAY_SIZE(rots));
        }
 -      evas_object_smart_callback_add(win, "wm,rotation,changed", _rotate_cb, ad);
 -
 -      wd = (struct Internal_Data *) calloc(1, sizeof(struct Internal_Data));
 -      goto_if(!wd, error);
  
 -      evas_object_data_set(win, PRIVATE_DATA_KEY_DATA, wd);
 -      evas_object_data_set(win, PRIVATE_DATA_KEY_NOTI, NULL);
 +      evas_object_smart_callback_add(win, "wm,rotation,changed", _ticker_win_rotation_cb, ad);
  
 -      wd->angle = 0;
 -      wd->w = ad->win.w;
 -      wd->h = ad->win.h;
 -
 -      evas_object_smart_callback_add(win, "sub-object-del", _sub_del, NULL);
 +      _ticker_win_rotation_cb(NULL, ticker.win, NULL);
  
        return win;
 -
 -error:
 -      if (win)
 -              evas_object_del(win);
 -
 -      return NULL;
  }
  
 -static Evas_Object *_win_content_get(Evas_Object *obj)
 +static void _ticker_window_destroy(void)
  {
 -      struct Internal_Data *wd;
 -
 -      retv_if(!obj, NULL);
 -
 -      wd = evas_object_data_get(obj, PRIVATE_DATA_KEY_DATA);
 -      retv_if(!wd, NULL);
 -
 -      return wd->content;
 +      evas_object_del(ticker.win);
  }
  
 -static void _win_content_set(Evas_Object *obj, Evas_Object *content)
 +static int _ticker_view_create(void)
  {
 -      struct Internal_Data *wd;
 -
 -      ret_if (!obj);
 -      ret_if (!content);
 -
 -      wd = evas_object_data_get(obj, PRIVATE_DATA_KEY_DATA);
 -      ret_if (!wd);
 -
 -      if (wd->content) {
 -              evas_object_del(wd->content);
 -      }
 -
 -      wd->content = content;
 -      if (wd->content) {
 -              evas_object_show(wd->content);
 -              evas_object_event_callback_add(wd->content, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _content_changed_size_hints, obj);
 +      if (!ticker.win)
 +              ticker.win = _ticker_window_create(ticker.ad);
 +      if (!ticker.layout)
 +              ticker.layout = _ticker_layout_create(ticker.win);
 +      if (!ticker.scroller)
 +              ticker.scroller = _ticker_scroller_create(ticker.layout);
 +
 +      evas_object_show(ticker.layout);
 +      evas_object_show(ticker.scroller);
 +      evas_object_show(ticker.win);
 +
 +      if (ticker.ad)
 +              util_signal_emit_by_win(&ticker.ad->win, "message.show.noeffect", "indicator.prog");
 +
 +      if (ticker.win && ticker.layout && ticker.scroller)
 +              return OK;
 +      else {
 +              _ticker_view_destroy();
 +              return FAIL;
        }
  }