Set default preedit style as reverse 48/82548/4
authorJihoon Kim <jihoon48.kim@samsung.com>
Thu, 4 Aug 2016 02:17:29 +0000 (19:17 -0700)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 10 Aug 2016 06:46:47 +0000 (23:46 -0700)
Change-Id: I64cda014199e6886d129d9cfe341be70b1209539

ism/extras/wayland_immodule/wayland_imcontext.c

index f604245..b939fbe 100644 (file)
@@ -1803,10 +1803,22 @@ wayland_im_context_preedit_string_with_attributes_get(Ecore_IMF_Context  *ctx,
         Eina_List *l;
         Ecore_IMF_Preedit_Attr *a, *attr;
 
-        EINA_LIST_FOREACH(imcontext->preedit_attrs, l, a) {
-            attr = malloc(sizeof(*attr));
-            attr = memcpy(attr, a, sizeof(*attr));
-            *attrs = eina_list_append(*attrs, attr);
+        if (imcontext->preedit_attrs) {
+            EINA_LIST_FOREACH(imcontext->preedit_attrs, l, a) {
+                attr = malloc(sizeof(*attr));
+                attr = memcpy(attr, a, sizeof(*attr));
+                *attrs = eina_list_append(*attrs, attr);
+            }
+        }
+        else {
+            if (imcontext->preedit_text) {
+                Ecore_IMF_Preedit_Attr *attr = calloc(1, sizeof(*attr));
+                // use REVERSE style as default
+                attr->preedit_type = ECORE_IMF_PREEDIT_TYPE_SUB2;
+                attr->start_index = 0;
+                attr->end_index = strlen(imcontext->preedit_text);
+                *attrs = eina_list_append(*attrs, attr);
+            }
         }
     }