Add new layer WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY.
authorBocklage, Jens <Jens_Bocklage@mentor.com>
Fri, 11 Nov 2016 15:00:10 +0000 (16:00 +0100)
committerBocklage, Jens <Jens_Bocklage@mentor.com>
Fri, 11 Nov 2016 15:00:10 +0000 (16:00 +0100)
Add new signal surfaceVisibilityChanged to homescreen and windowmanager API.

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

index 58743d0..b2bfd17 100644 (file)
@@ -27,6 +27,13 @@ LayoutHandler::LayoutHandler(QObject *parent) :
                                               "/Popup",
                                               QDBusConnection::sessionBus(),
                                               0);
+
+    QDBusConnection::sessionBus().connect("org.agl.windowmanager",
+                                       "/windowmanager",
+                                       "org.agl.windowmanager",
+                                       "surfaceVisibilityChanged",
+                                       this,
+                                       SLOT(surfaceVisibilityChanged(int,bool)));
 }
 
 LayoutHandler::~LayoutHandler()
@@ -117,12 +124,14 @@ void LayoutHandler::setUpLayouts()
 
 void LayoutHandler::showAppLayer()
 {
-    mp_dBusWindowManagerProxy->showLayer(1); //1==app layer
+    // POPUP=0, HOMESCREEN_OVERLAY=1, APPS=2, HOMESCREEN=3
+    mp_dBusWindowManagerProxy->showLayer(2); // TODO: enum
 }
 
 void LayoutHandler::hideAppLayer()
 {
-    mp_dBusWindowManagerProxy->hideLayer(1); //1==app layer
+    // POPUP=0, HOMESCREEN_OVERLAY=1, APPS=2, HOMESCREEN=3
+    mp_dBusWindowManagerProxy->hideLayer(2); // TODO: enum
 }
 
 void LayoutHandler::makeMeVisible(int pid)
@@ -265,6 +274,12 @@ void LayoutHandler::setLayoutByName(QString layoutName)
     }
 }
 
+void LayoutHandler::requestSurfaceVisibilityChanged(int surfaceId, bool visible)
+{
+    qDebug("requestSurfaceVisibilityChanged %d %s", surfaceId, visible ? "true" : "false");
+    surfaceVisibilityChanged(surfaceId, visible);
+}
+
 void LayoutHandler::timerEvent(QTimerEvent *e)
 {
     if (e->timerId() == m_secondsTimerId)
index e51930b..54290ac 100644 (file)
@@ -30,6 +30,12 @@ public slots:
     void requestSurfaceIdToFullScreen(int surfaceId);
     void setLayoutByName(QString layoutName);
 
+    // this will receive the surfaceVisibilityChanged signal of the windowmanager
+    void requestSurfaceVisibilityChanged(int surfaceId, bool visible);
+
+Q_SIGNALS: // SIGNALS
+    void surfaceVisibilityChanged(int surfaceId, bool visible);
+
 protected:
     void timerEvent(QTimerEvent *e);
 private:
index 1c0ddea..3c5c881 100644 (file)
@@ -70,6 +70,7 @@ void WindowManager::start()
     err =  ilm_registerNotification(WindowManager::notificationFunc_static, this);
 
     createNewLayer(WINDOWMANAGER_LAYER_POPUP);
+    createNewLayer(WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY);
     createNewLayer(WINDOWMANAGER_LAYER_APPLICATIONS);
     createNewLayer(WINDOWMANAGER_LAYER_HOMESCREEN);
 #endif
@@ -184,6 +185,19 @@ void WindowManager::addSurfaceToLayer(int surfaceId, int layerId)
         ilm_layerAddSurface(layerId, surfaceId);
     }
 
+    if (layerId == WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY)
+    {
+        struct ilmSurfaceProperties surfaceProperties;
+        ilm_getPropertiesOfSurface(surfaceId, &surfaceProperties);
+
+        ilm_surfaceSetDestinationRectangle(surfaceId, 0, 0, surfaceProperties.origSourceWidth, surfaceProperties.origSourceHeight);
+        ilm_surfaceSetSourceRectangle(surfaceId, 0, 0, surfaceProperties.origSourceWidth, surfaceProperties.origSourceHeight);
+        ilm_surfaceSetOpacity(surfaceId, 0.5);
+        ilm_surfaceSetVisibility(surfaceId, ILM_TRUE);
+
+        ilm_layerAddSurface(layerId, surfaceId);
+    }
+
     if (layerId == WINDOWMANAGER_LAYER_POPUP)
     {
         struct ilmSurfaceProperties surfaceProperties;
@@ -259,7 +273,8 @@ void WindowManager::updateScreen()
     t_ilm_layer renderOrder[WINDOWMANAGER_LAYER_NUM];
     renderOrder[0] = WINDOWMANAGER_LAYER_HOMESCREEN;
     renderOrder[1] = WINDOWMANAGER_LAYER_APPLICATIONS;
-    renderOrder[2] = WINDOWMANAGER_LAYER_POPUP;
+    renderOrder[2] = WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY;
+    renderOrder[3] = WINDOWMANAGER_LAYER_POPUP;
 
     ilm_displaySetRenderOrder(0, renderOrder, WINDOWMANAGER_LAYER_NUM);
 
@@ -334,6 +349,7 @@ void WindowManager::surfaceCallbackFunction_non_static(t_ilm_surface surface,
     if (ILM_NOTIFICATION_VISIBILITY & mask)
     {
         qDebug("ILM_NOTIFICATION_VISIBILITY");
+        surfaceVisibilityChanged(surface, surfaceProperties.visibility);
     }
     if (ILM_NOTIFICATION_OPACITY & mask)
     {
@@ -528,9 +544,13 @@ void WindowManager::hideLayer(int layer)
     }
     if (1 == layer)
     {
-        ilm_layerSetVisibility(WINDOWMANAGER_LAYER_APPLICATIONS, ILM_FALSE);
+        ilm_layerSetVisibility(WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY, ILM_FALSE);
     }
     if (2 == layer)
+    {
+        ilm_layerSetVisibility(WINDOWMANAGER_LAYER_APPLICATIONS, ILM_FALSE);
+    }
+    if (3 == layer)
     {
         ilm_layerSetVisibility(WINDOWMANAGER_LAYER_HOMESCREEN, ILM_FALSE);
     }
@@ -603,9 +623,13 @@ void WindowManager::showLayer(int layer)
     }
     if (1 == layer)
     {
-        ilm_layerSetVisibility(WINDOWMANAGER_LAYER_APPLICATIONS, ILM_TRUE);
+        ilm_layerSetVisibility(WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY, ILM_TRUE);
     }
     if (2 == layer)
+    {
+        ilm_layerSetVisibility(WINDOWMANAGER_LAYER_APPLICATIONS, ILM_TRUE);
+    }
+    if (3 == layer)
     {
         ilm_layerSetVisibility(WINDOWMANAGER_LAYER_HOMESCREEN, ILM_TRUE);
     }
index 5b0a552..a4d9d4f 100644 (file)
@@ -103,6 +103,9 @@ public Q_SLOTS: // METHODS
     int setLayoutByName(const QString &layoutName);
     int setSurfaceToLayoutArea(int surfaceId, int layoutAreaId);
     void showLayer(int layer);
+
+Q_SIGNALS: // SIGNALS
+    void surfaceVisibilityChanged(int surfaceId, bool visible);
 };
 
 
index 95e84a6..fe0ea30 100644 (file)
                        <arg name="surfaceId" type="i" direction="in"/>
                        <arg name="layoutArea" type="i" direction="in"/>
                </method>
+               <!--
+                 surfaceVisibilityChanged:
+                 @surfaceId: The surface that changed.
+                 @visible: True, if the surface is visible.
+
+                 This is emitted when the visible property of the surfaces changes.
+               -->
+               <signal name="surfaceVisibilityChanged">
+                       <arg name="surfaceId" type="i"/>
+                       <arg name="visible" type="b"/>
+               </signal>
        </interface>
 </node>
 
index a4be58f..754c816 100644 (file)
                        <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;int&gt;"/> 
                </method>
 
+               <!--
+                 surfaceVisibilityChanged:
+                 @surfaceId: The surface that changed.
+                 @visible: True, if the surface is visible.
+
+                 This is emitted when the visible property of the surfaces changes.
+               -->
+               <signal name="surfaceVisibilityChanged">
+                       <arg name="surfaceId" type="i"/>
+                       <arg name="visible" type="b"/>
+               </signal>
+
                <!--
                  showLayer:
-                 @layer: The ID of the layer to show. POPUP=0, APPS=1, HOMESCREEN=2
+                 @layer: The ID of the layer to show. POPUP=0, HOMESCREEN_OVERLAY=1, APPS=2, HOMESCREEN=3
 
                  Show complete layers.
                  By default, all layers are shown.
                </method>
                <!--
                  hideLayer:
-                 @layer: The ID of the layer to hide. POPUP=0, APPS=1, HOMESCREEN=2
+                 @layer: The ID of the layer to hide. POPUP=0, HOMESCREEN_OVERLAY=1, APPS=2, HOMESCREEN=3
 
                  Hide complete layers.
                  By default, all layers are shown.