+void WindowManager::surfaceCallbackFunction_non_static(t_ilm_surface surface,
+ struct ilmSurfaceProperties* surfaceProperties,
+ t_ilm_notification_mask mask)
+{
+ qDebug("-=[surfaceCallbackFunction_non_static]=-");
+ qDebug("surfaceCallbackFunction_non_static changes for surface %d", surface);
+ if (ILM_NOTIFICATION_VISIBILITY & mask)
+ {
+ qDebug("ILM_NOTIFICATION_VISIBILITY");
+ surfaceVisibilityChanged(surface, surfaceProperties->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");
+ //updateScreen();
+ }
+ if (ILM_NOTIFICATION_CONTENT_REMOVED & mask)
+ {
+ qDebug("ILM_NOTIFICATION_CONTENT_REMOVED");
+ }
+ 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);
+
+ ilm_surfaceSetSourceRectangle(surface,
+ 0,
+ 0,
+ surfaceProperties->origSourceWidth,
+ surfaceProperties->origSourceHeight);
+
+ ilm_commitChanges();
+ updateScreen();
+ }
+}
+
+void WindowManager::surfaceCallbackFunction_static(t_ilm_surface surface,
+ struct ilmSurfaceProperties* surfaceProperties,
+ t_ilm_notification_mask mask)
+
+{
+ static_cast<WindowManager*>(WindowManager::myThis)->surfaceCallbackFunction_non_static(surface, surfaceProperties, mask);
+}
+#endif
+
+int WindowManager::layoutId() const
+{
+ return m_currentLayout;
+}
+
+QString WindowManager::layoutName() const
+{
+ QList<Layout>::const_iterator i = m_layouts.begin();
+
+ QString result = "not found";
+ while (i != m_layouts.constEnd())
+ {
+ if (i->id == m_currentLayout)
+ {
+ result = i->name;
+ }
+
+ ++i;
+ }
+
+ return result;
+}
+
+
+int WindowManager::addLayout(int layoutId, const QString &layoutName, const QList<LayoutArea> &surfaceAreas)
+{
+ qDebug("-=[addLayout]=-");
+ m_layouts.append(Layout(layoutId, layoutName, surfaceAreas));
+
+ qDebug("addLayout %d %s, size %d",
+ layoutId,
+ layoutName.toStdString().c_str(),
+ surfaceAreas.size());
+
+ dumpScene();
+
+ return WINDOWMANAGER_NO_ERROR;
+}
+
+int WindowManager::deleteLayoutById(int layoutId)
+{
+ qDebug("-=[deleteLayoutById]=-");
+ qDebug("layoutId: %d", layoutId);
+ int result = WINDOWMANAGER_NO_ERROR;
+
+ if (m_currentLayout == layoutId)
+ {
+ result = WINDOWMANAGER_ERROR_ID_IN_USE;
+ }
+ else
+ {
+ QList<Layout>::iterator i = m_layouts.begin();
+ result = WINDOWMANAGER_ERROR_ID_IN_USE;
+ while (i != m_layouts.constEnd())
+ {
+ if (i->id == layoutId)
+ {
+ m_layouts.erase(i);
+ result = WINDOWMANAGER_NO_ERROR;
+ break;
+ }
+
+ ++i;
+ }
+ }
+
+ return result;
+}
+
+
+QList<Layout> WindowManager::getAllLayouts()
+{
+ qDebug("-=[getAllLayouts]=-");
+
+ return m_layouts;
+}
+
+QList<int> WindowManager::getAllSurfacesOfProcess(int pid)
+{
+ QList<int> result;
+#ifdef HAVE_IVI_LAYERMANAGEMENT_API
+ struct ilmSurfaceProperties surfaceProperties;
+
+ for (int i = 0; i < m_appSurfaces.size(); ++i)
+ {
+ ilm_getPropertiesOfSurface(m_appSurfaces.at(i), &surfaceProperties);
+ if (pid == surfaceProperties.creatorPid)
+ {
+ result.append(m_appSurfaces.at(i));
+ }
+ }
+#endif
+ return result;
+}
+
+QList<int> WindowManager::getAvailableLayouts(int numberOfAppSurfaces)
+{
+ qDebug("-=[getAvailableLayouts]=-");
+ QList<Layout>::const_iterator i = m_layouts.begin();
+
+ QList<int> result;
+ while (i != m_layouts.constEnd())
+ {
+ if (i->layoutAreas.size() == numberOfAppSurfaces)
+ {
+ result.append(i->id);
+ }
+
+ ++i;
+ }
+
+ return result;
+}
+
+QList<int> WindowManager::getAvailableSurfaces()
+{
+ qDebug("-=[getAvailableSurfaces]=-");