From 751b65c5674dce167ceaf0f94e4d516a16b0e549 Mon Sep 17 00:00:00 2001 From: Timo Lotterbach Date: Thu, 10 Jan 2013 03:36:37 -0800 Subject: [PATCH] GenericCommunicator: added support for GetPropertiesOfScreen Signed-off-by: Timo Lotterbach --- .../include/GenericCommunicator.h | 1 + .../src/GenericCommunicator.cpp | 45 +++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/LayerManagerPlugins/Communicators/GenericCommunicator/include/GenericCommunicator.h b/LayerManagerPlugins/Communicators/GenericCommunicator/include/GenericCommunicator.h index ac3e64f..7f6c014 100644 --- a/LayerManagerPlugins/Communicators/GenericCommunicator/include/GenericCommunicator.h +++ b/LayerManagerPlugins/Communicators/GenericCommunicator/include/GenericCommunicator.h @@ -154,6 +154,7 @@ private: void SurfaceRemoveNotification(t_ilm_message message); void SetOptimizationMode(t_ilm_message message); void GetOptimizationMode(t_ilm_message message); + void GetPropertiesOfScreen(t_ilm_message message); private: void RemoveApplicationReference(char* owner); diff --git a/LayerManagerPlugins/Communicators/GenericCommunicator/src/GenericCommunicator.cpp b/LayerManagerPlugins/Communicators/GenericCommunicator/src/GenericCommunicator.cpp index cfeff42..4865095 100644 --- a/LayerManagerPlugins/Communicators/GenericCommunicator/src/GenericCommunicator.cpp +++ b/LayerManagerPlugins/Communicators/GenericCommunicator/src/GenericCommunicator.cpp @@ -19,6 +19,7 @@ #include "GenericCommunicator.h" #include "ilm_types.h" +#include "LmScreen.h" #include "Log.h" #include "Configuration.h" @@ -83,6 +84,7 @@ #include #include #include +#include #define DEFAULT_SCREEN 0 @@ -174,7 +176,8 @@ GenericCommunicator::GenericCommunicator(ICommandExecutor& executor, Configurati { "LayerRemoveNotification", &GenericCommunicator::LayerRemoveNotification }, { "SurfaceRemoveNotification", &GenericCommunicator::SurfaceRemoveNotification }, { "SetOptimizationMode", &GenericCommunicator::SetOptimizationMode }, - { "GetOptimizationMode", &GenericCommunicator::GetOptimizationMode } + { "GetOptimizationMode", &GenericCommunicator::GetOptimizationMode }, + { "GetPropertiesOfScreen", &GenericCommunicator::GetPropertiesOfScreen } }; int entryCount = sizeof(manager_methods) / sizeof(MethodTable); @@ -2549,4 +2552,44 @@ void GenericCommunicator::GetOptimizationMode(t_ilm_message message) } +void GenericCommunicator::GetPropertiesOfScreen(t_ilm_message message) +{ + t_ilm_message response; + t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message); + uint id = 0; + m_ipcModule.getUint(message, &id); + + LmScreen* screen = m_executor->getScene()->getScreen(id); + if (screen != NULL) + { + LayerList renderOrder = screen->getCurrentRenderOrder(); + std::vector layerIdVector; + + LayerListConstIterator iter = renderOrder.begin(); + LayerListConstIterator end = renderOrder.end(); + for (; iter != end; ++iter) + { + layerIdVector.push_back((*iter)->getID()); + } + + uint numberOfHardwareLayers = m_executor->getNumberOfHardwareLayers(id); + uint* resolution = m_executor->getScreenResolution(id); + + response = m_ipcModule.createResponse(message); + m_ipcModule.appendUintArray(response, layerIdVector.data(), layerIdVector.size()); + m_ipcModule.appendUint(response,numberOfHardwareLayers); + m_ipcModule.appendUint(response, resolution[0]); + m_ipcModule.appendUint(response, resolution[1]); + } + else + { + response = m_ipcModule.createErrorResponse(message); + m_ipcModule.appendString(response, RESOURCE_NOT_FOUND); + } + + m_ipcModule.sendToClients(response, &clientHandle, 1); + m_ipcModule.destroyMessage(response); +} + DECLARE_LAYERMANAGEMENT_PLUGIN(GenericCommunicator) + -- 2.7.4