aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBocklage, Jens <Jens_Bocklage@mentor.com>2016-11-04 17:23:02 +0100
committerBocklage, Jens <Jens_Bocklage@mentor.com>2016-11-04 17:23:02 +0100
commitbf0f33bec5ad705666dff6c821334524c1b81583 (patch)
treec9544663e1ca3bacbbd23113b227a77526f4b0fc
parentec688535558c31989e7da221b858328b2e0766c8 (diff)
Fix for pid and surface handling.
Signed-off-by: Bocklage, Jens <Jens_Bocklage@mentor.com>
-rw-r--r--HomeScreen/src/layouthandler.cpp88
-rw-r--r--HomeScreen/src/layouthandler.h2
-rw-r--r--WindowManager/src/windowmanager.cpp18
-rw-r--r--WindowManager/src/windowmanager.hpp1
-rw-r--r--interfaces/windowmanager.xml13
5 files changed, 80 insertions, 42 deletions
diff --git a/HomeScreen/src/layouthandler.cpp b/HomeScreen/src/layouthandler.cpp
index 0dac24f..5f52cd5 100644
--- a/HomeScreen/src/layouthandler.cpp
+++ b/HomeScreen/src/layouthandler.cpp
@@ -112,60 +112,66 @@ void LayoutHandler::setUpLayouts()
mp_dBusWindowManagerProxy->addLayout(3, "side by side", surfaceAreas);
}
-void LayoutHandler::makeMeVisible(int surfaceId)
+void LayoutHandler::makeMeVisible(int pid)
{
- qDebug("makeMeVisible %d", surfaceId);
- m_requestsToBeVisibleSurfaces.append(surfaceId);
+ qDebug("makeMeVisible %d", pid);
- qDebug("m_visibleSurfaces %d", m_visibleSurfaces.size());
- qDebug("m_invisibleSurfaces %d", m_invisibleSurfaces.size());
- qDebug("m_requestsToBeVisibleSurfaces %d", m_requestsToBeVisibleSurfaces.size());
+ QList<int> allSurfaces = mp_dBusWindowManagerProxy->getAllSurfacesOfProcess(pid);
+ qSort(allSurfaces);
- QList<int> availableLayouts = mp_dBusWindowManagerProxy->getAvailableLayouts(m_visibleSurfaces.size() + m_requestsToBeVisibleSurfaces.size());
- if (0 == availableLayouts.size())
+ if (0 != allSurfaces.size())
{
- // no layout fits the need!
- // replace the last app
- qDebug("no layout fits the need!");
- qDebug("replace the last surface");
+ m_requestsToBeVisibleSurfaces.append(allSurfaces.at(0));
- m_invisibleSurfaces.append(m_visibleSurfaces.last());
- m_visibleSurfaces.removeLast();
+ qDebug("m_visibleSurfaces %d", m_visibleSurfaces.size());
+ qDebug("m_invisibleSurfaces %d", m_invisibleSurfaces.size());
+ qDebug("m_requestsToBeVisibleSurfaces %d", m_requestsToBeVisibleSurfaces.size());
- m_visibleSurfaces.append(m_requestsToBeVisibleSurfaces);
- m_requestsToBeVisibleSurfaces.clear();
-
- for (int i = 0; i < m_visibleSurfaces.size(); ++i)
+ QList<int> availableLayouts = mp_dBusWindowManagerProxy->getAvailableLayouts(m_visibleSurfaces.size() + m_requestsToBeVisibleSurfaces.size());
+ if (0 == availableLayouts.size())
{
- mp_dBusWindowManagerProxy->setSurfaceToLayoutArea(m_visibleSurfaces.at(i), i);
- }
- }
- if (1 == availableLayouts.size())
- {
- // switch to new layout
- qDebug("switch to new layout %d", availableLayouts.at(0));
- m_visibleSurfaces.append(m_requestsToBeVisibleSurfaces);
- m_requestsToBeVisibleSurfaces.clear();
+ // no layout fits the need!
+ // replace the last app
+ qDebug("no layout fits the need!");
+ qDebug("replace the last surface");
- mp_dBusWindowManagerProxy->setLayoutById(availableLayouts.at(0));
- for (int i = 0; i < m_visibleSurfaces.size(); ++i)
- {
- mp_dBusWindowManagerProxy->setSurfaceToLayoutArea(m_visibleSurfaces.at(i), i);
- }
- }
- if (1 < availableLayouts.size())
- {
- // more than one layout possible! Ask user.
- qDebug("more than one layout possible! Ask user.");
+ m_invisibleSurfaces.append(m_visibleSurfaces.last());
+ m_visibleSurfaces.removeLast();
+
+ m_visibleSurfaces.append(m_requestsToBeVisibleSurfaces);
+ m_requestsToBeVisibleSurfaces.clear();
- QStringList choices;
- for (int i = 0; i < availableLayouts.size(); ++i)
+ for (int i = 0; i < m_visibleSurfaces.size(); ++i)
+ {
+ mp_dBusWindowManagerProxy->setSurfaceToLayoutArea(m_visibleSurfaces.at(i), i);
+ }
+ }
+ if (1 == availableLayouts.size())
{
- choices.append(mp_dBusWindowManagerProxy->getLayoutName(availableLayouts.at(i)));
+ // switch to new layout
+ qDebug("switch to new layout %d", availableLayouts.at(0));
+ m_visibleSurfaces.append(m_requestsToBeVisibleSurfaces);
+ m_requestsToBeVisibleSurfaces.clear();
+
+ mp_dBusWindowManagerProxy->setLayoutById(availableLayouts.at(0));
+ for (int i = 0; i < m_visibleSurfaces.size(); ++i)
+ {
+ mp_dBusWindowManagerProxy->setSurfaceToLayoutArea(m_visibleSurfaces.at(i), i);
+ }
}
+ if (1 < availableLayouts.size())
+ {
+ // more than one layout possible! Ask user.
+ qDebug("more than one layout possible! Ask user.");
- mp_dBusPopupProxy->showPopupComboBox("Select Layout", choices);
+ QStringList choices;
+ for (int i = 0; i < availableLayouts.size(); ++i)
+ {
+ choices.append(mp_dBusWindowManagerProxy->getLayoutName(availableLayouts.at(i)));
+ }
+ mp_dBusPopupProxy->showPopupComboBox("Select Layout", choices);
+ }
}
}
diff --git a/HomeScreen/src/layouthandler.h b/HomeScreen/src/layouthandler.h
index ee400b7..cc4b7ab 100644
--- a/HomeScreen/src/layouthandler.h
+++ b/HomeScreen/src/layouthandler.h
@@ -17,7 +17,7 @@ public:
signals:
public slots:
- void makeMeVisible(int surfaceId);
+ void makeMeVisible(int pid);
void requestRenderSurfaceToArea(int surfaceId, const QRect &renderArea);
void requestSurfaceIdToFullScreen(int surfaceId);
diff --git a/WindowManager/src/windowmanager.cpp b/WindowManager/src/windowmanager.cpp
index 765ae4f..ed38c49 100644
--- a/WindowManager/src/windowmanager.cpp
+++ b/WindowManager/src/windowmanager.cpp
@@ -420,6 +420,24 @@ QList<Layout> WindowManager::getAllLayouts()
return m_layouts;
}
+QList<int> WindowManager::getAllSurfacesOfProcess(int pid)
+{
+ QList<int> result;
+#ifdef __arm__
+ struct ilmSurfaceProperties surfaceProperties;
+
+ for (int i = 0; i < m_surfaces.size(); ++i)
+ {
+ ilm_getPropertiesOfSurface(m_surfaces.at(i), &surfaceProperties);
+ if (pid == surfaceProperties.creatorPid)
+ {
+ result.append(m_surfaces.at(i));
+ }
+ }
+#endif
+ return result;
+}
+
QList<int> WindowManager::getAvailableLayouts(int numberOfAppSurfaces)
{
qDebug("-=[getAvailableLayouts]=-");
diff --git a/WindowManager/src/windowmanager.hpp b/WindowManager/src/windowmanager.hpp
index fce5937..6c11760 100644
--- a/WindowManager/src/windowmanager.hpp
+++ b/WindowManager/src/windowmanager.hpp
@@ -93,6 +93,7 @@ public: // PROPERTIES
public Q_SLOTS: // METHODS
int addLayout(int layoutId, const QString &layoutName, const QList<LayoutArea> &surfaceAreas);
QList<Layout> getAllLayouts();
+ QList<int> getAllSurfacesOfProcess(int pid);
QList<int> getAvailableLayouts(int numberOfAppSurfaces);
QList<int> getAvailableSurfaces();
QString getLayoutName(int layoutId);
diff --git a/interfaces/windowmanager.xml b/interfaces/windowmanager.xml
index 80f2a19..c15ca2c 100644
--- a/interfaces/windowmanager.xml
+++ b/interfaces/windowmanager.xml
@@ -122,6 +122,19 @@
</method>
<!--
+ getAllSurfacesOfProcess:
+ @pid: The PID of the process.
+ @surfaceIds: A list of surfaces that were created by the process.
+
+ The surface IDs can be used to assign them to a layout render area.
+ -->
+ <method name="getAllSurfacesOfProcess">
+ <arg name="pid" type="i" direction="in"/>
+ <arg name="layoutIds" type="ai" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;int&gt;"/>
+ </method>
+
+ <!--
setSurfaceToLayoutArea:
@surfaceId: The ID of the surface that shall be positioned.
@layoutAreaId: The ID of the layout area where the surface shall be rendered.