Summary: Library for developing the application
Version: 1.1.4
Release: 1
-Group: HomeTF/widget
+Group: Applications/Core Applications
License: Flora License, Version 1.1
Source0: %{name}-%{version}.tar.gz
Source1001: %{name}.manifest
BuildRequires: pkgconfig(widget_service)
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(elementary)
-BuildRequires: model-build-features
%if %{with wayland}
%else
%files -n %{name}
%manifest %{name}.manifest
%defattr(-,root,root,-)
-%{_libdir}/libwidget_viewer.so*
-%{_datarootdir}/license/libwidget_viewer
+%{_libdir}/%{name}.so*
+%{_datarootdir}/license/%{name}
%files devel
%manifest %{name}.manifest
#################################################
# libwidget_viewer_evas
-%package -n libwidget_viewer_evas
+%package -n %{name}_evas
Summary: Library for developing the widget viewer evas
-Group: HomeTF/widget
+Group: Applications/Core Applications
License: Flora
-Requires: libwidget_viewer
-%description -n libwidget_viewer_evas
+%description -n %{name}_evas
Provider APIs to develop the widget viewer EFL application.
-%package -n libwidget_viewer_evas-devel
-Summary: Header & package configuration files to support development of the widget viewer applications. (for EFL app)
+%package -n %{name}_evas-devel
+Summary: widget provider application development library (dev) (EFL version)
Group: Development/Libraries
-Requires: libwidget_viewer_evas
+Requires: %{name}_evas
-%description -n libwidget_viewer_evas-devel
-widget provider application development library (dev) (EFL version)
+%description -n %{name}_evas-devel
+Header & package configuration files to support development of the widget viewer applications. (for EFL app)
-%files -n libwidget_viewer_evas
+%post -n %{name}_evas -p /sbin/ldconfig
+%postun -n %{name}_evas -p /sbin/ldconfig
+
+%files -n %{name}_evas
%manifest %{name}.manifest
%defattr(-,root,root,-)
-%{_libdir}/libwidget_viewer_evas.so*
+%{_libdir}/%{name}_evas.so*
%{_datadir}/widget_viewer_evas/*
-%{_datarootdir}/license/libwidget_viewer_evas
+%{_datarootdir}/license/%{name}_evas
-%files -n libwidget_viewer_evas-devel
+%files -n %{name}_evas-devel
%manifest %{name}.manifest
%defattr(-,root,root,-)
%{_includedir}/widget_viewer_evas/widget_viewer_evas.h
#include <dlog.h>
#include <widget_errno.h> /* For error code */
-#include <widget_service.h>
+#include <widget_service.h> /* For buffer event data */
#include <widget_buffer.h>
#include "debug.h"
int errno;
-static struct {
-} s_info = {
-};
-
int fb_init(void *disp)
{
return WIDGET_ERROR_NONE;
info->bufsz = info->w * info->h * info->pixels;
}
-static inline int sync_for_file(struct fb_info *info, int x, int y, int w, int h)
+static int sync_for_file(struct fb_info *info, int x, int y, int w, int h)
{
int fd;
widget_fb_t buffer;
+ const char *path = NULL;
buffer = info->buffer;
return WIDGET_ERROR_NONE;
}
- fd = open(util_uri_to_path(info->id), O_RDONLY);
+ path = util_uri_to_path(info->id);
+
+ if (path == NULL) {
+ ErrPrint("Invalid parameter\n");
+ return WIDGET_ERROR_INVALID_PARAMETER;
+ }
+
+ fd = open(path, O_RDONLY);
if (fd < 0) {
ErrPrint("Failed to open a file (%s) because of (%d)\n",
util_uri_to_path(info->id), errno);
- /*!
- * \note
+ /**
+ * @note
* But return ZERO, even if we couldn't get a buffer file,
* the viewer can draw empty screen.
*
return WIDGET_ERROR_NONE;
}
+ /**
+ * @note
+ * Could we get some advantage if we load a part of file instead of loading all of them?
+ */
if (x != 0 || y != 0 || info->w != w || info->h != h) {
int iy;
register int index;
ErrPrint("close: %d\n", errno);
}
- /*!
- * \note
+ /**
+ * @note
* But return ZERO, even if we couldn't get a buffer file,
* the viewer can draw empty screen.
*
if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
return sync_for_file(info, x, y, w, h);
} else if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
- /**
- * @note
- */
+ return WIDGET_ERROR_NONE;
} else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
/* No need to do sync */
return WIDGET_ERROR_NONE;
DbgPrint("SHMID: %d is gotten\n", info->handle);
} else if (sscanf(info->id, SCHEMA_PIXMAP "%d:%d", &info->handle, &info->pixels) == 2) {
DbgPrint("PIXMAP-SHMID: %d is gotten (%d)\n", info->handle, info->pixels);
- ErrPrint("Unsupported\n");
- free(info);
- return NULL;
} else {
info->handle = WIDGET_ERROR_INVALID_PARAMETER;
}
if (!info->buffer) {
if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
- ErrPrint("Unsupported Type\n");
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
+ /**
+ */
return NULL;
} else if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
update_fb_size(info);
buffer = info->buffer;
switch (buffer->type) {
+ case WIDGET_FB_TYPE_PIXMAP:
+ buffer->refcnt++;
+ break;
case WIDGET_FB_TYPE_FILE:
buffer->refcnt++;
break;
- case WIDGET_BUFFER_TYPE_PIXMAP:
default:
DbgPrint("Unknwon FP: %d\n", buffer->type);
set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
}
switch (buffer->type) {
- case WIDGET_BUFFER_TYPE_SHM:
+ case WIDGET_FB_TYPE_SHM:
if (shmdt(buffer) < 0) {
ErrPrint("shmdt: %d\n", errno);
}
break;
- case WIDGET_BUFFER_TYPE_FILE:
+ case WIDGET_FB_TYPE_PIXMAP:
+ break;
+ case WIDGET_FB_TYPE_FILE:
buffer->refcnt--;
if (buffer->refcnt == 0) {
struct fb_info *info;
free(buffer);
}
break;
- case WIDGET_BUFFER_TYPE_PIXMAP:
default:
ErrPrint("Unknwon buffer type\n");
set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
return WIDGET_ERROR_INVALID_PARAMETER;
}
- buffer = container_of(data, struct buffer, data);
+ buffer = container_of(data, struct widget_fb, data);
if (buffer->state != WIDGET_FB_STATE_CREATED) {
ErrPrint("Invalid handle\n");
ret = buf.shm_nattch;
break;
+ case WIDGET_FB_TYPE_PIXMAP:
+ ret = 0;
+ break;
case WIDGET_FB_TYPE_FILE:
ret = buffer->refcnt;
break;
- case WIDGET_BUFFER_TYPE_PIXMAP:
default:
set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
ret = WIDGET_ERROR_INVALID_PARAMETER;
widget_fb_t buffer;
if (!info) {
- return WIDGET_BUFFER_TYPE_ERROR;
+ return WIDGET_FB_TYPE_ERROR;
}
buffer = info->buffer;
*/
if (info->id) {
if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
- type = WIDGET_BUFFER_TYPE_FILE;
+ type = WIDGET_FB_TYPE_FILE;
} else if (!strncasecmp(info->id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP))) {
- /* Unsupported type */
+ type = WIDGET_FB_TYPE_PIXMAP;
} else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
- type = WIDGET_BUFFER_TYPE_SHM;
+ type = WIDGET_FB_TYPE_SHM;
}
}
#include <com-core_packet.h>
#include <packet.h>
+#include <widget_errno.h>
#include <widget_service.h>
#include <widget_service_internal.h>
-#include <widget_errno.h>
#include <widget_cmd_list.h>
#include <widget_buffer.h>
src/widget_viewer_evas.c
)
+IF (X11_SUPPORT)
+SET(BUILD_SOURCE
+ ${BUILD_SOURCE}
+ src/util_x11.c
+)
+ENDIF (X11_SUPPORT)
+
+IF (WAYLAND_SUPPORT)
+SET(BUILD_SOURCE
+ ${BUILD_SOURCE}
+ src/util_wayland.c
+)
+ENDIF (WAYLAND_SUPPORT)
+
FOREACH(flag ${viewer_evas_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
--- /dev/null
+/*
+ * Samsung API
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __WIDGET_VIEWER_UTIL_H
+#define __WIDGET_VIEWER_UTIL_H
+
+extern int util_screen_size_get(int *w, int *h);
+extern int util_replace_native_surface(struct widget *handle, int gbar, Evas_Object *content, unsigned int pixmap, int skip_acquire);
+extern int util_set_native_surface(struct widget *handle, int gbar, Evas_Object *content, unsigned int pixmap, int skip_acquire);
+extern unsigned int util_get_resource_id_of_native_surface(Evas_Native_Surface *surface);
+extern void *util_display_get(void);
+
+#endif
+
+/* End of a file */
--- /dev/null
+#include <stdio.h>
+#include <Evas.h>
+
+#include <widget_errno.h>
+#include <widget_viewer.h>
+
+int util_screen_size_get(int *x, int *y)
+{
+ *x = 0;
+ *y = 0;
+
+ return 0;
+}
+
+int util_replace_native_surface(struct widget *handle, int gbar, Evas_Object *content, unsigned int pixmap, int skip_acquire)
+{
+ return 0;
+}
+
+int util_set_native_surface(struct widget *handle, int gbar, Evas_Object *content, unsigned int pixmap, int skip_acquire)
+{
+ return 1;
+}
+
+unsigned int util_get_resource_id_of_native_surface(Evas_Native_Surface *surface)
+{
+ return 0u;
+}
+
+void *util_display_get(void)
+{
+ return NULL;
+}
+
+/* End of a file */
--- /dev/null
+#include <stdio.h>
+#include <Evas.h>
+
+#include <Ecore_X.h>
+
+#include <dlog.h>
+
+#include <widget_errno.h>
+#include <widget_viewer.h>
+
+#include "debug.h"
+
+int util_screen_size_get(int *w, int *h)
+{
+ int _w;
+ int _h;
+
+ if (!w) {
+ w = &_w;
+ }
+
+ if (!h) {
+ h = &_h;
+ }
+
+ ecore_x_window_size_get(0, w, h);
+ return 0;
+}
+
+int util_replace_native_surface(struct widget *handle, int gbar, Evas_Object *content, unsigned int pixmap, int skip_acquire)
+{
+ Evas_Native_Surface *old_surface;
+ Evas_Native_Surface surface;
+
+ surface.version = EVAS_NATIVE_SURFACE_VERSION;
+ surface.type = EVAS_NATIVE_SURFACE_X11;
+ surface.data.x11.pixmap = pixmap;
+
+ old_surface = evas_object_image_native_surface_get(content);
+ if (!old_surface) {
+ surface.data.x11.visual = ecore_x_default_visual_get(ecore_x_display_get(), ecore_x_default_screen_get());
+
+ evas_object_image_native_surface_set(content, &surface);
+
+ DbgPrint("Created: %u\n", surface.data.x11.pixmap);
+ } else {
+ unsigned int old_pixmap;
+
+ old_pixmap = old_surface->data.x11.pixmap;
+
+ if (old_pixmap != pixmap) {
+ surface.data.x11.visual = old_surface->data.x11.visual;
+ evas_object_image_native_surface_set(content, &surface);
+
+ if (old_pixmap && handle) {
+ if (!skip_acquire) {
+ widget_viewer_release_resource_id(handle, gbar, old_pixmap);
+ }
+ }
+
+ DbgPrint("Replaced: %u (%u)\n", pixmap, old_pixmap);
+ } else {
+ DbgPrint("Same resource, reuse it [%u]\n", pixmap);
+ }
+ }
+
+ return 0;
+}
+
+int util_set_native_surface(struct widget *handle, int gbar, Evas_Object *content, unsigned int pixmap, int skip_acquire)
+{
+ Evas_Native_Surface *old_surface;
+ Evas_Native_Surface surface;
+ int is_first = 0;
+
+ surface.version = EVAS_NATIVE_SURFACE_VERSION;
+ surface.type = EVAS_NATIVE_SURFACE_X11;
+ surface.data.x11.pixmap = (unsigned int)pixmap;
+
+ old_surface = evas_object_image_native_surface_get(content);
+ if (!old_surface) {
+ surface.data.x11.visual = ecore_x_default_visual_get(ecore_x_display_get(), ecore_x_default_screen_get());
+ evas_object_image_native_surface_set(content, &surface);
+
+ is_first = 1;
+ } else {
+ unsigned int old_pixmap = 0u;
+ old_pixmap = old_surface->data.x11.pixmap;
+ surface.data.x11.visual = old_surface->data.x11.visual;
+ evas_object_image_native_surface_set(content, &surface);
+
+ if (old_pixmap) {
+ if (!skip_acquire) {
+ widget_viewer_release_resource_id(handle, gbar, old_pixmap);
+ }
+ }
+
+ is_first = 0;
+ }
+
+ return is_first;
+}
+
+unsigned int util_get_resource_id_of_native_surface(Evas_Native_Surface *surface)
+{
+ return surface ? surface->data.x11.pixmap : 0u;
+}
+
+void *util_display_get(void)
+{
+ return ecore_x_display_get();
+}
+
+/* End of a file */
#include <Elementary.h>
#include <Ecore.h>
-#include <Ecore_X.h>
#include <Ecore_Evas.h>
#include <Evas.h>
#include <Edje.h>
+#include <widget_errno.h>
#include <widget_viewer.h>
#include <widget_viewer_internal.h>
-#include <widget_viewer.h>
-#include <widget_errno.h>
#include <widget_conf.h>
+#include "util.h"
#if defined(LOG_TAG)
#undef LOG_TAG
break;
}
- pixmap = surface->data.x11.pixmap;
+ pixmap = util_get_resource_id_of_native_surface(surface);
evas_object_del(gbar_content);
if (!s_info.conf.field.skip_acquire) {
} else {
data->view_port.x = 0;
data->view_port.y = 0;
- ecore_x_window_size_get(0, &data->view_port.w, &data->view_port.h);
+ util_screen_size_get(&data->view_port.w, &data->view_port.h);
ErrPrint("Failed to get view port info (Fallback: %dx%d - %dx%d\n",
data->view_port.x, data->view_port.y, data->view_port.w, data->view_port.h);
}
static void replace_pixmap(struct widget *handle, int gbar, Evas_Object *content, unsigned int pixmap)
{
- Evas_Native_Surface *old_surface;
- Evas_Native_Surface surface;
-
- surface.version = EVAS_NATIVE_SURFACE_VERSION;
- surface.type = EVAS_NATIVE_SURFACE_X11;
- surface.data.x11.pixmap = pixmap;
-
- old_surface = evas_object_image_native_surface_get(content);
- if (!old_surface) {
- surface.data.x11.visual = ecore_x_default_visual_get(ecore_x_display_get(), ecore_x_default_screen_get());
-
- evas_object_image_native_surface_set(content, &surface);
-
- DbgPrint("Created: %u\n", surface.data.x11.pixmap);
- } else {
- unsigned int old_pixmap;
-
- old_pixmap = old_surface->data.x11.pixmap;
-
- if (old_pixmap != pixmap) {
- surface.data.x11.visual = old_surface->data.x11.visual;
- evas_object_image_native_surface_set(content, &surface);
-
- if (old_pixmap && handle) {
- if (!s_info.conf.field.skip_acquire) {
- widget_viewer_release_resource_id(handle, gbar, old_pixmap);
- }
- }
-
- DbgPrint("Replaced: %u (%u)\n", pixmap, old_pixmap);
- } else {
- DbgPrint("Same resource, reuse it [%u]\n", pixmap);
- }
- }
+ util_replace_native_surface(handle, gbar, content, pixmap, s_info.conf.field.skip_acquire);
}
static void acquire_widget_pixmap_cb(struct widget *handle, int pixmap, void *cbdata)
{
struct acquire_data *acquire_data = cbdata;
struct widget_data *data = acquire_data->data;
- Evas_Native_Surface *old_surface;
- Evas_Native_Surface surface;
data->is.field.gbar_pixmap_acquire_requested = 0;
evas_object_image_size_set(acquire_data->content, acquire_data->w, acquire_data->h);
evas_object_image_fill_set(acquire_data->content, 0, 0, acquire_data->w, acquire_data->h);
- surface.version = EVAS_NATIVE_SURFACE_VERSION;
- surface.type = EVAS_NATIVE_SURFACE_X11;
- surface.data.x11.pixmap = (unsigned int)pixmap;
-
- old_surface = evas_object_image_native_surface_get(acquire_data->content);
- if (!old_surface) {
+ /**
+ * 1 means, First time.
+ */
+ if (util_set_native_surface(handle, 1, acquire_data->content, (unsigned int)pixmap, s_info.conf.field.skip_acquire) == 1) {
gbar_overlay_disable(data);
- surface.data.x11.visual = ecore_x_default_visual_get(ecore_x_display_get(), ecore_x_default_screen_get());
- evas_object_image_native_surface_set(acquire_data->content, &surface);
- } else {
- unsigned int old_pixmap = 0u;
- old_pixmap = old_surface->data.x11.pixmap;
- surface.data.x11.visual = old_surface->data.x11.visual;
- evas_object_image_native_surface_set(acquire_data->content, &surface);
-
- if (old_pixmap) {
- if (!s_info.conf.field.skip_acquire) {
- widget_viewer_release_resource_id(data->handle, 1, old_pixmap);
- }
- }
}
data->gbar_pixmap = (unsigned int)pixmap;
return WIDGET_ERROR_ALREADY_EXIST;
}
- ecore_x_window_size_get(0, &s_info.screen_width, &s_info.screen_height);
+ util_screen_size_get(&s_info.screen_width, &s_info.screen_height);
s_info.conf.field.render_animator = 0; // By default, use render animator for updating
- ret = widget_viewer_init(ecore_x_display_get(), 1, 0.001f, 1);
+ ret = widget_viewer_init(util_display_get(), 1, 0.001f, 1);
if (ret < 0) {
return ret;
}
}
}
+#if defined(ELM_ACCESS_ENABLED)
static void access_ret_cb(struct widget *handle, int ret, void *data)
{
struct access_ret_cb_data *cb_data = data;
free(cb_data);
}
+#endif
EAPI int widget_viewer_evas_feed_mouse_up_event(Evas_Object *widget)
{
EAPI int widget_viewer_evas_feed_access_event(Evas_Object *widget, int type, void *_info, void (*ret_cb)(Evas_Object *obj, int ret, void *data), void *cbdata)
{
+#if defined(ELM_ACCESS_ENABLED)
struct widget_data *data;
Elm_Access_Action_Info *info = _info;
int w;
}
return ret;
+#else
+ return WIDGET_ERROR_NOT_SUPPORTED;
+#endif
}
EAPI void widget_viewer_evas_disable_preview(Evas_Object *widget)