CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-ADD_SUBDIRECTORY(widget_toolkit)
ADD_SUBDIRECTORY(widget_viewer)
ADD_SUBDIRECTORY(widget_viewer_dali)
ADD_SUBDIRECTORY(widget_viewer_evas)
ADD_SUBDIRECTORY(widget_viewer_sdk)
ADD_SUBDIRECTORY(watch-control)
-ADD_DEPENDENCIES(widget_viewer_evas widget_toolkit)
-ADD_DEPENDENCIES(watch-control widget_toolkit)
ADD_DEPENDENCIES(widget_viewer_sdk widget_viewer_evas)
Source1002: %{name}_dali.manifest
Source1003: org.tizen.widget_viewer_sdk.manifest
Source1004: watch-control.manifest
-Source1005: libwidget_toolkit.manifest
BuildRequires: cmake, gettext-tools, coreutils, edje-bin
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(aul)
BuildRequires: pkgconfig(appsvc)
BuildRequires: pkgconfig(ecore-wayland)
BuildRequires: pkgconfig(wayland-tbm-client)
+BuildRequires: pkgconfig(screen_connector_watcher)
+BuildRequires: pkgconfig(screen_connector_watcher_evas)
%description
API for creating a new instance of the widget and managing its life-cycle.
cp %{SOURCE1002} .
cp %{SOURCE1003} .
cp %{SOURCE1004} .
-cp %{SOURCE1005} .
%build
%cmake . -DWIDGET_ENABLED=On -DTZ_SYS_SHARE=/usr/share
%{_includedir}/widget_viewer/widget_viewer.h
%{_libdir}/pkgconfig/widget_viewer.pc
-################################################
-# libwidget_toolkit
-%package -n widget_toolkit
-Summary: APIs to develop the widget viewer libraries
-Version: 0.0.1
-License: FLora-1.1
-Group: Applications/Core Applications
-
-%description -n widget_toolkit
-A sset of APIs to implement widget libraries
-
-%package -n widget_toolkit-devel
-Summary: APIs to develop the widget viewer libraries
-Group: Development/Libraries
-Requires: widget_toolkit
-
-%description -n widget_toolkit-devel
-Header & package configuration files of widget_toolkit
-
-%post -n widget_toolkit -p /sbin/ldconfig
-%postun -n widget_toolkit -p /sbin/ldconfig
-
#################################################
# libwidget_viewer_evas
%package -n %{name}_evas
Summary: Library for developing the widget viewer evas
Group: Applications/Core Applications
License: Flora-1.1
-Requires: widget_toolkit
%description -n %{name}_evas
Provider APIs to develop the widget viewer EFL application.
Version: 0.0.1
License: Flora-1.1
Group: Applications/Core Applications
-Requires: widget_toolkit
%description -n watch-control
A set of APIs to control watch applications
%{_datarootdir}/license/org.tizen.widget_viewer_sdk
%{_prefix}/apps/org.tizen.widget_viewer_sdk/*
-%files -n widget_toolkit
-%manifest libwidget_toolkit.manifest
-%{_libdir}/libwidget_toolkit.so*
-
-%files -n widget_toolkit-devel
-%{_includedir}/widget_toolkit/*.h
-%{_libdir}/pkgconfig/widget_toolkit.pc
-
%files -n watch-control
%manifest watch-control.manifest
%{_libdir}/libwatch-control.so*
capi-system-info
capi-appfw-application
aul
+ screen_connector_watcher_evas
)
SET(BUILD_SOURCE
SET(CMAKE_C_FLAGS_RELEASE "-O2")
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../widget_toolkit/include)
ADD_LIBRARY(${PROJECT_NAME} SHARED ${BUILD_SOURCE})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${watch-control_LDFLAGS} "-lpthread" widget_toolkit)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${watch-control_LDFLAGS})
CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc")
#include <aul_svc.h>
#include <bundle_internal.h>
#include <app_control_internal.h>
-#include <compositor.h>
+#include <screen_connector_watcher_evas.h>
#include <dlog.h>
#include <unistd.h>
#include "watch_control.h"
}
__win = win;
- _compositor_init(win);
- _compositor_start_visibility_notify();
+ screen_connector_watcher_evas_init(__win);
+ screen_connector_watcher_evas_start_visibility_notify();
__win_resized(NULL, NULL, win, NULL); /* init */
evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, __win_resized, NULL);
if (__win)
evas_object_event_callback_del(__win, EVAS_CALLBACK_RESIZE, __win_resized);
- _compositor_stop_visibility_notify();
- _compositor_fini();
+ screen_connector_watcher_evas_stop_visibility_notify();
+ screen_connector_watcher_evas_fini();
}
API int watch_manager_init(Evas_Object *win)
return 0;
}
-static void __tbm_cb(const char *app_id, const char *event, Evas_Object *obj, void *data)
+static void __screen_connector_watcher_evas_added_cb(const char *appid, Evas_Object *image, void *data)
{
int w, h, x, y;
- Evas_Object *surface = obj;
- evas_object_geometry_get(surface, &x, &y, &w, &h);
+ evas_object_geometry_get(image, &x, &y, &w, &h);
- if (!event) {
- _E("invalid param");
- return;
- }
+ _D("obj added");
+ _D("w: %d, h: %d, x: %d y: %d", w, h, x, y);
+ evas_object_smart_callback_call(__win, WATCH_SMART_SIGNAL_ADDED, image);
+}
- if (strcmp(event, "added") == 0) {
- _E("obj added");
- _E("w: %d, h: %d, x: %d y: %d", w, h, x, y);
- evas_object_smart_callback_call(__win, WATCH_SMART_SIGNAL_ADDED, surface);
- } else if (strcmp(event, "removed") == 0) {
- _E("obj removed");
- evas_object_smart_callback_call(__win, WATCH_SMART_SIGNAL_REMOVED, surface);
- }
+static void __screen_connector_watcher_evas_removed_cb(const char *appid, Evas_Object *image, void *data)
+{
+ _D("obj removed");
+ evas_object_smart_callback_call(__win, WATCH_SMART_SIGNAL_REMOVED, image);
+}
+
+static void __screen_connector_watcher_evas_updated_cb(const char *appid, Evas_Object *image, void *data)
+{
}
API int watch_manager_set_resource_id(int resource_id)
{
- return _compositor_set_handler_by_rid(resource_id, __tbm_cb, NULL);
+ screen_connector_watcher_evas_ops ops;
+
+ ops.added = __screen_connector_watcher_evas_added_cb;
+ ops.removed = __screen_connector_watcher_evas_removed_cb;
+ ops.updated = __screen_connector_watcher_evas_updated_cb;
+ return screen_connector_watcher_evas_add_by_rid(&ops, resource_id, NULL);
}
API int watch_manager_get_resource_id(Evas_Object *watch, int *resource_id)
{
- return _compositor_get_rid(watch, resource_id);
+ return screen_connector_watcher_evas_get_rid(watch, resource_id);
}
API int watch_manager_send_terminate(Evas_Object *watch)
{
- const char *appid = _compositor_get_app_id(watch);
int pid;
int r;
- _compositor_get_pid(watch, &pid);
- _D("watch_manager_send_terminate %s, %d", appid, pid);
+ screen_connector_watcher_evas_get_pid(watch, &pid);
+ _D("watch_manager_send_terminate %d", pid);
if (pid < 1) {
_E("failed to get pid from %p", watch);
return -1;
{
char buf[10];
bundle *b = NULL;
+ screen_connector_watcher_evas_ops ops;
app_control_create(app_control);
app_control_set_app_id(*app_control, app_id);
app_control_set_operation(*app_control, APP_CONTROL_OPERATION_MAIN);
- _compositor_set_handler(app_id, __tbm_cb, NULL);
+ ops.added = __screen_connector_watcher_evas_added_cb;
+ ops.removed = __screen_connector_watcher_evas_removed_cb;
+ ops.updated = __screen_connector_watcher_evas_updated_cb;
+ screen_connector_watcher_evas_add(&ops, (char *)app_id, NULL);
app_control_to_bundle(*app_control, &b);
if (b) {
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(widget_toolkit C)
-
-SET(PREFIX "${CMAKE_INSTALL_PREFIX}")
-SET(PROJECT_NAME "${PROJECT_NAME}")
-SET(LIBDIR ${LIB_INSTALL_DIR})
-SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
-SET(VERSION_MAJOR 1)
-SET(VERSION "${VERSION_MAJOR}.0.0")
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(widget_toolkit REQUIRED
- dlog
- elementary
- pkgmgr-info
- capi-system-info
- capi-appfw-application
- aul
- ecore-wayland
-)
-
-SET(BUILD_SOURCE
- src/compositor.c
-)
-
-FOREACH(flag ${widget_toolkit_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline")
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
-SET(CMAKE_C_FLAGS_RELEASE "-O2")
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
-
-ADD_LIBRARY(${PROJECT_NAME} SHARED ${BUILD_SOURCE})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
-
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${widget_toolkit_LDFLAGS} "-lpthread")
-
-CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
-SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc")
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/compositor.h DESTINATION include/${PROJECT_NAME})
+++ /dev/null
-/*
- * Samsung API
- * Copyright (c) 2016 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 __COMPOSITOR_H__
-#define __COMPOSITOR_H__
-
-#include <Evas.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- VISIBILITY_TYPE_UNOBSCURED = 0,
- VISIBILITY_TYPE_PARTIALLY_OBSCURED,
- VISIBILITY_TYPE_FULLY_OBSCURED,
-} visibility_type;
-
-typedef void (*_compositor_handler_cb)(const char *app_id, const char *event, Evas_Object *obj, void *data);
-
-int _compositor_init(Evas_Object *win);
-int _compositor_fini();
-int _compositor_set_handler(const char *app_id, _compositor_handler_cb cb, void *data);
-int _compositor_set_handler_by_rid(int resource_id, _compositor_handler_cb cb, void *data);
-int _compositor_get_rid(Evas_Object *obj, int *resource_id);
-
-const char *_compositor_get_title(Evas_Object *obj);
-const char *_compositor_get_app_id(Evas_Object *obj);
-int _compositor_get_pid(Evas_Object *obj, int *pid);
-int _compositor_set_visibility(Evas_Object *obj, visibility_type type);
-int _compositor_freeze_visibility(Evas_Object *obj, visibility_type type);
-int _compositor_thaw_visibility(Evas_Object *obj);
-int _compositor_stop_visibility_notify();
-int _compositor_start_visibility_notify();
-int _compositor_send_mouse_up(Evas_Object *obj);
-int _compositor_send_touch_cancel(Evas_Object *obj);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2016 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.
- */
-
-#include <stdbool.h>
-#include <Evas.h>
-#include <wayland-extension/tizen-extension-client-protocol.h>
-#include <tizen-remote-surface-client-protocol.h>
-#include <tbm_surface.h>
-#include <wayland-client.h>
-#include <wayland-tbm-client.h>
-#include <glib.h>
-#include <dlog.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <aul.h>
-#include "compositor.h"
-#include <Ecore_Wayland.h>
-#include <Elementary.h>
-#include <aul_rsm_viewer.h>
-
-#ifndef _E
-#define _E LOGE
-#endif
-
-#ifndef _D
-#define _D LOGD
-#endif
-
-#undef LOG_TAG
-#define LOG_TAG "WIDGET_TOOLKIT"
-
-#define API __attribute__((visibility("default")))
-#define ERR_BUFFER_SIZE 1024
-
-struct compositor_handler {
- char *app_id;
- _compositor_handler_cb cb;
- void *data;
- Evas_Object *evas_obj;
- int freeze;
- int visible_type;
- bool is_init_visibility;
- struct tizen_remote_surface *surface;
-};
-
-struct compositor_h {
- Evas_Object *win;
-};
-
-static GHashTable *__evas_tbl;
-static Ecore_Event_Handler *__visibility_listener;
-static struct compositor_h *__comp;
-static int __init_count;
-
-static bool __obj_is_visible(Evas_Object *obj)
-{
- int x, y, w, h;
- Ecore_Wl_Window *window = NULL;
- int window_x, window_y, window_w, window_h;
- int rotation;
-
- window = elm_win_wl_window_get(__comp->win);
- ecore_wl_window_geometry_get(window, &window_x, &window_y, &window_w, &window_h);
- evas_object_geometry_get(obj, &x, &y, &w, &h);
- rotation = ecore_wl_window_rotation_get(window);
-
- if (x >= -w && x < window_w &&
- y >= - h && y < window_h &&
- (rotation == 0 || rotation == 180))
- return true;
- else if (x >= - w && x < window_h &&
- y >= - h && y < window_w &&
- (rotation == 90 || rotation == 270))
- return true;
- return false;
-}
-
-static void __obj_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- struct compositor_handler *handler = (struct compositor_handler *)data;
-
- if (__obj_is_visible(handler->evas_obj))
- _compositor_set_visibility(obj, VISIBILITY_TYPE_UNOBSCURED);
- else
- _compositor_set_visibility(obj, VISIBILITY_TYPE_FULLY_OBSCURED);
-}
-
-static void __rs_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- struct compositor_handler *handler = (struct compositor_handler *)data;
- Evas_Event_Mouse_Down *ev = event_info;
- const char *desc = evas_device_description_get(ev->dev);
- int x;
- int y;
- int w;
- int h;
-
- evas_object_geometry_get(obj, &x, &y, &w, &h);
- _D("mouse down: %d %d", ev->canvas.x - x, ev->canvas.y - y);
-
- if (!__obj_is_visible(handler->evas_obj)) {
- _D("object is invisible ignore event");
- return;
- }
-
- if (desc == NULL)
- desc = "";
-
- tizen_remote_surface_transfer_mouse_event(handler->surface,
- TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_DOWN,
- 0,
- ev->button,
- ev->canvas.x - x,
- ev->canvas.y - y,
- wl_fixed_from_double(ev->radius_x),
- wl_fixed_from_double(ev->radius_y),
- wl_fixed_from_double(ev->pressure),
- wl_fixed_from_double(ev->angle),
- evas_device_class_get(ev->dev),
- evas_device_subclass_get(ev->dev),
- desc,
- ev->timestamp);
-}
-
-static void __rs_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- struct compositor_handler *handler = (struct compositor_handler *)data;
- Evas_Event_Mouse_Up *ev = event_info;
- const char *desc = evas_device_description_get(ev->dev);
- int x;
- int y;
- int w;
- int h;
-
- evas_object_geometry_get(obj, &x, &y, &w, &h);
- _D("mouse up: %d %d", ev->canvas.x - x, ev->canvas.y - y);
-
- if (!__obj_is_visible(handler->evas_obj)) {
- _D("object is invisible ignore event");
- return;
- }
-
- if (desc == NULL)
- desc = "";
-
- tizen_remote_surface_transfer_mouse_event(handler->surface,
- TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_UP,
- 0,
- ev->button,
- ev->canvas.x - x,
- ev->canvas.y - y,
- wl_fixed_from_double(ev->radius_x),
- wl_fixed_from_double(ev->radius_y),
- wl_fixed_from_double(ev->pressure),
- wl_fixed_from_double(ev->angle),
- evas_device_class_get(ev->dev),
- evas_device_subclass_get(ev->dev),
- desc,
- ev->timestamp);
-}
-
-static void __rs_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- struct compositor_handler *handler = (struct compositor_handler *)data;
- Evas_Event_Mouse_Move *ev = event_info;
- const char *desc = evas_device_description_get(ev->dev);
- int x;
- int y;
- int w;
- int h;
-
- evas_object_geometry_get(obj, &x, &y, &w, &h);
- _D("mouse move: %d %d", ev->cur.canvas.x - x, ev->cur.canvas.y - y);
-
- if (!__obj_is_visible(handler->evas_obj)) {
- _D("object is invisible ignore event");
- return;
- }
-
- if (desc == NULL)
- desc = "";
-
- tizen_remote_surface_transfer_mouse_event(handler->surface,
- TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_MOVE,
- 0,
- 0,
- ev->cur.canvas.x - x,
- ev->cur.canvas.y - y,
- wl_fixed_from_double(ev->radius_x),
- wl_fixed_from_double(ev->radius_y),
- wl_fixed_from_double(ev->pressure),
- wl_fixed_from_double(ev->angle),
- evas_device_class_get(ev->dev),
- evas_device_subclass_get(ev->dev),
- desc,
- ev->timestamp);
-
-}
-
-static void __rs_cb_mouse_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- struct compositor_handler *handler = (struct compositor_handler *)data;
- Evas_Event_Mouse_Wheel *ev = event_info;
- const char *desc = evas_device_description_get(ev->dev);
-
- _D("mouse wheel");
-
- if (!__obj_is_visible(handler->evas_obj)) {
- _D("object is invisible ignore event");
- return;
- }
-
- if (desc == NULL)
- desc = "";
-
- tizen_remote_surface_transfer_mouse_wheel(handler->surface,
- ev->direction,
- ev->z,
- evas_device_class_get(ev->dev),
- evas_device_subclass_get(ev->dev),
- desc,
- ev->timestamp);
-
-}
-
-static void __rs_cb_show(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- _D("show");
-}
-
-static void __rs_cb_hide(void *data, Evas *e, Evas_Object *obj, void *event_info)
-{
- _D("hide");
-}
-
-static void __rs_cb_buffer_update(struct tizen_remote_surface *trs, struct wl_buffer *buffer, uint32_t time, void *data)
-{
- struct compositor_handler *handler = (struct compositor_handler *)data;
- tbm_surface_h tbm_surface;
- int width;
- int height;
- char plug_id[256];
- int pid;
-
- if (!handler->evas_obj) {
- _D("first added");
- handler->surface = trs;
- handler->evas_obj = evas_object_image_filled_add(
- evas_object_evas_get(__comp->win));
- evas_object_image_alpha_set(handler->evas_obj, 1);
- evas_object_event_callback_add(handler->evas_obj,
- EVAS_CALLBACK_MOUSE_DOWN,
- __rs_cb_mouse_down, handler);
- evas_object_event_callback_add(handler->evas_obj,
- EVAS_CALLBACK_MOUSE_UP,
- __rs_cb_mouse_up, handler);
- evas_object_event_callback_add(handler->evas_obj,
- EVAS_CALLBACK_MOUSE_MOVE,
- __rs_cb_mouse_move, handler);
- evas_object_event_callback_add(handler->evas_obj,
- EVAS_CALLBACK_MOUSE_WHEEL,
- __rs_cb_mouse_wheel, handler);
- evas_object_event_callback_add(handler->evas_obj,
- EVAS_CALLBACK_SHOW,
- __rs_cb_show, handler);
- evas_object_event_callback_add(handler->evas_obj,
- EVAS_CALLBACK_HIDE,
- __rs_cb_hide, handler);
-
- g_hash_table_insert(__evas_tbl, handler->evas_obj, handler);
-
- /* Set data to use in accessibility */
- aul_rsm_viewer_get_surface_pid(handler->app_id, &pid);
- snprintf(plug_id, sizeof(plug_id), "%s:%d", handler->app_id, pid);
- evas_object_data_set(handler->evas_obj, "___PLUGID", strdup(plug_id));
-
- if (handler->cb) {
- _D("call added !!!! %s", handler->app_id);
- handler->cb(handler->app_id, "added", handler->evas_obj,
- handler->data);
- }
-
- if (__obj_is_visible(handler->evas_obj))
- _compositor_set_visibility(handler->evas_obj, VISIBILITY_TYPE_UNOBSCURED);
- else
- _compositor_set_visibility(handler->evas_obj, VISIBILITY_TYPE_FULLY_OBSCURED);
-
- evas_object_event_callback_add(handler->evas_obj,
- EVAS_CALLBACK_MOVE, __obj_move_cb, handler);
- }
-
- tbm_surface = wl_buffer_get_user_data(buffer);
- width = tbm_surface_get_width(tbm_surface);
- height = tbm_surface_get_height(tbm_surface);
-
- Evas_Native_Surface ns;
- memset(&ns, 0, sizeof(Evas_Native_Surface));
- ns.version = EVAS_NATIVE_SURFACE_VERSION;
- ns.type = EVAS_NATIVE_SURFACE_TBM;
- ns.data.tbm.buffer = tbm_surface;
-
- evas_object_image_size_set(handler->evas_obj, width, height);
-
- evas_object_image_native_surface_set(handler->evas_obj, &ns);
- evas_object_image_pixels_dirty_set(handler->evas_obj, EINA_TRUE);
-
- evas_object_resize(handler->evas_obj, width, height);
-}
-
-static void __free_compositor_handler(struct compositor_handler *handler)
-{
- if (!handler)
- return;
-
- if (handler->app_id)
- free(handler->app_id);
-
- if (handler->evas_obj) {
- evas_object_del(handler->evas_obj);
- handler->evas_obj = NULL;
- }
-
- free(handler);
-}
-
-static void __rs_cb_missing(struct tizen_remote_surface *trs, void *data)
-{
- struct compositor_handler *handler;
- char *plug_id;
-
- _D("missing");
- handler = (struct compositor_handler *)data;
- if (!handler) {
- _E("Null handler");
- return;
- }
-
- g_hash_table_remove(__evas_tbl, handler->evas_obj);
-
- /* Remove data used in accessibility */
- plug_id = evas_object_data_del(handler->evas_obj, "___PLUGID");
- free(plug_id);
-
- handler->cb(handler->app_id, "removed", handler->evas_obj, handler->data);
-
- aul_rsm_viewer_unset_surface_handler(handler->app_id);
- __free_compositor_handler(handler);
-}
-
-static aul_rsm_handler __rs_listener = {
- __rs_cb_buffer_update,
- __rs_cb_missing,
-};
-
-API int _compositor_init(Evas_Object *win)
-{
- if (__init_count > 0) {
- __init_count++;
- return __init_count;
- }
-
- __comp = (struct compositor_h *)g_malloc0(sizeof(struct compositor_h));
- if (!__comp) {
- _E("out of memory");
- return -1;
- }
-
- __comp->win = win;
-
- aul_rsm_viewer_init();
-
- __evas_tbl = g_hash_table_new(g_direct_hash, g_direct_equal);
- if (!__evas_tbl) {
- _E("failed to create table");
- return -1;
- }
-
-
- __init_count++;
-
- return __init_count;
-}
-
-API int _compositor_fini()
-{
- if (__init_count > 1) {
- __init_count--;
- return __init_count;
- }
-
- aul_rsm_viewer_fini();
-
- if (__evas_tbl)
- g_hash_table_destroy(__evas_tbl);
-
- return __init_count;
-}
-
-API int _compositor_set_handler(const char *app_id, _compositor_handler_cb cb, void *data)
-{
- struct compositor_handler *handler;
-
- if (!app_id || !cb) {
- _E("inavlid parameter");
- return -1;
- }
-
- handler = (struct compositor_handler *)g_malloc0(sizeof(struct compositor_handler));
- if (!handler) {
- _E("out of memory");
- return -1;
- }
-
- _D("_compositor_set_handler %s", app_id);
- handler->app_id = g_strdup(app_id);
- handler->cb = cb;
- handler->data = data;
- handler->freeze = 0;
- handler->is_init_visibility = false;
- handler->visible_type = TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_INVISIBLE;
-
- /*
- * handler will be freed in __rs_cb_missing callabck
- * __rs_cb_missing will be called when surface received missing event
- */
- aul_rsm_viewer_set_surface_handler(handler->app_id, &__rs_listener, handler);
-
- return 0;
-}
-
-API int _compositor_set_handler_by_rid(int resource_id, _compositor_handler_cb cb, void *data)
-{
- struct compositor_handler *handler;
- char buf[32];
-
- if (resource_id < 0) {
- _E("invalid parameter");
- return -1;
- }
-
- handler = (struct compositor_handler *)g_malloc(sizeof(struct compositor_handler));
- if (!handler) {
- _E("out of memory");
- return -1;
- }
-
- snprintf(buf, sizeof(buf), "%d", resource_id);
- handler->app_id = g_strdup(buf);
- if (!handler->app_id) {
- _E("out of memory");
- return -1;
- }
-
- handler->cb = cb;
- handler->data = data;
- handler->freeze = 0;
-
- aul_rsm_viewer_set_surface_handler_by_rid(resource_id, &__rs_listener,
- handler);
-
- return 0;
-}
-
-API int _compositor_get_rid(Evas_Object *obj, int *resource_id)
-{
- struct compositor_handler *handler;
-
- handler = g_hash_table_lookup(__evas_tbl, obj);
- if (!handler) {
- _E("unknown object. not widget object");
- return -1;
- }
-
- return aul_rsm_viewer_get_surface_rid(handler->app_id, resource_id);
-}
-
-API const char *_compositor_get_title(Evas_Object *obj)
-{
- return NULL;
-}
-
-API const char *_compositor_get_app_id(Evas_Object *obj)
-{
- struct compositor_handler *handler;
-
- handler = g_hash_table_lookup(__evas_tbl, obj);
- if (!handler) {
- _E("unknown object. not widget object");
- return NULL;
- }
- return handler->app_id;
-}
-
-API int _compositor_get_pid(Evas_Object *obj, int *pid)
-{
- struct compositor_handler *handler;
-
- handler = g_hash_table_lookup(__evas_tbl, obj);
- if (!handler) {
- _E("unknown object. not widget object");
- return -1;
- }
-
- return aul_rsm_viewer_get_surface_pid(handler->app_id, pid);
-}
-
-API int _compositor_set_visibility(Evas_Object *obj, visibility_type type)
-{
- struct compositor_handler *handler;
- int obscured;
-
- handler = (struct compositor_handler *)g_hash_table_lookup(__evas_tbl, obj);
-
- if (!handler) {
- _E("obj not found");
- return -1;
- }
-
- switch (type) {
- case VISIBILITY_TYPE_UNOBSCURED:
- case VISIBILITY_TYPE_PARTIALLY_OBSCURED:
- obscured = TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_VISIBLE;
- break;
- case VISIBILITY_TYPE_FULLY_OBSCURED:
- obscured = TIZEN_REMOTE_SURFACE_VISIBILITY_TYPE_INVISIBLE;
- break;
- default:
- return -1;
- }
-
- if (handler->surface &&
- (handler->visible_type != obscured || !handler->is_init_visibility)) {
- tizen_remote_surface_transfer_visibility(handler->surface, obscured);
- if (!handler->is_init_visibility)
- handler->is_init_visibility = true;
- }
- handler->visible_type = obscured;
- return 0;
-}
-
-API int _compositor_freeze_visibility(Evas_Object *obj, visibility_type type)
-{
- struct compositor_handler *handler;
-
- handler = (struct compositor_handler *)g_hash_table_lookup(__evas_tbl, obj);
-
- if (!handler) {
- _E("obj not found");
- return -1;
- }
-
- handler->freeze = 1;
-
- return _compositor_set_visibility(obj, type);
-}
-
-API int _compositor_thaw_visibility(Evas_Object *obj)
-{
- struct compositor_handler *handler;
-
- handler = (struct compositor_handler *)g_hash_table_lookup(__evas_tbl, obj);
-
- if (!handler) {
- _E("obj not found");
- return -1;
- }
-
- handler->freeze = 0;
-
- return 0;
-}
-
-static void __send_visibility(gpointer key, gpointer value, gpointer user_data)
-{
- struct compositor_handler *handler = (struct compositor_handler *)value;
- Evas_Object *evas_obj = (Evas_Object *)key;
- unsigned int event = GPOINTER_TO_INT(user_data);
- int ret;
- visibility_type type;
-
- if (handler->freeze)
- return;
-
- if (!__obj_is_visible(handler->evas_obj))
- return;
-
- if (event)
- type = VISIBILITY_TYPE_FULLY_OBSCURED;
- else
- type = VISIBILITY_TYPE_UNOBSCURED;
-
- ret = _compositor_set_visibility(evas_obj, type);
- if (ret == -1)
- _E("failed to set object visibility set %p to %d", evas_obj, type);
-}
-
-static Eina_Bool __visibility_cb(void *data, int type, void *event)
-{
- Ecore_Wl_Event_Window_Visibility_Change *ev = event;
-
- _D("visibility change: %d %d", (unsigned int)ev->win,
- (unsigned int)ev->fully_obscured);
-
- if (!__evas_tbl)
- return ECORE_CALLBACK_RENEW;
-
- g_hash_table_foreach(__evas_tbl, __send_visibility,
- GINT_TO_POINTER(ev->fully_obscured));
-
- return ECORE_CALLBACK_RENEW;
-}
-
-API int _compositor_start_visibility_notify()
-{
- if (__visibility_listener)
- return 0;
-
- __visibility_listener = ecore_event_handler_add(
- ECORE_WL_EVENT_WINDOW_VISIBILITY_CHANGE, __visibility_cb, NULL);
-
- return 0;
-}
-
-API int _compositor_stop_visibility_notify()
-{
- if (!__visibility_listener)
- return 0;
-
- ecore_event_handler_del(__visibility_listener);
- __visibility_listener = NULL;
-
- return 0;
-}
-
-API int _compositor_send_mouse_up(Evas_Object *obj)
-{
- struct compositor_handler *handler;
- int x;
- int y;
- int w;
- int h;
- unsigned int timestamp;
-
- handler = g_hash_table_lookup(__evas_tbl, obj);
- if (!handler) {
- _E("unknown object. not widget object.");
- return -1;
- }
-
- if (!handler->surface) {
- _E("surface not yet initialized.");
- return -1;
- }
-
- evas_object_geometry_get(obj, &x, &y, &w, &h);
-
- timestamp = (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff);
-
- tizen_remote_surface_transfer_mouse_event(handler->surface,
- TIZEN_REMOTE_SURFACE_EVENT_TYPE_MOUSE_UP,
- 0,
- 1,
- w / 2,
- h / 2,
- 0,
- 0,
- 0,
- 0,
- TIZEN_INPUT_DEVICE_CLAS_MOUSE,
- TIZEN_INPUT_DEVICE_SUBCLAS_NONE,
- "",
- timestamp);
-
- return 0;
-}
-
-API int _compositor_send_touch_cancel(Evas_Object *obj)
-{
- struct compositor_handler *handler;
-
- handler = g_hash_table_lookup(__evas_tbl, obj);
- if (!handler) {
- _E("unknown object. not widget object.");
- return -1;
- }
-
- if (handler->surface) {
- tizen_remote_surface_transfer_touch_cancel(handler->surface);
- } else {
- _E("surface not yet initialized.");
- return -1;
- }
-
- return 0;
-}
+++ /dev/null
-prefix=@PREFIX@
-exec_prefix=@EXEC_PREFIX@
-libdir=@LIBDIR@
-includedir=@INCLUDEDIR@
-
-Name: widget_toolkit
-Description: Support development of the widget Viewer Library
-Version: @VERSION@
-Libs: -L${libdir} -lwidget_toolkit
-Cflags: -I${includedir}
-cppflags: -I${includedir}
capi-appfw-application
aul
cynara-client
+ screen_connector_watcher_evas
)
SET(BUILD_SOURCE
ADD_DEFINITIONS("-DPKGNAME=\"${PROJECT_NAME}\"")
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../widget_toolkit/include)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../widget_viewer/include)
ADD_LIBRARY(${PROJECT_NAME} SHARED ${BUILD_SOURCE})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${viewer_evas_LDFLAGS} "-lpthread" widget_toolkit widget_viewer)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${viewer_evas_LDFLAGS} "-lpthread" widget_viewer)
CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc")
#include <widget_service_internal.h>
#include <widget_instance.h>
#include <widget_viewer.h>
-#include <compositor.h>
#include <aul_app_com.h>
+#include <screen_connector_watcher_evas.h>
+
#if defined(LOG_TAG)
#undef LOG_TAG
evas_object_smart_callback_call(obj, signal, cbdata);
}
-static void widget_object_cb(const char *instance_id, const char *event, Evas_Object *obj, void *data)
+static void __screen_connector_watcher_evas_added_cb(const char *appid, Evas_Object *image, void *data)
{
struct widget_info *info;
- struct widget_evas_event_info event_info;
- Evas_Object *surface;
-
- if (!event) {
- ErrPrint("invalid parameters");
- return;
- }
+ int x, y, w, h;
- surface = obj;
- if (!surface) {
+ if (!image) {
ErrPrint("Invalid parameters");
return;
}
- info = g_hash_table_lookup(s_info.widget_table, instance_id);
+ info = (struct widget_info *)data;
if (!info) {
ErrPrint("Unable to find a proper object");
- evas_object_del(surface);
+ evas_object_del(image);
return;
}
- if (info->restart)
+ if (info->restart || (strcmp(appid, info->widget_id) != 0))
return;
- if (strcmp(event, "added") == 0) {
- int x, y, w, h;
- DbgPrint("widget added: %s", instance_id);
- evas_object_geometry_get(surface, &x, &y, &w, &h);
- DbgPrint("widget geometry:%d %d %d %d", x, y, w, h);
- elm_object_part_content_set(info->layout, "tbm,widget", surface);
-
- if (!info->disable_preview)
- elm_object_signal_emit(info->layout, "disable", "preview");
-
- if (!info->disable_loading)
- elm_object_signal_emit(info->layout, "disable", "loading,text");
+ DbgPrint("widget added: %s, instance : %s, (%p)", appid, info->instance_id, image);
+ evas_object_geometry_get(image, &x, &y, &w, &h);
+ DbgPrint("widget geometry:%d %d %d %d", x, y, w, h);
+ elm_object_part_content_set(info->layout, "tbm,widget", image);
- info->state = WIDGET_STATE_ATTACHED;
+ if (!info->disable_preview)
+ elm_object_signal_emit(info->layout, "disable", "preview");
- __flush_event_queue(info);
- /**
- * @note
- * After swallow this widget object to the layout,
- * It will be automatically resized by EDJE.
- */
- } else if (strcmp(event, "removed") == 0) {
- DbgPrint("widget removed: %s", instance_id);
- elm_object_part_content_set(info->layout, "tbm,widget", NULL);
+ if (!info->disable_loading)
+ elm_object_signal_emit(info->layout, "disable", "loading,text");
- if (info->disable_preview)
- elm_object_signal_emit(info->layout, "enable", "preview");
+ info->state = WIDGET_STATE_ATTACHED;
- if (info->disable_loading)
- elm_object_signal_emit(info->layout, "enable", "loading,text");
+ __flush_event_queue(info);
+ /**
+ * @note
+ * After swallow this widget object to the layout,
+ * It will be automatically resized by EDJE.
+ */
+}
- event_info.error = WIDGET_ERROR_NONE;
- event_info.widget_app_id = info->widget_id;
- event_info.event = WIDGET_EVENT_DELETED;
+static void __screen_connector_watcher_evas_removed_cb(const char *appid, Evas_Object *image, void *data)
+{
+ struct widget_evas_event_info event_info;
+ struct widget_info *info;
- smart_callback_call(info->layout, WIDGET_SMART_SIGNAL_WIDGET_DELETED, &event_info);
- } else {
- ErrPrint("undefiend event occured");
+ info = (struct widget_info *)data;
+ if (!info) {
+ ErrPrint("Unable to find a proper object");
return;
}
+
+ if (info->restart)
+ return;
+
+ DbgPrint("widget removed: %s", appid);
+ elm_object_part_content_set(info->layout, "tbm,widget", NULL);
+
+ if (info->disable_preview)
+ elm_object_signal_emit(info->layout, "enable", "preview");
+
+ if (info->disable_loading)
+ elm_object_signal_emit(info->layout, "enable", "loading,text");
+
+ event_info.error = WIDGET_ERROR_NONE;
+ event_info.widget_app_id = info->widget_id;
+ event_info.event = WIDGET_EVENT_DELETED;
+
+ smart_callback_call(info->layout, WIDGET_SMART_SIGNAL_WIDGET_DELETED, &event_info);
+}
+
+static void __screen_connector_watcher_evas_updated_cb(const char *appid, Evas_Object *image, void *data)
+{
}
static void __display_overlay_text(struct widget_info *info)
GHashTableIter iter;
gpointer key, value;
+ screen_connector_watcher_evas_ops ops;
struct widget_info *widget_instance_info;
int w, h;
int target_pid = 0;
widget_instance_info->pid == target_pid) {
evas_object_geometry_get(widget_instance_info->layout, NULL, NULL, &w, &h);
DbgPrint("Widget launch %s, %d, %d", widget_instance_info->instance_id, w, h);
- _compositor_set_handler(widget_instance_info->instance_id, widget_object_cb, NULL);
+
+ ops.added = __screen_connector_watcher_evas_added_cb;
+ ops.removed = __screen_connector_watcher_evas_removed_cb;
+ ops.updated = __screen_connector_watcher_evas_updated_cb;
+ screen_connector_watcher_evas_add(&ops, widget_instance_info->widget_id, widget_instance_info);
widget_instance_info->pid = widget_instance_launch(widget_instance_info->instance_id, widget_instance_info->content_info, w, h);
widget_instance_info->restart = false;
}
}
s_info.win = win;
-
- _compositor_init(win);
- _compositor_start_visibility_notify();
+ screen_connector_watcher_evas_init(win);
+ screen_connector_watcher_evas_start_visibility_notify();
if (aul_app_get_appid_bypid(getpid(), app_id, sizeof(app_id)) != AUL_R_OK) {
ErrPrint("failed to get appid of pid:%d", getpid());
return WIDGET_ERROR_FAULT;
}
- _compositor_fini();
+ screen_connector_watcher_evas_fini();
widget_instance_unlisten_event(__instance_event_cb);
widget_instance_fini();
char *preview_path = NULL;
int x, y, w, h;
widget_size_type_e size_type;
+ screen_connector_watcher_evas_ops ops;
if (!info || !layout) {
ErrPrint("Failed to load the info(%p) or layout(%p)", info, layout);
elm_object_part_text_set(layout, "text", T_("IDS_ST_POP_LOADING_ING"));
}
- _compositor_set_handler(info->instance_id, widget_object_cb, NULL);
+ ops.added = __screen_connector_watcher_evas_added_cb;
+ ops.removed = __screen_connector_watcher_evas_removed_cb;
+ ops.updated = __screen_connector_watcher_evas_updated_cb;
+ screen_connector_watcher_evas_add(&ops, info->widget_id, info);
+
info->pid = widget_instance_launch(info->instance_id, info->content_info, w, h);
if (info->pid < 0) {
struct widget_evas_event_info event_info;
if (type == WIDGET_VIEWER_EVAS_MANUAL_PAUSE_RESUME) {
if (value)
- _compositor_stop_visibility_notify();
+ screen_connector_watcher_evas_stop_visibility_notify();
else
- _compositor_start_visibility_notify();
+ screen_connector_watcher_evas_start_visibility_notify();
}
return WIDGET_ERROR_NONE;
return;
}
- _compositor_send_touch_cancel(remote_obj);
+ screen_connector_watcher_evas_send_touch_cancel(remote_obj);
return;
}
return WIDGET_ERROR_INVALID_PARAMETER;
}
- _compositor_send_mouse_up(remote_obj);
+ screen_connector_watcher_evas_send_mouse_up(remote_obj);
return WIDGET_ERROR_NONE;
}
EAPI void widget_viewer_evas_activate_faulted_widget(Evas_Object *widget)
{
struct widget_info *info;
+ screen_connector_watcher_evas_ops ops;
if (!is_widget_feature_enabled()) {
set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
elm_object_signal_emit(info->layout, "enable", "text");
}
- _compositor_set_handler(info->instance_id, widget_object_cb, NULL);
+ ops.added = __screen_connector_watcher_evas_added_cb;
+ ops.removed = __screen_connector_watcher_evas_removed_cb;
+ ops.updated = __screen_connector_watcher_evas_updated_cb;
+ screen_connector_watcher_evas_add(&ops, info->widget_id, info);
info->pid = widget_instance_launch(info->instance_id, info->content_info, w, h);
if (info->pid < 0) {
ErrPrint("Failed to launch an widget");
}
if (status == WIDGET_VISIBILITY_STATUS_SHOW_FIXED) {
- ret = _compositor_freeze_visibility(tbm_obj, VISIBILITY_TYPE_UNOBSCURED);
+ ret = screen_connector_watcher_evas_freeze_visibility(tbm_obj, VISIBILITY_TYPE_UNOBSCURED);
if (ret < 0) {
ErrPrint("Fail to resume the widget(%p):(%d)", widget, ret);
return ret;
}
info->visibility_freeze = status;
} else if (status == WIDGET_VISIBILITY_STATUS_HIDE_FIXED) {
- ret = _compositor_freeze_visibility(tbm_obj, VISIBILITY_TYPE_FULLY_OBSCURED);
+ ret = screen_connector_watcher_evas_freeze_visibility(tbm_obj, VISIBILITY_TYPE_FULLY_OBSCURED);
if (ret < 0) {
ErrPrint("Fail to pause the widget(%p):(%d)", widget, ret);
return ret;
return WIDGET_ERROR_INVALID_PARAMETER;
}
- _compositor_thaw_visibility(tbm_obj);
+ screen_connector_watcher_evas_thaw_visibility(tbm_obj);
info->visibility_freeze = 0;
return WIDGET_ERROR_NONE;
Name: widget_viewer_evas
Description: Support development of the widget Viewer EVAS Frontend library
Version: @VERSION@
-Requires: widget_service widget_toolkit widget_viewer
-Libs: -L${libdir} -lwidget_viewer_evas -lwidget_toolkit
+Requires: widget_service screen_connector_watcher_evas widget_viewer
+Libs: -L${libdir} -lwidget_viewer_evas -lscreen_connector_watcher_evas
Cflags: -I${includedir}
cppflags: -I${includedir}