ime_preedit_attribute *attr;
g_variant_get(parameters, "(a(v)&s)", &attr_iter, &preedit_string);
- if (!attr_iter || !preedit_string)
+ if (!attr_iter || !preedit_string) {
LOGE("Failed to get variant");
+ return;
+ }
while (g_variant_iter_loop (attr_iter, "(v)", &iter_body)) {
g_variant_get(iter_body, "(uuuu)", &start, &length, &type, &value);
char *dev_name = NULL;
g_variant_get(parameters, "(a{sv}&s)", &key_event_iter, &dev_name);
- if (!key_event_iter)
+ if (!key_event_iter) {
LOGD("Failed to get iter");
+ return;
+ }
key_event.dev_name = std::string(dev_name);
while (g_variant_iter_loop (key_event_iter, "{sv}", &key, &value)) {
scim::AttributeList attr;
g_variant_get(parameters, "(a(v)&s&si)", &attr_iter, &preedit_string, &commit_string, &caret);
- if (!attr_iter || !preedit_string || !commit_string)
+ if (!attr_iter || !preedit_string || !commit_string) {
LOGE("Failed to get variant");
+ return;
+ }
while (g_variant_iter_loop (attr_iter, "(v)", &iter_body)) {
g_variant_get(iter_body, "(uuuu)", &start, &length, &type, &value);
scim::AttributeList attr;
g_variant_get(parameters, "(a(v)&s)", &attr_iter, &aux_string);
- if (!attr_iter || !aux_string)
+ if (!attr_iter || !aux_string) {
LOGE("Failed to get variant");
+ return;
+ }
while (g_variant_iter_loop (attr_iter, "(v)", &iter_body)) {
g_variant_get(iter_body, "(uuuu)", &start, &length, &type, &value);
scim::AttributeList attr;
g_variant_get(parameters, "(a(v)&s&sii)", &attr_iter, &preedit_string, &commit_string, &offset, &len);
- if (!attr_iter || !preedit_string || !commit_string)
+ if (!attr_iter || !preedit_string || !commit_string) {
LOGE("Failed to get variant");
+ return;
+ }
while (g_variant_iter_loop (attr_iter, "(v)", &iter_body)) {
g_variant_get(iter_body, "(uuuu)", &start, &length, &type, &value);
char *tip = NULL;
g_variant_get(parameters, "(a(v))", &list_iter);
- if (!list_iter)
+ if (!list_iter) {
LOGE("Failed to get variant");
+ return;
+ }
while (g_variant_iter_loop (list_iter, "(v)", &iter_body)) {
g_variant_get(iter_body, "(&s&s&s&s)", &key, &label, &icon, &tip);
return image_ob;
}
-static sclboolean check_nine_patch_png_file(const char *image_path)
-{
- sclboolean found = FALSE;
- for (sclint loop = strlen(image_path);!found && loop > 0;loop--) {
- if (image_path[loop] == '.') {
- found = TRUE;
- if (loop >= 2) { // for checking prefix ".#" and ".9"
- if (strcasecmp(image_path + loop - 2, ".#.png") == 0 ||
- strcasecmp(image_path + loop - 2, ".9.png") == 0) {
- return TRUE;
- }
- }
- }
- }
- return FALSE;
-}
-
SclNinePatchInfo get_nine_patch_info_from_png_file(Evas_Object *image_data, sclint w, sclint h)
{
/* FIXME : Assuming we're dealing with 32bit image, need to check if there's any other cases */
}
return NULL;
-
- CSCLResourceCache *cache = CSCLResourceCache::get_instance();
- CSCLWindows *windows = CSCLWindows::get_instance();
- CSCLUtils *utils = CSCLUtils::get_instance();
- SclWindowContext *window_context = NULL;
- SclWindowContext *target_window_context = NULL;
- if (windows && window) {
- //window_context = windows->get_window_context(window, FALSE);
- window_context = windows->get_window_context(window);
- //target_window_context = windows->get_window_context(draw_ctx, FALSE);
- target_window_context = windows->get_window_context(draw_ctx);
- }
-
- if (window_context && target_window_context && image_path && utils && cache && windows) {
- sclboolean is_highlight_ui = FALSE;
- sclchar buf[_POSIX_PATH_MAX] = {0};
- utils->get_decomposed_path(buf, IMG_PATH_PREFIX, image_path);
- if (strcmp(buf, SCL_HIGHLIGHT_UI_IMAGE) == 0) {
- is_highlight_ui = TRUE;
- }
-
- if (strlen(image_path) > 0) {
-#ifdef DO_NOT_MOVE_MAGNIFIER_WINDOW
- if (window == windows->get_magnifier_window()) {
- dest_x += magnifierx;
- dest_y += magnifiery;
- }
-#endif
-#ifdef TEST_NEWBACKEND
- sclboolean bFound = FALSE;
- sclboolean bOrgSizeMinusOne = (src_width == -1 && src_height == -1);
- sclint hashval = hash_string(image_path);
- /*for(std::list<ImageCache>::iterator iter = g_ImageCache.begin();
- bFound && iter != g_ImageCache.end();std::advance(iter, 1)) {*/
- for (sclint loop = 0;loop < (sclint)g_ImageCache.size() && !bFound;loop++) {
- if (
- /* (*iter).used &&
- window == (*iter).window &&
- hashval == (*iter).imgPathHash &&
- dest_x == (*iter).dest_x &&
- dest_y == (*iter).dest_y &&
- dest_width == (*iter).dest_width &&
- dest_height == (*iter).dest_height &&
- src_x == (*iter).src_x &&
- src_y == (*iter).src_y &&
- src_width == (*iter).src_width &&
- src_height == (*iter).src_height &&
- extrace_image == (*iter).extrace_image*/
- g_ImageCache[loop].used &&
- window == g_ImageCache[loop].window &&
- hashval == g_ImageCache[loop].imgPathHash &&
- dest_x == g_ImageCache[loop].dest_x &&
- dest_y == g_ImageCache[loop].dest_y &&
- dest_width == g_ImageCache[loop].dest_width &&
- dest_height == g_ImageCache[loop].dest_height &&
- src_x == g_ImageCache[loop].src_x &&
- src_y == g_ImageCache[loop].src_y &&
- src_width == g_ImageCache[loop].src_width &&
- src_height == g_ImageCache[loop].src_height &&
- extrace_image == g_ImageCache[loop].extrace_image
- )
- {
- //if (strcmp(image_path, (*iter).image_path) == 0) {
- if (strcmp(image_path, g_ImageCache[loop].image_path) == 0) {
- bFound = TRUE;
- //evas_object_show((*iter).image);
- evas_object_show(g_ImageCache[loop].image);
- evas_object_raise(g_ImageCache[loop].image);
- if (g_ImageCache[loop].clipper) {
- evas_object_show(g_ImageCache[loop].clipper);
- evas_object_raise(g_ImageCache[loop].clipper);
- }
- }
- }
- }
- if (!bFound) {
-#endif
- EFLObject *clip_object = NULL;
-
- Evas_Object *window_object = (Evas_Object*)window;
- if (window_context->is_virtual) {
- window_object = static_cast<Evas_Object*>(windows->get_base_window());
- }
-
- Evas *evas = evas_object_evas_get(window_object);
- Evas_Object *image_object = NULL;
- if (is_highlight_ui && m_highlight_ui_object) {
- image_object = m_highlight_ui_object;
- const SclNinePatchInfo *nine_patch_info = utils->get_nine_patch_info(image_path);
- if (nine_patch_info) {
- evas_object_image_border_set(image_object,
- nine_patch_info->left, nine_patch_info->right, nine_patch_info->top, nine_patch_info->bottom);
- }
- evas_object_move(image_object, dest_x, dest_y);
- evas_object_raise(image_object);
- evas_object_show(image_object);
- } else {
- EFLObject *object = new EFLObject;
- if (object) {
- image_object = evas_object_image_add(evas);
- object->extracted = FALSE;
-
- if (image_object) {
- int image_width = 0;
- int image_height = 0;
- evas_object_image_file_set(image_object, image_path, NULL);
- evas_object_image_size_get(image_object, &image_width, &image_height);
-
- sclboolean is_nine_patch_png = check_nine_patch_png_file(image_path);
- if (is_nine_patch_png) {
- std::map<std::string, SclNinePatchInfo>::iterator it = _nine_patch_map.find(image_path);
- if (it != _nine_patch_map.end()) {
- evas_object_image_border_set(image_object,
- (*it).second.left, (*it).second.right, (*it).second.top, (*it).second.bottom);
- } else {
- SclNinePatchInfo info = get_nine_patch_info_from_png_file(image_object, image_width, image_height);
- evas_object_image_border_set(image_object, info.left, info.right, info.top, info.bottom);
- _nine_patch_map[std::string(image_path)] = info;
- }
- } else if (cachedinfo) {
- evas_object_image_border_set(image_object,
- cachedinfo->nine_patch_left,
- cachedinfo->nine_patch_right,
- cachedinfo->nine_patch_top,
- cachedinfo->nine_patch_bottom);
- } else {
- const SclNinePatchInfo *nine_patch_info = utils->get_nine_patch_info(image_path);
- if (nine_patch_info) {
- evas_object_image_border_set(image_object,
- nine_patch_info->left, nine_patch_info->right, nine_patch_info->top, nine_patch_info->bottom);
- }
- }
- const SclLayout *layout = cache->get_cur_layout(window);
- if (layout) {
- if (layout->display_mode == DISPLAYMODE_PORTRAIT) {
- image_width = utils->get_scaled_x(image_width);
- image_height = utils->get_scaled_y(image_height);
- } else {
- image_width = utils->get_scaled_y(image_width);
- image_height = utils->get_scaled_x(image_height);
- }
- }
- if (src_width == -1 && src_height == -1) {
- src_width = image_width;
- src_height = image_height;
- }
- if ((src_width > 0 && src_height > 0) &&
- (image_width != dest_width || image_height != dest_height) && extrace_image) {
- #ifdef EXTRACT_PARTIMAGE
- Evas_Object *newobj = extract_partimage_from_fullimage(image_object, src_x, src_y, 0, 0, src_width, src_height);
- object->extracted = TRUE;
- evas_object_del(image_object);
- image_object = newobj;
- evas_object_move(image_object, dest_x, dest_y);
- if (dest_width > 0 && dest_height > 0) {
- evas_object_image_fill_set(image_object, 0, 0, dest_width, dest_height);
- evas_object_resize(image_object, dest_width, dest_height);
- }
- #else
- //evas_object_move(image_object, src_x - dest_x, src_y - dest_y);
- evas_object_move(image_object, dest_x - src_x, dest_y - src_y);
- evas_object_image_fill_set(image_object, 0, 0, image_width, image_height);
- evas_object_resize(image_object, image_width, image_height);
-
- Evas_Object *clipper = evas_object_rectangle_add(evas);
- evas_object_color_set(clipper, 255, 255, 255, 255);
- //evas_object_color_set(clipper, 0, 0, 0, 0);
- evas_object_move(clipper, dest_x, dest_y);
- evas_object_resize(clipper, dest_width, dest_height);
- evas_object_clip_set(image_object, clipper);
- evas_object_show(clipper);
-
- clip_object = new EFLObject;
- if (clip_object) {
- clip_object->object = clipper;
- clip_object->type = EFLOBJECT_CLIPOBJECT;
- clip_object->position.x = dest_x;
- clip_object->position.y = dest_y;
- clip_object->position.width = dest_width;
- clip_object->position.height = dest_height;
- clip_object->etc_info = image_path;
- clip_object->extracted = FALSE;
- clip_object->data = NULL;
- }
- #endif
- } else {
- evas_object_move(image_object, dest_x, dest_y);
- if (dest_width > 0 && dest_height > 0) {
- if (is_nine_patch_png) {
- evas_object_image_fill_set(image_object, -1, -1, dest_width + 2, dest_height + 2);
- } else {
- evas_object_image_fill_set(image_object, 0, 0, dest_width, dest_height);
- }
- evas_object_resize(image_object, dest_width, dest_height);
- }
- }
- evas_object_raise(image_object);
- evas_object_show(image_object);
-
- //evas_object_event_callback_add((Evas_Object*)image_object, EVAS_CALLBACK_MOUSE_DOWN, mouse_press, window);
- /*evas_object_event_callback_add((Evas_Object*)image_object, EVAS_CALLBACK_MOUSE_UP, mouse_release, window);
- evas_object_event_callback_add((Evas_Object*)image_object, EVAS_CALLBACK_MOUSE_MOVE, mouse_move, window);*/
-
- object->object = image_object;
- object->type = EFLOBJECT_IMAGE;
- object->position.x = dest_x;
- object->position.y = dest_y;
- object->position.width = dest_width;
- object->position.height = dest_height;
- object->etc_info = image_path;
- object->data = clip_object;
-
- if (is_highlight_ui) {
- delete object;
- } else {
- target_window_context->etc_info =
- eina_list_append((Eina_List*)(target_window_context->etc_info), object);
- if (clip_object) {
- target_window_context->etc_info =
- eina_list_append((Eina_List*)(target_window_context->etc_info), clip_object);
- }
- }
-
- /* FIXME : this is for placing the background image at the lowest depth */
- sclint window_layer = 29000;
- if (!windows->is_base_window(reinterpret_cast<sclwindow>(draw_ctx))) {
- window_layer = 29010;
- }
- //SclRectangle rt;
- //windows->get_window_rect(window, &rt);
- //if (rt.width == dest_width && rt.height == dest_height) {
- if (window_context->geometry.width == dest_width &&
- window_context->geometry.height == dest_height) {
- //evas_object_lower(image_object);
- evas_object_layer_set(image_object, window_layer + 0);
- } else {
- evas_object_layer_set(image_object, window_layer + 1);
- }
- return image_object;
- } else {
- delete object;
- object = NULL;
- }
- }
- }
-#ifdef TEST_NEWBACKEND
- ImageCache cache;
- cache.used = true;
- cache.window = window;
- strncpy(cache.image_path, image_path, sizeof(cache.image_path));
- cache.imgPathHash = hashval;
- cache.dest_x = dest_x;
- cache.dest_y = dest_y;
- cache.dest_width = dest_width;
- cache.dest_height = dest_height;
- cache.src_x = src_x;
- cache.src_y = src_y;
- if (bOrgSizeMinusOne) {
- cache.src_width = -1;
- cache.src_height = -1;
- } else {
- cache.src_width = src_width;
- cache.src_height = src_height;
- }
- cache.extrace_image = extrace_image;
- cache.image = object->object;
- if (clip_object) {
- cache.clipper = clip_object->object;
- } else {
- cache.clipper = NULL;
- }
-
- //g_ImageCache.insert(g_ImageCache.end(), cache);
- sclboolean bInserted = FALSE;
- for (sclint loop = 0;loop < (sclint)g_ImageCache.size() && !bInserted;loop++) {
- if (!g_ImageCache[loop].used) {
- g_ImageCache[loop] = cache;
- }
- }
- if (!bInserted) {
- g_ImageCache.push_back(cache);
- }
- }
-#endif
- }
- }
- return NULL;
}
sclimage