X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=WindowManager%2Fsrc%2Fwindowmanager.cpp;h=ed38c49138be9861e75d0dc3bc218bb4a1b6a68d;hb=bf0f33bec5ad705666dff6c821334524c1b81583;hp=26d650fc114be744c16ae560c9f38c7c8b0e6113;hpb=f1de82b82538e143bd46fd216ccc62e1f1b0f983;p=staging%2FHomeScreen.git diff --git a/WindowManager/src/windowmanager.cpp b/WindowManager/src/windowmanager.cpp index 26d650f..ed38c49 100644 --- a/WindowManager/src/windowmanager.cpp +++ b/WindowManager/src/windowmanager.cpp @@ -33,6 +33,10 @@ #define WINDOWMANAGER_LAYER_NUM 3 +// the HomeScreen app has to have the surface id 1000 +#define WINDOWMANAGER_HOMESCREEN_MAIN_SURFACE_ID 1000 + + void* WindowManager::myThis = 0; WindowManager::WindowManager(QObject *parent) : @@ -40,8 +44,7 @@ WindowManager::WindowManager(QObject *parent) : m_layouts(), m_surfaces(), mp_layoutAreaToSurfaceIdAssignment(0), - m_currentLayout(-1), - m_homeScreenPid(-1) + m_currentLayout(-1) { qDebug("-=[WindowManager]=-"); // publish windowmanager interface @@ -160,7 +163,7 @@ void WindowManager::addSurfaceToLayer(int surfaceId, int layerId) ilm_getScreenResolution(screenID, &width, &height); ilm_surfaceSetDestinationRectangle(surfaceId, 0, 0, width, height); - ilm_surfaceSetSourceRectangle(surfaceId, 0, 0, surfaceProperties.origSourceWidth, surfaceProperties.origSourceHeight); + ilm_surfaceSetSourceRectangle(surfaceId, 0, 0, width, height); ilm_surfaceSetOpacity(surfaceId, 1.0); ilm_surfaceSetVisibility(surfaceId, ILM_TRUE); @@ -282,15 +285,11 @@ void WindowManager::notificationFunc_non_static(ilmObjectType object, qDebug(" origSourceWidth : %d", surfaceProperties.origSourceWidth); qDebug(" origSourceHeight: %d", surfaceProperties.origSourceHeight); - if (m_homeScreenPid == surfaceProperties.creatorPid) + if (WINDOWMANAGER_HOMESCREEN_MAIN_SURFACE_ID == id) { - if (m_homeScreenSurfaceId != id) - { - qDebug("HomeScreen app detected"); - m_homeScreenSurfaceId = id; - addSurfaceToLayer(id, WINDOWMANAGER_LAYER_HOMESCREEN); - updateScreen(); - } + qDebug("HomeScreen app detected"); + addSurfaceToLayer(id, WINDOWMANAGER_LAYER_HOMESCREEN); + updateScreen(); } else { @@ -335,26 +334,35 @@ void WindowManager::surfaceCallbackFunction_non_static(t_ilm_surface surface, { qDebug("ILM_NOTIFICATION_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"); + } + if (ILM_NOTIFICATION_CONTENT_REMOVED & mask) + { + qDebug("ILM_NOTIFICATION_CONTENT_REMOVED"); + } + if (ILM_NOTIFICATION_CONFIGURED & mask) + { + qDebug("ILM_NOTIFICATION_CONFIGURED"); + updateScreen(); + } } void WindowManager::surfaceCallbackFunction_static(t_ilm_surface surface, @@ -366,44 +374,6 @@ void WindowManager::surfaceCallbackFunction_static(t_ilm_surface surface, } #endif - -int WindowManager::homeScreenPid() const -{ - return m_homeScreenPid; -} - -void WindowManager::setHomeScreenPid(int value) -{ - m_homeScreenPid = value; -#ifdef __arm__ - // maybe the HomeSceen app has already provided its surface. - // if so, shift it to the correct layer - // find the current used layout - QList::iterator ci = m_surfaces.begin(); - - struct ilmSurfaceProperties surfaceProperties; - bool found = false; - while ((!found) && (ci != m_surfaces.constEnd())) - { - ilm_getPropertiesOfSurface(*ci, &surfaceProperties); - if (m_homeScreenPid == surfaceProperties.creatorPid) - { - qDebug("HomeScreen app detected"); - m_homeScreenSurfaceId = *ci; - addSurfaceToLayer(*ci, WINDOWMANAGER_LAYER_HOMESCREEN); - m_surfaces.erase(ci); - found = true; - updateScreen(); - } - - ++ci; - } -#endif - - updateScreen(); - dumpScene(); -} - int WindowManager::layoutId() const { return m_currentLayout; @@ -450,6 +420,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]=-");