ilmControl, LayerManagerControl: Add ilm_GetKeyboardMultiFocusSurfaceIds and make...
authorJonathan Maw <jonathan.maw@codethink.co.uk>
Tue, 28 Oct 2014 15:41:20 +0000 (15:41 +0000)
committerNobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Fri, 14 Nov 2014 04:43:55 +0000 (13:43 +0900)
The function ilm_GetKeyboardFocusSurfaceId is retained for backwards
compatibility.

ivi-layermanagement-api/ilmControl/include/ilm_control.h
ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
ivi-layermanagement-examples/LayerManagerControl/src/control.cpp

index 405abc9..430d846 100644 (file)
@@ -408,6 +408,17 @@ ilmErrorTypes ilm_GetKeyboardFocusSurfaceId(t_ilm_surface* pSurfaceId);
 ilmErrorTypes ilm_SetKeyboardMultiFocus(t_ilm_surface *pSurfaceIds, t_ilm_int number);
 
 /**
+ * \brief Get the indentifiers of all the surfaces that have keyboard focus
+ *
+ * \ingroup ilmControl
+ * \param[out] pSurfaceIds Pointer to the list of surface IDs
+ * \param[in]  size The total available number of elements in pSurfaceIds
+ * \param[out] pCount Pointer to the number of surface IDs that were returned
+ * \return ILM_SUCCESS if the method call was successful
+ * \return ILM_FAILED if the client can not call the method on the service.
+ */
+ilmErrorTypes ilm_GetKeyboardMultiFocusSurfaceIds(t_ilm_surface *pSurfaceIds, t_ilm_int size, t_ilm_int *pCount);
+/**
  * \brief Set the destination area of a surface within a layer for rendering. The surface will be scaled to this rectangle for rendering.
  * \ingroup ilmControl
  * \param[in] surfaceId Id of surface.
index 8f25b39..4511bc0 100644 (file)
@@ -2205,6 +2205,30 @@ ilm_SetKeyboardMultiFocus(t_ilm_surface *pSurfaceIds, t_ilm_int number)
 }
 
 ILM_EXPORT ilmErrorTypes
+ilm_GetKeyboardMultiFocusSurfaceIds(t_ilm_surface *pSurfaceIds, t_ilm_int size,
+                                    t_ilm_int *pCount)
+{
+    struct ilm_control_context *ctx = sync_and_acquire_instance();
+    struct surface_context *ctx_surf;
+
+    *pCount = 0;
+    wl_list_for_each(ctx_surf, &ctx->wl.list_surface, link) {
+        if (ctx_surf->prop.hasKeyboardFocus) {
+            if (*pCount >= size) {
+                fprintf(stderr, "not enough space to store surface IDs\n");
+                break;
+            }
+            pSurfaceIds[*pCount] = ctx_surf->id_surface;
+            (*pCount)++;
+        }
+    }
+
+    release_instance();
+
+    return ILM_SUCCESS;
+}
+
+ILM_EXPORT ilmErrorTypes
 ilm_surfaceSetDestinationRectangle(t_ilm_surface surfaceId,
                                    t_ilm_int x, t_ilm_int y,
                                    t_ilm_int width, t_ilm_int height)
index 7404b2a..26492a1 100644 (file)
@@ -96,12 +96,23 @@ void setSurfaceKeyboardFocus(t_ilm_surface surface)
 
 void getKeyboardFocus()
 {
-    t_ilm_surface surfaceId;
+    t_ilm_surface surfaceIds[1024];
+    t_ilm_int surfaceCount;
 
-    ilmErrorTypes callResult = ilm_GetKeyboardFocusSurfaceId(&surfaceId);
+    ilmErrorTypes callResult;
+
+    callResult = ilm_GetKeyboardMultiFocusSurfaceIds((t_ilm_surface*)surfaceIds,
+                                                     1024, &surfaceCount);
     if (ILM_SUCCESS == callResult)
     {
-        cout << "keyboardFocusSurfaceId == " << surfaceId << endl;
+        cout << "keyboardFocusSurfaceId == ";
+        for (int i = 0; i < surfaceCount; i++)
+        {
+            cout << surfaceIds[i];
+            if (i + 1 < surfaceCount)
+                cout << ",";
+        }
+        cout << endl;
     }
     else
     {