weston-ivi-shell and ilmControl: Implement 'set keyboard focus'
authorJonathan Maw <jonathan.maw@codethink.co.uk>
Thu, 7 Aug 2014 16:47:44 +0000 (16:47 +0000)
committerNobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Thu, 6 Nov 2014 08:18:34 +0000 (17:18 +0900)
This commit implements ilm_SetKeyboardFocusOn by using the "ivi
controller surface" interface, implementing the specific case
of keyboard focus.

It expands ivi-layout.h and ivi-layout-export.h so that keyboard
focus can be stored on a per-surface basis.

Signed-off-by: James Thomas <james.thomas@codethink.co.uk>
ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
weston-ivi-shell/src/ivi-controller.c
weston-ivi-shell/src/ivi-layout-export.h
weston-ivi-shell/src/ivi-layout.h

index f09a307..b1c0787 100644 (file)
@@ -2135,8 +2135,18 @@ ILM_EXPORT ilmErrorTypes
 ilm_SetKeyboardFocusOn(t_ilm_surface surfaceId)
 {
     ilmErrorTypes returnValue = ILM_FAILED;
-    (void)surfaceId;
-    returnValue = ILM_SUCCESS;
+    struct ilm_control_context *ctx = sync_and_acquire_instance();
+    struct surface_context *ctx_surf =
+        get_surface_context(&ctx->wl, (uint32_t)surfaceId);
+
+    if (ctx_surf != NULL
+        && ctx_surf->prop.inputDevicesAcceptance & ILM_INPUT_DEVICE_KEYBOARD)
+    {
+        ivi_controller_surface_set_input_focus(ctx_surf->controller,
+                        IVI_CONTROLLER_SURFACE_INPUT_DEVICE_KEYBOARD, 1);
+        returnValue = ILM_SUCCESS;
+    }
+    release_instance();
     return returnValue;
 }
 
index 807b616..0f152e1 100755 (executable)
@@ -1071,9 +1071,13 @@ controller_surface_set_input_focus(struct wl_client *client,
               int32_t enabled)
 {
     (void)client;
-    (void)resource;
-    (void)device;
-    (void)enabled;
+    struct ivisurface *ivisurf = wl_resource_get_user_data(resource);
+
+    if (device & IVI_CONTROLLER_SURFACE_INPUT_DEVICE_KEYBOARD) {
+        if (enabled) {
+            ivi_layout_SetKeyboardFocusOn(ivisurf->layout_surface);
+        }
+    }
 }
 
 static const
index f24fa99..3d1afc9 100644 (file)
@@ -68,6 +68,7 @@ enum ivi_layout_notification_mask {
     IVI_NOTIFICATION_ADD         = (1 << 9),
     IVI_NOTIFICATION_REMOVE      = (1 << 10),
     IVI_NOTIFICATION_CONFIGURE   = (1 << 11),
+    IVI_NOTIFICATION_KEYBOARD_FOCUS = (1 << 12),
     IVI_NOTIFICATION_ALL         = 0xFFFF
 };
 
index 8cca33c..7a53733 100644 (file)
@@ -87,6 +87,7 @@ struct ivi_layout_SurfaceProperties
     int32_t  creatorPid;
     int32_t  transitionType;
     uint32_t transitionDuration;
+    uint32_t hasKeyboardFocus;
 };
 
 struct ivi_layout_LayerProperties