ecore_imf/wayland: support feature to change layout of virtual keyboard
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 20 May 2015 09:47:58 +0000 (18:47 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 20 May 2015 09:47:58 +0000 (18:47 +0900)
src/modules/ecore_imf/wayland/wayland_imcontext.c
src/modules/ecore_imf/wayland/wayland_imcontext.h
src/modules/ecore_imf/wayland/wayland_module.c

index d6679bd..adc5367 100644 (file)
@@ -75,6 +75,7 @@ struct _WaylandIMContext
 
    uint32_t serial;
    uint32_t reset_serial;
+   uint32_t content_purpose;
 };
 
 static unsigned int
@@ -643,6 +644,10 @@ wayland_im_context_focus_in(Ecore_IMF_Context *ctx)
         wl_text_input_show_input_panel(imcontext->text_input);
         wl_text_input_activate(imcontext->text_input, seat,
                                ecore_wl_window_surface_get(imcontext->window));
+
+        wl_text_input_set_content_type(imcontext->text_input,
+                                       WL_TEXT_INPUT_CONTENT_HINT_NONE,
+                                       imcontext->content_purpose);
      }
 }
 
@@ -813,6 +818,47 @@ wayland_im_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int
      }
 }
 
+EAPI void
+wayland_im_context_input_panel_layout_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout)
+{
+   WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx);
+
+   switch (layout) {
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER:
+         imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NUMBER;
+         break;
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL:
+         imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_EMAIL;
+         break;
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_URL:
+         imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_URL;
+         break;
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER:
+         imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_PHONE;
+         break;
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_IP:
+         imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NUMBER;
+         break;
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_MONTH:
+         imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_DATE;
+         break;
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY:
+        imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_DIGITS;
+        break;
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_TERMINAL:
+        imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_TERMINAL;
+        break;
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD:
+        imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_PASSWORD;
+        break;
+      case ECORE_IMF_INPUT_PANEL_LAYOUT_DATETIME:
+        imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_DATETIME;
+        break;
+      default:
+        imcontext->content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NORMAL;
+        break;
+   }
+}
 
 WaylandIMContext *wayland_im_context_new (struct wl_text_input_manager *text_input_manager)
 {
index fb6906c..111dd5f 100644 (file)
@@ -60,6 +60,9 @@ EAPI void wayland_im_context_cursor_location_set(Ecore_IMF_Context    *ctx,
                                                  int                   width,
                                                  int                   height);
 
+EAPI void wayland_im_context_input_panel_layout_set(Ecore_IMF_Context *ctx,
+                                                    Ecore_IMF_Input_Panel_Layout layout);
+
 WaylandIMContext *wayland_im_context_new        (struct wl_text_input_manager *text_input_manager);
 
 extern int _ecore_imf_wayland_log_dom;
index 13d09f2..d189d6b 100644 (file)
@@ -64,7 +64,7 @@ static Ecore_IMF_Context_Class wayland_imf_class =
    NULL,                                      /* autocapital_type_set */
    NULL,                                      /* control panel show */
    NULL,                                      /* control panel hide */
-   NULL,                                      /* input_panel_layout_set */
+   wayland_im_context_input_panel_layout_set, /* input_panel_layout_set */
    NULL,                                      /* input_panel_layout_get, */
    NULL,                                      /* input_panel_language_set, */
    NULL,                                      /* input_panel_language_get, */