From 40392aafca55c9ee79919ad25d9f6d83237c7f6a Mon Sep 17 00:00:00 2001 From: Timo Lotterbach Date: Fri, 18 Jan 2013 04:08:28 -0800 Subject: [PATCH] ilmClient: fix for ilm_getPropertiesOfScreen if screen was not found if the scene does not contain the requested screen, the screenProperties structure is now initialized to save values. LayerManagerControl now correctly evaluates the return value of ilm_getPropertiesOfScreen and prints "screen not found" instead of crashing. Signed-off-by: Timo Lotterbach --- .../ilmClient/src/generic_ilm_client.c | 9 ++++++++ LayerManagerControl/src/print.cpp | 25 ++++++++++++++-------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/LayerManagerClient/ilmClient/src/generic_ilm_client.c b/LayerManagerClient/ilmClient/src/generic_ilm_client.c index e337960..35a5020 100644 --- a/LayerManagerClient/ilmClient/src/generic_ilm_client.c +++ b/LayerManagerClient/ilmClient/src/generic_ilm_client.c @@ -1961,6 +1961,15 @@ ilmErrorTypes ilm_getPropertiesOfScreen(t_ilm_display screenID, struct ilmScreen { returnValue = ILM_SUCCESS; } + else + { + pScreenProperties->layerCount = 0; + pScreenProperties->harwareLayerCount = 0; + pScreenProperties->layerIds = NULL; + pScreenProperties->screenWidth = 0; + pScreenProperties->screenHeight = 0; + } + gIpcModule.destroyMessage(response); gIpcModule.destroyMessage(command); return returnValue; diff --git a/LayerManagerControl/src/print.cpp b/LayerManagerControl/src/print.cpp index c41e0ef..1e10574 100644 --- a/LayerManagerControl/src/print.cpp +++ b/LayerManagerControl/src/print.cpp @@ -85,20 +85,27 @@ void printScreenProperties(unsigned int screenid, const char* prefix) cout << prefix << "---------------------------------------\n"; ilmScreenProperties screenProperties; - ilm_getPropertiesOfScreen(screenid, &screenProperties); - cout << prefix << "- resolution: x=" << screenProperties.screenWidth << ", y=" - << screenProperties.screenHeight << "\n"; + if (ilm_getPropertiesOfScreen(screenid, &screenProperties) == ILM_SUCCESS) + { + cout << prefix << "- resolution: x=" << screenProperties.screenWidth << ", y=" + << screenProperties.screenHeight << "\n"; - cout << prefix << "- hardware layer count: " << screenProperties.harwareLayerCount << "\n"; + cout << prefix << "- hardware layer count: " << screenProperties.harwareLayerCount << "\n"; - cout << prefix << "- layer render order: "; + cout << prefix << "- layer render order: "; - for (t_ilm_uint layerIndex = 0; layerIndex < screenProperties.layerCount; ++layerIndex) + for (t_ilm_uint layerIndex = 0; layerIndex < screenProperties.layerCount; ++layerIndex) + { + t_ilm_layer layerid = screenProperties.layerIds[layerIndex]; + cout << layerid << "(0x" << hex << layerid << dec << "), "; + } + cout << "\n"; + } + else { - t_ilm_layer layerid = screenProperties.layerIds[layerIndex]; - cout << layerid << "(0x" << hex << layerid << dec << "), "; + cout << "No screen with ID :" << screenid; + cout << "\n"; } - cout << "\n"; } void printLayerProperties(unsigned int layerid, const char* prefix) -- 2.7.4