Set default window size 34/244934/2
authorhyunho <hhstark.kang@samsung.com>
Mon, 28 Sep 2020 05:59:19 +0000 (14:59 +0900)
committerhyunho <hhstark.kang@samsung.com>
Mon, 28 Sep 2020 07:36:53 +0000 (16:36 +0900)
Change-Id: I48e55425308d42767c53c373fbfbf7b620371d9f
Signed-off-by: hyunho <hhstark.kang@samsung.com>
watch-holder/src/watch_holder.cc
watch-holder/src/watch_holder.hh

index 887066e2433225e810b97a024a155e17f6a5140a..9921c1edf0a5629960bc8a9f450c9bb2b3e624c7 100644 (file)
@@ -20,6 +20,7 @@
 #include <appsvc.h>
 #include <aul_svc.h>
 #include <aul_widget.h>
+#include <system_info.h>
 
 #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<Watch> WatchHolder::CreateWatch(std::string appid,
@@ -88,10 +103,16 @@ std::shared_ptr<Watch> 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);
index e4b61a3914f87e6f9e3de998767ea106ca92a4e4..4aeb01bba4cc7f638a45b1d61bd40de79f4fa29f 100644 (file)
@@ -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