Add org.agl.homescreen function renderSurfaceToAreaAllowed.
authorBocklage, Jens <Jens_Bocklage@mentor.com>
Fri, 11 Nov 2016 09:49:52 +0000 (10:49 +0100)
committerBocklage, Jens <Jens_Bocklage@mentor.com>
Fri, 11 Nov 2016 09:49:52 +0000 (10:49 +0100)
This function can be used to request, if it is allowed to render a surface in a layout area in preparation of the real renderSurfaceToArea command. This call will not change anything, it is only a request.

Signed-off-by: Bocklage, Jens <Jens_Bocklage@mentor.com>
HomeScreen/src/homescreencontrolinterface.cpp
HomeScreen/src/homescreencontrolinterface.h
HomeScreen/src/layouthandler.cpp
HomeScreen/src/layouthandler.h
HomeScreen/src/mainwindow.cpp
SampleHomeScreenInterfaceApp/src/sampleclass.cpp
SampleHomeScreenInterfaceApp/src/sampleclass.hpp
interfaces/homescreen.xml
libhomescreen/include/libhomescreen.hpp
libhomescreen/src/libhomescreen.cpp

index 71e4a2c..faf4b99 100644 (file)
@@ -54,10 +54,16 @@ void HomeScreenControlInterface::hardKeyPressed(int key)
     }
 }
 
-void HomeScreenControlInterface::renderSurfaceToArea(int surfaceId, const QRect &renderArea)
+void HomeScreenControlInterface::renderSurfaceToArea(int surfaceId, int layoutArea)
 {
-    qDebug("requestSurfaceIdToFullScreen %d", surfaceId);
-    newRequestRenderSurfaceToArea(surfaceId, renderArea);
+    qDebug("renderSurfaceToArea %d %d", surfaceId, layoutArea);
+    newRequestRenderSurfaceToArea(surfaceId, layoutArea);
+}
+
+bool HomeScreenControlInterface::renderSurfaceToAreaAllowed(int surfaceId, int layoutArea)
+{
+    qDebug("renderSurfaceToAreaAllowed %d %d", surfaceId, layoutArea);
+    return renderSurfaceToAreaAllowed(surfaceId, layoutArea);
 }
 
 void HomeScreenControlInterface::requestSurfaceIdToFullScreen(int surfaceId)
index 27cf4e8..b202dc9 100644 (file)
@@ -19,7 +19,8 @@ signals:
 
     QList<int> newRequestGetAllSurfacesOfProcess(int pid);
     int newRequestGetSurfaceStatus(int surfaceId);
-    void newRequestRenderSurfaceToArea(int surfaceId, const QRect &renderArea);
+    void newRequestRenderSurfaceToArea(int surfaceId, int layoutArea);
+    bool newRequestRenderSurfaceToAreaAllowed(int surfaceId, int layoutArea);
     void newRequestSurfaceIdToFullScreen(int surfaceId);
 
 //from homescreen_adapter.h
@@ -27,9 +28,9 @@ public Q_SLOTS: // METHODS
     QList<int> getAllSurfacesOfProcess(int pid);
     int getSurfaceStatus(int surfaceId);
     void hardKeyPressed(int key);
-    void renderSurfaceToArea(int surfaceId, const QRect &renderArea);
+    void renderSurfaceToArea(int surfaceId, int layoutArea);
+    bool renderSurfaceToAreaAllowed(int surfaceId, int layoutArea);
     void requestSurfaceIdToFullScreen(int surfaceId);
-
 private:
     HomescreenAdaptor *mp_homeScreenAdaptor;
     org::agl::appframework *mp_dBusAppFrameworkProxy;
index 80f6cd1..58743d0 100644 (file)
@@ -234,9 +234,16 @@ int LayoutHandler::requestGetSurfaceStatus(int surfaceId)
     return result;
 }
 
-void LayoutHandler::requestRenderSurfaceToArea(int surfaceId, const QRect &renderArea)
+void LayoutHandler::requestRenderSurfaceToArea(int surfaceId, int layoutArea)
 {
-    qDebug("requestRenderSurfaceToArea %d %d,%d,%d,%d", surfaceId, renderArea.x(), renderArea.y(), renderArea.width(), renderArea.height());
+    qDebug("requestRenderSurfaceToArea %d %d", surfaceId, layoutArea);
+}
+
+bool LayoutHandler::requestRenderSurfaceToAreaAllowed(int surfaceId, int layoutArea)
+{
+    qDebug("requestRenderSurfaceToAreaAllowed %d %d", surfaceId, layoutArea);
+    bool result = true;
+    return result;
 }
 
 void LayoutHandler::requestSurfaceIdToFullScreen(int surfaceId)
index 7487be5..e51930b 100644 (file)
@@ -25,7 +25,8 @@ private:
 public slots:
     QList<int> requestGetAllSurfacesOfProcess(int pid);
     int requestGetSurfaceStatus(int surfaceId);
-    void requestRenderSurfaceToArea(int surfaceId, const QRect &renderArea);
+    void requestRenderSurfaceToArea(int surfaceId, int layoutArea);
+    bool requestRenderSurfaceToAreaAllowed(int surfaceId, int layoutArea);
     void requestSurfaceIdToFullScreen(int surfaceId);
     void setLayoutByName(QString layoutName);
 
index e1a8371..82336ca 100644 (file)
@@ -105,8 +105,8 @@ MainWindow::MainWindow(QWidget *parent) :
     QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestGetAllSurfacesOfProcess(int)), mp_layoutHandler, SLOT(requestGetAllSurfacesOfProcess(int)));
     QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestGetSurfaceStatus(int)), mp_layoutHandler, SLOT(requestGetSurfaceStatus(int)));
     QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestsToBeVisibleApp(int)), mp_layoutHandler, SLOT(makeMeVisible(int)));
-    QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestSurfaceIdToFullScreen(int)), mp_layoutHandler, SLOT(requestSurfaceIdToFullScreen(int)));
-    QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestRenderSurfaceToArea(int, QRect)), mp_layoutHandler, SLOT(requestRenderSurfaceToArea(int,QRect)));
+    QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestRenderSurfaceToArea(int, int)), mp_layoutHandler, SLOT(requestRenderSurfaceToArea(int,int)));
+    QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestRenderSurfaceToAreaAllowed(int, int)), mp_layoutHandler, SLOT(requestRenderSurfaceToAreaAllowed(int,int)));
     QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestSurfaceIdToFullScreen(int)), mp_layoutHandler, SLOT(requestSurfaceIdToFullScreen(int)));
 
     QObject::connect(mp_popupWidget, SIGNAL(comboBoxResult(QString)), mp_layoutHandler, SLOT(setLayoutByName(QString)));
index bc39af9..86b5943 100644 (file)
@@ -31,6 +31,11 @@ void SampleClass::renderSurfaceToArea(int surfaceId, int layoutArea)
     mp_libHomeScreen->renderSurfaceToArea(surfaceId, layoutArea);
 }
 
+bool SampleClass::renderSurfaceToAreaAllowed(int surfaceId, int layoutArea)
+{
+    return mp_libHomeScreen->renderSurfaceToAreaAllowed(surfaceId, layoutArea);
+}
+
 void SampleClass::requestSurfaceIdToFullScreen(int surfaceId)
 {
     mp_libHomeScreen->requestSurfaceIdToFullScreen(surfaceId);
index 9293843..3e80117 100644 (file)
@@ -14,6 +14,7 @@ public:
     int getSurfaceStatus(int surfaceId);
     void hardKeyPressed(int key);
     void renderSurfaceToArea(int surfaceId, int layoutArea);
+    bool renderSurfaceToAreaAllowed(int surfaceId, int layoutArea);
     void requestSurfaceIdToFullScreen(int surfaceId);
 
 private:
index 999b0e9..95e84a6 100644 (file)
                        <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;int&gt;"/>
                </method>
                <!--
+               renderSurfaceToAreaAllowed:
+               @surfaceId: The surface that is requested.
+               @layoutArea: The layout area where the surface shall be rendered.
+               @allowed: Returns true, if the surface is allowed to be rendered in the area
+
+               This function can be used to request, if it is allowed to render a surface in a layout area in preparation
+               of the real renderSurfaceToArea command. This call will not change anything, it is only a request.
+               -->
+               <method name="renderSurfaceToAreaAllowed">
+                       <arg name="surfaceId" type="i" direction="in"/>
+                       <arg name="layoutArea" type="i" direction="in"/>
+                       <arg name="allowed" type="b" direction="out"/>
+               </method>
+               <!--
                renderSurfaceToArea:
                @surfaceId: The surface that is requested.
                @layoutArea: The layout area where the surface shall be rendered.
index f88b35f..6ec843f 100644 (file)
@@ -26,10 +26,11 @@ public:
     int getSurfaceStatus(int surfaceId);
     void hardKeyPressed(int key);
     void renderSurfaceToArea(int surfaceId, int layoutArea);
+    bool renderSurfaceToAreaAllowed(int surfaceId, int layoutArea);
     void requestSurfaceIdToFullScreen(int surfaceId);
-
 private:
     LibHomeScreenHomescreen *mp_libHomeScreenHomescreen_Proxy;
 };
 
 #endif // LIBHOMESCREEN_HPP
+
index 374cfe8..03c4baf 100644 (file)
@@ -122,6 +122,27 @@ void LibHomeScreen::renderSurfaceToArea(int surfaceId, int layoutArea)
     }
 }
 
+bool LibHomeScreen::renderSurfaceToAreaAllowed(int surfaceId, int layoutArea)
+{
+    gboolean result = true;
+    GError *err = NULL;
+
+    lib_home_screen_homescreen_call_render_surface_to_area_allowed_sync(
+                mp_libHomeScreenHomescreen_Proxy,
+                surfaceId,
+                layoutArea,
+                &result,
+                NULL,
+                &err);
+
+    if (NULL != err)
+    {
+        fprintf(stderr, "Unable to call renderSurfaceToArea: %s\n", err->message);
+    }
+
+    return result;
+}
+
 void LibHomeScreen::requestSurfaceIdToFullScreen(int surfaceId)
 {
     GError *err = NULL;