X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=WindowManager%2Fsrc%2Fwindowmanager.cpp;h=25d971a704f567e8970d1bfc69717de0ebe77387;hb=65f6210462dbc20f5690d27e834db1bd9f324d9c;hp=765ae4f358bd59e72401ac583dfca602a31a6b81;hpb=6656309e1ddf27c3e62fe5d599bee2beeddcbff1;p=staging%2FHomeScreen.git diff --git a/WindowManager/src/windowmanager.cpp b/WindowManager/src/windowmanager.cpp index 765ae4f..25d971a 100644 --- a/WindowManager/src/windowmanager.cpp +++ b/WindowManager/src/windowmanager.cpp @@ -28,8 +28,9 @@ // On top all applications in one layer. // On top of that, the popup layer. #define WINDOWMANAGER_LAYER_POPUP 100 -#define WINDOWMANAGER_LAYER_APPLICATIONS 101 -#define WINDOWMANAGER_LAYER_HOMESCREEN 102 +#define WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY 101 +#define WINDOWMANAGER_LAYER_APPLICATIONS 102 +#define WINDOWMANAGER_LAYER_HOMESCREEN 103 #define WINDOWMANAGER_LAYER_NUM 3 @@ -69,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 @@ -183,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; @@ -258,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); @@ -333,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) { @@ -353,6 +370,7 @@ void WindowManager::surfaceCallbackFunction_non_static(t_ilm_surface surface, if (ILM_NOTIFICATION_CONTENT_AVAILABLE & mask) { qDebug("ILM_NOTIFICATION_CONTENT_AVAILABLE"); + updateScreen(); } if (ILM_NOTIFICATION_CONTENT_REMOVED & mask) { @@ -413,6 +431,37 @@ int WindowManager::addLayout(int layoutId, const QString &layoutName, const QLis 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::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 WindowManager::getAllLayouts() { qDebug("-=[getAllLayouts]=-"); @@ -420,6 +469,24 @@ QList WindowManager::getAllLayouts() return m_layouts; } +QList WindowManager::getAllSurfacesOfProcess(int pid) +{ + QList 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 WindowManager::getAvailableLayouts(int numberOfAppSurfaces) { qDebug("-=[getAvailableLayouts]=-"); @@ -465,6 +532,31 @@ QString WindowManager::getLayoutName(int layoutId) return result; } +void WindowManager::hideLayer(int layer) +{ + qDebug("-=[hideLayer]=-"); + qDebug("layer %d", layer); + +#ifdef __arm__ + if (0 == layer) + { + ilm_layerSetVisibility(WINDOWMANAGER_LAYER_POPUP, ILM_FALSE); + } + if (1 == layer) + { + 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); + } + ilm_commitChanges(); +#endif +} int WindowManager::setLayoutById(int layoutId) { @@ -518,3 +610,29 @@ int WindowManager::setSurfaceToLayoutArea(int surfaceId, int layoutAreaId) return result; } + +void WindowManager::showLayer(int layer) +{ + qDebug("-=[showLayer]=-"); + qDebug("layer %d", layer); + +#ifdef __arm__ + if (0 == layer) + { + ilm_layerSetVisibility(WINDOWMANAGER_LAYER_POPUP, ILM_TRUE); + } + if (1 == layer) + { + 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); + } + ilm_commitChanges(); +#endif +}