app_id TEXT not null,
box_type TEXT not null,
auto_launch INT,
+ mouse_event INT,
PRIMARY KEY (box_id) ,
CHECK(1) );
COMMIT;
Name: livebox.web-provider
Summary: web framework for livebox
-Version: 1.9
+Version: 1.10
Release: 1
Group: main/app
License: Flora License, Version 1.0
static const std::string infoTable("LiveboxInfo");
+enum InfoTableField {
+ BOX_ID = 0,
+ APP_ID,
+ BOX_TYPE,
+ AUTO_LAUNCH,
+ MOUSE_EVENT,
+};
+
// TODO this default type should be retrieved more automatically
static const std::string defaultBoxType("app");
return NULL;
}
- const char* box_type = handle->getText(2);
+ const char* box_type = handle->getText(InfoTableField::BOX_TYPE);
const char* box_type_dup = NULL;
if (box_type) {
return NULL;
}
- const char* app_id = handle->getText(1);
+ const char* app_id = handle->getText(InfoTableField::APP_ID);
const char* app_id_dup = NULL;
if (app_id) {
return NULL;
}
- int autoLaunch = handle->getInt(3);
+ int autoLaunch = handle->getInt(InfoTableField::AUTO_LAUNCH);
handle->closeDB();
return autoLaunch;
}
+int web_provider_livebox_get_mouse_event(const char* box_id)
+{
+ if (!box_id) {
+ return NULL;
+ }
+
+ std::shared_ptr<WebProviderDB> handle(new WebProviderDB());
+ if (!handle->openDB()) {
+ return NULL;
+ }
+
+ std::string query = "select * from " + infoTable + " where box_id = ?";
+ if (!handle->setCommand(query, "s", box_id)) {
+ handle->closeDB();
+ return NULL;
+ }
+
+ if (!handle->executeCommand()) {
+ handle->closeDB();
+ return NULL;
+ }
+
+ int mouseEvent = handle->getInt(InfoTableField::MOUSE_EVENT);
+ handle->closeDB();
+
+ return mouseEvent;
+}
+
int web_provider_livebox_insert_box_info(
const char* box_id,
const char* app_id,
const char* box_type,
- int auto_launch)
+ int auto_launch,
+ int mouse_event)
{
if (!box_id || !app_id || !box_type) {
return -1;
std::string query =
"insert into " + infoTable +
- " (box_id, app_id, box_type, auto_launch) values (?,?,?,?)";
+ " (box_id, app_id, box_type, auto_launch, mouse_event) values (?,?,?,?,?)";
- if (!handle->setCommand(query, "sssi", box_id, app_id, box_type, auto_launch)) {
+ if (!handle->setCommand(
+ query, "sssii",
+ box_id, app_id, box_type, auto_launch, mouse_event)) {
handle->closeDB();
return -1;
}
const char* app_id,
const char* box_type)
{
- return web_provider_livebox_insert_box_info(box_id, app_id, box_type, 0);
+ return web_provider_livebox_insert_box_info(box_id, app_id, box_type, 0, 0);
}
int web_provider_livebox_delete_by_box_id(const char* box_id)
const char* app_id,
const char* box_type)
{
- return web_provider_livebox_insert_box_info(box_id, app_id, box_type, 0);
+ return web_provider_livebox_insert_box_info(box_id, app_id, box_type, 0, 0);
}
int web_provider_info_delete_by_box_id(const char* box_id)
EXPORT_API const char* web_provider_livebox_get_box_type(const char* box_id);
EXPORT_API const char* web_provider_livebox_get_app_id(const char* box_id);
EXPORT_API int web_provider_livebox_get_auto_launch(const char* box_id);
+EXPORT_API int web_provider_livebox_get_mouse_event(const char* box_id);
EXPORT_API int web_provider_livebox_insert_box_info(
const char* box_id,
const char* app_id,
const char* box_type,
- int auto_launch);
+ int auto_launch,
+ int mouse_event);
DEPRECATED_API int web_provider_livebox_insert_box_type(
const char* box_id,
const char* app_id,
// static functions
static web_provider_plugin_info* get_parsed_json_data(std::string& configPath);
+static bool web_provider_plugin_release_info(web_provider_plugin_info* info);
static const std::string installedPluginDirPath("/usr/lib/web-provider/");
// Json's content for plugin is the following (example)
// {
// "type" : "clip",
-// "path" : "/usr/lib/web-provider/libweb-provider-plugin-clipbox.so"
+// "path" : "/usr/lib/web-provider/libweb-provider-plugin-clipbox.so",
// "service_boxid" : "org.tizen.browser"
// }
//
static const std::string jsonMemberType("type");
static const std::string jsonMemberPath("path");
static const std::string jsonMemberBoxId("service_boxid");
+static const std::string jsonMemberBoxScrollable("box_scrollable");
+
+static const std::string jsonValueBoolTrue("true");
+static const std::string jsonValueBoolFalse("false");
+static const std::string jsonFileExtension(".json");
web_provider_plugin_info** web_provider_plugin_get_installed_list(int* count)
{
}
for (int i = 0; i < count; i++) {
- if (info_list[i]) {
- if (info_list[i]->type) {
- delete[] info_list[i]->type;
- }
- if (info_list[i]->path) {
- delete[] info_list[i]->path;
- }
- if (info_list[i]->service_boxid) {
- delete[] info_list[i]->service_boxid;
- }
- }
+ web_provider_plugin_release_info(info_list[i]);
+ }
+}
+
+int web_provider_plugin_get_box_scrollable(const char* plugin_type)
+{
+ if (!plugin_type) {
+ return -1;
}
- if (info_list) {
- delete[] info_list;
+
+ std::string configPath;
+ configPath = installedPluginDirPath;
+ configPath += plugin_type;
+ configPath += jsonFileExtension;
+ web_provider_plugin_info* info = get_parsed_json_data(configPath);
+
+ if (!info) {
+ return -1;
}
+ int ret = info->box_scrollable;
+ web_provider_plugin_release_info(info);
+
+ LogD("box_scrollable: %d", ret);
+ return ret;
}
static web_provider_plugin_info* get_parsed_json_data(std::string& configPath)
}
}
+ gboolean hasBoxScrollable =
+ json_object_has_member(object, jsonMemberBoxScrollable.c_str());
+ if (hasBoxScrollable == TRUE) {
+ const char* boxScrollable =
+ static_cast<const char*>(
+ json_object_get_string_member(object, jsonMemberBoxScrollable.c_str()));
+ if (boxScrollable && (jsonValueBoolTrue == boxScrollable)) {
+ info->box_scrollable = 1;
+ } else {
+ info->box_scrollable = 0;
+ }
+ }
+
LogD("type: %s", info->type);
LogD("path: %s", info->path);
if (info->service_boxid) {
LogD("service_boxid: %s", info->service_boxid);
}
+ LogD("box_scrollable: %d", info->box_scrollable);
json_node_free(root);
g_error_free(error);
return info;
}
+
+bool web_provider_plugin_release_info(web_provider_plugin_info* info)
+{
+ LogD("enter");
+ if (!info) {
+ LogD("empty struct");
+ return false;
+ }
+
+ // only members with buffer are released
+ delete info->type;
+ delete info->path;
+ delete info->service_boxid;
+ delete info;
+
+ return true;
+}
const char* type;
const char* path;
const char* service_boxid;
+ int box_scrollable;
};
typedef _web_provider_plugin_info web_provider_plugin_info;
EXPORT_API void web_provider_plugin_release_installed_list(
web_provider_plugin_info** info_list,
int count);
+EXPORT_API int web_provider_plugin_get_box_scrollable(const char* plugin_type);
#ifdef __cplusplus
}
return true;
}
-bool Box::openPd(int width, int height)
+bool Box::openPd(int width, int height, double x, double y)
{
LogD("enter");
CHECK_BOX_STATE(m_state, permitOpenPd);
m_boxInfo->pdWidth = width;
m_boxInfo->pdHeight = height;
+ m_boxInfo->pdX = x;
+ m_boxInfo->pdY = y;
try {
m_updateTimer->stop();
RenderInfoPtr Box::makeRenderInfo(const std::string& renderType) const
{
+ LogD("enter");
RenderInfoPtr renderInfo(new RenderInfo);
+
+ // add width, height, operation type
+ renderInfo->defaultUrlParams = "?type=" + renderType;
+
// set width, height
if (renderType == renderTypeOpenPd) {
renderInfo->width = m_boxInfo->pdWidth;
renderInfo->width = m_boxInfo->boxWidth;
renderInfo->height = m_boxInfo->boxHeight;
}
- // add width, height, operation type
- renderInfo->defaultUrlParams = "?type=" + renderType;
char buff[32];
sprintf(buff, "&width=%d&height=%d", renderInfo->width, renderInfo->height);
renderInfo->defaultUrlParams += buff;
+ // if needed, set pd information
+ if (renderType == renderTypeOpenPd) {
+ renderInfo->defaultUrlParams += "&pdopen-direction=";
+ if (m_boxInfo->pdY == 0.0f) {
+ renderInfo->defaultUrlParams += "down";
+ } else {
+ renderInfo->defaultUrlParams += "up";
+ }
+
+ char buff[32];
+ sprintf(buff, "&pdopen-arrow-xpos=%d",
+ static_cast<int>((m_boxInfo->pdX) * (m_boxInfo->pdWidth)));
+ renderInfo->defaultUrlParams += buff;
+ }
+
+
// add content info
if (!m_boxInfo->contentInfo.empty()) {
renderInfo->defaultUrlParams += "&" + m_boxInfo->contentInfo;
bool resize(int width, int height);
bool resume();
bool pause();
- bool openPd(int width, int height);
+ bool openPd(int width, int height, double x, double y);
bool closePd();
bool update();
bool changePeriod(float period);
int boxHeight;
int pdWidth;
int pdHeight;
+ double pdX;
+ double pdY;
int priority;
float period;
std::string contentInfo;
boxHeight(0),
pdWidth(0),
pdHeight(0),
+ pdX(0.0f),
+ pdY(0.0f),
priority(0),
period(0),
contentInfo()
result = requestPauseAll();
break;
case REQUEST_CMD_OPEN_PD:
- result = requestOpenPd(boxInfo->instanceId, boxInfo->pdWidth, boxInfo->pdHeight);
+ result = requestOpenPd(boxInfo->instanceId,
+ boxInfo->pdWidth, boxInfo->pdHeight,
+ boxInfo->pdX, boxInfo->pdY);
break;
case REQUEST_CMD_CLOSE_PD:
result = requestClosePd(boxInfo->instanceId);
return true;
}
-bool BoxManager::requestOpenPd(std::string& instanceId, int width, int height)
+bool BoxManager::requestOpenPd(
+ std::string& instanceId,
+ int width, int height, double x, double y)
{
LogD("enter");
IBoxPtr box = searchBoxMap(instanceId);
return false;
}
- return box->openPd(width, height);
+ return box->openPd(width, height, x, y);
}
bool BoxManager::requestClosePd(std::string& instanceId)
virtual bool requestPauseBox(std::string& instanceId);
virtual bool requestResumeAll();
virtual bool requestPauseAll();
- virtual bool requestOpenPd(std::string& instanceId, int width, int height);
+ virtual bool requestOpenPd(
+ std::string& instanceId,
+ int width, int height, double x, double y);
virtual bool requestClosePd(std::string& instanceId);
virtual bool requestChangePeriod(std::string& instanceId, float period);
// ewk context deleter
virtual bool resize(int width, int height) = 0;
virtual bool resume() = 0;
virtual bool pause() = 0;
- virtual bool openPd(int width, int height) = 0;
+ virtual bool openPd(int width, int height, double x, double y) = 0;
virtual bool closePd() = 0;
virtual bool update() = 0;
virtual bool changePeriod(float period) = 0;
info->pdWidth = arg->info.pd_create.w;
info->pdHeight = arg->info.pd_create.h;
+ info->pdX = arg->info.pd_create.x;
+ info->pdY = arg->info.pd_create.y;
LogD("--------------------------------------------");
LogD("boxId: %s", info->boxId.c_str());
LogD("InstanceId: %s", info->instanceId.c_str());
LogD("width: %d", info->pdWidth);
LogD("height: %d", info->pdHeight);
+ LogD("x: %f", info->pdX);
+ LogD("y: %f", info->pdY);
LogD("--------------------------------------------");
return ecore_job_add(
* @author Yunchan Cho (yunchan.cho@samsung.com)
*/
#include <string>
-#include <livebox-service.h>
+#include <API/web_provider_livebox_info.h>
#include <Core/Buffer/RenderBuffer.h>
#include <Core/Util/Log.h>
#include "AppBoxRenderView.h"
, m_renderView()
{
LogD("enter");
- if (livebox_service_mouse_event(m_boxId.c_str())) {
+ if (web_provider_livebox_get_mouse_event(m_boxId.c_str())) {
m_mouseEventRecievable = true;
}
deleteRenderTimer();
// stop touch timer
- if (livebox_service_mouse_event(m_boxId.c_str())) {
+ if (web_provider_livebox_get_mouse_event(m_boxId.c_str())) {
m_renderBuffer->deleteTouchTimer();
}
This->m_fireRenderTimer = NULL;
This->m_renderBuffer->stopCanvasUpdate();
- if (livebox_service_mouse_event(This->m_boxId.c_str())) {
+ if (web_provider_livebox_get_mouse_event(This->m_boxId.c_str())) {
// stop touch timer
This->m_renderBuffer->deleteTouchTimer();
This->m_view->Suspend();