From: hyunho Date: Mon, 28 Sep 2020 05:59:19 +0000 (+0900) Subject: Set default window size X-Git-Tag: submit/tizen_5.5/20200928.082043~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b10333bc9407bafc19b2d90d84e449d5a78cceb3;p=platform%2Fcore%2Fappfw%2Fwidget-viewer.git Set default window size Change-Id: I48e55425308d42767c53c373fbfbf7b620371d9f Signed-off-by: hyunho --- diff --git a/watch-holder/src/watch_holder.cc b/watch-holder/src/watch_holder.cc index 887066e2..9921c1ed 100644 --- a/watch-holder/src/watch_holder.cc +++ b/watch-holder/src/watch_holder.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include "watch_holder.hh" #include "bundle_cpp.h" @@ -58,6 +59,20 @@ WatchHolder::WatchHolder(Evas_Object* win) : win_(win) { LOGE("Failed to get appid (%d)", getpid()); } appid_ = appid_buf; + + int w = 360; + int ret = system_info_get_platform_int( + "http://tizen.org/feature/screen.width", &w); + if (ret != SYSTEM_INFO_ERROR_NONE) + LOGE("fail to get width: %d", ret); + default_width_ = w; + + int h = 360; + ret = system_info_get_platform_int( + "http://tizen.org/feature/screen.height", &h); + if (ret != SYSTEM_INFO_ERROR_NONE) + LOGE("fail to get height: %d", ret); + default_height_ = h; } std::shared_ptr WatchHolder::CreateWatch(std::string appid, @@ -88,10 +103,16 @@ std::shared_ptr WatchHolder::CreateWatch(int rid, std::string id, int WatchHolder::Launch( string watch_appid, bool background, bundle* extra) { - Evas_Coord x, y, w, h; + int x, y, w, h; evas_object_geometry_get(win_, &x, &y, &w, &h); Bundle data; + if (w == 0 && h == 0) { + LOGW("Viewer window not ready assign default size"); + h = default_height_; + w = default_width_; + } + if (extra != nullptr) data = Bundle(extra, true, true); aul_svc_set_appid(data.GetHandle(), watch_appid.c_str()); @@ -99,6 +120,7 @@ int WatchHolder::Launch( data.Add("WATCH_HEIGHT", std::to_string(h)); data.Add("WATCH_BG_LAUNCH", std::to_string((int)background)); data.Add(AUL_K_WIDGET_VIEWER, appid_); + LOGI("Size (%d, %d)", w, h); if (extra != nullptr) extra_map_[watch_appid] = Bundle(extra, true, true); diff --git a/watch-holder/src/watch_holder.hh b/watch-holder/src/watch_holder.hh index e4b61a39..4aeb01bb 100644 --- a/watch-holder/src/watch_holder.hh +++ b/watch-holder/src/watch_holder.hh @@ -75,6 +75,8 @@ class EXPORT_API WatchHolder : public Watch::IEvent, public AmbientListener { aul_app_com_connection_h launch_signal_conn_ = nullptr; aul_app_com_connection_h dead_signal_conn_ = nullptr; aul_app_com_connection_h ambient_changed_signal_conn_ = nullptr; + int default_height_; + int default_width_; }; } // namespace watch_holder