Fix event dispatcher of surface and layer
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Wed, 12 Sep 2018 02:26:08 +0000 (11:26 +0900)
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Wed, 12 Sep 2018 02:42:05 +0000 (11:42 +0900)
Change-Id: I0bb83298a1750e4363d59ddf30ceb13402d76e0f
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
src/wm_layer_control.cpp

index 30c37f9..31f6c4f 100644 (file)
@@ -277,7 +277,7 @@ WMError LayerControl::loadLayerSetting(const string &path)
     int ret = jh::inputJsonFilie(path.c_str(), &json_obj);
     if (0 > ret)
     {
-        HMI_DEBUG("Could not open %s, so use default area information", path.c_str());
+        HMI_ERROR("Could not open %s", path.c_str());
         return WMError::FAIL;
     }
     HMI_INFO("json_obj dump:%s", json_object_get_string(json_obj));
@@ -310,7 +310,7 @@ WMError LayerControl::loadAreaDb(const std::string& path)
     int ret = jh::inputJsonFilie(path.c_str(), &json_obj);
     if (0 > ret)
     {
-        HMI_DEBUG("Could not open %s, so use default area information", path.c_str());
+        HMI_ERROR("Could not open %s", path.c_str());
         return WMError::FAIL;
     }
     HMI_INFO("json_obj dump:%s", json_object_get_string(json_obj));
@@ -446,7 +446,10 @@ void LayerControl::dispatchCreateEvent(ilmObjectType object, unsigned id, bool c
             ilmErrorTypes rc;
             rc = ilm_getPropertiesOfSurface(id, &sp);
             if(rc != ILM_SUCCESS)
+            {
+                HMI_ERROR("Failed to get surface %d property due to %d", id, ilm_getError());
                 return;
+            }
             this->cb.surfaceCreated(sp.creatorPid, id);
             ilm_surfaceAddNotification(id, surfaceCallback_static);
             ilm_surfaceSetVisibility(id, ILM_TRUE);
@@ -461,11 +464,12 @@ void LayerControl::dispatchCreateEvent(ilmObjectType object, unsigned id, bool c
         if(created)
         {
             ilm_layerAddNotification(id, layerCallback_static);
-            // this->cb->layerCreated(id);
         }
         else
         {
-            // this->cb->layerDestroyed(id); // Means Application is dead.
+            // Ignore here. Nothing to do currently.
+            // Process of application dead is handled by Window Manager
+            // from binder notification
         }
     }
 }
@@ -474,65 +478,32 @@ void LayerControl::dispatchPropertyChangeEvent(unsigned id,
         struct ilmSurfaceProperties* sprop,
         t_ilm_notification_mask mask)
 {
-    pid_t pid = sprop->creatorPid;
-    HMI_DEBUG("pid : %d", pid);
-
+    /*
+      ILM_NOTIFICATION_CONTENT_AVAILABLE & ILM_NOTIFICATION_CONTENT_REMOVED
+      are not handled here, handled in create/destroy event
+     */
     if (ILM_NOTIFICATION_VISIBILITY & mask)
     {
-        //this->cb->surfaceVisibilityChanged(id, sprop->visibility);
+        HMI_DEBUG("surface %d turns visibility %d", id, sprop->visibility);
     }
     if (ILM_NOTIFICATION_OPACITY & mask)
     {
-    }
-    if (ILM_NOTIFICATION_ORIENTATION & mask)
-    {
+        HMI_DEBUG("surface %d turns opacity %f", id, sprop->opacity);
     }
     if (ILM_NOTIFICATION_SOURCE_RECT & mask)
     {
-        // this->cb->surfaceSourceRectChanged(id, )
+        HMI_DEBUG("surface %d source rect changes", id);
     }
     if (ILM_NOTIFICATION_DEST_RECT & mask)
     {
-        // this->cb->surfaceSourceRectChanged(id, )
-    }
-    if (ILM_NOTIFICATION_CONTENT_AVAILABLE & mask)
-    {
-    }
-    if (ILM_NOTIFICATION_CONTENT_REMOVED & mask)
-    {
-        /* application being down */
-        // m_appLayers.remove(pid);
+        HMI_DEBUG("surface %d dest rect changes", id);
     }
     if (ILM_NOTIFICATION_CONFIGURED & mask)
     {
-        HMI_DEBUG("surface %d available", id);
+        HMI_DEBUG("surface %d size %d, %d, %d, %d", id,
+            sprop->sourceX, sprop->sourceY, sprop->origSourceWidth, sprop->origSourceHeight);
         ilm_surfaceSetSourceRectangle(id, 0, 0, sprop->origSourceWidth, sprop->origSourceHeight);
         ilm_surfaceSetDestinationRectangle(id, 0, 0, sprop->origSourceWidth, sprop->origSourceHeight);
-        /* qDebug("ILM_NOTIFICATION_CONFIGURED");
-        qDebug("  surfaceProperties %d", surface);
-        qDebug("    surfaceProperties.origSourceWidth: %d", surfaceProperties->origSourceWidth);
-        qDebug("    surfaceProperties.origSourceHeight: %d", surfaceProperties->origSourceHeight);
-
-        if (surface == WINDOWMANAGER_HOMESCREEN_MAIN_SURFACE_ID) {
-            addSurfaceToLayer(surface, WINDOWMANAGER_LAYER_HOMESCREEN);
-            configureHomeScreenMainSurface(surface, surfaceProperties->origSourceWidth, surfaceProperties->origSourceHeight);
-        } else {
-            ilmErrorTypes result;
-            t_ilm_layer layer = addSurfaceToAppLayer(pid, surface);
-
-            if (layer != 0) {
-                configureAppSurface(surface,
-                                    surfaceProperties->origSourceWidth,
-                                    surfaceProperties->origSourceHeight);
-
-                result = ilm_layerAddSurface(layer, surface);
-                if (result != ILM_SUCCESS) {
-                    qDebug("ilm_layerAddSurface(%d,%d) failed.", layer, surface);
-                }
-                ilm_commitChanges();
-            }
-        }
-        updateScreen(); */
     }
 }
 
@@ -540,59 +511,25 @@ void LayerControl::dispatchPropertyChangeEvent(unsigned id,
         struct ilmLayerProperties* lprop,
         t_ilm_notification_mask mask)
 {
+    /*
+      ILM_NOTIFICATION_CONTENT_AVAILABLE & ILM_NOTIFICATION_CONTENT_REMOVED
+      are not handled here, handled in create/destroy event
+     */
     if (ILM_NOTIFICATION_VISIBILITY & mask)
     {
-        //this->cb->layerVisibilityChanged(id, sprop->visibility);
+        HMI_DEBUG("layer %d turns visibility %d", id, lprop->visibility);
     }
     if (ILM_NOTIFICATION_OPACITY & mask)
     {
-    }
-    if (ILM_NOTIFICATION_ORIENTATION & mask)
-    {
+        HMI_DEBUG("layer %d turns opacity %f", id, lprop->opacity);
     }
     if (ILM_NOTIFICATION_SOURCE_RECT & mask)
     {
-        // this->cb->surfaceSourceRectChanged(id, )
+        HMI_DEBUG("layer %d source rect changes", id);
     }
     if (ILM_NOTIFICATION_DEST_RECT & mask)
     {
-        // this->cb->surfaceSourceRectChanged(id, )
-    }
-    if (ILM_NOTIFICATION_CONTENT_AVAILABLE & mask)
-    {
-    }
-    if (ILM_NOTIFICATION_CONTENT_REMOVED & mask)
-    {
-        /* application being down */
-        // m_appLayers.remove(pid);
-    }
-    if (ILM_NOTIFICATION_CONFIGURED & mask)
-    {
-        /* qDebug("ILM_NOTIFICATION_CONFIGURED");
-        qDebug("  surfaceProperties %d", surface);
-        qDebug("    surfaceProperties.origSourceWidth: %d", surfaceProperties->origSourceWidth);
-        qDebug("    surfaceProperties.origSourceHeight: %d", surfaceProperties->origSourceHeight);
-
-        if (surface == WINDOWMANAGER_HOMESCREEN_MAIN_SURFACE_ID) {
-            addSurfaceToLayer(surface, WINDOWMANAGER_LAYER_HOMESCREEN);
-            configureHomeScreenMainSurface(surface, surfaceProperties->origSourceWidth, surfaceProperties->origSourceHeight);
-        } else {
-            ilmErrorTypes result;
-            t_ilm_layer layer = addSurfaceToAppLayer(pid, surface);
-
-            if (layer != 0) {
-                configureAppSurface(surface,
-                                    surfaceProperties->origSourceWidth,
-                                    surfaceProperties->origSourceHeight);
-
-                result = ilm_layerAddSurface(layer, surface);
-                if (result != ILM_SUCCESS) {
-                    qDebug("ilm_layerAddSurface(%d,%d) failed.", layer, surface);
-                }
-                ilm_commitChanges();
-            }
-        }
-        updateScreen(); */
+        HMI_DEBUG("layer %d dest rect changes", id);
     }
 }