diff options
-rw-r--r-- | interfaces/windowmanager.xml | 1 | ||||
-rw-r--r-- | windowmanager/src/windowmanager.cpp | 171 | ||||
-rw-r--r-- | windowmanager/src/windowmanager.hpp | 7 |
3 files changed, 85 insertions, 94 deletions
diff --git a/interfaces/windowmanager.xml b/interfaces/windowmanager.xml index f288b32..e3c6df3 100644 --- a/interfaces/windowmanager.xml +++ b/interfaces/windowmanager.xml @@ -191,7 +191,6 @@ Show layer for application . --> <method name="showAppLayer"> - <arg name="name" type="s" direction="in"/> <arg name="pid" type="i" direction="in"/> </method> <!-- diff --git a/windowmanager/src/windowmanager.cpp b/windowmanager/src/windowmanager.cpp index 6510b74..08dac72 100644 --- a/windowmanager/src/windowmanager.cpp +++ b/windowmanager/src/windowmanager.cpp @@ -60,8 +60,6 @@ WindowManager::WindowManager(int displayId, QObject *parent) : , m_appSurfaces(), m_appLayers(), - m_keepApps(), - m_bgApps(), m_pending_to_show(-1) #endif { @@ -73,8 +71,6 @@ WindowManager::WindowManager(int displayId, QObject *parent) : m_showLayers[2] = 0; /* APPLICATIONS is not shown by default */ m_showLayers[3] = WINDOWMANAGER_LAYER_HOMESCREEN; /* HOMESCREEN is shwon by default */ - m_keepApps.append(QString("mediaplayer@")); - m_keepApps.append(QString("navigation@")); #endif qDebug("-=[WindowManager]=-"); } @@ -124,46 +120,26 @@ WindowManager::~WindowManager() } #ifdef HAVE_IVI_LAYERMANAGEMENT_API -t_ilm_layer* WindowManager::getLayerRenderOrder(int& num_layers) +int WindowManager::getLayerRenderOrder(t_ilm_layer id_array[]) { - int i, j, n_bg = m_bgApps.size(); + int i, j; - t_ilm_layer* id_array = new t_ilm_layer[n_bg + WINDOWMANAGER_LAYER_NUM]; - - qDebug("Layer render order (ivi-layer-id), %d bgApps: ", n_bg); - - num_layers = 0; - for (i = 0; i < n_bg; i++) { - if (m_bgApps[i] != 0) { - QMap<pid_t, t_ilm_layer>::const_iterator i_layers; - i_layers = m_appLayers.find(m_bgApps[i]); - /* m_showLayers[2] means layer for apps */ - if (i_layers != m_appLayers.end() && i_layers.value() != 0 - && i_layers.value() != m_showLayers[2]) { - qDebug(" m_bgApps[%d]=%d", i, i_layers.value()); - id_array[num_layers++] = i_layers.value(); - } - } - } - - for (i = WINDOWMANAGER_LAYER_NUM - 1, j = 0; i >= 0; i--,j++) { + for (i = WINDOWMANAGER_LAYER_NUM - 1, j = 0; i >= 0; i--) { if (m_showLayers[i] != 0) { - qDebug(" m_showLayers[%d]=%d", i, m_showLayers[i]); - id_array[num_layers++] = m_showLayers[i]; + id_array[j++] = m_showLayers[i]; } } - return id_array; + return j; } void WindowManager::renderLayers() { - int num_layers; - t_ilm_layer* renderOrder = getLayerRenderOrder(num_layers); - - qDebug("Screen render order %d, %d layers", m_screenId, num_layers); - ilm_displaySetRenderOrder(m_screenId, renderOrder, num_layers); - ilm_commitChanges(); + t_ilm_layer renderOrder[WINDOWMANAGER_LAYER_NUM]; + int num_layers = getLayerRenderOrder(renderOrder); + qDebug("Screen render order %d, %d layers", m_screenId, num_layers); + ilm_displaySetRenderOrder(m_screenId, renderOrder, num_layers); + ilm_commitChanges(); } #endif @@ -367,13 +343,82 @@ void WindowManager::updateScreen() { qDebug("-=[updateScreen]=-"); +#if 0 +//#ifdef HAVE_IVI_LAYERMANAGEMENT_API + if (-1 != m_currentLayout) + { + // hide all surfaces + for (int i = 0; i < m_appSurfaces.size(); ++i) + { + ilm_layerRemoveSurface(WINDOWMANAGER_LAYER_APPLICATIONS, m_appSurfaces.at(i)); + //ilm_surfaceSetVisibility(m_appSurfaces.at(i), ILM_FALSE); + //ilm_surfaceSetOpacity(m_appSurfaces.at(i), 0.0); + ilm_commitChanges(); + } + + // find the current used layout + QList<Layout>::const_iterator ci = m_layouts.begin(); + + Layout currentLayout; + while (ci != m_layouts.constEnd()) + { + if (ci->id == m_currentLayout) + { + currentLayout = *ci; + } + + ++ci; + } + + qDebug("show %d apps", mp_layoutAreaToSurfaceIdAssignment->size()); + for (int j = 0; j < mp_layoutAreaToSurfaceIdAssignment->size(); ++j) + { + int surfaceToShow = mp_layoutAreaToSurfaceIdAssignment->find(j).value(); + qDebug(" surface no. %d: %d", j, surfaceToShow); + + addSurfaceToLayer(surfaceToShow, WINDOWMANAGER_LAYER_APPLICATIONS); + + ilm_surfaceSetVisibility(surfaceToShow, ILM_TRUE); + ilm_surfaceSetOpacity(surfaceToShow, 1.0); + + qDebug(" layout area %d", j); + qDebug(" x: %d", currentLayout.layoutAreas[j].x); + qDebug(" y: %d", currentLayout.layoutAreas[j].y); + qDebug(" w: %d", currentLayout.layoutAreas[j].width); + qDebug(" h: %d", currentLayout.layoutAreas[j].height); + + ilm_surfaceSetDestinationRectangle(surfaceToShow, + currentLayout.layoutAreas[j].x, + currentLayout.layoutAreas[j].y, + currentLayout.layoutAreas[j].width, + currentLayout.layoutAreas[j].height); + ilm_commitChanges(); + } + } + + // layer surface render order + t_ilm_int length; + t_ilm_surface* pArray; + ilm_getSurfaceIDsOnLayer(WINDOWMANAGER_LAYER_HOMESCREEN, &length, &pArray); + ilm_layerSetRenderOrder(WINDOWMANAGER_LAYER_HOMESCREEN, pArray, length); + ilm_commitChanges(); + ilm_getSurfaceIDsOnLayer(WINDOWMANAGER_LAYER_APPLICATIONS, &length, &pArray); + ilm_layerSetRenderOrder(WINDOWMANAGER_LAYER_APPLICATIONS, pArray, length); + ilm_commitChanges(); + ilm_getSurfaceIDsOnLayer(WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY, &length, &pArray); + ilm_layerSetRenderOrder(WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY, pArray, length); + ilm_commitChanges(); + ilm_getSurfaceIDsOnLayer(WINDOWMANAGER_LAYER_POPUP, &length, &pArray); + ilm_layerSetRenderOrder(WINDOWMANAGER_LAYER_POPUP, pArray, length); + ilm_commitChanges(); +#endif #ifdef HAVE_IVI_LAYERMANAGEMENT_API if (m_pending_to_show != -1) { qDebug("show pending app (%d)", m_pending_to_show); showAppLayer(m_pending_to_show); } else { // display layer render order - renderLayers(); + renderLayers(); } #endif } @@ -666,7 +711,7 @@ void WindowManager::hideLayer(int layer) /* clear pending flag */ m_pending_to_show = -1; } - renderLayers(); + renderLayers(); } #endif } @@ -741,7 +786,7 @@ void WindowManager::showLayer(int layer) m_showLayers[layer] = layer_id_array[layer]; - renderLayers(); + renderLayers(); } #endif } @@ -761,65 +806,17 @@ void WindowManager::showAppLayer(int pid) /* search layer id for application to show */ QMap<pid_t, t_ilm_layer>::const_iterator i = m_appLayers.find(pid); + QMap<pid_t, t_ilm_surface>::const_iterator j = m_appSurfaces.find(pid); if (i != m_appLayers.end()) { - qDebug("Found layer(%d) to show for app(pid=%d)", m_showLayers[2], pid); m_showLayers[2] = i.value(); - } else { - QMap<pid_t, t_ilm_surface>::const_iterator j = m_appSurfaces.find(pid); - /* check if this app is registered */ - if (j == m_appSurfaces.end()) { - qDebug("New app %d", pid); - m_appSurfaces.insert(pid, 0); /* register pid only so far */ - } /* check app is required keep running while background */ - - /* Probably app layer hasn't been made yet */ - m_pending_to_show = pid; - /* hide current app once, back to default screen */ - m_showLayers[2] = 0; - qDebug("No layer to show for app(pid=%d)", pid); - } - renderLayers(); -#endif -} - -void WindowManager::showAppLayer(const QString &app_id, int pid) -{ - qDebug("-=[showAppLayer]=-"); - qDebug() << "id=" << app_id << ", pid=" << pid; - - if (pid == -1) { - /* nothing to show */ - return; - } -#ifdef HAVE_IVI_LAYERMANAGEMENT_API - /* clear pending flag */ - m_pending_to_show = -1; - - /* search layer id for application to show */ - QMap<pid_t, t_ilm_layer>::const_iterator i = m_appLayers.find(pid); - - if (i != m_appLayers.end()) { qDebug("Found layer(%d) to show for app(pid=%d)", m_showLayers[2], pid); - m_showLayers[2] = i.value(); } else { - QMap<pid_t, t_ilm_surface>::const_iterator j = m_appSurfaces.find(pid); /* check if this app is registered */ if (j == m_appSurfaces.end()) { qDebug("New app %d", pid); m_appSurfaces.insert(pid, 0); /* register pid only so far */ - - /* check if rendering is always required */ - /* QML apps should be always rendered if */ - for (int k = 0; k != m_keepApps.size(); k++) { - if (app_id.indexOf(m_keepApps[k]) == 0) { - int idx = m_bgApps.indexOf(pid); - if (idx == -1) { - m_bgApps.append(pid); - } - } - } - } /* check app is required keep running while background */ + } /* Probably app layer hasn't been made yet */ m_pending_to_show = pid; diff --git a/windowmanager/src/windowmanager.hpp b/windowmanager/src/windowmanager.hpp index 0826627..7a9b297 100644 --- a/windowmanager/src/windowmanager.hpp +++ b/windowmanager/src/windowmanager.hpp @@ -52,11 +52,7 @@ private: t_ilm_layer* m_showLayers; QMap<pid_t, t_ilm_surface> m_appSurfaces; QMap<pid_t, t_ilm_layer> m_appLayers; - - QList<QString> m_keepApps; /* Apps needs to keep rendering */ - QList<pid_t> m_bgApps; - - t_ilm_layer* getLayerRenderOrder(int& num_layers); + int getLayerRenderOrder(t_ilm_layer* id_array); void createNewLayer(const int layerId); @@ -128,7 +124,6 @@ public Q_SLOTS: // METHODS int setSurfaceToLayoutArea(int surfaceId, int layoutAreaId); void showLayer(int layer); void showAppLayer(int pid); - void showAppLayer(const QString &app_id, int pid); Q_SIGNALS: // SIGNALS void surfaceVisibilityChanged(int surfaceId, bool visible); |