HomeScreen main surface has to have the surface id 1000!
authorBocklage, Jens <Jens_Bocklage@mentor.com>
Thu, 3 Nov 2016 15:38:56 +0000 (16:38 +0100)
committerBocklage, Jens <Jens_Bocklage@mentor.com>
Thu, 3 Nov 2016 15:38:56 +0000 (16:38 +0100)
Use
QT_IVI_SURFACE_ID=1000 QT_WAYLAND_SHELL_INTEGRATION="ivi-shell" ./HomeScreen &
to launch HomeScreen.

Signed-off-by: Bocklage, Jens <Jens_Bocklage@mentor.com>
WindowManager/src/windowmanager.cpp
WindowManager/src/windowmanager.hpp
interfaces/windowmanager.xml

index 26d650f..765ae4f 100644 (file)
 
 #define WINDOWMANAGER_LAYER_NUM 3
 
+// the HomeScreen app has to have the surface id 1000
+#define WINDOWMANAGER_HOMESCREEN_MAIN_SURFACE_ID 1000
+
+
 void* WindowManager::myThis = 0;
 
 WindowManager::WindowManager(QObject *parent) :
@@ -40,8 +44,7 @@ WindowManager::WindowManager(QObject *parent) :
     m_layouts(),
     m_surfaces(),
     mp_layoutAreaToSurfaceIdAssignment(0),
-    m_currentLayout(-1),
-    m_homeScreenPid(-1)
+    m_currentLayout(-1)
 {
     qDebug("-=[WindowManager]=-");
     // publish windowmanager interface
@@ -160,7 +163,7 @@ void WindowManager::addSurfaceToLayer(int surfaceId, int layerId)
         ilm_getScreenResolution(screenID, &width, &height);
 
         ilm_surfaceSetDestinationRectangle(surfaceId, 0, 0, width, height);
-        ilm_surfaceSetSourceRectangle(surfaceId, 0, 0, surfaceProperties.origSourceWidth, surfaceProperties.origSourceHeight);
+        ilm_surfaceSetSourceRectangle(surfaceId, 0, 0, width, height);
         ilm_surfaceSetOpacity(surfaceId, 1.0);
         ilm_surfaceSetVisibility(surfaceId, ILM_TRUE);
 
@@ -282,15 +285,11 @@ void WindowManager::notificationFunc_non_static(ilmObjectType object,
             qDebug("  origSourceWidth : %d", surfaceProperties.origSourceWidth);
             qDebug("  origSourceHeight: %d", surfaceProperties.origSourceHeight);
 
-            if (m_homeScreenPid == surfaceProperties.creatorPid)
+            if (WINDOWMANAGER_HOMESCREEN_MAIN_SURFACE_ID == id)
             {
-                if (m_homeScreenSurfaceId != id)
-                {
-                    qDebug("HomeScreen app detected");
-                    m_homeScreenSurfaceId = id;
-                    addSurfaceToLayer(id, WINDOWMANAGER_LAYER_HOMESCREEN);
-                    updateScreen();
-                }
+                qDebug("HomeScreen app detected");
+                addSurfaceToLayer(id, WINDOWMANAGER_LAYER_HOMESCREEN);
+                updateScreen();
             }
             else
             {
@@ -335,26 +334,35 @@ void WindowManager::surfaceCallbackFunction_non_static(t_ilm_surface surface,
     {
         qDebug("ILM_NOTIFICATION_VISIBILITY");
     }
-
     if (ILM_NOTIFICATION_OPACITY & mask)
     {
         qDebug("ILM_NOTIFICATION_OPACITY");
     }
-
     if (ILM_NOTIFICATION_ORIENTATION & mask)
     {
         qDebug("ILM_NOTIFICATION_ORIENTATION");
     }
-
     if (ILM_NOTIFICATION_SOURCE_RECT & mask)
     {
         qDebug("ILM_NOTIFICATION_SOURCE_RECT");
     }
-
     if (ILM_NOTIFICATION_DEST_RECT & mask)
     {
         qDebug("ILM_NOTIFICATION_DEST_RECT");
     }
+    if (ILM_NOTIFICATION_CONTENT_AVAILABLE & mask)
+    {
+        qDebug("ILM_NOTIFICATION_CONTENT_AVAILABLE");
+    }
+    if (ILM_NOTIFICATION_CONTENT_REMOVED & mask)
+    {
+        qDebug("ILM_NOTIFICATION_CONTENT_REMOVED");
+    }
+    if (ILM_NOTIFICATION_CONFIGURED & mask)
+    {
+        qDebug("ILM_NOTIFICATION_CONFIGURED");
+        updateScreen();
+    }
 }
 
 void WindowManager::surfaceCallbackFunction_static(t_ilm_surface surface,
@@ -366,44 +374,6 @@ void WindowManager::surfaceCallbackFunction_static(t_ilm_surface surface,
 }
 #endif
 
-
-int WindowManager::homeScreenPid() const
-{
-    return m_homeScreenPid;
-}
-
-void WindowManager::setHomeScreenPid(int value)
-{
-    m_homeScreenPid = value;
-#ifdef __arm__
-    // maybe the HomeSceen app has already provided its surface.
-    // if so, shift it to the correct layer
-    // find the current used layout
-    QList<int>::iterator ci = m_surfaces.begin();
-
-    struct ilmSurfaceProperties surfaceProperties;
-    bool found = false;
-    while ((!found) && (ci != m_surfaces.constEnd()))
-    {
-        ilm_getPropertiesOfSurface(*ci, &surfaceProperties);
-        if (m_homeScreenPid == surfaceProperties.creatorPid)
-        {
-            qDebug("HomeScreen app detected");
-            m_homeScreenSurfaceId = *ci;
-            addSurfaceToLayer(*ci, WINDOWMANAGER_LAYER_HOMESCREEN);
-            m_surfaces.erase(ci);
-            found = true;
-            updateScreen();
-        }
-
-        ++ci;
-    }
-#endif
-
-    updateScreen();
-    dumpScene();
-}
-
 int WindowManager::layoutId() const
 {
     return m_currentLayout;
index 027344b..fce5937 100644 (file)
@@ -46,8 +46,6 @@ private:
     QMap<int, unsigned int> *mp_layoutAreaToSurfaceIdAssignment;
 
     int m_currentLayout;
-    int m_homeScreenPid;
-    int m_homeScreenSurfaceId;
 
     void dumpScene();
 
@@ -86,10 +84,6 @@ public slots:
 
 // from windowmanager_adapter.h
 public: // PROPERTIES
-    Q_PROPERTY(int homeScreenPid READ homeScreenPid WRITE setHomeScreenPid)
-    int homeScreenPid() const;
-    void setHomeScreenPid(int value);
-
     Q_PROPERTY(int layoutId READ layoutId)
     int layoutId() const;
 
index 67187ac..80f2a19 100644 (file)
                        <arg name="surfaceIds" type="a(i)" direction="out"/>
                        <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;int&gt;"/> 
                </method>
-
-               <!--
-                 homeScreenPid:
-                 The PID of the Home Screen app. The Home Screen app requires a special handling.
-                 It will always be visible in the background. So it will be placed in a special layer at the lowest z-order.
-               -->
-               <property name="homeScreenPid" type="i" access="readwrite"/>
        </interface>
 </node>