From: Ji-hoon Lee Date: Mon, 17 Oct 2016 09:40:26 +0000 (+0900) Subject: Modified to decorate preedit strings by underlining X-Git-Tag: accepted/tizen/common/20161017.170411~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F39%2F92539%2F2;p=platform%2Fcore%2Fuifw%2Fise-default.git Modified to decorate preedit strings by underlining Change-Id: I1216980c9240c5c45e8f35a9bdfcad437c08b249 --- diff --git a/src/include/ise.h b/src/include/ise.h index 5a3b491..9d6d66c 100644 --- a/src/include/ise.h +++ b/src/include/ise.h @@ -233,7 +233,7 @@ class CCoreEventCallback : public ISCLCoreEventCallback }; void ise_send_string(const sclchar *key_value); -void ise_update_preedit_string(const sclchar *str); +void ise_update_preedit_string(const sclchar *str, const sclboolean underline = TRUE); void ise_send_event(sclulong key_event, sclulong key_mask); void ise_forward_key_event(sclulong key_event); diff --git a/src/ise.cpp b/src/ise.cpp index e09b692..14c6bb9 100644 --- a/src/ise.cpp +++ b/src/ise.cpp @@ -15,6 +15,8 @@ * */ +#define Uses_SCIM_ATTRIBUTE + #include #include #include @@ -23,6 +25,7 @@ #include #include #include +#include #include "sclui.h" #include "sclcore.h" @@ -692,13 +695,28 @@ ise_send_string(const sclchar *key_value) * Send the preedit string to input framework */ void -ise_update_preedit_string(const sclchar *str) +ise_update_preedit_string(const sclchar *str, const sclboolean underline) { int ic = -1; if (!check_ic_temporary(g_keyboard_state.ic)) { ic = g_keyboard_state.ic; } - g_core.update_preedit_string(ic, "", str); + if (underline) { + /* Count UTF-8 string length */ + int len = 0; + const sclchar *s = str; + while (*s) len += (*s++ & 0xc0) != 0x80; + scim::Attribute attr; + attr.set_start(0); + attr.set_length(len); + attr.set_type(scim::SCIM_ATTR_DECORATE); + attr.set_value(scim::SCIM_ATTR_DECORATE_UNDERLINE); + std::vector underline_attribute; + underline_attribute.push_back(attr); + g_core.update_preedit_string(ic, "", str, underline_attribute); + } else { + g_core.update_preedit_string(ic, "", str); + } LOGD("ic : %x, %s\n", ic, str); } diff --git a/src/sdk/sdk.cpp b/src/sdk/sdk.cpp index ae6a22e..d17c9ce 100644 --- a/src/sdk/sdk.cpp +++ b/src/sdk/sdk.cpp @@ -174,7 +174,7 @@ int process_korean_automata(int is_consonant, unsigned short key_index, bool ski iconv_string(AUTOMATA_BASE_ENCODING, SYSTEM_OUTPUT_ENCODING, (const char*)(CJI_GetMakeCode().ucode), buffer, CJI_GetMakeCode().size * 2, KOREAN_ENCODING_BUFFER_SIZE); if (buffer[0] || makecode.size > 0) { - ise_update_preedit_string(buffer); + ise_update_preedit_string(buffer, FALSE); ret = TRUE; }