Merge branch 'port_3.0' into tizen 73/57573/2
authorSung-jae Park <nicesj.park@samsung.com>
Thu, 21 Jan 2016 05:30:23 +0000 (14:30 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Mon, 25 Jan 2016 05:44:05 +0000 (14:44 +0900)
Conflicts:
packaging/libwidget_viewer_evas.spec
widget_viewer/CMakeLists.txt
widget_viewer/src/widget.c
widget_viewer_evas/src/widget_viewer_evas.c

Resolve conflicts.
Recover widget-viewer functions.

Change-Id: Ia2c04d9f7b09f6d347c79fed54d11200b7675142

1  2 
packaging/libwidget_viewer_evas.spec
widget_viewer_evas/src/widget_viewer_evas.c

index 0000000,54a8576..1cc42a3
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,94 +1,93 @@@
 -
+ %bcond_with wayland
+ Name: libwidget_viewer_evas
+ Summary: Library for developing the widget viewer evas
+ Version: 2.0.0
+ Release: 1
+ Group: Applications/Core Applications
+ License: Flora-1.1
+ Source0: %{name}-%{version}.tar.gz
+ Source1001: %{name}.manifest
+ Source1002: org.tizen.widget_viewer_sdk.manifest
+ BuildRequires: cmake, gettext-tools, coreutils, edje-bin
+ BuildRequires: pkgconfig(dlog)
+ BuildRequires: pkgconfig(aul)
+ BuildRequires: pkgconfig(glib-2.0)
+ BuildRequires: pkgconfig(gio-2.0)
+ BuildRequires: pkgconfig(com-core)
+ BuildRequires: pkgconfig(sqlite3)
+ BuildRequires: pkgconfig(db-util)
+ BuildRequires: pkgconfig(widget_service)
+ BuildRequires: pkgconfig(vconf)
+ BuildRequires: pkgconfig(elementary)
+ BuildRequires: pkgconfig(pkgmgr-info)
+ BuildRequires: pkgconfig(capi-appfw-application)
+ BuildRequires: pkgconfig(appcore-efl)
+ BuildRequires: pkgconfig(capi-system-info)
+ BuildRequires: pkgconfig(efl-extension)
+ BuildRequires: pkgconfig(wayland-client)
+ BuildRequires: pkgconfig(libtbm)
+ %description
+ Provider APIs to develop the widget viewer EFL application.
+ %package devel
+ Summary: Widget provider application development library (dev) (EFL version)
+ Group: Development/Libraries
+ Requires: %{name} = %{version}-%{release}
+ %description devel
+ Header & package configuration files to support development of the widget viewer applications. (for EFL app)
+ %prep
+ %setup -q
+ cp %{SOURCE1001} .
+ cp %{SOURCE1002} .
+ %build
+ %cmake . -DWIDGET_ENABLED=On
+ make %{?jobs:-j%jobs}
+ %install
+ rm -rf %{buildroot}
+ %make_install
+ %post -n %{name} -p /sbin/ldconfig
+ %postun -n %{name} -p /sbin/ldconfig
+ %files -n %{name}
+ %manifest %{name}.manifest
+ %defattr(-,root,root,-)
+ %{_libdir}/%{name}.so*
+ %{_datarootdir}/license/%{name}
+ %files devel
+ %manifest %{name}.manifest
+ %defattr(-,root,root,-)
+ %{_includedir}/widget_viewer/widget_viewer.h
+ %{_libdir}/pkgconfig/widget_viewer.pc
+ #################################################
+ # org.tizen.widget_viewer_sdk
+ %package -n org.tizen.widget_viewer_sdk
+ Summary: The widget viewer for development using SDK(IDE)
+ Version: 0.0.1
+ Group: Development/Tools
+ License: Flora-1.1
+ Requires: %{name}_evas
+ %description -n org.tizen.widget_viewer_sdk
+ While developing the widget applications, this viewer will load it and execute it to help you to see it on the screen.
+ %post -n org.tizen.widget_viewer_sdk -p /sbin/ldconfig
+ %postun -n org.tizen.widget_viewer_sdk -p /sbin/ldconfig
+ %files -n org.tizen.widget_viewer_sdk
+ %manifest org.tizen.widget_viewer_sdk.manifest
+ %defattr(-,root,root,-)
+ %attr(-,app,app) %dir /opt/usr/apps/org.tizen.widget_viewer_sdk/data
+ %{_datarootdir}/packages/org.tizen.widget_viewer_sdk.xml
+ %{_datarootdir}/license/org.tizen.widget_viewer_sdk
+ %{_prefix}/apps/org.tizen.widget_viewer_sdk/*
+ # End of a file
  
  int errno;
  
- EAPI int widget_viewer_evas_init(Evas_Object *win)
+ static struct info {
+       int w;
+       int h;
+       Evas_Object *win;
+       char *compositor_name;
+       GHashTable *widget_table;
+ } s_info = {
+       .w = 0,
+       .h = 0,
+       .win = NULL,
+       .compositor_name = NULL,
+       .widget_table = NULL,
+ };
+ struct widget_info {
+       char *widget_id;
+       char *instance_id;
+       char *content_info;
+       char *title;
+       bundle *b;
+       int pid;
+       int permanent_delete;
+       Evas_Object *layout;
+ };
+ static inline bool is_widget_feature_enabled(void)
  {
 -      static bool feature = false;
 -      static bool retrieved = false;
 -
 -      if (retrieved == false) {
 -              int ret;
 -
 -              ret = system_info_get_platform_bool("http://tizen.org/feature/shell.appwidget", &feature);
 -              if (ret != SYSTEM_INFO_ERROR_NONE) {
 -                      ErrPrint("system_info: %d\n", ret);
 -              } else {
 -                      retrieved = true;
 -              }
 -      }
 -
 -      return feature;
 +      return WIDGET_ERROR_NOT_SUPPORTED;
  }
 +
+ static void set_runtime_dir(void)
+ {
+       char buf[256];
+       snprintf(buf, sizeof(buf) - 1, "/run/user/%d", getuid());
+       if (setenv("XDG_RUNTIME_DIR", buf, 0) < 0) {
+               ErrPrint("Unable to set XDB_RUNTIME_DIR: %s (%s)\n", buf, strerror(errno));
+       }
+ }
+ static void object_deleted_cb(void *data, Evas_Object *obj, void *event_info)
+ {
+       ErrPrint("Object is deleted.\n");
+       /**
+        * @todo
+        * ...
+        */
+ }
+ static void object_added_cb(void *data, Evas_Object *obj, void *event_info)
+ {
+       struct widget_info *info;
+       Evas_Object *surface;
+       const char *instance_id;
+       surface = event_info;
+       if (!surface) {
+               ErrPrint("Invalid parameters\n");
+               return;
+       }
+       /**
+        * @note
+        * Current version of Pepper only supports to pass the title of surface.
+        * So we should find the infomation data using this title.
+        * This title will be used as an instance id of the widget.
+        */
+       instance_id = pepper_efl_object_title_get(surface);
+       if (!instance_id) {
+               ErrPrint("Instance Id is not valid\n");
+               evas_object_del(surface);
+               return;
+       }
+       info = g_hash_table_lookup(s_info.widget_table, instance_id);
+       if (!info) {
+               ErrPrint("Unable to find a proper object\n");
+               evas_object_del(surface);
+               return;
+       }
+       /**
+        * @note
+        * After swallow this widget object to the layout,
+        * It will be automatically resized by EDJE.
+        */
+       elm_object_part_content_set(info->layout, "pepper,widget", surface);
+ }
+ EAPI int widget_viewer_evas_init(Evas_Object *win)
+ {
+       if (!is_widget_feature_enabled()) {
+               return WIDGET_ERROR_NOT_SUPPORTED;
+       }
+       s_info.win = win;
+       /**
+        * @todo
+        * What should I set to initialize widget subsystem??
+        */
+       widget_instance_init("WHAT I HAVE TO SET FOR THIS?");
+       set_runtime_dir();
+       s_info.compositor_name = pepper_efl_compositor_create(win, NULL);
+       if (!s_info.compositor_name) {
+               return WIDGET_ERROR_FAULT;
+       }
+       if (setenv("WAYLAND_DISPLAY", s_info.compositor_name, 1) < 0) {
+               ErrPrint("Failed to set WAYLAND_DISPLAY: %s\n", strerror(errno));
+       }
+       evas_object_smart_callback_add(win, PEPPER_EFL_OBJ_ADD, object_added_cb, NULL);
+       evas_object_smart_callback_add(win, PEPPER_EFL_OBJ_DEL, object_deleted_cb, NULL);
+       s_info.widget_table = g_hash_table_new(g_str_hash, g_str_equal);
+       return WIDGET_ERROR_NONE;
+ }
  EAPI int widget_viewer_evas_fini(void)
  {
-       return WIDGET_ERROR_NOT_SUPPORTED;
+       if (!is_widget_feature_enabled()) {
+               return WIDGET_ERROR_NOT_SUPPORTED;
+       }
+       if (s_info.win && s_info.compositor_name) {
+               pepper_efl_compositor_destroy(s_info.compositor_name);
+               s_info.compositor_name = NULL;
+       }
+       widget_instance_fini();
+       return WIDGET_ERROR_NONE;
  }
  
  EAPI int widget_viewer_evas_notify_resumed_status_of_viewer(void)