int screen_connector_watcher_evas_thaw_visibility(Evas_Object *obj);
int screen_connector_watcher_evas_send_mouse_up(Evas_Object *obj);
int screen_connector_watcher_evas_send_touch_cancel(Evas_Object *obj);
+
+/**
+ * @brief Add screen connector watcher by rid.
+ * @details Using this API, viewer can watch screen which already watched by other viewer.\n
+ * @since_tizen 3.0
+ * @param[in] obj screen image object
+ * @param[out] pid screen provider pid
+ * @return 0 if success, negative value(<0) if fail
+ *
+ * @remark
+ * This API is only for main viewer. \n
+ * Sub viewer can not get provider's information like provider's pid by screen image object.
+ * @see screen_connector_watcher_evas_add_by_rid()
+*/
int screen_connector_watcher_evas_get_pid(Evas_Object *obj, int *pid);
-int screen_connector_watcher_evas_add_by_rid(screen_connector_watcher_evas_ops *ops, int res_id, void *data);
+
+/**
+ * @brief Add screen connector watcher by rid.
+ * @details Using this API, viewer can watch screen which already watched by other viewer.\n
+ * @since_tizen 3.0
+ * @param[in] ops screen watcher evas callback handler function
+ * @param[in] res_id screen provider rid
+ * @param[in] data user-supplied data for watcher handler
+ * @return @c Not null on success
+ *
+ * @remark
+ * This API is only for sub viewer. \n
+ * Sub viewer can not get provider's information like provider's pid by screen image object.
+*/
+screen_connector_watcher_evas_h screen_connector_watcher_evas_add_by_rid(screen_connector_watcher_evas_ops *ops, int res_id, void *data);
int screen_connector_watcher_evas_get_rid(Evas_Object *obj, int *resource_id);
/**
return 0;
}
-EXPORT_API int screen_connector_watcher_evas_add_by_rid(screen_connector_watcher_evas_ops *ops, int res_id, void *data)
+EXPORT_API screen_connector_watcher_evas_h screen_connector_watcher_evas_add_by_rid(screen_connector_watcher_evas_ops *ops,
+ int res_id, void *data)
{
- GHashTableIter iter;
- gpointer key, value;
screen_connector_watcher_evas_h watcher_evas_h;
- screen_connector_watcher_evas_h cur_h = NULL;
screen_connector_watcher_evas_ops *evas_ops;
- char *appid = NULL;
+ char rid_str[32];
int pid = 0;
screen_connector_watcher_ops watcher_ops;
watcher_ops.missing_cb = __watcher_missing_cb;
watcher_ops.update_cb = __watcher_update_cb;
- g_hash_table_iter_init(&iter, __watcher_tbl);
- while (g_hash_table_iter_next(&iter, &key, &value)) {
- cur_h = (screen_connector_watcher_evas_h)value;
- if (screen_connector_watcher_get_resource_id(cur_h->watcher_h) == res_id) {
- appid = screen_connector_watcher_get_appid(cur_h->watcher_h);
- pid = screen_connector_watcher_get_pid(cur_h->watcher_h);
- break;
- }
- }
-
evas_ops = (screen_connector_watcher_evas_ops *)calloc(1, sizeof(screen_connector_watcher_evas_ops));
if (evas_ops == NULL) {
LOGE("evas_ops calloc fail");
- return -1;
+ return NULL;
}
+ snprintf(rid_str, sizeof(rid_str), "%d", res_id);
memcpy(evas_ops, ops, sizeof(screen_connector_watcher_evas_ops));
watcher_evas_h = (screen_connector_watcher_evas_h)calloc(1, sizeof(struct _screen_connector_watcher_evas_h));
if (watcher_evas_h == NULL) {
LOGE("handle calloc fail");
free(evas_ops);
- return -1;
+ return NULL;
}
+ watcher_evas_h->img_type = -1;
watcher_evas_h->ops = evas_ops;
watcher_evas_h->data = data;
- watcher_evas_h->watcher_h = screen_connector_watcher_create_handle(appid, pid, &watcher_ops, watcher_evas_h);
+ watcher_evas_h->watcher_h = screen_connector_watcher_create_handle(rid_str, pid, &watcher_ops, watcher_evas_h);
+ screen_connector_watcher_set_resource_id(watcher_evas_h->watcher_h, res_id);
screen_connector_watcher_redirect_surface(watcher_evas_h->watcher_h);
- return 0;
+ return watcher_evas_h;
}
EXPORT_API int screen_connector_watcher_evas_get_rid(Evas_Object *obj, int *resource_id)
watcher_evas_h = (screen_connector_watcher_evas_h)g_hash_table_lookup(__watcher_tbl, obj);
if (!watcher_evas_h) {
- LOGE("unknown object. not widget object");
+ LOGE("unknown object.");
return -1;
}
*resource_id = screen_connector_watcher_get_resource_id(watcher_evas_h->watcher_h);
watcher_evas_h = (screen_connector_watcher_evas_h)g_hash_table_lookup(__watcher_tbl, obj);
if (!watcher_evas_h) {
- LOGE("unknown object. not widget object");
+ LOGE("unknown object.");
return -1;
}
*pid = screen_connector_watcher_get_pid(watcher_evas_h->watcher_h);