LayerManagement: fixed warnings detected by style guide check scripts
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Fri, 1 Mar 2013 09:42:46 +0000 (01:42 -0800)
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Thu, 14 Mar 2013 12:03:39 +0000 (05:03 -0700)
Signed-off-by: Timo Lotterbach <timo.lotterbach@bmw-carit.de>
243 files changed:
LayerManagerBase/include/ApplicationReferenceList.h
LayerManagerBase/include/ApplicationReferenceMap.h
LayerManagerBase/include/Configuration.h
LayerManagerBase/include/FileList.h
LayerManagerBase/include/FloatRectangle.h [new file with mode: 0644]
LayerManagerBase/include/GraphicalSurface.h
LayerManagerBase/include/HealthMonitorList.h
LayerManagerBase/include/IApplicationReference.h
LayerManagerBase/include/ICommandExecutor.h
LayerManagerBase/include/IHealthMonitor.h
LayerManagerBase/include/IPlugin.h
LayerManagerBase/include/IScene.h
LayerManagerBase/include/ISceneProvider.h
LayerManagerBase/include/InputManager.h
LayerManagerBase/include/Layer.h
LayerManagerBase/include/Layermanager.h
LayerManagerBase/include/ObjectType.h
LayerManagerBase/include/OptimizationType.h
LayerManagerBase/include/OrientationType.h
LayerManagerBase/include/PixelFormat.h
LayerManagerBase/include/PlatformSurface.h
LayerManagerBase/include/PluginBase.h
LayerManagerBase/include/PluginList.h
LayerManagerBase/include/PluginManager.h
LayerManagerBase/include/Rectangle.h
LayerManagerBase/include/Scene.h
LayerManagerBase/include/Shader.h
LayerManagerBase/include/SignalHandler.h
LayerManagerBase/include/Surface.h
LayerManagerBase/include/ViewportTransform.h
LayerManagerBase/src/Configuration.cpp
LayerManagerBase/src/GraphicalObject.cpp
LayerManagerBase/src/GraphicalSurface.cpp
LayerManagerBase/src/InputManager.cpp
LayerManagerBase/src/Layermanager.cpp
LayerManagerBase/src/PluginBase.cpp
LayerManagerBase/src/PluginManager.cpp
LayerManagerBase/src/Scene.cpp
LayerManagerBase/src/Shader.cpp
LayerManagerBase/src/ShaderProgram.cpp
LayerManagerBase/src/ShaderUniform.cpp
LayerManagerBase/src/SignalHandler.cpp
LayerManagerClient/ilmClient/include/ilm_client.h
LayerManagerClient/ilmCommon/include/ilm_types.h
LayerManagerClient/ilmCommon/src/ilm_tools.c
LayerManagerClient/ilmControl/include/ilm_control.h
LayerManagerCommands/include/CommitCommand.h
LayerManagerCommands/include/ExitCommand.h
LayerManagerCommands/include/GetOptimizationModeCommand.h
LayerManagerCommands/include/LayerDumpCommand.h
LayerManagerCommands/include/LayerGetDimensionCommand.h
LayerManagerCommands/include/LayerGetOrientationCommand.h
LayerManagerCommands/include/LayerSetDestinationRectangleCommand.h
LayerManagerCommands/include/LayerSetPositionCommand.h
LayerManagerCommands/include/LayerSetSourceRectangleCommand.h
LayerManagerCommands/include/ScreenDumpCommand.h
LayerManagerCommands/include/ScreenSetRenderOrderCommand.h
LayerManagerCommands/include/SurfaceDumpCommand.h
LayerManagerCommands/include/SurfaceGetDimensionCommand.h
LayerManagerCommands/include/SurfaceGetKeyboardFocusCommand.h
LayerManagerCommands/include/SurfaceGetOrientationCommand.h
LayerManagerCommands/include/SurfaceRemoveNativeContentCommand.h
LayerManagerCommands/include/SurfaceSetDestinationRectangleCommand.h
LayerManagerCommands/include/SurfaceSetDimensionCommand.h
LayerManagerCommands/include/SurfaceSetKeyboardFocusCommand.h
LayerManagerCommands/include/SurfaceSetNativeContentCommand.h
LayerManagerCommands/include/SurfaceSetSourceRectangleCommand.h
LayerManagerCommands/include/SurfaceUpdateInputEventAcceptance.h
LayerManagerCommands/src/LayerAddSurfaceCommand.cpp
LayerManagerCommands/src/LayerCreateCommand.cpp
LayerManagerCommands/src/LayerDumpCommand.cpp
LayerManagerCommands/src/LayerSetChromaKeyCommand.cpp
LayerManagerCommands/src/LayerSetOpacityCommand.cpp
LayerManagerCommands/src/LayerSetRenderOrderCommand.cpp
LayerManagerCommands/src/ScreenDumpCommand.cpp
LayerManagerCommands/src/ShaderCreateCommand.cpp
LayerManagerCommands/src/ShaderSetUniformsCommand.cpp
LayerManagerCommands/src/SurfaceDumpCommand.cpp
LayerManagerCommands/src/SurfaceGetOrientationCommand.cpp
LayerManagerCommands/src/SurfaceGetPixelformatCommand.cpp
LayerManagerCommands/src/SurfaceRemoveNativeContentCommand.cpp
LayerManagerCommands/src/SurfaceSetChromaKeyCommand.cpp
LayerManagerCommands/src/SurfaceSetDestinationRectangleCommand.cpp
LayerManagerCommands/src/SurfaceSetDimensionCommand.cpp
LayerManagerCommands/src/SurfaceSetKeyboardFocusCommand.cpp
LayerManagerCommands/src/SurfaceSetNativeContentCommand.cpp
LayerManagerCommands/src/SurfaceSetOpacityCommand.cpp
LayerManagerCommands/src/SurfaceSetPositionCommand.cpp
LayerManagerCommands/src/SurfaceSetSourceRectangleCommand.cpp
LayerManagerControl/include/Expression.h
LayerManagerControl/include/ExpressionInterpreter.h
LayerManagerControl/include/LMControl.h
LayerManagerControl/include/SceneStore.h
LayerManagerControl/include/StringMapTree.h
LayerManagerControl/src/Expression.cpp
LayerManagerControl/src/ExpressionInterpreter.cpp
LayerManagerControl/src/analyze.cpp
LayerManagerControl/src/commands.cpp
LayerManagerControl/src/common.cpp
LayerManagerControl/src/control.cpp
LayerManagerControl/src/demo.cpp
LayerManagerControl/src/main.cpp
LayerManagerControl/src/scatter.cpp
LayerManagerControl/src/sceneio.cpp
LayerManagerExamples/EGLWLApplicationExample/include/WaylandServerinfoClientProtocol.h
LayerManagerExamples/EGLWLInputEventExample/include/WLContext.h
LayerManagerExamples/EGLWLInputEventExample/include/WLEGLSurface.h
LayerManagerExamples/EGLWLInputEventExample/include/WLEyes.h
LayerManagerExamples/EGLWLInputEventExample/include/WLEyesRenderer.h
LayerManagerExamples/EGLWLInputEventExample/include/WLSurface.h
LayerManagerExamples/EGLWLInputEventExample/include/WaylandServerinfoClientProtocol.h
LayerManagerExamples/EGLWLMockNavigation/include/Argument.h
LayerManagerExamples/EGLWLMockNavigation/include/Camera.h
LayerManagerExamples/EGLWLMockNavigation/include/Car.h
LayerManagerExamples/EGLWLMockNavigation/include/Ground.h
LayerManagerExamples/EGLWLMockNavigation/include/House.h
LayerManagerExamples/EGLWLMockNavigation/include/IRenderable.h
LayerManagerExamples/EGLWLMockNavigation/include/IUpdateable.h
LayerManagerExamples/EGLWLMockNavigation/include/MockNavi.h
LayerManagerExamples/EGLWLMockNavigation/include/OpenGLES2App.h
LayerManagerExamples/EGLWLMockNavigation/include/Street.h
LayerManagerExamples/EGLWLMockNavigation/include/WaylandServerinfoClientProtocol.h
LayerManagerExamples/EGLWLMockNavigation/include/vec.h
LayerManagerExamples/EGLX11ApplicationExample/src/egl_helper.cpp
LayerManagerExamples/EGLX11ApplicationExample/src/gles2application.cpp
LayerManagerExamples/EGLX11MockNavigation/include/Argument.h
LayerManagerExamples/EGLX11MockNavigation/include/Camera.h
LayerManagerExamples/EGLX11MockNavigation/include/Car.h
LayerManagerExamples/EGLX11MockNavigation/include/Ground.h
LayerManagerExamples/EGLX11MockNavigation/include/House.h
LayerManagerExamples/EGLX11MockNavigation/include/IRenderable.h
LayerManagerExamples/EGLX11MockNavigation/include/IUpdateable.h
LayerManagerExamples/EGLX11MockNavigation/include/MockNavi.h
LayerManagerExamples/EGLX11MockNavigation/include/OpenGLES2App.h
LayerManagerExamples/EGLX11MockNavigation/include/Street.h
LayerManagerExamples/EGLX11MockNavigation/include/vec.h
LayerManagerExamples/EGLX11MockNavigation/src/Argument.cpp
LayerManagerExamples/EGLX11MockNavigation/src/Car.cpp
LayerManagerExamples/EGLX11MockNavigation/src/Ground.cpp
LayerManagerExamples/EGLX11MockNavigation/src/House.cpp
LayerManagerExamples/EGLX11MockNavigation/src/MockNavi.cpp
LayerManagerExamples/EGLX11MockNavigation/src/OpenGLES2App.cpp
LayerManagerExamples/EGLX11MockNavigation/src/ShaderBase.cpp
LayerManagerExamples/EGLX11MockNavigation/src/ShaderLighting.cpp
LayerManagerExamples/EGLX11MockNavigation/src/Street.cpp
LayerManagerExamples/EGLX11MockNavigation/src/main.cpp
LayerManagerExamples/LayerManagerClientExample/src/LayermanagerClientTest.c
LayerManagerExamples/LayerSceneDescriptionExample/include/LayerSceneProvider.h
LayerManagerExamples/WLChromakeyExample/include/serverinfo-client-protocol.h
LayerManagerPlugins/Communicators/GenericCommunicator/include/GenericCommunicator.h
LayerManagerPlugins/Communicators/GenericCommunicator/src/GenericCommunicator.cpp
LayerManagerPlugins/Communicators/GenericCommunicator/test/mock_CommandExecutor.h
LayerManagerPlugins/Communicators/GenericCommunicator/test/mock_Communicator.h
LayerManagerPlugins/Communicators/GenericCommunicator/test/mock_Layerlist.h
LayerManagerPlugins/Communicators/GenericCommunicator/test/mock_Renderer.h
LayerManagerPlugins/HealthMonitor/SystemdHealthMonitor/include/SystemdHealthMonitor.h
LayerManagerPlugins/HealthMonitor/SystemdHealthMonitor/src/SystemdHealthMonitor.cpp
LayerManagerPlugins/IpcModules/DbusIpcModule/include/introspection.h
LayerManagerPlugins/IpcModules/DbusIpcModule/src/callbacks.c
LayerManagerPlugins/IpcModules/DbusIpcModule/src/initialization.c
LayerManagerPlugins/IpcModules/DbusIpcModule/src/introspection.c
LayerManagerPlugins/IpcModules/DbusIpcModule/src/message.c
LayerManagerPlugins/IpcModules/TcpIpcModule/include/socketConfiguration.h
LayerManagerPlugins/IpcModules/TcpIpcModule/src/get.c
LayerManagerPlugins/IpcModules/TcpIpcModule/src/initialization.c
LayerManagerPlugins/IpcModules/TcpIpcModule/src/message.c
LayerManagerPlugins/Renderers/Base/include/BaseRenderer.h
LayerManagerPlugins/Renderers/Base/include/RenderUtil.h
LayerManagerPlugins/Renderers/Base/src/BaseRenderer.cpp
LayerManagerPlugins/Renderers/Graphic/include/GraphicSystems/DrmGLESGraphicSystem.h
LayerManagerPlugins/Renderers/Graphic/include/GraphicSystems/GLESGraphicSystem.h
LayerManagerPlugins/Renderers/Graphic/include/GraphicSystems/GLXGraphicsystem.h
LayerManagerPlugins/Renderers/Graphic/include/PlatformSurfaces/BeaglePlatformSurface.h
LayerManagerPlugins/Renderers/Graphic/include/PlatformSurfaces/EglWaylandPlatformSurface.h
LayerManagerPlugins/Renderers/Graphic/include/PlatformSurfaces/EglXPlatformSurface.h
LayerManagerPlugins/Renderers/Graphic/include/PlatformSurfaces/GLXPlatformSurface.h
LayerManagerPlugins/Renderers/Graphic/include/PlatformSurfaces/WaylandPlatformSurface.h
LayerManagerPlugins/Renderers/Graphic/include/PlatformSurfaces/XPlatformSurface.h
LayerManagerPlugins/Renderers/Graphic/include/TextureBinders/BeagleEglImage.h
LayerManagerPlugins/Renderers/Graphic/include/TextureBinders/WaylandGLESTexture.h
LayerManagerPlugins/Renderers/Graphic/include/TextureBinders/X11Copy.h
LayerManagerPlugins/Renderers/Graphic/include/TextureBinders/X11CopyGLES.h
LayerManagerPlugins/Renderers/Graphic/include/TextureBinders/X11CopyGLX.h
LayerManagerPlugins/Renderers/Graphic/include/TextureBinders/X11EglImage.h
LayerManagerPlugins/Renderers/Graphic/include/TextureBinders/X11TextureFromPixmap.h
LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/BaseWindowSystem.h
LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/WaylandBaseWindowSystem.h
LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/WaylandDrmWindowSystem.h
LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/WaylandEvdevInputEvent.h
LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/WaylandFbdevWindowSystem.h
LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/WaylandInputDevice.h
LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/WaylandInputEvent.h
LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/WaylandServerinfoServerProtocol.h
LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/WaylandX11InputEvent.h
LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/WaylandX11WindowSystem.h
LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/X11WindowSystem.h
LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/DrmGLESGraphicSystem.cpp
LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLESGraphicSystem.cpp
LayerManagerPlugins/Renderers/Graphic/src/GraphicSystems/GLXGraphicSystem.cpp
LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/WaylandGLESTexture.cpp
LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11CopyGLES.cpp
LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11CopyGLX.cpp
LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11EglImage.cpp
LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11TextureFromPixmap.cpp
LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandBaseWindowSystem.cpp
LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandDrmWindowSystem.cpp
LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandEvdevInputEvent.cpp
LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandFbdevWindowSystem.cpp
LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandInputDevice.cpp
LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandInputEvent.cpp
LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandServerinfoProtocol.cpp
LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandX11InputEvent.cpp
LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/WaylandX11WindowSystem.cpp
LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp
LayerManagerPlugins/Renderers/Platform/GLXRenderer/src/X11GLXRenderer.cpp
LayerManagerPlugins/Renderers/Platform/TextRenderer/include/TextRenderer.h
LayerManagerPlugins/Renderers/Platform/TextRenderer/src/TextRenderer.cpp
LayerManagerPlugins/Renderers/Platform/WaylandDrmGLESRenderer/include/WaylandDrmGLESRenderer.h
LayerManagerPlugins/Renderers/Platform/WaylandDrmGLESRenderer/src/WaylandDrmGLESRenderer.cpp
LayerManagerPlugins/Renderers/Platform/WaylandFbdevGLESRenderer/include/WaylandFbdevGLESRenderer.h
LayerManagerPlugins/Renderers/Platform/WaylandFbdevGLESRenderer/src/WaylandFbdevGLESRenderer.cpp
LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer/include/WaylandGLESRenderer.h
LayerManagerPlugins/Renderers/Platform/WaylandGLESRenderer/src/WaylandGLESRenderer.cpp
LayerManagerPlugins/Renderers/Platform/WaylandX11GLESRenderer/include/WaylandX11GLESRenderer.h
LayerManagerPlugins/Renderers/Platform/WaylandX11GLESRenderer/src/WaylandX11GLESRenderer.cpp
LayerManagerPlugins/Renderers/Platform/X11GLESRenderer/include/ShaderProgramGLES.h
LayerManagerPlugins/Renderers/Platform/X11GLESRenderer/src/ShaderProgramGLES.cpp
LayerManagerPlugins/Renderers/Platform/X11GLESRenderer/src/X11GLESRenderer.cpp
LayerManagerPlugins/SceneProvider/ExampleSceneProvider/include/ExampleAppIds.h
LayerManagerPlugins/SceneProvider/ExampleSceneProvider/include/ExampleSceneProvider.h
LayerManagerPlugins/SceneProvider/ExampleSceneProvider/src/ExampleSceneProvider.cpp
LayerManagerService/src/main.cpp
LayerManagerUtils/include/IlmMatrix.h
LayerManagerUtils/include/IpcModule.h
LayerManagerUtils/include/Log.h
LayerManagerUtils/include/LogMessageBuffer.h
LayerManagerUtils/include/ThreadBase.h
LayerManagerUtils/src/Bitmap.cpp
LayerManagerUtils/src/IlmMatrix.cpp
LayerManagerUtils/src/IpcModuleLoader.cpp
LayerManagerUtils/src/Log.cpp
LayerManagerUtils/src/LogMessageBuffer.cpp
LayerManagerUtils/src/ThreadBase.cpp

index 734a4a0..0dc8ded 100644 (file)
@@ -16,8 +16,8 @@
 * limitations under the License.
 *
 ****************************************************************************/
-#ifndef _APPLICATION_REFERENCE_LIST_H_
-#define _APPLICATION_REFERENCE_LIST_H_
+#ifndef _APPLICATIONREFERENCELIST_H_
+#define _APPLICATIONREFERENCELIST_H_
 
 #include <list>
 
@@ -25,4 +25,4 @@ typedef std::list<t_ilm_client_handle> ApplicationReferenceList;
 typedef std::list<t_ilm_client_handle>::iterator ApplicationReferenceListIterator;
 typedef std::list<t_ilm_client_handle>::const_iterator ApplicationReferenceListConstIterator;
 
-#endif // _APPLICATION_REFERENCE_LIST_H_
+#endif // _APPLICATIONREFERENCELIST_H_
index d5f82b2..abcf41e 100644 (file)
@@ -16,8 +16,8 @@
 * limitations under the License.
 *
 ****************************************************************************/
-#ifndef _APPLICATION_REFERENCE_MAP_H_
-#define _APPLICATION_REFERENCE_MAP_H_
+#ifndef _APPLICATIONREFERENCEMAP_H_
+#define _APPLICATIONREFERENCEMAP_H_
 
 #include <map>
 #include "IApplicationReference.h"
@@ -27,4 +27,4 @@ typedef std::map<t_ilm_client_handle, IApplicationReference*> ApplicationReferen
 typedef std::map<t_ilm_client_handle, IApplicationReference*>::iterator ApplicationReferenceMapIterator;
 typedef std::map<t_ilm_client_handle, IApplicationReference*>::const_iterator ApplicationReferenceMapConstIterator;
 
-#endif /* _APPLICATION_REFERENCE_MAP_H_ */
+#endif /* _APPLICATIONREFERENCEMAP_H_ */
index 4214218..baf9d93 100644 (file)
@@ -55,7 +55,7 @@ public:
     std::string getPluginPath();
 
     void logAllSettings();
-    
+
 private:
     void processCommandLine(int argc, char** argv);
     void processBuildFlags();
index d6bba08..465c5a1 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- * 
+ *
  * Copyright 2012 BMW Car IT GmbH
  *
  *
diff --git a/LayerManagerBase/include/FloatRectangle.h b/LayerManagerBase/include/FloatRectangle.h
new file mode 100644 (file)
index 0000000..7a41652
--- /dev/null
@@ -0,0 +1,59 @@
+/***************************************************************************
+ *
+ * Copyright 2013 BMW Car IT GmbH
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ****************************************************************************/
+
+#ifndef _FLOATRECTANGLE_H_
+#define _FLOATRECTANGLE_H_
+
+#include <ostream>
+#include "FloatRectangle.h"
+
+class FloatRectangle
+{
+public:
+    FloatRectangle()
+    : x(0.0f)
+    , y(0.0f)
+    , width(0.0f)
+    , height(0.0f)
+    {
+    }
+
+    FloatRectangle(float x, float y, float width, float height)
+    : x(x)
+    , y(y)
+    , width(width)
+    , height(height)
+    {
+    }
+
+    FloatRectangle(const Rectangle& rhs)
+    : x(rhs.x)
+    , y(rhs.y)
+    , width(rhs.width)
+    , height(rhs.height)
+    {
+    }
+
+    float x;
+    float y;
+    float width;
+    float height;
+};
+
+#endif /* _FLOATRECTANGLE_H_ */
index e4e8257..cfba12a 100644 (file)
@@ -101,8 +101,8 @@ public:
     bool DestToSourceCoordinates(int *x, int *y, bool check) const;
 
     int OriginalSourceWidth;
-    int OriginalSourceHeight;    
-    
+    int OriginalSourceHeight;
+
 private:
     OrientationType m_orientation; // Rotation of the graphical content
     Rectangle m_sourceViewport;
@@ -115,8 +115,8 @@ inline GraphicalSurface::GraphicalSurface(ObjectType type, int creatorPid)
 , OriginalSourceWidth(0)
 , OriginalSourceHeight(0)
 , m_orientation(Zero)
-, m_sourceViewport(0,0,0,0)
-, m_destinationViewport(0,0,0,0)
+, m_sourceViewport(0, 0, 0, 0)
+, m_destinationViewport(0, 0, 0, 0)
 {
 }
 
@@ -125,8 +125,8 @@ inline GraphicalSurface::GraphicalSurface(int externalId, ObjectType type, int c
 , OriginalSourceWidth(0)
 , OriginalSourceHeight(0)
 , m_orientation(Zero)
-, m_sourceViewport(0,0,0,0)
-, m_destinationViewport(0,0,0,0)
+, m_sourceViewport(0, 0, 0, 0)
+, m_destinationViewport(0, 0, 0, 0)
 {
 }
 
@@ -187,7 +187,7 @@ inline bool GraphicalSurface::setPosition(const unsigned int& x, const unsigned
 
 inline Vector2 GraphicalSurface::getPosition()
 {
-    return Vector2(m_destinationViewport.x,m_destinationViewport.y);
+    return Vector2(m_destinationViewport.x, m_destinationViewport.y);
 }
 
 inline bool GraphicalSurface::setDimension(const unsigned int& width, const unsigned int& height)
index b7070f8..b91a8a1 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- * 
+ *
  * Copyright 2010,2011 BMW Car IT GmbH
  *
  *
index cf7ce1b..aa8d08c 100644 (file)
  *
  ****************************************************************************/
 
-#ifndef _IAPPLICATION_REFERENCE_H_
-#define _IAPPLICATION_REFERENCE_H_
+#ifndef _IAPPLICATIONREFERENCE_H_
+#define _IAPPLICATIONREFERENCE_H_
 #include <locale>
 #include <string.h>
 #include <stdlib.h>
 
 /**
- * Abstract Base Class for all Application References 
+ * Abstract Base Class for all Application References
  */
 class IApplicationReference
 {
 public:
     /**
      * Constructor: Contructs a Object with the provided Application id and SerialId
-     * 
+     *
      */
     IApplicationReference(char* processName, unsigned int processId);
     ~IApplicationReference();
 
-     const char* getProcessName();
-     unsigned int getProcessId();
+    const char* getProcessName();
+    unsigned int getProcessId();
 
 protected:
     char* m_processName;
@@ -69,4 +69,4 @@ inline const char* IApplicationReference::getProcessName()
     return m_processName;
 }
 
-#endif /* _IAPPLICATION_REFERENCE_H_ */
+#endif /* _IAPPLICATIONREFERENCE_H_ */
index 581a8a9..63ff5d4 100644 (file)
@@ -17,8 +17,8 @@
 *
 ****************************************************************************/
 
-#ifndef _COMMANDEXECUTOR_H_
-#define _COMMANDEXECUTOR_H_
+#ifndef _ICOMMANDEXECUTOR_H_
+#define _ICOMMANDEXECUTOR_H_
 
 #include "RendererList.h"
 #include "CommunicatorList.h"
@@ -236,4 +236,4 @@ public:
     virtual HealthCondition getHealth() = 0;
 };
 
-#endif /* _COMMANDEXECUTOR_H_ */
+#endif /* _ICOMMANDEXECUTOR_H_ */
index 7ec1916..fd0cf69 100644 (file)
@@ -17,8 +17,8 @@
 *
 ****************************************************************************/
 
-#ifndef __IHEALTH_H__
-#define __IHEALTH_H__
+#ifndef __IHEALTHMONITOR_H__
+#define __IHEALTHMONITOR_H__
 
 #include "ilm_types.h"
 
@@ -51,4 +51,4 @@ IHealthMonitor::~IHealthMonitor()
 {
 }
 
-#endif // __IHEALTH_H__
+#endif // __IHEALTHMONITOR_H__
index 2f353f2..efe5b85 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- * 
+ *
  * Copyright 2010,2011 BMW Car IT GmbH
  *
  *
index e99503f..02f2508 100644 (file)
@@ -177,7 +177,6 @@ public:
     virtual bool isLayerInCurrentRenderOrder(const uint id) = 0;
 
     bool debugMode;
-
 };
 
 #endif /* _ISCENE_H_ */
index fc1967a..3bb26cb 100644 (file)
@@ -17,8 +17,8 @@
  *
  ****************************************************************************/
 
-#ifndef _ISCENE_PROVIDER_H_
-#define _ISCENE_PROVIDER_H_
+#ifndef _ISCENEPROVIDER_H_
+#define _ISCENEPROVIDER_H_
 
 class ICommandExecutor;
 
@@ -39,7 +39,7 @@ public:
      * Delegate Scene : this method will be called on LayerManager startup
      * to delegate a initial scene description of Layers on the target Platform
      */
-     virtual bool delegateScene() = 0;
+    virtual bool delegateScene() = 0;
 
 protected:
     ICommandExecutor* m_executor;
@@ -50,4 +50,4 @@ inline ISceneProvider::ISceneProvider(ICommandExecutor* executor)
 {
 }
 
-#endif /* _ISCENE_PROVIDER_H_ */
+#endif /* _ISCENEPROVIDER_H_ */
index 04e88af..eb31b5f 100644 (file)
@@ -75,67 +75,64 @@ typedef PointVect::iterator PointVectIterator;
 
 class InputManager
 {
-    public:
-        /** Ctor / Dtor
-         */
-        InputManager(IScene* s);
-        ~InputManager();
-
-
-        /** Methods to report input events
-         *  They all return the surface to transfer the event to, or NULL if the event should not be dispatched
-         */
-        Surface * reportKeyboardEvent(InputEventState state, long keyId);
-        Surface * reportTouchEvent(PointVect& pv);
-        Surface * reportPointerEvent(Point& p);
-
-
-        /** Methods to control the focus
-         */
-        bool setKeyboardFocusOn(unsigned int surfId);
-        bool updateInputEventAcceptanceOn(unsigned int surfId, InputDevice devices, bool accept);
-
-        /** Few getters
-         */
-        unsigned int getKeyboardFocusSurfaceId();
-
-    private:
-        Surface * electSurfaceForPointerEvent(int& x, int& y);
-        void transformGlobalToLocalCoordinates(Surface* surf, int& x, int& y);
-
-
-        /*
-         * Private Getters / Setters
-         * Needed because access to their associated member requires exclusive area
-         */
-
-        /** \brief Set the keyboard focus on a particular surface */
-        void _setKbdFocus(Surface * s);
-        /** \brief Get the surface which has keyboard focus */
-        Surface * _getKbdFocus();
-        /** \brief Set the pointer focus on a particular surface */
-        void _setPointerFocus(Surface * s);
-        /** \brief Get the surface which has pointer focus */
-        Surface * _getPointerFocus();
-        /** \brief Set the touch focus on a particular surface */
-        void _setTouchFocus(Surface * s);
-        /** \brief Get the surface which has touch focus */
-        Surface * _getTouchFocus();
-
-
-    private:
-        IScene * m_pScene;                  /*!< Pointer to the scene */
-        std::map<long, Surface*> m_KeyMap;  /*!< Map that associate keypressed event to the surface it has been forward to. See @ref<InputManager-KeypressedMap>. */
-        pthread_mutex_t m_mutex;            /*!< Mutex to avoid concurrent access to shared variables */
-
-        /* Access to the below members must be protected by mutex to avoid concurrent accesses */
-        Surface * m_KbdFocus;               /*!< Pointer to the surface which has the focus for keyboard event.
-                                                 Should only be accessed via its getter / setter */
-        Surface * m_PointerFocus;           /*!< Pointer to the surface which has the focus for pointer event.
-                                                 Should only be accessed via its getter / setter */
-        Surface * m_TouchFocus;             /*!< Pointer to the surface which has the focus for touch event.
-                                                 Should only be accessed via its getter / setter */
-
+public:
+    /** Ctor / Dtor
+        */
+    InputManager(IScene* s);
+    ~InputManager();
+
+    /** Methods to report input events
+        *  They all return the surface to transfer the event to, or NULL if the event should not be dispatched
+        */
+    Surface * reportKeyboardEvent(InputEventState state, long keyId);
+    Surface * reportTouchEvent(PointVect& pv);
+    Surface * reportPointerEvent(Point& p);
+
+    /** Methods to control the focus
+        */
+    bool setKeyboardFocusOn(unsigned int surfId);
+    bool updateInputEventAcceptanceOn(unsigned int surfId, InputDevice devices, bool accept);
+
+    /** Few getters
+        */
+    unsigned int getKeyboardFocusSurfaceId();
+
+private:
+    Surface * electSurfaceForPointerEvent(int& x, int& y);
+    void transformGlobalToLocalCoordinates(Surface* surf, int& x, int& y);
+
+    /*
+        * Private Getters / Setters
+        * Needed because access to their associated member requires exclusive area
+        */
+
+    /** \brief Set the keyboard focus on a particular surface */
+    void _setKbdFocus(Surface * s);
+    /** \brief Get the surface which has keyboard focus */
+    Surface * _getKbdFocus();
+    /** \brief Set the pointer focus on a particular surface */
+    void _setPointerFocus(Surface * s);
+    /** \brief Get the surface which has pointer focus */
+    Surface * _getPointerFocus();
+    /** \brief Set the touch focus on a particular surface */
+    void _setTouchFocus(Surface * s);
+    /** \brief Get the surface which has touch focus */
+    Surface * _getTouchFocus();
+
+
+private:
+    IScene * m_pScene;                  /*!< Pointer to the scene */
+    std::map<long, Surface*> m_KeyMap;  /*!< Map that associate keypressed event to the surface it has been forward to.
+                                            See @ref<InputManager-KeypressedMap>. */
+    pthread_mutex_t m_mutex;            /*!< Mutex to avoid concurrent access to shared variables */
+
+    /* Access to the below members must be protected by mutex to avoid concurrent accesses */
+    Surface * m_KbdFocus;               /*!< Pointer to the surface which has the focus for keyboard event.
+                                                Should only be accessed via its getter / setter */
+    Surface * m_PointerFocus;           /*!< Pointer to the surface which has the focus for pointer event.
+                                                Should only be accessed via its getter / setter */
+    Surface * m_TouchFocus;             /*!< Pointer to the surface which has the focus for touch event.
+                                                Should only be accessed via its getter / setter */
 };
 
 
@@ -188,8 +185,8 @@ class InputManager
  *  \anchor<LM_INPUT_REQ_06>
  *  <li>
  *    LM_INPUT_REQ_06:
- *    A surface can request to not receive particular input events. In this case, the surface should not be considered for focus election & the events
- *    must be dispatched to an other surface, if relevant.
+ *    A surface can request to not receive particular input events. In this case, the surface should not be considered
+ *    for focus election & the events must be dispatched to an other surface, if relevant.
  *  </li>
  *
  *  </ul>
@@ -206,7 +203,8 @@ class InputManager
  * 3- The command "surfaceSetKeyboardFocus" is called on S2, so the surface S2 is now the keyboard elected one
  * 4- Key X is released.
  * We should then forward the KeyRelased event to S1 since we have reported the pressed event to it.
- * So we need a map that associate keyPressed  -> Surface. When the same key is released, we must forward that event to the original surface, and not to the elected one.
+ * So we need a map that associate keyPressed  -> Surface. When the same key is released, we must forward that event
+ * to the original surface, and not to the elected one.
  *
  *
  */
index 1bcc471..a44b70e 100644 (file)
@@ -31,7 +31,7 @@
 /*
  * A graphical Layerobject which contains Surfaces.
  */
-class Layer: public GraphicalSurface
+class Layer : public GraphicalSurface
 {
     friend class Scene;
 
@@ -142,7 +142,7 @@ inline bool Layer::removeAllSurfaces()
     SurfaceListConstIterator iter = m_surfaces.begin();
     SurfaceListConstIterator iterEnd = m_surfaces.end();
 
-    if(iter == iterEnd)
+    if (iter == iterEnd)
         return false;
 
     for (; iter != iterEnd; ++iter)
@@ -166,15 +166,15 @@ inline void Layer::setContainingScreenId(unsigned int id)
 
 inline void Layer::applySurfaceTransform()
 {
-       SurfaceListConstIterator iter = m_surfaces.begin();
-       SurfaceListConstIterator iterEnd = m_surfaces.end();
-       if(iter != iterEnd) 
-       {
-               for (; iter != iterEnd; ++iter)
-               {
-                       (*iter)->calculateTargetDestination(getSourceRegion(),getDestinationRegion());
-               }
-       }
+    SurfaceListConstIterator iter = m_surfaces.begin();
+    SurfaceListConstIterator iterEnd = m_surfaces.end();
+    if (iter != iterEnd)
+    {
+        for (; iter != iterEnd; ++iter)
+        {
+            (*iter)->calculateTargetDestination(getSourceRegion(), getDestinationRegion());
+        }
+    }
 }
 
 #endif /* _LAYER_H_ */
index c95789f..9db1642 100644 (file)
@@ -41,7 +41,7 @@ typedef std::map<unsigned int, const char*> PidToProcessNameTable;
 typedef std::list<IPlugin*> PluginList;
 
 
-class Layermanager: public ICommandExecutor
+class Layermanager : public ICommandExecutor
 {
 public:
     Layermanager(Configuration& config);
index 21835ef..78bb6f1 100644 (file)
@@ -17,8 +17,8 @@
 *
 ****************************************************************************/
 
-#ifndef _GRAPHICALOBJECTTYPE_H_
-#define _GRAPHICALOBJECTTYPE_H_
+#ifndef _OBJECTTYPE_H_
+#define _OBJECTTYPE_H_
 
 #include "ilm_types.h"
 
@@ -32,4 +32,4 @@ enum ObjectType
     TypeMax
 };
 
-#endif /* _GRAPHICALOBJECTTYPE_H_ */
+#endif /* _OBJECTTYPE_H_ */
index caeaed3..b8f77de 100644 (file)
@@ -18,8 +18,8 @@
 *
 ****************************************************************************/
 
-#ifndef _OPTIMIZATION_H
-#define _OPTIMIZATION_H
+#ifndef _OPTIMIZATIONTYPE_H
+#define _OPTIMIZATIONTYPE_H
 
 #include "ilm_types.h"
 
@@ -44,4 +44,4 @@ enum OptimizationModeType
 
 const int OPT_MODE_COUNT = 4;
 
-#endif /* _OPTIMIZATION_H */
+#endif /* _OPTIMIZATIONTYPE_H */
index 8a1d98a..119f1e0 100644 (file)
@@ -17,8 +17,8 @@
 *
 ****************************************************************************/
 
-#ifndef _ORIENTATION_H
-#define _ORIENTATION_H
+#ifndef _ORIENTATIONTYPE_H
+#define _ORIENTATIONTYPE_H
 
 #include "ilm_types.h"
 
@@ -34,4 +34,4 @@ enum OrientationType
     TwoSeventy = ILM_TWOHUNDREDSEVENTY
 };
 
-#endif /* _ORIENTATION_H */
+#endif /* _ORIENTATIONTYPE_H */
index 6bacbde..1dd0f80 100644 (file)
@@ -37,5 +37,6 @@ enum PixelFormat
     PIXELFORMAT_UNKNOWN = ILM_PIXEL_FORMAT_UNKNOWN
 };
 
-#define PixelFormatHasAlpha(pf) ((pf == PIXELFORMAT_RGBA8888) || (pf == PIXELFORMAT_RGBA5551) || (pf == PIXELFORMAT_RGBA6661) || (pf == PIXELFORMAT_RGBA4444))
+#define PixelFormatHasAlpha(pf) \
+    ((pf == PIXELFORMAT_RGBA8888) || (pf == PIXELFORMAT_RGBA5551) || (pf == PIXELFORMAT_RGBA6661) || (pf == PIXELFORMAT_RGBA4444))
 #endif /* _PIXELFORMAT_H_ */
index 8c0888a..27fbf6b 100644 (file)
@@ -44,7 +44,6 @@ public:
 
     // Reference to platform independant surface type for access to size etc
     Surface* s;
-
 };
 
 #endif /* _PLATFORMSURFACE_H_ */
index 21fb913..20b956a 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- * 
+ *
  * Copyright 2010,2011 BMW Car IT GmbH
  *
  *
index 89fc361..ca55839 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- * 
+ *
  * Copyright 2012 BMW Car IT GmbH
  *
  *
index 6d7102d..194da8e 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- * 
+ *
  * Copyright 2012 BMW Car IT GmbH
  *
  *
@@ -39,20 +39,20 @@ class PluginManager
 public:
     PluginManager(ICommandExecutor& executor, Configuration& config);
     ~PluginManager();
-    
+
     void getRendererList(RendererList& list);
     void getHealthMonitorList(HealthMonitorList& list);
     void getSceneProviderList(SceneProviderList& list);
     void getCommunicatorList(CommunicatorList& list);
-    
+
     static bool registerStaticPluginCreateFunction(StaticPluginCreateFunc func);
-    
+
 private:
     void createStaticallyLinkedPlugins();
     void getAllFilesInPluginPath(std::string path);
     void createDynamicallyLinkedPlugins();
     IPlugin* createDynamicallyLinkedPlugin(std::string path);
-    
+
 private:
     ICommandExecutor& mExecutor;
     Configuration& mConfiguration;
@@ -61,4 +61,4 @@ private:
     static StaticPluginCreateFuncList mStaticPluginCreateFuncList;
 };
 
-#endif // __PLUGINMANAGER_H__
\ No newline at end of file
+#endif // __PLUGINMANAGER_H__
index 589fff3..359f4dd 100644 (file)
@@ -52,37 +52,4 @@ public:
     }
 };
 
-class FloatRectangle
-{
-public:
-    FloatRectangle()
-    : x(0.0f)
-    , y(0.0f)
-    , width(0.0f)
-    , height(0.0f)
-    {
-    }
-
-    FloatRectangle(float x, float y, float width, float height)
-    : x(x)
-    , y(y)
-    , width(width)
-    , height(height)
-    {
-    }
-
-    FloatRectangle(const Rectangle& rhs)
-    : x(rhs.x)
-    , y(rhs.y)
-    , width(rhs.width)
-    , height(rhs.height)
-    {
-    }
-
-    float x;
-    float y;
-    float width;
-    float height;
-};
-
 #endif /* _RECTANGLE_H_ */
index 052bdca..f2fb93b 100644 (file)
@@ -37,7 +37,7 @@ class Surface;
 /*
  * Represents a list of Layers which contain the Surfaces.
  */
-class Scene: public IScene
+class Scene : public IScene
 {
     // TODO: these should use public interface instead
     friend class Layermanager;
index 5c8c074..5c0c2cf 100644 (file)
@@ -31,7 +31,7 @@ using std::string;
  * Represents a shader instance.
  *
  * It stores a set of uniform parameters and refers to an OpenGL program object.
- * Some uniform variables are pre-defined, like surface position and size, 
+ * Some uniform variables are pre-defined, like surface position and size,
  * opacity, etc... Additionally, there may be user-defined uniforms.
  */
 class Shader
index f7fb58e..9275fe5 100644 (file)
@@ -17,8 +17,8 @@
  *
  ****************************************************************************/
 
-#ifndef __SIGNALHADLER_H__
-#define __SIGNALHADLER_H__
+#ifndef __SIGNALHANDLER_H__
+#define __SIGNALHANDLER_H__
 
 #include "ilm_types.h"
 
@@ -30,4 +30,4 @@ public:
     void waitForShutdownSignal();
 };
 
-#endif // __SIGNALHADLER_H__
+#endif // __SIGNALHANDLER_H__
index 5ccda0b..f5b5583 100644 (file)
@@ -32,9 +32,8 @@
 /**
  * Represents a graphical surface generated by an application. Always contained in layers.
  */
-class Surface: public GraphicalSurface
+class Surface : public GraphicalSurface
 {
-
 public:
     PixelFormat getPixelFormat() const
     {
@@ -60,8 +59,8 @@ public:
     {
         return m_hasNativeContent;
     }
-    
-    void removeNativeContent() 
+
+    void removeNativeContent()
     {
         m_hasNativeContent = false;
     }
@@ -80,43 +79,45 @@ public:
         return hasNativeContent() ? m_nativeHandle : -1;
     }
 
+    void calculateTargetDestination(const Rectangle &layerSource, const Rectangle &layerDestination)
+    {
+        if (ViewportTransform::isFullyCropped(getDestinationRegion(), layerSource))
+        {
+            m_isCropped = true;
+            return; // skip rendering of this surface, because it is cropped by layer source region
+        }
+        else
+        {
+            m_isCropped = false;
+        }
+
+        const FloatRectangle layerSourceRegion = layerSource;
+        const FloatRectangle layerDestinationRegion = layerDestination;
+
+        FloatRectangle targetSource = getSourceRegion();
+        FloatRectangle targetDestination = getDestinationRegion();
+
+        ViewportTransform::applyLayerSource(layerSourceRegion, targetSource, targetDestination);
+        ViewportTransform::applyLayerDestination(layerDestinationRegion, layerSourceRegion, targetDestination);
+        m_targetDestination = targetDestination;
+        m_targetSource = targetSource;
+    }
+
+    bool isCropped()
+    {
+        return m_isCropped;
+    }
+
+    const FloatRectangle& getTargetSourceRegion() const
+    {
+        return m_targetSource;
+    }
+
+    const FloatRectangle& getTargetDestinationRegion() const
+    {
+        return m_targetDestination;
+    }
 
-       void calculateTargetDestination (const Rectangle &layerSource,const Rectangle &layerDestination)
-       {
-               if (ViewportTransform::isFullyCropped(getDestinationRegion(), layerSource ) )
-               {
-                       m_isCropped =true;
-                       return; // skip rendering of this surface, because it is cropped by layer source region
-               } else {
-                       m_isCropped =false;
-               }
-               
-               const FloatRectangle layerSourceRegion = layerSource;
-               const FloatRectangle layerDestinationRegion = layerDestination;
-
-               FloatRectangle targetSource = getSourceRegion();
-               FloatRectangle targetDestination = getDestinationRegion();
-
-               ViewportTransform::applyLayerSource(layerSourceRegion, targetSource, targetDestination);
-               ViewportTransform::applyLayerDestination(layerDestinationRegion, layerSourceRegion, targetDestination );                
-               m_targetDestination = targetDestination;
-               m_targetSource = targetSource;
-       }
-       bool isCropped() 
-       {
-               return m_isCropped;
-       }
-       
-       const FloatRectangle& getTargetSourceRegion() const
-       {
-               return m_targetSource;
-       }       
-       
-       const FloatRectangle& getTargetDestinationRegion() const
-       {
-               return m_targetDestination;
-       }               
-    
     /**
      * Indicate from which input devices the Surface can accept events.
      *
@@ -139,7 +140,6 @@ public:
         }
     }
 
-
     /**
      * Indicate if the surface accepts input events from the specified list of devices.
      *
@@ -157,7 +157,7 @@ public:
 
         return ret;
     }
-    
+
     /**
      * Get the set of devices from which the surface can accept input events
      *
@@ -167,7 +167,7 @@ public:
     {
         return m_acceptInputFrom;
     }
-    
+
     /**
      * Platform specific Object containing surface information specific to a used platform.
      * This typically contains a native window handle/surface handle or information only used
@@ -191,8 +191,8 @@ public:
     , m_hasNativeContent(false)
     , m_acceptInputFrom(INPUT_DEVICE_ALL)
     , m_isCropped(false)
-    , m_targetDestination(0.0,0.0,0.0,0.0)
-   , m_targetSource(0.0,0.0,0.0,0.0)    
+    , m_targetDestination(0.0, 0.0, 0.0, 0.0)
+    , m_targetSource(0.0, 0.0, 0.0, 0.0)
     {
         pthread_mutex_init(&m_inputAcceptMutex, NULL);
     }
@@ -209,8 +209,8 @@ public:
     , m_hasNativeContent(false)
     , m_acceptInputFrom(INPUT_DEVICE_ALL)
     , m_isCropped(false)
-    , m_targetDestination(0.0,0.0,0.0,0.0)
-    , m_targetSource(0.0,0.0,0.0,0.0)
+    , m_targetDestination(0.0, 0.0, 0.0, 0.0)
+    , m_targetSource(0.0, 0.0, 0.0, 0.0)
     {
         pthread_mutex_init(&m_inputAcceptMutex, NULL);
     }
@@ -219,7 +219,7 @@ public:
     {
         pthread_mutex_destroy(&m_inputAcceptMutex);
     }
-    
+
 
 private:
     long m_nativeHandle;
index 4b5e3bb..99aba33 100644 (file)
  *
  ****************************************************************************/
 
-#ifndef _VIEWPORT_TRANSFORM_H_
-#define _VIEWPORT_TRANSFORM_H_
+#ifndef _VIEWPORTTRANSFORM_H_
+#define _VIEWPORTTRANSFORM_H_
+
+#include "FloatRectangle.h"
 
 class ViewportTransform
 {
@@ -35,26 +37,32 @@ public:
     static void applyLayerSource(const FloatRectangle& layerSource, FloatRectangle& surfaceSource, FloatRectangle& surfaceDestination);
 
     /*
-     * Apply Destination View of Layer to the given surface destination region, ie scale and movement relative to scaling and position of layer
+     * Apply Destination View of Layer to the given surface destination region, ie scale and movement relative
+     * to scaling and position of layer
      */
-    static void applyLayerDestination(const FloatRectangle& layerDestination, const FloatRectangle& layerSource, FloatRectangle& regionToScale);
+    static void applyLayerDestination(const FloatRectangle& layerDestination,
+                                        const FloatRectangle& layerSource,
+                                        FloatRectangle& regionToScale);
 
     /*
      * Calculate Texture Coordinates as relation of the given rectangle to original values.
      * Example: x position of 10 with an original width of 40 will yield a texture coordinate of 10/40=0.25f.
      * This function expects textureCoordinates to be an allocated float array of size 4, in which the texture coordinates will be returned.
      */
-    static void transformRectangleToTextureCoordinates(const FloatRectangle& rectangle, const float originalWidth, const float originalHeight, float* textureCoordinates);
+    static void transformRectangleToTextureCoordinates(const FloatRectangle& rectangle,
+                                                        const float originalWidth,
+                                                        const float originalHeight,
+                                                        float* textureCoordinates);
 };
 
 
 inline bool ViewportTransform::isFullyCropped(const Rectangle& surfaceDestination, const Rectangle& layerSource)
 {
     // is surface completely to the right of layer source region?
-    if (surfaceDestination.x >= layerSource.x + layerSource.width )
+    if (surfaceDestination.x >= layerSource.x + layerSource.width)
         return true;
     // is surface completely beneath layer source region?
-    if (surfaceDestination.y >= layerSource.y + layerSource.height )
+    if (surfaceDestination.y >= layerSource.y + layerSource.height)
         return true;
     // is surface completely to the left of layer source region?
     if (surfaceDestination.x + surfaceDestination.width <= layerSource.x)
@@ -65,7 +73,9 @@ inline bool ViewportTransform::isFullyCropped(const Rectangle& surfaceDestinatio
     return false;
 }
 
-inline void ViewportTransform::applyLayerSource(const FloatRectangle& layerSource, FloatRectangle& surfaceSource, FloatRectangle& surfaceDestination)
+inline void ViewportTransform::applyLayerSource(const FloatRectangle& layerSource,
+                                                FloatRectangle& surfaceSource,
+                                                FloatRectangle& surfaceDestination)
 {
     float cropamount = 0;
     float surfaceInverseScaleX = surfaceSource.width / surfaceDestination.width;
@@ -128,7 +138,9 @@ inline void ViewportTransform::applyLayerSource(const FloatRectangle& layerSourc
     }
 }
 
-inline void ViewportTransform::applyLayerDestination(const FloatRectangle& layerDestination, const FloatRectangle& layerSource, FloatRectangle& regionToScale)
+inline void ViewportTransform::applyLayerDestination(const FloatRectangle& layerDestination,
+                                                        const FloatRectangle& layerSource,
+                                                        FloatRectangle& regionToScale)
 {
     float scaleX = layerDestination.width / layerSource.width;
     float scaleY = layerDestination.height / layerSource.height;
@@ -148,7 +160,10 @@ inline void ViewportTransform::applyLayerDestination(const FloatRectangle& layer
     regionToScale.y += layerDestination.y;
 }
 
-inline void ViewportTransform::transformRectangleToTextureCoordinates(const FloatRectangle& rectangle, const float originalWidth, const float originalHeight, float* textureCoordinates)
+inline void ViewportTransform::transformRectangleToTextureCoordinates(const FloatRectangle& rectangle,
+                                                                        const float originalWidth,
+                                                                        const float originalHeight,
+                                                                        float* textureCoordinates)
 {
     // move texture coordinate proportional to the cropped pixels
     float percentageCroppedFromLeftSide = rectangle.x / originalWidth;
@@ -170,4 +185,4 @@ inline void ViewportTransform::transformRectangleToTextureCoordinates(const Floa
     textureCoordinates[3] = 1.0f - percentageCroppedFromBottomSide;
 }
 
-#endif /* _VIEWPORT_TRANSFORM_H_ */
+#endif /* _VIEWPORTTRANSFORM_H_ */
index 6bb09fa..8f055b5 100644 (file)
@@ -92,18 +92,18 @@ void Configuration::logAllSettings()
     LOG_INFO("LayerManagerService", "Display " << mDisplayName << " size: " << mDisplayWidth << "x" << mDisplayHeight);
     LOG_INFO("LayerManagerService", "Plugin path: " << mPluginPath);
     LOG_DEBUG("LayerManagerService", "Log level: console " << mLogLevelConsole << ", file " << mLogLevelFile << ", trace " << mLogLevelTrace);
-    
+
     for (int i = 0; i < mBuildFlagCount; ++i)
     {
         const BuildFlag& flag = mpBuildFlags[i];
         switch (flag.type)
         {
-            case DEBUG_FLAG:
-                LOG_DEBUG("LayerManagerService", flag.description);
-                break;
-            case INFO_FLAG:
-                LOG_INFO("LayerManagerService", flag.description);
-                break;
+        case DEBUG_FLAG:
+            LOG_DEBUG("LayerManagerService", flag.description);
+            break;
+        case INFO_FLAG:
+            LOG_INFO("LayerManagerService", flag.description);
+            break;
         }
     }
 }
@@ -115,49 +115,49 @@ void Configuration::processCommandLine(int argc, char** argv)
         int option = getopt(argc, argv, "w::h::d::?::c::f::v::l::");
         switch (option)
         {
-            case 'd':
-                mDisplayName = optarg;
-                break;
-                
-            case 'w':
-                mDisplayWidth = atoi(optarg);
-                break;
-                
-            case 'h':
-                mDisplayHeight = atoi(optarg);
-                break;
-                
-            case 'c':
-                if (atoi(optarg) < LOG_MAX_LEVEL)
-                {
-                    mLogLevelConsole = (LOG_MODES)atoi(optarg);
-                }
-                break;
-                
-            case 'f':
-                if (atoi(optarg) < LOG_MAX_LEVEL)
-                {
-                    mLogLevelFile = (LOG_MODES)atoi(optarg);
-                }
-                break;
-                
-            case 'l':
-                if (atoi(optarg) < LOG_MAX_LEVEL)
-                {
-                    mLogLevelTrace = (LOG_MODES)atoi(optarg);
-                }
-                break;
-
-            case 'v':
-                LOG_INFO("LayerManagerService", "Version: " << ILM_VERSION);
-                exit(-1);
-                break;
-                
-            case '?':
-            default:
-                LOG_INFO("LayerManagerService", "Version: " << ILM_VERSION);
-                puts(USAGE_DESCRIPTION);
-                exit(-1);
+        case 'd':
+            mDisplayName = optarg;
+            break;
+
+        case 'w':
+            mDisplayWidth = atoi(optarg);
+            break;
+
+        case 'h':
+            mDisplayHeight = atoi(optarg);
+            break;
+
+        case 'c':
+            if (atoi(optarg) < LOG_MAX_LEVEL)
+            {
+                mLogLevelConsole = (LOG_MODES)atoi(optarg);
+            }
+            break;
+
+        case 'f':
+            if (atoi(optarg) < LOG_MAX_LEVEL)
+            {
+                mLogLevelFile = (LOG_MODES)atoi(optarg);
+            }
+            break;
+
+        case 'l':
+            if (atoi(optarg) < LOG_MAX_LEVEL)
+            {
+                mLogLevelTrace = (LOG_MODES)atoi(optarg);
+            }
+            break;
+
+        case 'v':
+            LOG_INFO("LayerManagerService", "Version: " << ILM_VERSION);
+            exit(-1);
+            break;
+
+        case '?':
+        default:
+            LOG_INFO("LayerManagerService", "Version: " << ILM_VERSION);
+            puts(USAGE_DESCRIPTION);
+            exit(-1);
         }
     }
 
index 4fd1552..acb75c6 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "GraphicalObject.h"
 
-unsigned int GraphicalObject::nextGraphicId[TypeMax]={1,1};
+unsigned int GraphicalObject::nextGraphicId[TypeMax]={1, 1};
 
 const unsigned int GraphicalObject::INVALID_ID=0xFFFFFFFF;
 
index 311e0f7..5e6bcd4 100644 (file)
 
 bool GraphicalSurface::isInside(unsigned int x_DestCoordinateSyst, unsigned int y_DestCoordinateSyst) const
 {
-       bool ret;
-
-       switch (m_orientation)
-       {
-               case Zero:
-                       ret = (
-                                  ((x_DestCoordinateSyst >= m_destinationViewport.x) && (x_DestCoordinateSyst < m_destinationViewport.x + m_destinationViewport.width))
-                               &&
-                                  ((y_DestCoordinateSyst >= m_destinationViewport.y) && (y_DestCoordinateSyst < m_destinationViewport.y + m_destinationViewport.height))
-                             );
-                       break;
-
-               case Ninety:
-               case OneEighty:
-               case TwoSeventy:
-                       /* Not yet supported */
-                       ret = false;
-                       break;
-
-               default:
-                       ret = false;
-                       break;
-       }
-
-       return ret;
+    bool ret;
+
+    switch (m_orientation)
+    {
+    case Zero:
+        ret = ((x_DestCoordinateSyst >= m_destinationViewport.x)
+            && (x_DestCoordinateSyst < m_destinationViewport.x + m_destinationViewport.width)
+            && (y_DestCoordinateSyst >= m_destinationViewport.y)
+            && (y_DestCoordinateSyst < m_destinationViewport.y + m_destinationViewport.height));
+        break;
+
+    case Ninety:
+    case OneEighty:
+    case TwoSeventy:
+        /* Not yet supported */
+        ret = false;
+        break;
+
+    default:
+        ret = false;
+        break;
+    }
+
+    return ret;
 }
 
 
@@ -63,39 +62,42 @@ bool GraphicalSurface::isInside(unsigned int x_DestCoordinateSyst, unsigned int
  */
 bool GraphicalSurface::DestToSourceCoordinates(int *x, int *y, bool check) const
 {
-       bool    ret;
-       int     TVxD, TVyD;  /* Translation vector x,y in destination system */ 
-       int     TVxS, TVyS;  /* Translation vector x,y in source system */
-       float   SFx, SFy;    /* Scaling factor x,y  */
-
-       if (!check || isInside(*x, *y))
-       {
-               /* The translation vector in the Destination system */
-               TVxD = m_destinationViewport.x;
-               TVyD = m_destinationViewport.y;
-
-               /* The translation vector in the Source system */
-               TVxS = m_sourceViewport.x;
-               TVyS = m_sourceViewport.y;
-
-               /* Compute the scaling factors */
-               SFx = (float) m_sourceViewport.width  / (float) m_destinationViewport.width;
-               SFy = (float) m_sourceViewport.height / (float) m_destinationViewport.height;
-
-               /* Compute the rotation */
-               // To be done ...
-
-               /* Apply the transformations */
-               *x = ((*x - TVxD) * SFx) + TVxS;
-               *y = ((*y - TVyD) * SFy) + TVyS;
-
-               ret = true;
-       }
-       else
-       {
-               ret = false;
-       }
-
-       return ret;
+    bool     ret;
+    int       TVxD;   /* Translation vector x in destination system */
+    int       TVyD;   /* Translation vector y in destination system */
+    int       TVxS;   /* Translation vector x in source system */
+    int       TVyS;   /* Translation vector y in source system */
+    float     SFx;    /* Scaling factor x  */
+    float     SFy;    /* Scaling factor y  */
+
+    if (!check || isInside(*x, *y))
+    {
+        /* The translation vector in the Destination system */
+        TVxD = m_destinationViewport.x;
+        TVyD = m_destinationViewport.y;
+
+        /* The translation vector in the Source system */
+        TVxS = m_sourceViewport.x;
+        TVyS = m_sourceViewport.y;
+
+        /* Compute the scaling factors */
+        SFx = (float) m_sourceViewport.width  / (float) m_destinationViewport.width;
+        SFy = (float) m_sourceViewport.height / (float) m_destinationViewport.height;
+
+        /* Compute the rotation */
+        // To be done ...
+
+        /* Apply the transformations */
+        *x = ((*x - TVxD) * SFx) + TVxS;
+        *y = ((*y - TVyD) * SFy) + TVyS;
+
+        ret = true;
+    }
+    else
+    {
+        ret = false;
+    }
+
+    return ret;
 }
 
index 26ee41a..37ca94b 100644 (file)
@@ -17,7 +17,6 @@
 *
 ****************************************************************************/
 
-
 #include <cassert>
 
 #include "Log.h"
@@ -74,7 +73,6 @@ bool InputManager::setKeyboardFocusOn(unsigned int surfId)
         }
     }
 
-
     return ret;
 }
 
@@ -134,19 +132,19 @@ Surface * InputManager::reportKeyboardEvent(InputEventState state, long keyId)
 
     switch (state)
     {
-        case INPUT_STATE_PRESSED:
-            elected = _getKbdFocus();
-            m_KeyMap[keyId] = elected;
-            break;
-
-        case INPUT_STATE_RELEASED:
-            elected = m_KeyMap[keyId];
-            break;
-
-        default:
-            elected = NULL;
-            LOG_WARNING("InputManager", "Invalid input state reported for reportKeyboardEvent() : " << state);
-            break;
+    case INPUT_STATE_PRESSED:
+        elected = _getKbdFocus();
+        m_KeyMap[keyId] = elected;
+        break;
+
+    case INPUT_STATE_RELEASED:
+        elected = m_KeyMap[keyId];
+        break;
+
+    default:
+        elected = NULL;
+        LOG_WARNING("InputManager", "Invalid input state reported for reportKeyboardEvent() : " << state);
+        break;
     }
 
     return elected;
@@ -162,26 +160,26 @@ Surface * InputManager::reportPointerEvent(Point& p)
 
     switch (p.state)
     {
-        case INPUT_STATE_PRESSED:
-            elected = electSurfaceForPointerEvent(p.x, p.y);
-            _setPointerFocus(elected);
-            /* Pointer pressed also assigns the focus for touch events */
-            _setTouchFocus(elected);
-            break;
-
-        case INPUT_STATE_OTHER:
-        case INPUT_STATE_MOTION:
-        case INPUT_STATE_RELEASED:
-            elected = _getPointerFocus();
-            if (elected != NULL)
-            {
-                transformGlobalToLocalCoordinates(elected, p.x, p.y);
-            }
-            break;
+    case INPUT_STATE_PRESSED:
+        elected = electSurfaceForPointerEvent(p.x, p.y);
+        _setPointerFocus(elected);
+        /* Pointer pressed also assigns the focus for touch events */
+        _setTouchFocus(elected);
+        break;
+
+    case INPUT_STATE_OTHER:
+    case INPUT_STATE_MOTION:
+    case INPUT_STATE_RELEASED:
+        elected = _getPointerFocus();
+        if (elected != NULL)
+        {
+            transformGlobalToLocalCoordinates(elected, p.x, p.y);
+        }
+        break;
 
-        default:
-            elected = NULL;
-            LOG_WARNING("InputManager", "Invalid input state reported for reportPointerEvent() : " << p.state);
+    default:
+        elected = NULL;
+        LOG_WARNING("InputManager", "Invalid input state reported for reportPointerEvent() : " << p.state);
     }
 
     return elected;
@@ -212,42 +210,38 @@ Surface * InputManager::electSurfaceForPointerEvent(int& x, int& y)
     LayerList &ll = m_pScene->getCurrentRenderOrder(0);
     LayerListConstReverseIterator currentLayer;
     SurfaceListConstReverseIterator currentSurf;
-    int x_SurfCoordinate, y_SurfCoordinate;
+    int x_SurfCoordinate;
+    int y_SurfCoordinate;
 
     surf = NULL;
     /* Need to browse for all layers. 1st layer of m_currentRenderOrder is rendered
      * on bottom, last one is rendrered on top. So we have to reverse iterate */
     LayerListConstReverseIterator layerEnd(ll.rend());
-    for (currentLayer = ll.rbegin();
-         currentLayer != layerEnd && surf == NULL;
-         currentLayer++)
+    for (currentLayer = ll.rbegin(); currentLayer != layerEnd && surf == NULL; currentLayer++)
     {
-        if ( ((*currentLayer)->visibility) && ((*currentLayer)->getOpacity() != 0) )
+        if ((*currentLayer)->visibility
+            && ((*currentLayer)->getOpacity() != 0)
+            && (*currentLayer)->isInside(x, y))
         {
-            if ((*currentLayer)->isInside(x, y))
+            x_SurfCoordinate = x;
+            y_SurfCoordinate = y;
+            (*currentLayer)->DestToSourceCoordinates(&x_SurfCoordinate, &y_SurfCoordinate, false);
+            /* Need to browse for all surfaces */
+            SurfaceListConstReverseIterator surfEnd((*currentLayer)->getAllSurfaces().rend());
+            for (currentSurf = (*currentLayer)->getAllSurfaces().rbegin();
+                    currentSurf != surfEnd && surf == NULL;
+                    currentSurf++)
             {
-                x_SurfCoordinate = x;
-                y_SurfCoordinate = y;
-                (*currentLayer)->DestToSourceCoordinates(&x_SurfCoordinate, &y_SurfCoordinate, false);
-                /* Need to browse for all surfaces */
-                SurfaceListConstReverseIterator surfEnd((*currentLayer)->getAllSurfaces().rend());
-                for (currentSurf = (*currentLayer)->getAllSurfaces().rbegin();
-                     currentSurf !=  surfEnd && surf == NULL;
-                     currentSurf++)
+                if ((*currentSurf)->hasNativeContent()
+                    && (*currentSurf)->visibility
+                    && ((*currentSurf)->getOpacity() != 0)
+                    && (*currentSurf)->isInside(x_SurfCoordinate, y_SurfCoordinate)
+                    && (*currentSurf)->isInputEventAcceptedFrom(INPUT_DEVICE_POINTER))
                 {
-                    if ( ((*currentSurf)->hasNativeContent()) && ((*currentSurf)->visibility) && ((*currentSurf)->getOpacity() != 0) )
-                    {
-                        if ((*currentSurf)->isInside(x_SurfCoordinate, y_SurfCoordinate))
-                        {
-                            if ((*currentSurf)->isInputEventAcceptedFrom(INPUT_DEVICE_POINTER))
-                            {
-                                surf = *currentSurf;
-                                (*currentSurf)->DestToSourceCoordinates(&x_SurfCoordinate, &y_SurfCoordinate, false);
-                                x = x_SurfCoordinate;
-                                y = y_SurfCoordinate;
-                            }
-                        }
-                    }
+                    surf = *currentSurf;
+                    (*currentSurf)->DestToSourceCoordinates(&x_SurfCoordinate, &y_SurfCoordinate, false);
+                    x = x_SurfCoordinate;
+                    y = y_SurfCoordinate;
                 }
             }
         }
@@ -265,8 +259,8 @@ void InputManager::transformGlobalToLocalCoordinates(Surface* surf, int& x, int&
     layer = m_pScene->getLayer(surf->getContainingLayerId());
     if (layer != NULL)
     {
-        layer->DestToSourceCoordinates(&x,&y, false);
-        surf->DestToSourceCoordinates(&x,&y, false);
+        layer->DestToSourceCoordinates(&x, &y, false);
+        surf->DestToSourceCoordinates(&x, &y, false);
     }
 }
 
index 0e9679d..9ce777b 100644 (file)
@@ -162,9 +162,11 @@ uint* Layermanager::getScreenIDs(uint* length) const
 // via the renderer for a redraw because of a rendering property change
 void Layermanager::signalRendererRedraw()
 {
-       IRenderer* renderer = *m_pRendererList->begin();
-       if (NULL!=renderer)
-               renderer->signalWindowSystemRedraw();
+    IRenderer* renderer = *m_pRendererList->begin();
+    if (renderer)
+    {
+        renderer->signalWindowSystemRedraw();
+    }
 }
 
 void Layermanager::addApplicationReference(t_ilm_client_handle client, IApplicationReference* reference)
@@ -269,15 +271,15 @@ bool Layermanager::executeCommand(ICommand* commandToBeExecuted)
 
     if (status == ExecutionFailedRedraw || status == ExecutionSuccessRedraw)
     {
-       // either a command that has changed the output was executed, or
-       // commit command was executed which contained commands that requested redraw was executed.
-       signalRendererRedraw();
+        // either a command that has changed the output was executed, or
+        // commit command was executed which contained commands that requested redraw was executed.
+        signalRendererRedraw();
     }
 
     unsigned int commandPid = commandToBeExecuted->getSenderPid();
     LOG_INFO("LayerManagerService", "executed " << commandToBeExecuted->getString()
-                                     << " from " << getSenderName(commandPid) << "(" << commandPid << ")"
-                                     << ((status == ExecutionSuccess || status == ExecutionSuccessRedraw) ? "+" : "-"));
+                                        << " from " << getSenderName(commandPid) << "(" << commandPid << ")"
+                                        << ((status == ExecutionSuccess || status == ExecutionSuccessRedraw) ? "+" : "-"));
 
     return (status == ExecutionSuccess || status == ExecutionSuccessRedraw);
 }
@@ -342,12 +344,12 @@ bool Layermanager::startAllRenderers(const int width, const int height,
         }
         if (renderer == NULL || allStarted == false)
         {
-          break;   
+            break;
         }
     }
     if (!allStarted)
     {
-        LOG_ERROR("LayerManagerService","Could not start Compositing Controllers");
+        LOG_ERROR("LayerManagerService", "Could not start Compositing Controllers");
     }
     return allStarted;
 }
@@ -373,7 +375,7 @@ bool Layermanager::delegateScene()
     }
     if (!allStarted)
     {
-        LOG_WARNING("LayerManagerService","Could not start delegate Scenes, initial Scene is lost");
+        LOG_WARNING("LayerManagerService", "Could not start delegate Scenes, initial Scene is lost");
     }
     return allStarted;
 }
@@ -381,10 +383,10 @@ bool Layermanager::delegateScene()
 bool Layermanager::startAllCommunicators()
 {
     bool allStarted = true;
-    
+
     CommunicatorListIterator communicatorIter = m_pCommunicatorList->begin();
     CommunicatorListIterator communicatorIterEnd = m_pCommunicatorList->end();
-    
+
     for (; communicatorIter != communicatorIterEnd; ++communicatorIter)
     {
         ICommunicator *communicator = *communicatorIter;
@@ -399,7 +401,7 @@ bool Layermanager::startAllCommunicators()
     }
     if (!allStarted)
     {
-        LOG_ERROR("LayerManagerService","Could not start Communication Controllers");
+        LOG_ERROR("LayerManagerService", "Could not start Communication Controllers");
     }
     return allStarted;
 }
@@ -407,10 +409,10 @@ bool Layermanager::startAllCommunicators()
 bool Layermanager::startAllHealthMonitors()
 {
     bool allStarted = true;
-    
+
     HealthMonitorListIterator iter = m_pHealthMonitorList->begin();
     HealthMonitorListIterator iterEnd = m_pHealthMonitorList->end();
-    
+
     for (; iter != iterEnd; ++iter)
     {
         IHealthMonitor* healthMonitor = *iter;
@@ -425,7 +427,7 @@ bool Layermanager::startAllHealthMonitors()
     }
     if (!allStarted)
     {
-        LOG_ERROR("LayerManagerService","Could not start Health Monitors");
+        LOG_ERROR("LayerManagerService", "Could not start Health Monitors");
     }
     return allStarted;
 }
@@ -437,14 +439,14 @@ bool Layermanager::startManagement()
     const int width = mConfiguration.getDisplayWidth();
     const int height = mConfiguration.getDisplayHeight();
     const char* displayName = mConfiguration.getDisplayName().c_str();
-    
+
     // 1. start renderers, no prerequisites
     // 2. execute scene provider plugins
     // 3. start communication (after scene is ready to use)
     result = startAllRenderers(width, height, displayName)
-             && delegateScene()
-             && startAllCommunicators()
-             && startAllHealthMonitors();
+                && delegateScene()
+                && startAllCommunicators()
+                && startAllHealthMonitors();
 
     return result;
 }
index b16ed65..7f789a8 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- * 
+ *
  * Copyright 2010,2011 BMW Car IT GmbH
  *
  *
@@ -52,4 +52,3 @@ void PluginBase::pluginSetHealth(HealthCondition health)
 {
     mHealth = health;
 }
-    
index 5dd1fcd..198dead 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- * 
+ *
  * Copyright 2012 BMW Car IT GmbH
  *
  *
@@ -28,7 +28,6 @@
 #include <dlfcn.h>
 #include <stdlib.h>
 
-
 StaticPluginCreateFuncList PluginManager::mStaticPluginCreateFuncList;
 
 //===========================================================================
@@ -44,16 +43,16 @@ PluginManager::PluginManager(ICommandExecutor& executor, Configuration& config)
 , mConfiguration(config)
 {
     LOG_DEBUG("PluginManager", "loading plugins from " << mConfiguration.getPluginPath());
-    
+
     // create static plugins
     createStaticallyLinkedPlugins();
-    
+
 #ifndef WITH_STATIC_LIBRARIES
     // create dynamic plugins
     getAllFilesInPluginPath(mConfiguration.getPluginPath());
     createDynamicallyLinkedPlugins();
 #endif
-    
+
     LOG_INFO("PluginManager", "created " << mPluginList.size() << " plugins");
 }
 
@@ -61,7 +60,7 @@ PluginManager::~PluginManager()
 {
     PluginList::iterator iter = mPluginList.begin();
     PluginList::iterator iterEnd = mPluginList.end();
-    
+
     for (; iter != iterEnd; ++iter)
     {
         IPlugin* plugin = *iter;
@@ -78,7 +77,7 @@ void PluginManager::getRendererList(RendererList& list)
 {
     PluginList::const_iterator iter = mPluginList.begin();
     PluginList::const_iterator iterEnd = mPluginList.end();
-    
+
     for (; iter != iterEnd; ++iter)
     {
         IPlugin* plugin = *iter;
@@ -95,7 +94,7 @@ void PluginManager::getHealthMonitorList(HealthMonitorList& list)
 {
     PluginList::const_iterator iter = mPluginList.begin();
     PluginList::const_iterator iterEnd = mPluginList.end();
-    
+
     for (; iter != iterEnd; ++iter)
     {
         IPlugin* plugin = *iter;
@@ -115,7 +114,7 @@ void PluginManager::getSceneProviderList(SceneProviderList& list)
 {
     PluginList::const_iterator iter = mPluginList.begin();
     PluginList::const_iterator iterEnd = mPluginList.end();
-    
+
     for (; iter != iterEnd; ++iter)
     {
         IPlugin* plugin = *iter;
@@ -132,7 +131,7 @@ void PluginManager::getCommunicatorList(CommunicatorList& list)
 {
     PluginList::const_iterator iter = mPluginList.begin();
     PluginList::const_iterator iterEnd = mPluginList.end();
-    
+
     for (; iter != iterEnd; ++iter)
     {
         IPlugin* plugin = *iter;
@@ -161,7 +160,7 @@ void PluginManager::createStaticallyLinkedPlugins()
 {
     StaticPluginCreateFuncList::iterator iter = mStaticPluginCreateFuncList.begin();
     StaticPluginCreateFuncList::iterator iterEnd = mStaticPluginCreateFuncList.end();
-    
+
     for (; iter != iterEnd; ++iter)
     {
         StaticPluginCreateFunc func = *iter;
@@ -175,37 +174,37 @@ void PluginManager::getAllFilesInPluginPath(std::string path)
 {
     DIR *directory = opendir(path.c_str());
     struct dirent *itemInDirectory = 0;
-    
+
     while (directory && (itemInDirectory = readdir(directory)))
     {
         unsigned char entryType = itemInDirectory->d_type;
         std::string entryName = itemInDirectory->d_name;
         std::string fullPath = path + "/" + entryName;
-        
+
         if (entryName.at(0) == '.')
         {
             continue;
         }
-        
+
         switch (entryType)
         {
-            case DT_REG:
-            case DT_LNK:
-            case DT_UNKNOWN:
-                mFileList.push_back(fullPath);
-                LOG_DEBUG("PluginManager", "considering File " << fullPath);
-                break;
-                
-            case DT_DIR:
-                getAllFilesInPluginPath(fullPath);
-                break;
-                
-            default:
-                LOG_DEBUG("PluginManager", "ignored file " << fullPath);
-                break;
+        case DT_REG:
+        case DT_LNK:
+        case DT_UNKNOWN:
+            mFileList.push_back(fullPath);
+            LOG_DEBUG("PluginManager", "considering File " << fullPath);
+            break;
+
+        case DT_DIR:
+            getAllFilesInPluginPath(fullPath);
+            break;
+
+        default:
+            LOG_DEBUG("PluginManager", "ignored file " << fullPath);
+            break;
         }
     }
-    
+
     closedir(directory);
 }
 
@@ -213,7 +212,7 @@ void PluginManager::createDynamicallyLinkedPlugins()
 {
     FileList::const_iterator iter = mFileList.begin();
     FileList::const_iterator iterEnd = mFileList.end();
-    
+
     for (; iter != iterEnd; ++iter)
     {
         IPlugin* plugin = createDynamicallyLinkedPlugin(*iter);
@@ -227,7 +226,7 @@ void PluginManager::createDynamicallyLinkedPlugins()
 IPlugin* PluginManager::createDynamicallyLinkedPlugin(std::string path)
 {
     IPlugin* returnValue = NULL;
-    
+
     // open library
     void *libraryHandle;
     dlerror(); // Clear any existing error
@@ -238,22 +237,22 @@ IPlugin* PluginManager::createDynamicallyLinkedPlugin(std::string path)
         LOG_DEBUG("PluginManager", "not a shared library: " << dlopen_error);
         return NULL;
     }
-    
+
     // load entry point
     union
     {
         void* data;
         IPlugin* (*createFunc)(ICommandExecutor&, Configuration&);
     } convertUnion;
-    
+
     int cutBegin = path.find_last_of('/') + 4;      // remove '*/lib' from name
     int cutEnd = path.find_first_of('.', cutBegin); // remove '.extension' from name
-    
+
     std::string createFunctionName = "create";
     createFunctionName += path.substr(cutBegin, cutEnd - cutBegin);
-    
+
     convertUnion.data = dlsym(libraryHandle, createFunctionName.c_str());
-    
+
     // create plugin instance from entry point
     const char* dlsym_error = dlerror();
     if (convertUnion.data && !dlsym_error)
@@ -267,6 +266,6 @@ IPlugin* PluginManager::createDynamicallyLinkedPlugin(std::string path)
         dlclose(libraryHandle);
         returnValue = NULL;
     }
-    
+
     return returnValue;
-}
\ No newline at end of file
+}
index ce2945f..1f35fca 100644 (file)
@@ -58,7 +58,7 @@ Layer* Scene::createLayer(const uint layerId, int creatorPid)
         }
         else
         {
-            LOG_DEBUG("Scene","createLayer: Layer with id " << layerId << " already exists ");
+            LOG_DEBUG("Scene", "createLayer: Layer with id " << layerId << " already exists ");
             newLayer = m_layerMap[layerId];
         }
     }
@@ -85,7 +85,7 @@ Surface* Scene::createSurface(const uint surfaceId, int creatorPid)
         else
         {
             newSurface = m_surfaceMap[surfaceId];
-            LOG_DEBUG("Scene","Surface with id [ " << surfaceId << " ] " << " already exists " );
+            LOG_DEBUG("Scene", "Surface with id [ " << surfaceId << " ] " << " already exists ");
         }
     }
     return newSurface;
@@ -102,7 +102,7 @@ LmScreen* Scene::getScreen(const uint screenId) const
             return (*iter);
         }
     }
-    LOG_WARNING("Scene","screen not found : id [ " << screenId << " ]");
+    LOG_WARNING("Scene", "screen not found : id [ " << screenId << " ]");
 
     return NULL;
 }
@@ -116,7 +116,7 @@ Layer* Scene::getLayer(const uint layerId)
     }
     else
     {
-        LOG_WARNING("Scene","layer not found : id [ " << layerId << " ]");
+        LOG_WARNING("Scene", "layer not found : id [ " << layerId << " ]");
     }
     return layer;
 }
@@ -130,7 +130,7 @@ Surface* Scene::getSurface(const uint surfaceId)
     }
     else
     {
-        LOG_WARNING("Scene","surface not found : id [ " << surfaceId << " ]");
+        LOG_WARNING("Scene", "surface not found : id [ " << surfaceId << " ]");
     }
     return surface;
 }
index 7b93f1a..c4a12c5 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <Shader.h>
 
-unsigned int Shader::m_nextUniqueShaderId=1;
+unsigned int Shader::m_nextUniqueShaderId = 1;
 
 Shader* Shader::createShader(const string& vertFileName, const string& fragFileName)
 {
@@ -92,7 +92,7 @@ void Shader::loadUniforms(void)
     UniformMapConstIterator iterEnd = m_uniformMap.end();
 
     for (; iter != iterEnd; ++iter)
-    {       
+    {
         ShaderUniform* uniform = (*iter).second;
         uniform->load(m_program);
     }
index d5b4fd9..191c731 100644 (file)
@@ -155,7 +155,7 @@ void ShaderProgram::loadCommonUniforms(const CommonUniforms& uniforms, const int
     {
         uniform1iv(m_texUnitLoc, texCount, uniforms.texUnit);
     }
-    if (m_chromaKeyLoc>= 0)
+    if (m_chromaKeyLoc >= 0)
     {
         uniform3fv(m_chromaKeyLoc, 1, uniforms.chromaKey);
     }
index 1129823..224f433 100644 (file)
 using namespace std;
 
 const int ShaderUniform::m_vectorSizesOfDataTypes[] =
-{ 0, // Undefined
-        1, // Vector1f
-        2, // Vector2f
-        3, // Vector3f
-        4, // Vector4f
-        4, // Matrix2f
-        9, // Matrix3f
-        16 // Matrix4f
-        };
+{
+    0, // Undefined
+    1, // Vector1f
+    2, // Vector2f
+    3, // Vector3f
+    4, // Vector4f
+    4, // Matrix2f
+    9, // Matrix3f
+    16 // Matrix4f
+};
 
 ShaderUniform* ShaderUniform::createFromStringDescription(
         const string& description)
@@ -81,7 +82,7 @@ ShaderUniform* ShaderUniform::createFromStringDescription(
     }
     else
     {
-        LOG_ERROR("Shader Uniform","Can not parse Type " << token);
+        LOG_ERROR("Shader Uniform", "Can not parse Type " << token);
         return NULL;
     }
 
@@ -91,7 +92,7 @@ ShaderUniform* ShaderUniform::createFromStringDescription(
     if (iss.fail())
     {
         // failed to parse element count
-        LOG_ERROR("Shader Uniform","Fail to parse element count.");
+        LOG_ERROR("Shader Uniform", "Fail to parse element count.");
         return NULL;
     }
 
@@ -101,7 +102,7 @@ ShaderUniform* ShaderUniform::createFromStringDescription(
     {
         if ((iss >> transpose).fail())
         {
-            LOG_ERROR("Shader Uniform","Fail to parse value ");
+            LOG_ERROR("Shader Uniform", "Fail to parse value ");
             return NULL;
         }
     }
@@ -115,7 +116,7 @@ ShaderUniform* ShaderUniform::createFromStringDescription(
         if (iss.fail())
         {
             // failed to parse value
-            LOG_ERROR("Shader Uniform","Fail to parse value " << value);
+            LOG_ERROR("Shader Uniform", "Fail to parse value " << value);
             return NULL;
         }
         floatData.push_back(value);
@@ -123,7 +124,7 @@ ShaderUniform* ShaderUniform::createFromStringDescription(
 
     if (floatData.size() != numValuesExpected)
     {
-        LOG_ERROR("Shader Uniform","Invalid number of values");
+        LOG_ERROR("Shader Uniform", "Invalid number of values");
         return NULL;
     }
 
@@ -178,16 +179,16 @@ void ShaderUniform::setData(const ShaderUniform& other)
 
 void ShaderUniform::load(ShaderProgram& program)
 {
-    LOG_DEBUG("ShaderUniform","Load Uniform " << getName() << " location " << m_location);
-    if ( m_location == 0 ) 
+    LOG_DEBUG("ShaderUniform", "Load Uniform " << getName() << " location " << m_location);
+    if (m_location == 0)
     {
         m_location = program.getUniformLocation(getName().c_str());
     }
-    LOG_DEBUG("ShaderUniform","Load Uniform " << getName() << " location " << m_location);
+    LOG_DEBUG("ShaderUniform", "Load Uniform " << getName() << " location " << m_location);
     if (m_location == -1)
     {
         // TODO: error? or silently fail?
-        LOG_WARNING("ShaderUniform","Load Uniform failed, location not defined" );
+        LOG_WARNING("ShaderUniform", "Load Uniform failed, location not defined");
         return;
     }
 
@@ -197,22 +198,22 @@ void ShaderUniform::load(ShaderProgram& program)
     switch (m_type)
     {
     case Vector1f:
-        LOG_DEBUG("ShaderUniform","Load Uniform1fv : " << values[0] );
+        LOG_DEBUG("ShaderUniform", "Load Uniform1fv : " << values[0]);
         program.uniform1fv(m_location, m_count, values);
         break;
 
     case Vector2f:
-        LOG_DEBUG("ShaderUniform","Load Uniform2fv : " << values[0] << "," << values[1] );
+        LOG_DEBUG("ShaderUniform", "Load Uniform2fv : " << values[0] << ", " << values[1]);
         program.uniform2fv(m_location, m_count, values);
         break;
 
     case Vector3f:
-        LOG_DEBUG("ShaderUniform","Load Uniform3fv : " << values[0] << "," << values[1] << "," << values[2] );
+        LOG_DEBUG("ShaderUniform", "Load Uniform3fv : " << values[0] << ", " << values[1] << ", " << values[2]);
         program.uniform3fv(m_location, m_count, values);
         break;
 
     case Vector4f:
-        LOG_DEBUG("ShaderUniform","Load Uniform4fv : " << values[0] << "," << values[1] << "," << values[2] << "," << values[3] );
+        LOG_DEBUG("ShaderUniform", "Load Uniform4fv : " << values[0] << ", " << values[1] << ", " << values[2] << ", " << values[3]);
         program.uniform4fv(m_location, m_count, values);
         break;
 
index 54a5e57..1b0dc63 100644 (file)
@@ -26,7 +26,7 @@
 #include <pthread.h>  // mutex
 
 #ifdef HAVE_EXECINFO_H
-    #include <execinfo.h>
+#include <execinfo.h>
 #endif
 
 
@@ -80,10 +80,10 @@ void printStackTrace()
 #ifdef HAVE_BACKTRACE
     const int maxStackSize = 64;
     void* stack[maxStackSize];
-    
+
     size_t count = backtrace(stack, maxStackSize);
     char **lines = backtrace_symbols(stack, count);
-    
+
     LOG_INFO("LayerManagerService", "--------------------------------------------------");
     for (unsigned int i = 0; i < count; ++i)
     {
@@ -100,36 +100,36 @@ void incomingSignalCallback(int sig)
 {
     switch (sig)
     {
-        case SIGTERM:
-            LOG_INFO("LayerManagerService", "Signal SIGTERM received. Shutting down.");
-            pthread_mutex_unlock(&gShutdownReceived);
-            break;
-            
-        case SIGINT:
-            LOG_INFO("LayerManagerService", "Signal SIGINT received. Shutting down.");
-            pthread_mutex_unlock(&gShutdownReceived);
-            break;
-            
-        case SIGBUS:
-            LOG_ERROR("LayerManagerService", "Signal SIGBUS received. Shutting down.");
-            printStackTrace();
-            pthread_mutex_unlock(&gShutdownReceived);
-            break;
-            
-        case SIGSEGV:
-            LOG_ERROR("LayerManagerService", "Signal SIGSEGV received. Shutting down.");
-            printStackTrace();
-            pthread_mutex_unlock(&gShutdownReceived);
-            break;
-            
-        case SIGABRT:
-            LOG_ERROR("LayerManagerService", "Signal SIGABRT received. Shutting down.");
-            printStackTrace();
-            pthread_mutex_unlock(&gShutdownReceived);
-            break;
-            
-        default:
-            LOG_INFO("LayerManagerService", "Signal " << sig << " received.");
-            break;
+    case SIGTERM:
+        LOG_INFO("LayerManagerService", "Signal SIGTERM received. Shutting down.");
+        pthread_mutex_unlock(&gShutdownReceived);
+        break;
+
+    case SIGINT:
+        LOG_INFO("LayerManagerService", "Signal SIGINT received. Shutting down.");
+        pthread_mutex_unlock(&gShutdownReceived);
+        break;
+
+    case SIGBUS:
+        LOG_ERROR("LayerManagerService", "Signal SIGBUS received. Shutting down.");
+        printStackTrace();
+        pthread_mutex_unlock(&gShutdownReceived);
+        break;
+
+    case SIGSEGV:
+        LOG_ERROR("LayerManagerService", "Signal SIGSEGV received. Shutting down.");
+        printStackTrace();
+        pthread_mutex_unlock(&gShutdownReceived);
+        break;
+
+    case SIGABRT:
+        LOG_ERROR("LayerManagerService", "Signal SIGABRT received. Shutting down.");
+        printStackTrace();
+        pthread_mutex_unlock(&gShutdownReceived);
+        break;
+
+    default:
+        LOG_INFO("LayerManagerService", "Signal " << sig << " received.");
+        break;
     }
 }
index a9f824f..c29a0bd 100644 (file)
@@ -92,7 +92,11 @@ ilmErrorTypes ilm_surfaceAddNotification(t_ilm_surface surface, surfaceNotificat
  * \return ILM_SUCCESS if the method call was successful
  * \return ILM_FAILED if the client can not call the method on the service.
  */
-ilmErrorTypes ilm_surfaceCreate(t_ilm_nativehandle nativehandle, t_ilm_int width, t_ilm_int height, ilmPixelFormat pixelFormat, t_ilm_surface *pSurfaceId);
+ilmErrorTypes ilm_surfaceCreate(t_ilm_nativehandle nativehandle,
+                                t_ilm_int width,
+                                t_ilm_int height,
+                                ilmPixelFormat pixelFormat,
+                                t_ilm_surface *pSurfaceId);
 
 /**
  * \brief Get the horizontal and vertical dimension of the surface.
@@ -159,7 +163,11 @@ ilmErrorTypes ilm_surfaceRemoveNotification(t_ilm_surface surface);
  * \return ILM_SUCCESS if the method call was successful
  * \return ILM_FAILED if the client can not call the method on the service.
  */
-ilmErrorTypes ilm_surfaceSetNativeContent(t_ilm_nativehandle nativehandle, t_ilm_int width, t_ilm_int height, ilmPixelFormat pixelFormat, t_ilm_surface surfaceId);
+ilmErrorTypes ilm_surfaceSetNativeContent(t_ilm_nativehandle nativehandle,
+                                            t_ilm_int width,
+                                            t_ilm_int height,
+                                            ilmPixelFormat pixelFormat,
+                                            t_ilm_surface surfaceId);
 
 /**
  * \brief Set the area of a surface which should be used for the rendering.
@@ -179,7 +187,7 @@ ilmErrorTypes ilm_surfaceSetSourceRectangle(t_ilm_surface surfaceId, t_ilm_int x
  * By default, a surface accept input events from all kind of devices (keyboards, pointer, ...)
  * By calling this function, you can adjust surface preferences. Note that this function only
  * adjust the acceptance for the specified devices. Non specified are keept untouched.
- * 
+ *
  * Typicall use case for this function is when dealing with pointer or touch events.
  * Those are normally dispatched to the first visible surface below the coordinate.
  * If you want a different behavior (i.e. forward events to an other surface below the coordinate,
index 54d5025..448965f 100644 (file)
@@ -80,7 +80,7 @@ typedef enum e_ilmPixelFormat
 {
     ILM_PIXELFORMAT_R_8 = 0,           /*!< Pixelformat value, to describe a 8 bit luminance surface */
     ILM_PIXELFORMAT_RGB_888 = 1,       /*!< Pixelformat value, to describe a 24 bit rgb surface */
-    ILM_PIXELFORMAT_RGBA_8888 =2,      /*!< Pixelformat value, to describe a 24 bit rgb surface with 8 bit alpha */
+    ILM_PIXELFORMAT_RGBA_8888 = 2,      /*!< Pixelformat value, to describe a 24 bit rgb surface with 8 bit alpha */
     ILM_PIXELFORMAT_RGB_565 = 3,       /*!< Pixelformat value, to describe a 16 bit rgb surface */
     ILM_PIXELFORMAT_RGBA_5551 = 4,     /*!< Pixelformat value, to describe a 16 bit rgb surface, with binary mask */
     ILM_PIXELFORMAT_RGBA_6661 = 5,     /*!< Pixelformat value, to describe a 18 bit rgb surface, with binars mask */
@@ -97,7 +97,8 @@ typedef enum e_ilmLayerType
     ILM_LAYERTYPE_UNKNOWN = 0,         /*!< LayerType not known */
     ILM_LAYERTYPE_HARDWARE = 1,        /*!< LayerType value, to describe a hardware layer */
     ILM_LAYERTYPE_SOFTWARE2D = 2,      /*!< LayerType value, to describe a redirected offscreen buffer layer */
-    ILM_LAYERTYPE_SOFTWARE2_5D = 3     /*!< LayerType value, to describe a redirected offscreen buffer layer, which can be rotated in the 3d space */
+    ILM_LAYERTYPE_SOFTWARE2_5D = 3     /*!< LayerType value, to describe a redirected offscreen buffer layer,
+                                            which can be rotated in the 3d space */
 } ilmLayerType;
 
 /**
@@ -299,27 +300,27 @@ typedef void* t_ilm_message;
  */
 typedef enum
 {
-    ILM_NOTIFICATION_VISIBILITY         = ILM_BIT(1),
-    ILM_NOTIFICATION_OPACITY            = ILM_BIT(2),
-    ILM_NOTIFICATION_ORIENTATION        = ILM_BIT(3),
-    ILM_NOTIFICATION_SOURCE_RECT        = ILM_BIT(4),
-    ILM_NOTIFICATION_DEST_RECT          = ILM_BIT(5),
-    ILM_NOTIFICATION_ALL                = 0xffff
+    ILM_NOTIFICATION_VISIBILITY = ILM_BIT(1),
+    ILM_NOTIFICATION_OPACITY = ILM_BIT(2),
+    ILM_NOTIFICATION_ORIENTATION = ILM_BIT(3),
+    ILM_NOTIFICATION_SOURCE_RECT = ILM_BIT(4),
+    ILM_NOTIFICATION_DEST_RECT = ILM_BIT(5),
+    ILM_NOTIFICATION_ALL = 0xffff
 } t_ilm_notification_mask;
 
 /**
  * Typedef for notification callback on property changes of a layer
  */
 typedef void(*layerNotificationFunc)(t_ilm_layer layer,
-                                     struct ilmLayerProperties*,
-                                     t_ilm_notification_mask mask);
+                                        struct ilmLayerProperties*,
+                                        t_ilm_notification_mask mask);
 
 /**
  * Typedef for notification callback on property changes of a surface
  */
 typedef void(*surfaceNotificationFunc)(t_ilm_surface surface,
-                                     struct ilmSurfaceProperties*,
-                                     t_ilm_notification_mask mask);
+                                        struct ilmSurfaceProperties*,
+                                        t_ilm_notification_mask mask);
 
 /**
  * enum for identifying different health states
@@ -341,16 +342,16 @@ enum HealthCondition
  */
 typedef enum PluginApi
 {
-    Renderer_Api            = 0x00010000,
+    Renderer_Api = 0x00010000,
     Renderer_Api_v1,
 
-    SceneProvider_Api       = 0x00020000,
+    SceneProvider_Api = 0x00020000,
     SceneProvider_Api_v1,
 
-    Communicator_Api        = 0x00040000,
+    Communicator_Api = 0x00040000,
     Communicator_Api_v1,
 
-    HealthMonitor_Api       = 0x00080000,
+    HealthMonitor_Api = 0x00080000,
     HealthMonitor_Api_v1
 } ilmPluginApi;
 
index 59f65f2..18ea6f2 100644 (file)
@@ -1,3 +1,22 @@
+/***************************************************************************
+ *
+ * Copyright 2013 BMW Car IT GmbH
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ****************************************************************************/
+
 #include "ilm_tools.h"
 #include "ilm_types.h"
 
index a9c6e9f..ef8b154 100644 (file)
@@ -75,7 +75,7 @@ ilmErrorTypes ilm_getScreenIDs(t_ilm_uint* pNumberOfIDs, t_ilm_uint** ppIDs);
  * \return ILM_SUCCESS if the method call was successful
  * \return ILM_FAILED if the client can not call the method on the service.
  */
-ilmErrorTypes ilm_getLayerIDs(t_ilm_int* pLength,t_ilm_layer** ppArray);
+ilmErrorTypes ilm_getLayerIDs(t_ilm_int* pLength, t_ilm_layer** ppArray);
 
 /**
  * \brief Get all LayerIds of the given screen
@@ -87,7 +87,7 @@ ilmErrorTypes ilm_getLayerIDs(t_ilm_int* pLength,t_ilm_layer** ppArray);
  * \return ILM_SUCCESS if the method call was successful
  * \return ILM_FAILED if the client can not call the method on the service.
  */
-ilmErrorTypes ilm_getLayerIDsOnScreen(t_ilm_uint screenID, t_ilm_int* pLength,t_ilm_layer** ppArray);
+ilmErrorTypes ilm_getLayerIDsOnScreen(t_ilm_uint screenID, t_ilm_int* pLength, t_ilm_layer** ppArray);
 
 /**
  * \brief Get all SurfaceIDs which are currently registered and managed by the services
@@ -98,7 +98,7 @@ ilmErrorTypes ilm_getLayerIDsOnScreen(t_ilm_uint screenID, t_ilm_int* pLength,t_
  * \return ILM_SUCCESS if the method call was successful
  * \return ILM_FAILED if the client can not call the method on the service.
  */
-ilmErrorTypes ilm_getSurfaceIDs(t_ilm_int* pLength,t_ilm_surface** ppArray);
+ilmErrorTypes ilm_getSurfaceIDs(t_ilm_int* pLength, t_ilm_surface** ppArray);
 
 /**
  * \brief Get all SurfaceIds which are currently registered to a given layer and are managed by the services
@@ -110,18 +110,18 @@ ilmErrorTypes ilm_getSurfaceIDs(t_ilm_int* pLength,t_ilm_surface** ppArray);
  * \return ILM_SUCCESS if the method call was successful
  * \return ILM_FAILED if the client can not call the method on the service.
  */
-ilmErrorTypes ilm_getSurfaceIDsOnLayer(t_ilm_layer layer,t_ilm_int* pLength,t_ilm_surface** ppArray);
+ilmErrorTypes ilm_getSurfaceIDsOnLayer(t_ilm_layer layer, t_ilm_int* pLength, t_ilm_surface** ppArray);
 
 /**
  * \brief Create a layer which should be managed by the service
  * \ingroup ilmControl
  * \param[out] pLayerId pointer where the id should be/is stored. It is possible
  *                      to set a id from outside, 0 will create a new id.
 *\param[in] width     horizontal dimension of the layer
- *  
\param[in] width     horizontal dimension of the layer
+ *
  * \param[in] height    vertical dimension of the layer
- *                      
-* 
+ *
+ *
  * \return ILM_SUCCESS if the method call was successful
  * \return ILM_FAILED if the client can not call the method on the service.
  */
@@ -169,7 +169,7 @@ ilmErrorTypes ilm_layerSetVisibility(t_ilm_layer layerId, t_ilm_bool newVisibili
  * \return ILM_SUCCESS if the method call was successful
  * \return ILM_FAILED if the client can not call the method on the service.
  */
-ilmErrorTypes ilm_layerGetVisibility(t_ilm_layer layerId,t_ilm_bool *pVisibility);
+ilmErrorTypes ilm_layerGetVisibility(t_ilm_layer layerId, t_ilm_bool *pVisibility);
 
 /**
  * \brief Set the opacity of a layer.
@@ -375,7 +375,7 @@ ilmErrorTypes ilm_surfaceGetOpacity(const t_ilm_surface surfaceId, t_ilm_float *
  * To receive keyboard events, 2 conditions must be fulfilled:
  *  1- The surface must accept events from keyboard. See ilm_UpdateInputEventAcceptanceOn
  *  2- The keyboard focus must be set on that surface
- * 
+ *
  * \ingroup ilmControl
  * \param[in] surfaceId Identifier of the surface to set the keyboard focus on.
  * \return ILM_SUCCESS if the method call was successful
@@ -385,7 +385,7 @@ ilmErrorTypes ilm_SetKeyboardFocusOn(t_ilm_surface surfaceId);
 
 /**
  * \brief Get the indentifier of the surface which hold the keyboard focus
- * 
+ *
  * \ingroup ilmControl
  * \param[out] pSurfaceId Pointer on the a surface identifier
  * \return ILM_SUCCESS if the method call was successful
index 9188210..68f1f14 100644 (file)
@@ -34,7 +34,7 @@ public:
     : ICommand(ExecuteSynchronous, sender)
     {}
 
-     /**
+    /**
      * \brief default destructor
      */
     virtual ~CommitCommand() {}
index 1223b8c..9a9592d 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "ICommand.h"
 
-class ExitCommand: public ICommand
+class ExitCommand : public ICommand
 {
 public:
 
@@ -36,7 +36,7 @@ public:
     : ICommand(ExecuteSynchronous, sender)
     {}
 
-     /**
+    /**
      * \brief default destructor
      */
     virtual ~ExitCommand() {}
index 96cbeda..e1d777d 100644 (file)
@@ -35,7 +35,7 @@ public:
      * \param[in] returnMode location to store mode of optimization on execution
      * \ingroup Commands
      */
-    GetOptimizationModeCommand(pid_t sender,OptimizationType id, OptimizationModeType* returnMode)
+    GetOptimizationModeCommand(pid_t sender, OptimizationType id, OptimizationModeType* returnMode)
     : ICommand(ExecuteSynchronous, sender)
     , m_id(id)
     , m_pReturnMode(returnMode)
index 788a07c..c9fcea6 100644 (file)
@@ -23,7 +23,7 @@
 #include "ICommand.h"
 #include <string>
 
-class LayerDumpCommand: public ICommand
+class LayerDumpCommand : public ICommand
 {
 public:
     /*!
index 0385301..873838f 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "ICommand.h"
 
-class LayerGetDimensionCommand: public ICommand
+class LayerGetDimensionCommand : public ICommand
 {
 public:
     /*!
index ac597a5..58a78f9 100644 (file)
@@ -23,7 +23,7 @@
 #include "ICommand.h"
 #include "OrientationType.h"
 
-class LayerGetOrientationCommand: public ICommand
+class LayerGetOrientationCommand : public ICommand
 {
 public:
     /*!
index 889a88d..57f74f1 100644 (file)
@@ -74,7 +74,8 @@ private:
     const unsigned int m_height;
 
     // for unit testing
-    template <typename id_type, typename x_type, typename y_type, typename width_type, typename height_type> friend class LayerSetDestinationRectangleCommandEqMatcherP5;
+    template <typename id_type, typename x_type, typename y_type, typename width_type, typename height_type>
+    friend class LayerSetDestinationRectangleCommandEqMatcherP5;
 };
 
 
index d280a4a..40ddb13 100644 (file)
@@ -41,7 +41,6 @@ public:
     , m_y(y)
     {}
 
-
     /**
      * \brief default destructor
      */
index 5ad2053..f695f63 100644 (file)
@@ -74,7 +74,8 @@ private:
     const unsigned int m_height;
 
     // for unit testing
-    template <typename id_type, typename x_type, typename y_type, typename width_type, typename height_type> friend class LayerSetSourceRectangleCommandEqMatcherP5;
+    template <typename id_type, typename x_type, typename y_type, typename width_type, typename height_type>
+    friend class LayerSetSourceRectangleCommandEqMatcherP5;
 };
 
 
index 95eebaa..e8c4dd8 100644 (file)
@@ -23,7 +23,7 @@
 #include "ICommand.h"
 #include <string>
 
-class ScreenDumpCommand: public ICommand
+class ScreenDumpCommand : public ICommand
 {
 public:
     /*!
index 645f6d2..c7e793f 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "ICommand.h"
 
-class ScreenSetRenderOrderCommand: public ICommand
+class ScreenSetRenderOrderCommand : public ICommand
 {
 public:
     /*!
index f476bb7..16d5ee0 100644 (file)
@@ -23,7 +23,7 @@
 #include "ICommand.h"
 #include <string>
 
-class SurfaceDumpCommand: public ICommand
+class SurfaceDumpCommand : public ICommand
 {
 public:
     /*!
index 8ef5a05..08f4c96 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "ICommand.h"
 
-class SurfaceGetDimensionCommand: public ICommand
+class SurfaceGetDimensionCommand : public ICommand
 {
 public:
     /*!
index 69b1bb6..a73aa73 100644 (file)
@@ -59,7 +59,6 @@ public:
 private:
     unsigned int* m_pSurfId;
 
-
     // for unit testing
     friend class GetKeyboardFocusSurfaceIdCommandEqMatcher;
 };
index f8de6db..5506cb3 100644 (file)
@@ -23,7 +23,7 @@
 #include "ICommand.h"
 #include "OrientationType.h"
 
-class SurfaceGetOrientationCommand: public ICommand
+class SurfaceGetOrientationCommand : public ICommand
 {
 public:
     /*!
index 43df083..f18f1c5 100644 (file)
@@ -66,7 +66,8 @@ private:
     uint m_surfaceId;
 
     // for unit testing
-    //template <typename nativeHandle_type, typename pixelformat_type, typename OriginalWidth_type, typename OriginalHeight_type> friend class SurfaceSetRenderBufferCommandEqMatcherP4;
+    //template <typename nativeHandle_type, typename pixelformat_type, typename OriginalWidth_type, typename OriginalHeight_type>
+    //friend class SurfaceSetRenderBufferCommandEqMatcherP4;
 };
 
 
index ff54810..041a994 100644 (file)
@@ -74,7 +74,8 @@ private:
     const unsigned int m_height;
 
     // for unit testing
-    template <typename id_type, typename x_type, typename y_type, typename width_type, typename height_type> friend class SurfaceSetDestinationRectangleCommandEqMatcherP5;
+    template <typename id_type, typename x_type, typename y_type, typename width_type, typename height_type>
+    friend class SurfaceSetDestinationRectangleCommandEqMatcherP5;
 };
 
 
index af0519a..d51825f 100644 (file)
@@ -34,7 +34,7 @@ public:
      * \param[in] height height of surface
      * \ingroup Commands
      */
-    SurfaceSetDimensionCommand(pid_t sender, int id, unsigned int width,unsigned  int height)
+    SurfaceSetDimensionCommand(pid_t sender, int id, unsigned int width, unsigned  int height)
     : ICommand(ExecuteAsynchronous, sender)
     , m_id(id)
     , m_width(width)
index ba45cbd..cceb278 100644 (file)
 
 class SurfaceSetKeyboardFocusCommand : public ICommand
 {
-    public:
-        /*!
-         * \action    This command sets the keyboard focus on a particular surface
-         * \frequency Called whenever a surface needs to receive keyboard events
-         * \param[in] sender process id of application that sent this command
-         * \param[in] surfId id of surface
-         * \ingroup Commands
-         */
-        SurfaceSetKeyboardFocusCommand(pid_t sender, unsigned int surfId)
-        : ICommand(ExecuteSynchronous, sender)
-        , m_surfId(surfId)
-        {}
+public:
+    /*!
+        * \action    This command sets the keyboard focus on a particular surface
+        * \frequency Called whenever a surface needs to receive keyboard events
+        * \param[in] sender process id of application that sent this command
+        * \param[in] surfId id of surface
+        * \ingroup Commands
+        */
+    SurfaceSetKeyboardFocusCommand(pid_t sender, unsigned int surfId)
+    : ICommand(ExecuteSynchronous, sender)
+    , m_surfId(surfId)
+    {}
 
-        /**
-         * \brief default destructor
-         */
-        virtual ~SurfaceSetKeyboardFocusCommand() {}
+    /**
+        * \brief default destructor
+        */
+    virtual ~SurfaceSetKeyboardFocusCommand() {}
 
-        /**
-         * \brief Execute this command.
-         * \param[in] executor Pointer to instance executing the LayerManagement Commands
-         * \return ExecutionSuccess: execution successful
-         * \return ExecutionFailed: execution failed
-         */
-        virtual ExecutionResult execute(ICommandExecutor* executor);
+    /**
+        * \brief Execute this command.
+        * \param[in] executor Pointer to instance executing the LayerManagement Commands
+        * \return ExecutionSuccess: execution successful
+        * \return ExecutionFailed: execution failed
+        */
+    virtual ExecutionResult execute(ICommandExecutor* executor);
 
-        /**
-         * \brief Get description string for this command.
-         * \return String object with description of this command object
-         */
-        virtual const std::string getString();
-    
-    private:
-        const unsigned int m_surfId;
+    /**
+        * \brief Get description string for this command.
+        * \return String object with description of this command object
+        */
+    virtual const std::string getString();
 
+private:
+    const unsigned int m_surfId;
 
     // for unit testing
     template <typename surfaceid_type> friend class SetKeyboardFocusOnCommandEqMatcherP;
index 2daf401..9f1b6bc 100644 (file)
@@ -40,7 +40,12 @@ public:
      * \param[in] OriginalHeight original height for native content
      * \ingroup Commands
      */
-    SurfaceSetNativeContentCommand(pid_t sender, unsigned int surfaceId, unsigned int handle, PixelFormat pixelformat, uint OriginalWidth, uint OriginalHeight)
+    SurfaceSetNativeContentCommand(pid_t sender,
+                                    unsigned int surfaceId,
+                                    unsigned int handle,
+                                    PixelFormat pixelformat,
+                                    uint OriginalWidth,
+                                    uint OriginalHeight)
     : ICommand(ExecuteSynchronous, sender)
     , m_surfaceId(surfaceId)
     , m_nativeHandle(handle)
@@ -78,7 +83,8 @@ private:
     uint m_originalHeight;
 
     // for unit testing
-    //template <typename nativeHandle_type, typename pixelformat_type, typename OriginalWidth_type, typename OriginalHeight_type> friend class SurfaceSetRenderBufferCommandEqMatcherP4;
+    //template <typename nativeHandle_type, typename pixelformat_type, typename OriginalWidth_type,
+    //      typename OriginalHeight_type> friend class SurfaceSetRenderBufferCommandEqMatcherP4;
 };
 
 
index 8803dbf..ac4f1d2 100644 (file)
@@ -76,7 +76,8 @@ private:
     const unsigned int m_height;
 
     // for unit testing
-    template <typename id_type, typename x_type, typename y_type, typename width_type, typename height_type> friend class SurfaceSetSourceRectangleCommandEqMatcherP5;
+    template <typename id_type, typename x_type, typename y_type, typename width_type, typename height_type>
+    friend class SurfaceSetSourceRectangleCommandEqMatcherP5;
 };
 
 
index ce6cc34..02a0508 100644 (file)
 
 class SurfaceUpdateInputEventAcceptance : public ICommand
 {
-    public:
-        /*!
-         * \action    This command update the list of input devices the surface
-         * can accept events from. Call this method if you do not want a surface
-         * to receive particular type of event (touch, keyboard, ...)
-         *
-         * \frequency Preferably at init. This could lead to weird results
-         * if you update the acceptance at runtime, while the surface has already
-         * a focus (touch, keyboard, ...)
-         *
-         * \param[in] sender process id of application that sent this command
-         * \param[in] surfId id of surface
-         * \param[in] devices Bitmask of ilmInputDevice. To set the acceptance status of one or more input device.
-         *            Note that this method will only the acceptance status for the specified InputDeviced in the
-         *            "devices" parameter. Not specified input device status will remain unchanged.
-         * \param[in] accept if TRUE, input events from all specified devices will be accepted
-         *
-         * \ingroup Commands
-         */
-        SurfaceUpdateInputEventAcceptance(pid_t sender, unsigned int surfId, InputDevice devices, bool accept)
-        : ICommand(ExecuteSynchronous, sender)
-        , m_surfId(surfId)
-        , m_devices(devices)
-        , m_accept(accept)
-        {}
+public:
+    /*!
+        * \action    This command update the list of input devices the surface
+        * can accept events from. Call this method if you do not want a surface
+        * to receive particular type of event (touch, keyboard, ...)
+        *
+        * \frequency Preferably at init. This could lead to weird results
+        * if you update the acceptance at runtime, while the surface has already
+        * a focus (touch, keyboard, ...)
+        *
+        * \param[in] sender process id of application that sent this command
+        * \param[in] surfId id of surface
+        * \param[in] devices Bitmask of ilmInputDevice. To set the acceptance status of one or more input device.
+        *            Note that this method will only the acceptance status for the specified InputDeviced in the
+        *            "devices" parameter. Not specified input device status will remain unchanged.
+        * \param[in] accept if TRUE, input events from all specified devices will be accepted
+        *
+        * \ingroup Commands
+        */
+    SurfaceUpdateInputEventAcceptance(pid_t sender, unsigned int surfId, InputDevice devices, bool accept)
+    : ICommand(ExecuteSynchronous, sender)
+    , m_surfId(surfId)
+    , m_devices(devices)
+    , m_accept(accept)
+    {}
 
-        /**
-         * \brief default destructor
-         */
-        virtual ~SurfaceUpdateInputEventAcceptance() {}
+    /**
+        * \brief default destructor
+        */
+    virtual ~SurfaceUpdateInputEventAcceptance() {}
 
-        /**
-         * \brief Execute this command.
-         * \param[in] executor Pointer to instance executing the LayerManagement Commands
-         * \return ExecutionSuccess: execution successful
-         * \return ExecutionFailed: execution failed
-         */
-        virtual ExecutionResult execute(ICommandExecutor* executor);
+    /**
+        * \brief Execute this command.
+        * \param[in] executor Pointer to instance executing the LayerManagement Commands
+        * \return ExecutionSuccess: execution successful
+        * \return ExecutionFailed: execution failed
+        */
+    virtual ExecutionResult execute(ICommandExecutor* executor);
 
-        /**
-         * \brief Get description string for this command.
-         * \return String object with description of this command object
-         */
-        virtual const std::string getString();
-
-    private:
-        const unsigned int m_surfId;
-        const InputDevice m_devices;
-        const bool m_accept;
+    /**
+        * \brief Get description string for this command.
+        * \return String object with description of this command object
+        */
+    virtual const std::string getString();
 
+private:
+    const unsigned int m_surfId;
+    const InputDevice m_devices;
+    const bool m_accept;
 
     // for unit testing
-    template <typename surfaceid_type, typename devices_type, typename acceptance_type> friend class UpdateInputEventAcceptanceOnCommandEqMatcherP3;
+    template <typename surfaceid_type, typename devices_type, typename acceptance_type>
+    friend class UpdateInputEventAcceptanceOnCommandEqMatcherP3;
 };
 
 #endif  /* ! _SURFACEUPDATEINPUTEVENTACCEPTANCE_H_ */
index 8c39051..91f1eb1 100644 (file)
@@ -34,17 +34,17 @@ ExecutionResult LayerAddSurfaceCommand::execute(ICommandExecutor* executor)
     {
         if (layer->addSurface(surface))
         {
-            LOG_DEBUG("LayerAddSurfaceCommand","Adding surface(" << m_surfaceid << ")" << surface->getID() << " to layer(" << m_layerid << ") " << layer->getID());
+            LOG_DEBUG("LayerAddSurfaceCommand", "Adding surface(" << m_surfaceid << ")" << surface->getID() << " to layer(" << m_layerid << ") " << layer->getID());
             LOG_DEBUG("LayerAddSurfaceCommand", "Layer now has #surfaces:" << layer->getAllSurfaces().size());
             result = surface->hasNativeContent() ? ExecutionSuccessRedraw : ExecutionSuccess;
         }
         else
         {
             unsigned int layer_id = surface->getContainingLayerId();
-            LOG_WARNING("LayerAddSurfaceCommand","surface : id [ " << m_surfaceid << " ] already belongs to layer : id [ " << layer_id << " ]");
+            LOG_WARNING("LayerAddSurfaceCommand", "surface : id [ " << m_surfaceid << " ] already belongs to layer : id [ " << layer_id << " ]");
             result = (m_layerid == layer_id) ? ExecutionSuccess : ExecutionFailed;
         }
-               surface->calculateTargetDestination(layer->getSourceRegion(),layer->getDestinationRegion());
+        surface->calculateTargetDestination(layer->getSourceRegion(), layer->getDestinationRegion());
     }
 
     return result;
index 0bf06fa..7422e06 100644 (file)
@@ -26,18 +26,18 @@ ExecutionResult LayerCreateCommand::execute(ICommandExecutor* executor)
     Scene& scene = *(executor->getScene());
     ExecutionResult result = ExecutionFailed;
 
-       Layer *layer = scene.createLayer(*m_idReturn, getSenderPid());
-       if (layer)
-       {
-               *m_idReturn = layer->getID();
+    Layer *layer = scene.createLayer(*m_idReturn, getSenderPid());
+    if (layer)
+    {
+        *m_idReturn = layer->getID();
 
-               layer->setDestinationRegion(Rectangle(0, 0, m_originalWidth, m_originalHeight));
-               layer->setSourceRegion(Rectangle(0, 0, m_originalWidth, m_originalHeight));
-               layer->OriginalSourceWidth = m_originalWidth;
-               layer->OriginalSourceHeight = m_originalHeight;
+        layer->setDestinationRegion(Rectangle(0, 0, m_originalWidth, m_originalHeight));
+        layer->setSourceRegion(Rectangle(0, 0, m_originalWidth, m_originalHeight));
+        layer->OriginalSourceWidth = m_originalWidth;
+        layer->OriginalSourceHeight = m_originalHeight;
 
-               LOG_DEBUG("LayerCreateCommand", "created layer with id: " << layer->getID() << "width: " << m_originalWidth << " height: " << m_originalHeight);
-               result = ExecutionSuccess;
+        LOG_DEBUG("LayerCreateCommand", "created layer with id: " << layer->getID() << "width: " << m_originalWidth << " height: " << m_originalHeight);
+        result = ExecutionSuccess;
     }
     return result;
 }
index 2fb235a..069ead8 100644 (file)
 
 ExecutionResult LayerDumpCommand::execute(ICommandExecutor* executor)
 {
-       ExecutionResult result = ExecutionFailed;
+    ExecutionResult result = ExecutionFailed;
     Scene& scene = *(executor->getScene());
     RendererList& m_rendererList = *(executor->getRendererList());
 
     bool status = false;
 
-    LOG_INFO("LayerDumpCommand","making screenshot, output file: " << m_filename);
+    LOG_INFO("LayerDumpCommand", "making screenshot, output file: " << m_filename);
 
-       if (scene.getLayer(m_id))
-       {
-               status = scene.isLayerInCurrentRenderOrder(m_id);
-               if (!status)
-               {
-                       LOG_WARNING("LayerDumpCommand","Requested layer: " << m_id << " does not belong to the current render order");
-               }
-       }
+    if (scene.getLayer(m_id))
+    {
+        status = scene.isLayerInCurrentRenderOrder(m_id);
+        if (!status)
+        {
+            LOG_WARNING("LayerDumpCommand", "Requested layer: " << m_id << " does not belong to the current render order");
+        }
+    }
 
     if (status)
     {
index 9c8d6be..3072bb0 100644 (file)
@@ -39,7 +39,7 @@ ExecutionResult LayerSetChromaKeyCommand::execute(ICommandExecutor* executor)
     {
         if (layer)
         {
-            LOG_DEBUG("LayerSetChromaKeyCommand","new chromakey disable for id: " << m_layerid);
+            LOG_DEBUG("LayerSetChromaKeyCommand", "new chromakey disable for id: " << m_layerid);
             result = layer->setChromaKeyEnabled(false) ? ExecutionSuccessRedraw : ExecutionSuccess;
         }
     }
@@ -47,7 +47,7 @@ ExecutionResult LayerSetChromaKeyCommand::execute(ICommandExecutor* executor)
     {
         if (layer)
         {
-            LOG_DEBUG("LayerSetChromaKeyCommand","new chromakey ("
+            LOG_DEBUG("LayerSetChromaKeyCommand", "new chromakey ("
                 << m_array[0] << ", " << m_array[1] << ", " << m_array[2] << ") for id: " << m_layerid);
             bool ansSetEnabled = layer->setChromaKeyEnabled(true);
             bool ansSetValues = layer->setChromaKey((unsigned char)m_array[0], (unsigned char)m_array[1], (unsigned char)m_array[2]);
index 0b69525..f409e31 100644 (file)
@@ -31,7 +31,7 @@ ExecutionResult LayerSetOpacityCommand::execute(ICommandExecutor* executor)
 
     if (layer)
     {
-        LOG_DEBUG("LayerSetOpacityCommand","new opacity " << m_opacity << " for id: " << m_id);
+        LOG_DEBUG("LayerSetOpacityCommand", "new opacity " << m_opacity << " for id: " << m_id);
         if (layer->setOpacity(m_opacity))
         {
             result = ExecutionSuccessRedraw;
index 8dff120..67bc027 100644 (file)
@@ -47,12 +47,12 @@ ExecutionResult LayerSetRenderOrderCommand::execute(ICommandExecutor* executor)
                 unsigned int layer_id = surface->getContainingLayerId();
                 if (layer->addSurface(surface))
                 {
-                    LOG_DEBUG("LayerSetRenderOrderCommand","Adding surface " << surface->getID() << " to renderorder of layer " << m_layerid);
+                    LOG_DEBUG("LayerSetRenderOrderCommand", "Adding surface " << surface->getID() << " to renderorder of layer " << m_layerid);
                     result = ExecutionSuccessRedraw;
                 }
                 else
                 {
-                    LOG_WARNING("LayerSetRenderOrderCommand","surface : id [ " << m_array[surfaceIndex] << " ] already belongs to layer : id [ " << layer_id << " ]");
+                    LOG_WARNING("LayerSetRenderOrderCommand", "surface : id [ " << m_array[surfaceIndex] << " ] already belongs to layer : id [ " << layer_id << " ]");
                 }
             }
         }
index 80f827a..659ab57 100644 (file)
 
 ExecutionResult ScreenDumpCommand::execute(ICommandExecutor* executor)
 {
-       ExecutionResult result = ExecutionFailed;
+    ExecutionResult result = ExecutionFailed;
     RendererList& m_rendererList = *(executor->getRendererList());
 
     bool status = false;
 
-    LOG_INFO("ScreenDumpCommand","making screenshot, output file: " << m_filename);
+    LOG_INFO("ScreenDumpCommand", "making screenshot, output file: " << m_filename);
 
     status = (m_id == 0);
 
index 7e86fec..a7f67a2 100644 (file)
@@ -43,7 +43,7 @@ ExecutionResult ShaderCreateCommand::execute(ICommandExecutor* executor)
     {
         // insert shader to shader map
         int id = shader->getId();
-        LOG_DEBUG("CreateShaderCommand","Shader with shader id : " << id << " successfully created");
+        LOG_DEBUG("CreateShaderCommand", "Shader with shader id : " << id << " successfully created");
         ShaderMap &shaderMap = scene.m_shaderMap;
         shaderMap[id] = shader;
         *m_returnID = id;
index 1f9e577..2585749 100644 (file)
@@ -43,7 +43,7 @@ ExecutionResult ShaderSetUniformsCommand::execute(ICommandExecutor* executor)
             const std::vector<std::string> uniformDesc = m_uniforms;
             std::vector<std::string>::const_iterator uiterator;
 
-            for (uiterator=uniformDesc.begin(); uiterator != uniformDesc.end(); ++uiterator)
+            for (uiterator = uniformDesc.begin(); uiterator != uniformDesc.end(); ++uiterator)
             {
                 // parse description string and create uniform object
                 ShaderUniform* uniform = ShaderUniform::createFromStringDescription(*uiterator);
@@ -69,7 +69,7 @@ ExecutionResult ShaderSetUniformsCommand::execute(ICommandExecutor* executor)
     else
     {
         // shader not found
-        LOG_ERROR("ShaderSetUniformsCommand", "shader ID "<<m_shaderid<<" not found");
+        LOG_ERROR("ShaderSetUniformsCommand", "shader ID " << m_shaderid << " not found");
         result = ExecutionFailed;
     }
 
index b582bf5..652b587 100644 (file)
 
 ExecutionResult SurfaceDumpCommand::execute(ICommandExecutor* executor)
 {
-       ExecutionResult result = ExecutionFailed;
+    ExecutionResult result = ExecutionFailed;
     Scene& scene = *(executor->getScene());
     RendererList& m_rendererList = *(executor->getRendererList());
 
     bool status = false;
     unsigned int layer_id = 0;
 
-    LOG_INFO("SurfaceDumpCommand","making screenshot, output file: " << m_filename);
+    LOG_INFO("SurfaceDumpCommand", "making screenshot, output file: " << m_filename);
 
-       if (scene.getSurface(m_id))
-       {
-               layer_id = scene.getSurface(m_id)->getContainingLayerId();
-               status = scene.isLayerInCurrentRenderOrder(layer_id);
-               if (!status)
-               {
-                       LOG_WARNING("SurfaceDumpCommand","Requested surface: " << m_id << " does not belong to a layer which is part of the current render order");
-               }
-       }
+    if (scene.getSurface(m_id))
+    {
+        layer_id = scene.getSurface(m_id)->getContainingLayerId();
+        status = scene.isLayerInCurrentRenderOrder(layer_id);
+        if (!status)
+        {
+            LOG_WARNING("SurfaceDumpCommand", "Requested surface: " << m_id << " does not belong to a layer which is part of the current render order");
+        }
+    }
 
     if (status)
     {
index 3224b4c..4f53412 100644 (file)
@@ -35,7 +35,7 @@ ExecutionResult SurfaceGetOrientationCommand::execute(ICommandExecutor* executor
         result = ExecutionSuccess;
     }
 
-            return result;
+    return result;
 }
 
 const std::string SurfaceGetOrientationCommand::getString()
index 2b5e66f..a65e835 100644 (file)
@@ -27,12 +27,12 @@ ExecutionResult SurfaceGetPixelformatCommand::execute(ICommandExecutor* executor
 
     ExecutionResult result = ExecutionFailed;
 
-       Surface* surface = scene.getSurface(m_id);
-       if (surface)
-       {
-               *m_pFormatreturn = surface->getPixelFormat();
-               result = ExecutionSuccess;
-       }
+    Surface* surface = scene.getSurface(m_id);
+    if (surface)
+    {
+        *m_pFormatreturn = surface->getPixelFormat();
+        result = ExecutionSuccess;
+    }
 
     return result;
 }
index f211b83..34cc32d 100644 (file)
@@ -31,7 +31,7 @@ ExecutionResult SurfaceRemoveNativeContentCommand::execute(ICommandExecutor* exe
 
     if (surface)
     {
-        if(surface->hasNativeContent())
+        if (surface->hasNativeContent())
         {
             surface->removeNativeContent();
             result = ExecutionSuccessRedraw;
index 54dacab..47b6d34 100644 (file)
@@ -39,7 +39,7 @@ ExecutionResult SurfaceSetChromaKeyCommand::execute(ICommandExecutor* executor)
     {
         if (surface)
         {
-            LOG_DEBUG("SurfaceSetChromaKeyCommand","new chromakey disable for id: " << m_surfaceid);
+            LOG_DEBUG("SurfaceSetChromaKeyCommand", "new chromakey disable for id: " << m_surfaceid);
             result = surface->setChromaKeyEnabled(false) ? ExecutionSuccessRedraw : ExecutionSuccess;
         }
     }
@@ -47,7 +47,7 @@ ExecutionResult SurfaceSetChromaKeyCommand::execute(ICommandExecutor* executor)
     {
         if (surface)
         {
-            LOG_DEBUG("SurfaceSetChromaKeyCommand","new chromakey (" << m_array[0] << ", " << m_array[1] << ", " << m_array[2] << ") for id: " << m_surfaceid);
+            LOG_DEBUG("SurfaceSetChromaKeyCommand", "new chromakey (" << m_array[0] << ", " << m_array[1] << ", " << m_array[2] << ") for id: " << m_surfaceid);
             bool ansSetEnabled = surface->setChromaKeyEnabled(true);
             bool ansSetValues = surface->setChromaKey((unsigned char)m_array[0], (unsigned char)m_array[1], (unsigned char)m_array[2]);
             if ((true == ansSetEnabled) | (true == ansSetValues))
index da8a945..a4b51e2 100644 (file)
@@ -42,9 +42,10 @@ ExecutionResult SurfaceSetDestinationRectangleCommand::execute(ICommandExecutor*
         {
             result = ExecutionSuccess;
         }
-        if ( layerid != Surface::INVALID_ID ) 
+        if (layerid != Surface::INVALID_ID)
         {
-            surface->calculateTargetDestination(scene.getLayer(layerid)->getSourceRegion(),scene.getLayer(layerid)->getDestinationRegion());
+            surface->calculateTargetDestination(scene.getLayer(layerid)->getSourceRegion(),
+                                                scene.getLayer(layerid)->getDestinationRegion());
         }
     }
 
index b6e32d3..073d2cf 100644 (file)
@@ -30,8 +30,8 @@ ExecutionResult SurfaceSetDimensionCommand::execute(ICommandExecutor* executor)
     Surface* surface = scene.getSurface(m_id);
     if (surface)
     {
-               unsigned int layerid = surface->getContainingLayerId();
-        if(surface->setDimension(m_width, m_height))
+        unsigned int layerid = surface->getContainingLayerId();
+        if (surface->setDimension(m_width, m_height))
         {
             executor->addClientNotification(surface, ILM_NOTIFICATION_DEST_RECT);
             result = ExecutionSuccessRedraw;
@@ -41,10 +41,11 @@ ExecutionResult SurfaceSetDimensionCommand::execute(ICommandExecutor* executor)
             result = ExecutionSuccess;
         }
 
-        if ( layerid != Surface::INVALID_ID ) 
-        {                      
-                       surface->calculateTargetDestination(scene.getLayer(layerid)->getSourceRegion(),scene.getLayer(layerid)->getDestinationRegion());
-               }                       
+        if (layerid != Surface::INVALID_ID)
+        {
+            surface->calculateTargetDestination(scene.getLayer(layerid)->getSourceRegion(),
+                                                scene.getLayer(layerid)->getDestinationRegion());
+        }
     }
 
     return result;
index 4ba3743..d623ab4 100644 (file)
@@ -36,14 +36,14 @@ ExecutionResult SurfaceSetKeyboardFocusCommand::execute(ICommandExecutor* execut
     {
         result = (*it)->getInputManager()->setKeyboardFocusOn(m_surfId) ? ExecutionSuccess : ExecutionFailed;
     }
-    
+
     return result;
 }
 
 const std::string SurfaceSetKeyboardFocusCommand::getString()
 {
     std::stringstream description;
-    
+
     description << "SurfaceSetKeyboardFocusCommand("
                 << "m_surfId=" << m_surfId << "(0x" << std::hex << m_surfId << ")" << std::dec
                 << ")";
index b72f87e..598b8a8 100644 (file)
@@ -30,7 +30,7 @@ ExecutionResult SurfaceSetNativeContentCommand::execute(ICommandExecutor* execut
 
     if (surface)
     {
-        if(!surface->hasNativeContent())
+        if (!surface->hasNativeContent())
         {
             surface->setNativeContent(m_nativeHandle);
             surface->setPixelFormat(m_pixelformat);
@@ -43,7 +43,7 @@ ExecutionResult SurfaceSetNativeContentCommand::execute(ICommandExecutor* execut
 
             result = ExecutionSuccessRedraw;
         }
-        else if(unsigned int) surface->getNativeContent() == m_nativeHandle)
+        else if ((unsigned int) surface->getNativeContent() == m_nativeHandle)
         {
             result = ExecutionSuccess;
         }
index 53f387b..c11611a 100644 (file)
@@ -31,7 +31,7 @@ ExecutionResult SurfaceSetOpacityCommand::execute(ICommandExecutor* executor)
 
     if (surface)
     {
-        LOG_DEBUG("SurfaceSetOpacityCommand","new opacity " << m_opacity << " for id: " << m_id);
+        LOG_DEBUG("SurfaceSetOpacityCommand", "new opacity " << m_opacity << " for id: " << m_id);
         if (surface->setOpacity(m_opacity))
         {
             executor->addClientNotification(surface, ILM_NOTIFICATION_OPACITY);
index 1a0938f..44b58f5 100644 (file)
@@ -43,7 +43,8 @@ ExecutionResult SurfaceSetPositionCommand::execute(ICommandExecutor* executor)
         }
         if (layerid != Surface::INVALID_ID)
         {
-            surface->calculateTargetDestination(scene.getLayer(layerid)->getSourceRegion(),scene.getLayer(layerid)->getDestinationRegion());
+            surface->calculateTargetDestination(scene.getLayer(layerid)->getSourceRegion(),
+                                                scene.getLayer(layerid)->getDestinationRegion());
         }
     }
     return result;
index 7b0a346..b89f5c4 100644 (file)
@@ -41,9 +41,10 @@ ExecutionResult SurfaceSetSourceRectangleCommand::execute(ICommandExecutor* exec
         {
             result = ExecutionSuccess;
         }
-        if ( layerid != Surface::INVALID_ID ) 
+        if (layerid != Surface::INVALID_ID)
         {
-            surface->calculateTargetDestination(scene.getLayer(layerid)->getSourceRegion(),scene.getLayer(layerid)->getDestinationRegion());
+            surface->calculateTargetDestination(scene.getLayer(layerid)->getSourceRegion(),
+                                                scene.getLayer(layerid)->getDestinationRegion());
         }
     }
 
index cbe3539..d31f87c 100644 (file)
@@ -67,7 +67,6 @@ private:
     callback mFuncPtr;
     string mVarValue;
     string mMatchText;
-
 };
 
 #endif // __EXPRESSION_H__
index 7562005..831489f 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef __COMMANDINTERPRETER_H__
-#define __COMMANDINTERPRETER_H__
+#ifndef __EXPRESSIONINTERPRETER_H__
+#define __EXPRESSIONINTERPRETER_H__
 
 #include "Expression.h"
 #include <string>
@@ -47,4 +47,4 @@ private:
     string mErrorText;
 };
 
-#endif // __COMMANDINTERPRETER_H__
+#endif // __EXPRESSIONINTERPRETER_H__
index 4a9d630..3ede657 100644 (file)
@@ -58,20 +58,22 @@ struct t_scene_data
 /*
  * Vector of four integers <x y z w>
  */
-class tuple4
+struct tuple4
 {
 public:
-    int x, y, z, w;
+    int x;
+    int y;
+    int z;
+    int w;
+
     tuple4(int _x, int _y, int _z, int _w) :
         x(_x), y(_y), z(_z), w(_w)
     {
-
     }
 
     tuple4() :
         x(0), y(0), z(0), w(0)
     {
-
     }
 
     tuple4(const tuple4& other)
@@ -98,7 +100,6 @@ public:
         w = other.w;
         return *this;
     }
-
 };
 
 
index 2db1cec..d2978fe 100644 (file)
@@ -17,8 +17,8 @@
  *
  ****************************************************************************/
 
-#ifndef __SCENE_STORE_H__
-#define __SCENE_STORE_H__
+#ifndef __SCENESTORE_H__
+#define __SCENESTORE_H__
 
 
 //=========================================================================
@@ -52,7 +52,7 @@ template<typename T> string getPrimitiveType(T var)
 template<typename T> string getPrimitiveType(T* var)
 {
     (void) var;//suppress warning: unsued variable
-    T var2=0;
+    T var2 = 0;
     return getPrimitiveType(var2) + "*";
 }
 
@@ -174,19 +174,17 @@ template<> string getPrimitiveType(unsigned long long int var)
 #endif
 
 
-class WrapperHelper
+struct WrapperHelper
 {
 public:
     const string mType;
     WrapperHelper(string t) :
             mType(t)
     {
-
     }
 
     virtual ~WrapperHelper()
     {
-
     }
 
     virtual void fromString(string s)
@@ -228,7 +226,7 @@ public:
 };
 
 template<typename T>
-class ComplexWrapper: public WrapperHelper
+struct ComplexWrapper : public WrapperHelper
 {
 public:
     list<T> components;
@@ -236,12 +234,11 @@ public:
     ComplexWrapper(string t) :
             WrapperHelper(t)
     {
-
     }
 
     virtual void toStringMapTree(StringMapTree* parent)
     {
-        for(typename list<T>::iterator it = components.begin(); it != components.end(); ++it)
+        for (typename list<T>::iterator it = components.begin(); it != components.end(); ++it)
         {
             StringMapTree* node = new StringMapTree;
             (*it)->toStringMapTree(node);
@@ -251,7 +248,7 @@ public:
 };
 
 template<typename T>
-class BasicWrapper: public WrapperHelper
+struct BasicWrapper : public WrapperHelper
 {
 public:
     T value;
@@ -259,14 +256,13 @@ public:
     BasicWrapper(string t) :
             WrapperHelper(t)
     {
-
     }
 
     virtual void fromString(string s)
     {
         stringstream ss;
         ss.str(s);
-        ss >> std::skipws>> value;
+        ss >> std::skipws >> value;
     }
 
     virtual string asString()
@@ -280,7 +276,6 @@ public:
     {
         return getPrimitiveType(value);
     }
-
 };
 
 template<>
@@ -292,7 +287,6 @@ public:
     BasicWrapper(string t) :
             WrapperHelper(t)
     {
-
     }
 
     virtual void fromString(string s)
@@ -320,7 +314,6 @@ public:
     BasicWrapper(char* t) :
             WrapperHelper(t)
     {
-
     }
 
     virtual void fromString(string s)
@@ -340,7 +333,7 @@ public:
 };
 
 template<typename T>
-class DummyWrapper: public WrapperHelper
+struct DummyWrapper : public WrapperHelper
 {
 public:
     T value;
@@ -348,10 +341,8 @@ public:
     DummyWrapper(string t) :
             WrapperHelper(t)
     {
-
     }
 
-
     virtual WrapperHelper* tryClone(string type, StringMapTree* tree)
     {
         if (type == mType)
@@ -369,7 +360,6 @@ public:
         value.toGrammarMapTree(tree);
     }
 
-
     virtual void addToComplexWrapper(WrapperHelper* wrapper)
     {
         ComplexWrapper<T*>* complexWrapper = static_cast<ComplexWrapper<T*>* >(wrapper);
@@ -377,7 +367,7 @@ public:
     }
 };
 
-map<int,string> _globalTypeIndexdToType;
+map<int, string> _globalTypeIndexdToType;
 
 #define OBJECT(class_name) \
 class class_name;\
@@ -536,20 +526,20 @@ public:\
         }\
     }\
     void fromStringMapTree(StringMapTree* node)\
-       {\
+    {\
         mClassName = node->mNodeLabel;\
-           for(map<string,pair<string,string> >::iterator it = node->mNodeValues.begin(); it != node->mNodeValues.end();++it)\
-           {\
-               properties[it->first]->fromString(it->second.second);\
-           }\
-           for(list<StringMapTree*>::iterator it = node->mChildren.begin(); it != node->mChildren.end(); ++it )\
-           {\
-               string type = (*it)->mNodeLabel;\
-               WrapperHelper* wrapper = dummyComponentClones[type]->tryClone(type, (*it));\
-               WrapperHelper* complexWrapper = components[type];\
-               wrapper->addToComplexWrapper(complexWrapper);\
-           }\
-       }\
+        for(map<string,pair<string,string> >::iterator it = node->mNodeValues.begin(); it != node->mNodeValues.end();++it)\
+        {\
+            properties[it->first]->fromString(it->second.second);\
+        }\
+        for(list<StringMapTree*>::iterator it = node->mChildren.begin(); it != node->mChildren.end(); ++it )\
+        {\
+            string type = (*it)->mNodeLabel;\
+            WrapperHelper* wrapper = dummyComponentClones[type]->tryClone(type, (*it));\
+            WrapperHelper* complexWrapper = components[type];\
+            wrapper->addToComplexWrapper(complexWrapper);\
+        }\
+    }\
 };
 
 
@@ -623,4 +613,4 @@ OBJECT(IlmScene)
     CONTAINS(IlmDisplay)
 OBJECTEND
 
-#endif
+#endif /* __SCENESTORE_H__ */
index 7ca5599..51f3b1e 100644 (file)
@@ -18,8 +18,8 @@
  ****************************************************************************/
 
 
-#ifndef __STRING_MAP_TREE_H__
-#define __STRING_MAP_TREE_H__
+#ifndef __STRINGMAPTREE_H__
+#define __STRINGMAPTREE_H__
 
 #include <map>
 #include <list>
@@ -33,16 +33,16 @@ class StringMapTree
 {
 public:
     string mNodeLabel;
-    map<string,pair<string,string> > mNodeValues;//key: property name, value= pair(type, property value)
+    map<string, pair<string, string> > mNodeValues;//key: property name, value= pair(type, property value)
     list<StringMapTree*> mChildren;// pair(type, child component node)
 
-    string toString(string prefix="")
+    string toString(string prefix = "")
     {
         string result;
-        result += prefix + mNodeLabel+ ":{\n";
-        for(map<string,pair<string,string> >::iterator it = mNodeValues.begin(); it != mNodeValues.end() ; ++it)
+        result += prefix + mNodeLabel + ":{\n";
+        for(map<string, pair<string, string> >::iterator it = mNodeValues.begin(); it != mNodeValues.end(); ++it)
         {
-            result += prefix + "\t[" + it->first + ":"+ it->second.first + "]=[" + it->second.second + "]\n";
+            result += prefix + "\t[" + it->first + ":" + it->second.first + "]=[" + it->second.second + "]\n";
         }
         for(list<StringMapTree*>::iterator it = mChildren.begin(); it != mChildren.end(); ++it)
         {
@@ -62,6 +62,4 @@ public:
     }
 };
 
-
-
-#endif
+#endif /* __STRINGMAPTREE_H__ */
index aa4219c..a08dc8f 100644 (file)
@@ -45,11 +45,11 @@ string Expression::getString(string name)
 {
     //remove brackets if needed
     string noBrackets = mName;
-    noBrackets = noBrackets[0] == '['? noBrackets.substr(1, noBrackets.size()-1) : noBrackets;
-    noBrackets = noBrackets[noBrackets.size()-1] == ']'? noBrackets.substr(0, noBrackets.size()-1) : noBrackets;
+    noBrackets = noBrackets[0] == '[' ? noBrackets.substr(1, noBrackets.size() - 1) : noBrackets;
+    noBrackets = noBrackets[noBrackets.size() - 1] == ']' ? noBrackets.substr(0, noBrackets.size() - 1) : noBrackets;
 
-    noBrackets = noBrackets[0] == '<'? noBrackets.substr(1, noBrackets.size()-1) : noBrackets;
-    noBrackets = noBrackets[noBrackets.size()-1] == '>'? noBrackets.substr(0, noBrackets.size()-1) : noBrackets;
+    noBrackets = noBrackets[0] == '<' ? noBrackets.substr(1, noBrackets.size() - 1) : noBrackets;
+    noBrackets = noBrackets[noBrackets.size() - 1] == '>' ? noBrackets.substr(0, noBrackets.size() - 1) : noBrackets;
 
     //remove default value (if needed)
     string exprName = noBrackets.substr(0, noBrackets.find("="));
@@ -98,7 +98,7 @@ void Expression::getUintArray(string name, unsigned int** array, unsigned int* c
     *count = 0;
 
     string stringVal;
-    while (getline( ss, stringVal, ',' ))
+    while (getline(ss, stringVal, ','))
     {
         sscanf(stringVal.c_str(), "%u", &buffer[*count]);
 
@@ -168,7 +168,7 @@ ExpressionList Expression::getClosure(bool bypass)
 {
     ExpressionList closure;
 
-    if(bypass)
+    if (bypass)
     {
         //if expression is end of the optional expression
         bool bypassChildren = mName[mName.length() - 1] != ']';
@@ -222,11 +222,11 @@ ExpressionList Expression::getNextExpressionClosure(string text)
                 string exprName = expr->mName;
 
                 //remove brakcets
-                exprName = exprName[0] == '['? exprName.substr(1, exprName.size()-1) : exprName;
-                exprName = exprName[exprName.size()-1] == ']'? exprName.substr(0, exprName.size()-1) : exprName;
+                exprName = exprName[0] == '[' ? exprName.substr(1, exprName.size() - 1) : exprName;
+                exprName = exprName[exprName.size() - 1] == ']' ? exprName.substr(0, exprName.size() - 1) : exprName;
 
-                exprName = exprName[0] == '<'? exprName.substr(1, exprName.size()-1) : exprName;
-                exprName = exprName[exprName.size()-1] == '>'? exprName.substr(0, exprName.size()-1) : exprName;
+                exprName = exprName[0] == '<' ? exprName.substr(1, exprName.size()-1) : exprName;
+                exprName = exprName[exprName.size() - 1] == '>' ? exprName.substr(0, exprName.size() - 1) : exprName;
 
                 //remove default value (if needed)
                 exprName = exprName.substr(0, exprName.find("="));
@@ -237,8 +237,8 @@ ExpressionList Expression::getNextExpressionClosure(string text)
             {
                 //remove brackets if needed
                 string exprName = expr->mName;
-                exprName = exprName[0] == '['? exprName.substr(1, exprName.size()-1) : exprName;
-                exprName = exprName[exprName.size()-1] == ']'? exprName.substr(0, exprName.size()-1) : exprName;
+                exprName = exprName[0] == '[' ? exprName.substr(1, exprName.size() - 1) : exprName;
+                exprName = exprName[exprName.size() - 1] == ']' ? exprName.substr(0, exprName.size() - 1) : exprName;
 
                 //check all alternatives (in case there are alternatives)
                 while (exprName.length() > 0)
index 1865db7..85efb69 100644 (file)
@@ -87,7 +87,7 @@ CommandResult ExpressionInterpreter::interpretCommand(string userInput)
 
         ExpressionList::const_iterator iter = currentState.begin();
         ExpressionList::const_iterator end = currentState.end();
-        for (;iter != end; ++iter)
+        for (; iter != end; ++iter)
         {
             Expression* expr = *iter;
             ExpressionList exprNextList = expr->getNextExpressionClosure(text);
@@ -110,7 +110,7 @@ CommandResult ExpressionInterpreter::interpretCommand(string userInput)
     nextState.clear();
     ExpressionList::const_iterator iter = currentState.begin();
     ExpressionList::const_iterator end = currentState.end();
-    for (;iter != end; ++iter)
+    for (; iter != end; ++iter)
     {
         Expression* expr = *iter;
         if (expr->isExecutable())
@@ -125,7 +125,7 @@ CommandResult ExpressionInterpreter::interpretCommand(string userInput)
 
             ExpressionList::const_iterator iter = children.begin();
             ExpressionList::const_iterator end = children.end();
-            for (;iter != end; ++iter)
+            for (; iter != end; ++iter)
             {
                 if ((*iter)->getName()[0] == '[')
                 {
index 917333f..4b695bc 100644 (file)
@@ -52,7 +52,6 @@ using std::vector;
 
 namespace
 {
-
 void analyzePrintHelper(string tag, string flag, string description)
 {
     cout << left << setw(25) << tag << " | " << setw(7) << flag << " | " << description << endl;
@@ -63,7 +62,8 @@ void analyzeVisibilityAndOpacity(t_ilm_surface targetSurfaceId, t_scene_data& sc
     t_ilm_layer targetSurfaceLayer = scene.surfaceLayer[targetSurfaceId];
     ilmSurfaceProperties& targetSurfaceProperties = scene.surfaceProperties[targetSurfaceId];
     ilmLayerProperties& targetLayerProperties = scene.layerProperties[targetSurfaceLayer];
-    string tag, flag;
+    string tag;
+    string flag;
     char description[300] = "";
 
     //check visibility
@@ -138,7 +138,8 @@ void analyzeVisibilityAndOpacity(t_ilm_surface targetSurfaceId, t_scene_data& sc
 void analyzeSurfaceDimensions(t_ilm_surface targetSurfaceId, t_scene_data& scene)
 {
     ilmSurfaceProperties& targetSurfaceProperties = scene.surfaceProperties[targetSurfaceId];
-    string tag, flag;
+    string tag;
+    string flag;
     char description[300] = "";
 
     t_ilm_uint minDimension = 32;
@@ -234,7 +235,8 @@ void analyzeLayerDimensions(t_ilm_surface targetSurfaceId, t_scene_data& scene)
     ilmLayerProperties& targetLayerProperties = scene.layerProperties[targetSurfaceLayer];
     t_ilm_uint minDimension = 32;
 
-    string tag, flag;
+    string tag;
+    string flag;
     char description[300] = "";
     tag = "Layer dest width";
     if (targetLayerProperties.destWidth <= minDimension)
@@ -323,7 +325,6 @@ void analyzeLayerDimensions(t_ilm_surface targetSurfaceId, t_scene_data& scene)
 
 void analyzeDimensions(t_ilm_surface targetSurfaceId, t_scene_data& scene)
 {
-
     analyzeSurfaceDimensions(targetSurfaceId, scene);
     analyzeLayerDimensions(targetSurfaceId, scene);
 }
@@ -333,7 +334,8 @@ void analyzeSurfaceCheckInsideLayer(t_ilm_surface targetSurfaceId, t_scene_data&
     t_ilm_layer targetSurfaceLayer = scene.surfaceLayer[targetSurfaceId];
     tuple4 targetSurfaceCoordinates = getSurfaceScreenCoordinates(&scene, targetSurfaceId);
     ilmLayerProperties& targetLayerProperties = scene.layerProperties[targetSurfaceLayer];
-    string tag, flag;
+    string tag;
+    string flag;
     char description[300] = "";
 
     tuple4 layerCoordinates(targetLayerProperties.destX,
@@ -363,7 +365,8 @@ void analyzeOcclusion(t_ilm_surface targetSurfaceId,
         map<t_ilm_layer, ilmLayerProperties>& layerProperties,
         vector<t_ilm_surface>& allSurfaces, tuple4 targetSurfaceCoordinates)
 {
-    string tag, flag;
+    string tag;
+    string flag;
     char description[300] = "";
 
     vector<t_ilm_surface> occludingSurfaces;
@@ -389,7 +392,7 @@ void analyzeOcclusion(t_ilm_surface targetSurfaceId,
         //coordinates of the surface on screen
         t_ilm_int horizontalScale = layerProperties[surfaceLayer].destWidth / layerProperties[surfaceLayer].sourceWidth;
         t_ilm_int surfaceX1 = layerProperties[surfaceLayer].destX + horizontalScale
-                * (surfaceProperties[surfaceId].destX- layerProperties[surfaceLayer].sourceX);
+                * (surfaceProperties[surfaceId].destX - layerProperties[surfaceLayer].sourceX);
         t_ilm_int surfaceX2 = surfaceX1 + horizontalScale * surfaceProperties[surfaceId].destWidth;
 
         t_ilm_int verticalScale = layerProperties[surfaceLayer].destHeight / layerProperties[surfaceLayer].sourceHeight;
@@ -407,7 +410,6 @@ void analyzeOcclusion(t_ilm_surface targetSurfaceId,
             analyzePrintHelper(tag, flag, description);
 
             occluded = ILM_TRUE;
-
         }
         //if the surface is partially occluded
         else if (intersect(targetSurfaceCoordinates, surfaceCoordinates))
@@ -429,7 +431,8 @@ void analyzeOcclusion(t_ilm_surface targetSurfaceId,
 
 void analyzeOcclusion(t_ilm_surface targetSurfaceId, t_scene_data& scene)
 {
-    string tag, flag;
+    string tag;
+    string flag;
     char description[300] = "";
 
     vector<t_ilm_surface> renderedSurfaces = getSceneRenderOrder(&scene);
@@ -437,7 +440,7 @@ void analyzeOcclusion(t_ilm_surface targetSurfaceId, t_scene_data& scene)
 
     vector<t_ilm_surface>::iterator it = find(renderedSurfaces.begin(), renderedSurfaces.end(), targetSurfaceId);
 
-    tuple4 targetSurfaceCoordinates = getSurfaceScreenCoordinates( &scene, targetSurfaceId);
+    tuple4 targetSurfaceCoordinates = getSurfaceScreenCoordinates(&scene, targetSurfaceId);
 
     t_ilm_bool occluded = ILM_FALSE;
     tag = "Occlusion";
@@ -489,7 +492,8 @@ t_ilm_bool analyzeCheckSurfaceExists(t_ilm_surface targetSurfaceId, t_scene_data
 {
     t_ilm_bool exists = ILM_FALSE;
 
-    string tag, flag;
+    string tag;
+    string flag;
     char description[300] = "";
 
     tag = "Surface existance";
@@ -529,7 +533,8 @@ t_ilm_bool analyzeCheckRendered(t_ilm_surface targetSurfaceId, t_scene_data& sce
     }
 
     //output
-    string tag, flag;
+    string tag;
+    string flag;
     char description[300] = "";
 
     tag = "Surface on layer";
@@ -568,7 +573,8 @@ t_ilm_bool analyzeCheckRendered(t_ilm_surface targetSurfaceId, t_scene_data& sce
 
 t_ilm_bool analyzeSharedNative(t_ilm_surface targetSurfaceId, t_scene_data& scene)
 {
-    string tag, flag;
+    string tag;
+    string flag;
     char description[300] = "";
 
     tag = "Shared native";
@@ -611,7 +617,8 @@ t_ilm_bool analyzeUpdateCounter(t_ilm_surface targetSurfaceId, t_scene_data& sce
     ilmSurfaceProperties& targetSurfaceProperties = scene.surfaceProperties[targetSurfaceId];
 
     t_ilm_bool problem = targetSurfaceProperties.updateCounter == 0;
-    string tag, flag;
+    string tag;
+    string flag;
     char description[300] = "";
 
     tag = "Update Counter";
@@ -632,7 +639,6 @@ t_ilm_bool analyzeUpdateCounter(t_ilm_surface targetSurfaceId, t_scene_data& sce
 
     return !problem;
 }
-
 } //end of anonymous namespace
 
 
index a5ad385..f926400 100644 (file)
@@ -9,9 +9,9 @@
  *
  *        http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed in writing, software
+ * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either inputess or implied.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
@@ -198,7 +198,7 @@ COMMAND("set layer|surface <id> source region <x> <y> <w> <h>")
         if (ILM_SUCCESS != callResult)
         {
             cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-            cout << "Failed to set source rectangle (" << x << "," << y << ", "<< w << ", " << h <<") for layer with ID " << id << "\n";
+            cout << "Failed to set source rectangle (" << x << "," << y << ", " << w << ", " << h << ") for layer with ID " << id << "\n";
             return;
         }
 
@@ -210,7 +210,7 @@ COMMAND("set layer|surface <id> source region <x> <y> <w> <h>")
         if (ILM_SUCCESS != callResult)
         {
             cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-            cout << "Failed to set source rectangle (" << x << ", " << y << ", "<< w << ", " << h <<") for surface with ID " << id << "\n";
+            cout << "Failed to set source rectangle (" << x << ", " << y << ", " << w << ", " << h << ") for surface with ID " << id << "\n";
             return;
         }
 
@@ -234,7 +234,7 @@ COMMAND("set layer|surface <id> destination region <x> <y> <w> <h>")
         if (ILM_SUCCESS != callResult)
         {
             cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-            cout << "Failed to set destination rectangle (" << x << ", " << y << ", "<< w << ", " << h <<") for layer with ID " << id << "\n";
+            cout << "Failed to set destination rectangle (" << x << ", " << y << ", " << w << ", " << h << ") for layer with ID " << id << "\n";
             return;
         }
 
@@ -246,7 +246,7 @@ COMMAND("set layer|surface <id> destination region <x> <y> <w> <h>")
         if (ILM_SUCCESS != callResult)
         {
             cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-            cout << "Failed to set destination rectangle (" << x << ", " << y << ", "<< w << ", " << h <<") for surface with ID " << id << "\n";
+            cout << "Failed to set destination rectangle (" << x << ", " << y << ", " << w << ", " << h << ") for surface with ID " << id << "\n";
             return;
         }
 
@@ -267,7 +267,7 @@ COMMAND("set layer|surface <id> opacity <opacity>")
         if (ILM_SUCCESS != callResult)
         {
             cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-            cout << "Failed to set opacity "<< opacity << " for layer with ID " << id << "\n";
+            cout << "Failed to set opacity " << opacity << " for layer with ID " << id << "\n";
             return;
         }
 
@@ -279,7 +279,7 @@ COMMAND("set layer|surface <id> opacity <opacity>")
         if (ILM_SUCCESS != callResult)
         {
             cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-            cout << "Failed to set opacity "<< opacity << " for surface with ID " << id << "\n";
+            cout << "Failed to set opacity " << opacity << " for surface with ID " << id << "\n";
             return;
         }
 
@@ -300,7 +300,7 @@ COMMAND("set layer|surface <id> visibility <visibility>")
         if (ILM_SUCCESS != callResult)
         {
             cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-            cout << "Failed to set visibility "<< visibility << " for layer with ID " << id << "\n";
+            cout << "Failed to set visibility " << visibility << " for layer with ID " << id << "\n";
             return;
         }
 
@@ -312,7 +312,7 @@ COMMAND("set layer|surface <id> visibility <visibility>")
         if (ILM_SUCCESS != callResult)
         {
             cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-            cout << "Failed to set visibility "<< visibility << " for surface with ID " << id << "\n";
+            cout << "Failed to set visibility " << visibility << " for surface with ID " << id << "\n";
             return;
         }
 
@@ -333,7 +333,7 @@ COMMAND("set layer|surface <id> orientation <orientation>")
         if (ILM_SUCCESS != callResult)
         {
             cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-            cout << "Failed to set orientation "<< orientation << " for layer with ID " << id << "\n";
+            cout << "Failed to set orientation " << orientation << " for layer with ID " << id << "\n";
             return;
         }
 
@@ -345,13 +345,12 @@ COMMAND("set layer|surface <id> orientation <orientation>")
         if (ILM_SUCCESS != callResult)
         {
             cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-            cout << "Failed to set orientation "<< orientation << " for surface with ID " << id << "\n";
+            cout << "Failed to set orientation " << orientation << " for surface with ID " << id << "\n";
             return;
         }
 
         ilm_commitChanges();
     }
-
 }
 
 //=============================================================================
index ae859a7..02d39da 100644 (file)
@@ -51,7 +51,7 @@ tuple4 getSurfaceScreenCoordinates(ilmSurfaceProperties targetSurfaceProperties,
                     1.0 * targetLayerProperties.destWidth / targetLayerProperties.sourceWidth : 0;
 
     t_ilm_float targetX1 = targetLayerProperties.destX + horizontalScale
-            * (targetSurfaceProperties.destX- targetLayerProperties.sourceX);
+            * (targetSurfaceProperties.destX - targetLayerProperties.sourceX);
     t_ilm_float targetX2 = targetX1 + horizontalScale * targetSurfaceProperties.destWidth;
 
     t_ilm_float verticalScale = targetLayerProperties.sourceHeight ?
@@ -190,7 +190,7 @@ void captureSceneData(t_scene_data* pScene)
         if (ILM_SUCCESS != callResult)
         {
             cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-            cout << "Failed to get layers on screen with ID "<< screenId <<"\n";
+            cout << "Failed to get layers on screen with ID " << screenId << "\n";
             return;
         }
 
@@ -222,7 +222,7 @@ void captureSceneData(t_scene_data* pScene)
         if (ILM_SUCCESS != callResult)
         {
             cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-            cout << "Failed to get properties of layer with ID "<< layerId <<"\n";
+            cout << "Failed to get properties of layer with ID " << layerId << "\n";
             return;
         }
 
@@ -242,7 +242,7 @@ void captureSceneData(t_scene_data* pScene)
         if (ILM_SUCCESS != callResult)
         {
             cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-            cout << "Failed to get surfaces on layer with ID "<< layerId <<"\n";
+            cout << "Failed to get surfaces on layer with ID " << layerId << "\n";
             return;
         }
 
@@ -437,7 +437,7 @@ void setScene(t_scene_data* pScene, bool clean)
     {
         t_ilm_layer layer = it->first;
         vector<t_ilm_surface>& surfaces = it->second;
-        if(surfaces.data() == NULL)
+        if (surfaces.data() == NULL)
         {
             surfaces.reserve(1);
         }
@@ -520,7 +520,7 @@ void emptyScene(t_scene_data* pScene)
     t_ilm_uint count;
     t_ilm_display* screenArray;
     ilm_getScreenIDs(&count, &screenArray);
-    for(t_ilm_uint i = 0 ; i < count ; ++i)
+    for (t_ilm_uint i = 0; i < count; ++i)
     {
         pScene->screens.push_back(screenArray[i]);
 
@@ -539,7 +539,7 @@ t_scene_data cloneToUniLayerScene(t_scene_data* pScene)
     //prepare values needed for dummy (animation) scene
     t_ilm_layer extraLayer = -1;
     //if the scene is already uni layer just reuse same layer
-    if(pScene->layers.size() == 1)
+    if (pScene->layers.size() == 1)
     {
         extraLayer = pScene->layers[0];
     }
@@ -646,7 +646,7 @@ void transformScene(t_scene_data* pInitialScene, t_scene_data* pFinalScene, t_il
         //sleep time
         long sleepMillis = durationMillis / frameCount;
         struct timespec sleepTime;
-        sleepTime.tv_nsec = (sleepMillis% 1000) * 1000000;
+        sleepTime.tv_nsec = (sleepMillis % 1000) * 1000000;
         sleepTime.tv_sec = sleepMillis / 1000;
 
         struct timespec remTime;
@@ -654,7 +654,7 @@ void transformScene(t_scene_data* pInitialScene, t_scene_data* pFinalScene, t_il
         //start and end coordinates of surfaces
         map<t_ilm_surface, tuple4> start;
         map<t_ilm_surface, tuple4> end;
-        for(vector<t_ilm_surface>::iterator it = dummyScene.surfaces.begin();
+        for (vector<t_ilm_surface>::iterator it = dummyScene.surfaces.begin();
                 it != dummyScene.surfaces.end(); ++it)
         {
             t_ilm_surface surface = *it;
@@ -668,23 +668,25 @@ void transformScene(t_scene_data* pInitialScene, t_scene_data* pFinalScene, t_il
             float t = 1.0 * i / frameCount;
 
             //interpolate properties of each surface
-            for(vector<t_ilm_surface>::iterator it = dummyScene.surfaces.begin();
+            for (vector<t_ilm_surface>::iterator it = dummyScene.surfaces.begin();
                     it != dummyScene.surfaces.end(); ++it)
             {
                 t_ilm_surface surface = *it;
                 tuple4 coords = interpolateCoordinatesHelper(start[surface], end[surface], t);
 
-                ilmErrorTypes callResult = ilm_surfaceSetDestinationRectangle(surface, coords.x, coords.y, coords.z - coords.x, coords.w - coords.y);
+                ilmErrorTypes callResult = ilm_surfaceSetDestinationRectangle(surface, coords.x, coords.y,
+                                                                                coords.z - coords.x, coords.w - coords.y);
                 if (ILM_SUCCESS != callResult)
                 {
                     cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                    cout << "Failed to set destination rectangle (" << coords.x << "," << coords.y << ", "<< coords.z - coords.x << ", " << coords.w - coords.y
+                    cout << "Failed to set destination rectangle (" << coords.x << "," << coords.y << ", "
+                            << coords.z - coords.x << ", " << coords.w - coords.y
                             <<") for surface with ID " << surface << "\n";
                     return;
                 }
 
                 float opacity = t * pFinalScene->surfaceProperties[surface].opacity
-                        + (1-t) * pInitialScene->surfaceProperties[surface].opacity;
+                        + (1 - t) * pInitialScene->surfaceProperties[surface].opacity;
                 ilm_surfaceSetOpacity(surface, opacity);
             }
 
@@ -705,7 +707,7 @@ void interruptSignalRestoreScene(int s)
 {
     (void) s;
 
-    cout<<"LayerManagerControl :Interrupt signal...\n";
+    cout << "LayerManagerControl :Interrupt signal...\n";
     if (global_pOriginalScene != NULL)
     {
         setScene(global_pOriginalScene, true);
index 94bf3df..fef2daa 100644 (file)
@@ -119,7 +119,7 @@ void setSurfaceAcceptsInput(t_ilm_surface surfaceId, string kbdPointerTouch, t_i
     ilmInputDevice devices = (ilmInputDevice)0;
 
     str = new char [kbdPointerTouch.size()+1];
-    strcpy (str, kbdPointerTouch.c_str());
+    strcpy(str, kbdPointerTouch.c_str());
     tok = strtok(str, ":");
     while (tok != NULL)
     {
@@ -178,19 +178,19 @@ void layerNotificationCallback(t_ilm_layer layer, struct ilmLayerProperties* pro
     if (ILM_NOTIFICATION_SOURCE_RECT & mask)
     {
         cout << "\tsource rect = x:" << properties->sourceX
-             << ", y:" << properties->sourceY
-             << ", width:" << properties->sourceWidth
-             << ", height:" << properties->sourceHeight
-             << "\n";
+                << ", y:" << properties->sourceY
+                << ", width:" << properties->sourceWidth
+                << ", height:" << properties->sourceHeight
+                << "\n";
     }
 
     if (ILM_NOTIFICATION_DEST_RECT & mask)
     {
         cout << "\tdest rect = x:" << properties->destX
-             << ", y:" << properties->destY
-             << ", width:" << properties->destWidth
-             << ", height:" << properties->destHeight
-             << "\n";
+                << ", y:" << properties->destY
+                << ", width:" << properties->destWidth
+                << ", height:" << properties->destHeight
+                << "\n";
     }
 }
 
@@ -206,7 +206,7 @@ void testNotificationLayer(t_ilm_layer layerid)
         return;
     }
 
-    for  (int i = 0; i < 2; ++i)
+    for (int i = 0; i < 2; ++i)
     {
         usleep(100 * 1000);
         cout << "Set layer 1000 visbility to FALSE\n";
@@ -292,19 +292,19 @@ void surfaceNotificationCallback(t_ilm_layer surface, struct ilmSurfacePropertie
     if (ILM_NOTIFICATION_SOURCE_RECT & mask)
     {
         cout << "\tsource rect = x:" << properties->sourceX
-             << ", y:" << properties->sourceY
-             << ", width:" << properties->sourceWidth
-             << ", height:" << properties->sourceHeight
-             << "\n";
+                << ", y:" << properties->sourceY
+                << ", width:" << properties->sourceWidth
+                << ", height:" << properties->sourceHeight
+                << "\n";
     }
 
     if (ILM_NOTIFICATION_DEST_RECT & mask)
     {
         cout << "\tdest rect = x:" << properties->destX
-             << ", y:" << properties->destY
-             << ", width:" << properties->destWidth
-             << ", height:" << properties->destHeight
-             << "\n";
+                << ", y:" << properties->destY
+                << ", width:" << properties->destWidth
+                << ", height:" << properties->destHeight
+                << "\n";
     }
 }
 
@@ -355,7 +355,7 @@ void setOptimization(t_ilm_uint id, t_ilm_uint mode)
     if (ILM_SUCCESS != callResult)
     {
         cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-        cout << "Failed to set optimization with ID "<< id <<" mode " << mode << "\n";
+        cout << "Failed to set optimization with ID " << id << " mode " << mode << "\n";
         return;
     }
 
@@ -370,7 +370,7 @@ void getOptimization(t_ilm_uint id)
     ilmErrorTypes callResult = ilm_GetOptimizationMode(optimizationId, &optimizationMode);
     if (callResult == ILM_SUCCESS)
     {
-        switch ( optimizationId )
+        switch (optimizationId)
         {
         case ILM_OPT_MULTITEXTURE :
             cout << "Optimization " << (int)optimizationId << " (Multitexture Optimization)" << endl;
@@ -401,14 +401,14 @@ void getOptimization(t_ilm_uint id)
             break;
 
         default:
-            cout <<"Mode " << "unknown" << endl ;
+            cout << "Mode " << "unknown" << endl;
             break;
         }
     }
     else
     {
         cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-        cout << "Failed to get mode for optimization with ID "<< optimizationId << "\n";
+        cout << "Failed to get mode for optimization with ID " << optimizationId << "\n";
         return;
     }
 
index 4a17fd0..20c3a5c 100644 (file)
@@ -47,8 +47,7 @@ using std::vector;
 
 namespace
 {
-
-typedef void (*t_pDemoAnimatorFunc)(t_scene_data* pInitialScene, t_scene_data* pDemoScene, bool* pStopDemo);
+typedef void(*t_pDemoAnimatorFunc)(t_scene_data* pInitialScene, t_scene_data* pDemoScene, bool* pStopDemo);
 
 void demoAnimatorDownwards(t_scene_data* pInitialScene, t_scene_data* pDemoScene, bool* pStopDemo)
 {
@@ -95,7 +94,6 @@ void demoAnimatorDownwards(t_scene_data* pInitialScene, t_scene_data* pDemoScene
         surfaceSpeed[surface] *= rand() % 2 ? -1 : 1;
     }
 
-
     //get surface positions and set initial positions
     map<t_ilm_surface, tuple4> surfaceCoordinates;
 
@@ -129,7 +127,7 @@ void demoAnimatorDownwards(t_scene_data* pInitialScene, t_scene_data* pDemoScene
     long sleepTimeMillis = 25;
 
     //start animation !
-    while(! *pStopDemo)
+    while (! *pStopDemo)
     {
         for (vector<t_ilm_surface>::iterator it = renderedSurfaces.begin();
                 it != renderedSurfaces.end(); ++it)
@@ -156,12 +154,14 @@ void demoAnimatorDownwards(t_scene_data* pInitialScene, t_scene_data* pDemoScene
                 //set source region to only the visible part of the surface
                 int ySource = static_cast<int>(-coordinates.y / surfaceScale[surface]);
 
-                ilmErrorTypes callResult = ilm_surfaceSetSourceRectangle(surface, 0, ySource, properties.sourceWidth, properties.sourceHeight - ySource);
+                ilmErrorTypes callResult = ilm_surfaceSetSourceRectangle(surface, 0, ySource, properties.sourceWidth,
+                                                                            properties.sourceHeight - ySource);
                 if (ILM_SUCCESS != callResult)
                 {
                     cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                    cout << "Failed to set source rectangle (" << 0 << "," << ySource << ", "<< properties.sourceWidth << ", " << properties.sourceHeight - ySource
-                            <<") for surface with ID " << surface << "\n";
+                    cout << "Failed to set source rectangle (" << 0 << "," << ySource << ", " << properties.sourceWidth
+                            << ", " << properties.sourceHeight - ySource
+                            << ") for surface with ID " << surface << "\n";
                 }
 
                 //set the destination region AT THE TOP of the layer used for displaying the surface
@@ -174,8 +174,8 @@ void demoAnimatorDownwards(t_scene_data* pInitialScene, t_scene_data* pDemoScene
                 if (ILM_SUCCESS != callResult)
                 {
                     cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                    cout << "Failed to set destination rectangle (" << coordinates.x << "," << 0 << ", "<< max(0, coordinates.z - coordinates.x) << ", "
-                            << max(0, coordinates.w) <<") for surface with ID " << surface << "\n";
+                    cout << "Failed to set destination rectangle (" << coordinates.x << "," << 0 << ", " << max(0, coordinates.z - coordinates.x) << ", "
+                            << max(0, coordinates.w) << ") for surface with ID " << surface << "\n";
                 }
             }
             else
@@ -185,8 +185,8 @@ void demoAnimatorDownwards(t_scene_data* pInitialScene, t_scene_data* pDemoScene
                 if (ILM_SUCCESS != callResult)
                 {
                     cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                    cout << "Failed to set source rectangle (" << 0 << "," << 0 << ", "<< properties.sourceWidth << ", " << properties.sourceHeight
-                            <<") for surface with ID " << surface << "\n";
+                    cout << "Failed to set source rectangle (" << 0 << "," << 0 << ", " << properties.sourceWidth << ", " << properties.sourceHeight
+                            << ") for surface with ID " << surface << "\n";
                 }
 
                 //set destination region to the region on the layer used for displaying the surface
@@ -199,8 +199,8 @@ void demoAnimatorDownwards(t_scene_data* pInitialScene, t_scene_data* pDemoScene
                 if (ILM_SUCCESS != callResult)
                 {
                     cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                    cout << "Failed to set destination rectangle (" << coordinates.x << "," << coordinates.y << ", "<< max(0, coordinates.z - coordinates.x) << ", "
-                            << max(0, coordinates.w - coordinates.y) <<") for surface with ID " << surface << "\n";
+                    cout << "Failed to set destination rectangle (" << coordinates.x << "," << coordinates.y << ", " << max(0, coordinates.z - coordinates.x) << ", "
+                            << max(0, coordinates.w - coordinates.y) << ") for surface with ID " << surface << "\n";
                 }
             }
 
@@ -288,7 +288,7 @@ void demoAnimatorRandomDirections(t_scene_data* pInitialScene, t_scene_data* pDe
     long sleepTimeMillis = 25;
 
     //start animation !
-    while(! *pStopDemo)
+    while (! *pStopDemo)
     {
         //set transparency to be inversly proportional to scale
         for (vector<t_ilm_surface>::iterator it = renderedSurfaces.begin();
@@ -302,7 +302,7 @@ void demoAnimatorRandomDirections(t_scene_data* pInitialScene, t_scene_data* pDe
             if (ILM_SUCCESS != callResult)
             {
                 cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                cout << "Failed to set opacity " << opacity <<" for surface with ID " << surface << "\n";
+                cout << "Failed to set opacity " << opacity << " for surface with ID " << surface << "\n";
             }
         }
 
@@ -331,19 +331,20 @@ void demoAnimatorRandomDirections(t_scene_data* pInitialScene, t_scene_data* pDe
             coordinates.y += surfaceSpeed[surface];
             coordinates.w += surfaceSpeed[surface];
 
-
             //if the upper part is not visible remove it from the source and destination regions
             if (coordinates.y <= 0)
             {
                 //set source region to only the visible part of the surface
                 int ySource = static_cast<int>(-coordinates.y / surfaceScale[surface]);
 
-                ilmErrorTypes callResult = ilm_surfaceSetSourceRectangle(surface, 0, ySource, properties.sourceWidth, properties.sourceHeight - ySource);
+                ilmErrorTypes callResult = ilm_surfaceSetSourceRectangle(surface, 0, ySource, properties.sourceWidth,
+                                                                            properties.sourceHeight - ySource);
                 if (ILM_SUCCESS != callResult)
                 {
                     cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                    cout << "Failed to set source rectangle (" << 0 << "," << ySource << ", "<< properties.sourceWidth << ", " << properties.sourceHeight - ySource
-                            <<") for surface with ID " << surface << "\n";
+                    cout << "Failed to set source rectangle (" << 0 << "," << ySource << ", " << properties.sourceWidth
+                            << ", " << properties.sourceHeight - ySource
+                            << ") for surface with ID " << surface << "\n";
                 }
 
                 //set the destination region AT THE TOP of the layer used for displaying the surface
@@ -356,8 +357,8 @@ void demoAnimatorRandomDirections(t_scene_data* pInitialScene, t_scene_data* pDe
                 if (ILM_SUCCESS != callResult)
                 {
                     cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                    cout << "Failed to set destination rectangle (" << coordinates.x << "," << 0 << ", "<< max(0, coordinates.z - coordinates.x) << ", " << max(0, coordinates.w)
-                            <<") for surface with ID " << surface << "\n";
+                    cout << "Failed to set destination rectangle (" << coordinates.x << "," << 0 << ", " << max(0, coordinates.z - coordinates.x) << ", " << max(0, coordinates.w)
+                            << ") for surface with ID " << surface << "\n";
                 }
             }
             else
@@ -367,8 +368,8 @@ void demoAnimatorRandomDirections(t_scene_data* pInitialScene, t_scene_data* pDe
                 if (ILM_SUCCESS != callResult)
                 {
                     cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                    cout << "Failed to set source rectangle (" << 0 << "," << 0 << ", "<< properties.sourceWidth << ", " << properties.sourceHeight
-                            <<") for surface with ID " << surface << "\n";
+                    cout << "Failed to set source rectangle (" << 0 << "," << 0 << ", " << properties.sourceWidth << ", " << properties.sourceHeight
+                            << ") for surface with ID " << surface << "\n";
                 }
 
                 //set destination region to the region on the layer used for displaying the surface
@@ -381,8 +382,8 @@ void demoAnimatorRandomDirections(t_scene_data* pInitialScene, t_scene_data* pDe
                 if (ILM_SUCCESS != callResult)
                 {
                     cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                    cout << "Failed to set destination rectangle (" << coordinates.x << "," << coordinates.y << ", "<< max(0, coordinates.z - coordinates.x) << ", "
-                            << max(0, coordinates.w - coordinates.y) <<") for surface with ID " << surface << "\n";
+                    cout << "Failed to set destination rectangle (" << coordinates.x << "," << coordinates.y << ", " << max(0, coordinates.z - coordinates.x) << ", "
+                            << max(0, coordinates.w - coordinates.y) << ") for surface with ID " << surface << "\n";
                 }
             }
 
@@ -470,7 +471,7 @@ void demoAnimatorWaterfall(t_scene_data* pInitialScene, t_scene_data* pDemoScene
     long sleepTimeMillis = 25;
 
     //start animation !
-    while(! *pStopDemo)
+    while (! *pStopDemo)
     {
         for (vector<t_ilm_surface>::iterator it = renderedSurfaces.begin();
                 it != renderedSurfaces.end(); ++it)
@@ -497,7 +498,7 @@ void demoAnimatorWaterfall(t_scene_data* pInitialScene, t_scene_data* pDemoScene
             if (ILM_SUCCESS != callResult)
             {
                 cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                cout << "Failed to set opacity " << opacity <<" for surface with ID " << surface << "\n";
+                cout << "Failed to set opacity " << opacity << " for surface with ID " << surface << "\n";
             }
 
             //move
@@ -518,8 +519,8 @@ void demoAnimatorWaterfall(t_scene_data* pInitialScene, t_scene_data* pDemoScene
                 if (ILM_SUCCESS != callResult)
                 {
                     cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                    cout << "Failed to set source rectangle (" << 0 << "," << ySource << ", "<< properties.sourceWidth << ", " << properties.sourceHeight - ySource
-                            <<") for surface with ID " << surface << "\n";
+                    cout << "Failed to set source rectangle (" << 0 << "," << ySource << ", " << properties.sourceWidth << ", " << properties.sourceHeight - ySource
+                            << ") for surface with ID " << surface << "\n";
                 }
 
                 //set the destination region AT THE TOP of the layer used for displaying the surface
@@ -532,8 +533,8 @@ void demoAnimatorWaterfall(t_scene_data* pInitialScene, t_scene_data* pDemoScene
                 if (ILM_SUCCESS != callResult)
                 {
                     cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                    cout << "Failed to set destination rectangle (" << coordinates.x << "," << 0 << ", "<< max(0, coordinates.z - coordinates.x) << ", " << max(0, coordinates.w)
-                            <<") for surface with ID " << surface << "\n";
+                    cout << "Failed to set destination rectangle (" << coordinates.x << "," << 0 << ", " << max(0, coordinates.z - coordinates.x) << ", " << max(0, coordinates.w)
+                            << ") for surface with ID " << surface << "\n";
                 }
             }
             else
@@ -543,8 +544,8 @@ void demoAnimatorWaterfall(t_scene_data* pInitialScene, t_scene_data* pDemoScene
                 if (ILM_SUCCESS != callResult)
                 {
                     cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                    cout << "Failed to set source rectangle (" << 0 << "," << 0 << ", "<< properties.sourceWidth << ", " << properties.sourceHeight
-                            <<") for surface with ID " << surface << "\n";
+                    cout << "Failed to set source rectangle (" << 0 << "," << 0 << ", " << properties.sourceWidth << ", " << properties.sourceHeight
+                            << ") for surface with ID " << surface << "\n";
                 }
 
                 //set destination region to the region on the layer used for displaying the surface
@@ -557,8 +558,8 @@ void demoAnimatorWaterfall(t_scene_data* pInitialScene, t_scene_data* pDemoScene
                 if (ILM_SUCCESS != callResult)
                 {
                     cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                    cout << "Failed to set destination rectangle (" << coordinates.x << "," << coordinates.y << ", "<< max(0, coordinates.z - coordinates.x) << ", "
-                            << max(0, coordinates.w - coordinates.y) <<") for surface with ID " << surface << "\n";
+                    cout << "Failed to set destination rectangle (" << coordinates.x << "," << coordinates.y << ", " << max(0, coordinates.z - coordinates.x) << ", "
+                            << max(0, coordinates.w - coordinates.y) << ") for surface with ID " << surface << "\n";
                 }
             }
 
@@ -601,10 +602,9 @@ void demoAnimatorZooming(t_scene_data* pInitialScene, t_scene_data* pDemoScene,
         if (ILM_SUCCESS != callResult)
         {
             cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-            cout << "Failed to set destination rectangle (" << surfaceProperties.destX << "," << surfaceProperties.destY << ", "<< surfaceProperties.destWidth << ", "
-                    << surfaceProperties.destHeight <<") for surface with ID " << surface << "\n";
+            cout << "Failed to set destination rectangle (" << surfaceProperties.destX << "," << surfaceProperties.destY << ", " << surfaceProperties.destWidth << ", "
+                    << surfaceProperties.destHeight << ") for surface with ID " << surface << "\n";
         }
-
     }
 
     //sleeping time
@@ -642,8 +642,8 @@ void demoAnimatorZooming(t_scene_data* pInitialScene, t_scene_data* pDemoScene,
             if (ILM_SUCCESS != callResult)
             {
                 cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                cout << "Failed to set destination rectangle (" << surfaceProperties.destX << "," << surfaceProperties.destY << ", "<< surfaceProperties.destWidth << ", "
-                        << surfaceProperties.destHeight <<") for surface with ID " << surface << "\n";
+                cout << "Failed to set destination rectangle (" << surfaceProperties.destX << "," << surfaceProperties.destY << ", " << surfaceProperties.destWidth << ", "
+                        << surfaceProperties.destHeight << ") for surface with ID " << surface << "\n";
             }
 
             callResult = ilm_layerSetRenderOrder(layer, renderedSurfaces.data() + currentSurfaceIndex, 1);
@@ -672,8 +672,8 @@ void demoAnimatorZooming(t_scene_data* pInitialScene, t_scene_data* pDemoScene,
             if (ILM_SUCCESS != callResult)
             {
                 cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                cout << "Failed to set destination rectangle (" << surfaceProperties.destX << "," << surfaceProperties.destY << ", "<< surfaceProperties.destWidth << ", "
-                        << surfaceProperties.destHeight <<") for surface with ID " << surface << "\n";
+                cout << "Failed to set destination rectangle (" << surfaceProperties.destX << "," << surfaceProperties.destY << ", " << surfaceProperties.destWidth << ", "
+                        << surfaceProperties.destHeight << ") for surface with ID " << surface << "\n";
             }
 
             float opacity = 1 / pow(t, 0.4);
@@ -682,7 +682,7 @@ void demoAnimatorZooming(t_scene_data* pInitialScene, t_scene_data* pDemoScene,
             if (ILM_SUCCESS != callResult)
             {
                 cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                cout << "Failed to set opacity " << opacity <<" for surface with ID " << surface << "\n";
+                cout << "Failed to set opacity " << opacity << " for surface with ID " << surface << "\n";
             }
         }
 
@@ -721,8 +721,8 @@ void demoAnimatorCascadedZooming(t_scene_data* pInitialScene, t_scene_data* pDem
         if (ILM_SUCCESS != callResult)
         {
             cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-            cout << "Failed to set destination rectangle (" << surfaceProperties.destX << "," << surfaceProperties.destY << ", "<< surfaceProperties.destWidth << ", "
-                    << surfaceProperties.destHeight <<") for surface with ID " << surface << "\n";
+            cout << "Failed to set destination rectangle (" << surfaceProperties.destX << "," << surfaceProperties.destY << ", " << surfaceProperties.destWidth << ", "
+                    << surfaceProperties.destHeight << ") for surface with ID " << surface << "\n";
         }
 
         scaleFactors[surface] = 1;
@@ -760,8 +760,8 @@ void demoAnimatorCascadedZooming(t_scene_data* pInitialScene, t_scene_data* pDem
                 if (ILM_SUCCESS != callResult)
                 {
                     cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                    cout << "Failed to set destination rectangle (" << surfaceProperties.destX << "," << surfaceProperties.destY << ", "<< surfaceProperties.destWidth << ", "
-                            << surfaceProperties.destHeight <<") for surface with ID " << surface << "\n";
+                    cout << "Failed to set destination rectangle (" << surfaceProperties.destX << "," << surfaceProperties.destY << ", " << surfaceProperties.destWidth << ", "
+                            << surfaceProperties.destHeight << ") for surface with ID " << surface << "\n";
                 }
 
                 ilm_commitChanges();
@@ -804,8 +804,8 @@ void demoAnimatorCascadedZooming(t_scene_data* pInitialScene, t_scene_data* pDem
                 if (ILM_SUCCESS != callResult)
                 {
                     cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                    cout << "Failed to set destination rectangle (" << surfaceProperties.destX << "," << surfaceProperties.destY << ", "<< surfaceProperties.destWidth << ", "
-                            << surfaceProperties.destHeight <<") for surface with ID " << surface << "\n";
+                    cout << "Failed to set destination rectangle (" << surfaceProperties.destX << "," << surfaceProperties.destY << ", " << surfaceProperties.destWidth << ", "
+                            << surfaceProperties.destHeight << ") for surface with ID " << surface << "\n";
                 }
 
                 float opacity = 1 / pow(scaleFactors[surface], 0.4f);
@@ -814,7 +814,7 @@ void demoAnimatorCascadedZooming(t_scene_data* pInitialScene, t_scene_data* pDem
                 if (ILM_SUCCESS != callResult)
                 {
                     cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                    cout << "Failed to set opacity " << opacity <<" for surface with ID " << surface << "\n";
+                    cout << "Failed to set opacity " << opacity << " for surface with ID " << surface << "\n";
                 }
             }
         }
@@ -829,7 +829,7 @@ static vector<t_pDemoAnimatorFunc> animators;
 void* demoThreadCallback(void* param)
 {
     //call function on parameters
-    map<string,void*>* paramMap = (map<string,void*>*) param;
+    map<string, void*>* paramMap = (map<string, void*>*) param;
 
     int* pAnimatorIndex = (int*) paramMap->at("pAnimatorIndex");
     t_pDemoAnimatorFunc animator = animators[*pAnimatorIndex];
@@ -842,7 +842,6 @@ void* demoThreadCallback(void* param)
 
     return NULL;
 }
-
 } //end of anonymous namespace
 
 void demo(t_ilm_uint mode)
@@ -880,10 +879,10 @@ void demo(t_ilm_uint mode)
         pthread_create(&demoThread, NULL, demoThreadCallback, (void*) &paramMap);
 
         //set initial scene (reset)
-        cout<<"Press ENTER to stop demo...";
+        cout << "Press ENTER to stop demo...";
         cin.get();
 
-        cout<<"Resetting scene...";
+        cout << "Resetting scene...";
         cout.flush();
 
         stopDemo = true; //this variable has to be checked in the animator function !!
@@ -893,7 +892,7 @@ void demo(t_ilm_uint mode)
         captureSceneData(&finalScene);
         transformScene(&finalScene, &initialScene, 1000, 50);
         setScene(&initialScene, true);
-        cout<<"done"<<endl;
+        cout << "done" << endl;
     }
     else
     {
index b2bbbd3..8ee0546 100644 (file)
@@ -27,7 +27,7 @@ int main(int argc, char* argv[])
     // create full string of arguments
     string userCommand;
 
-    if(argc == 1)
+    if (argc == 1)
     {
         userCommand = "help";
     }
index 0cb27b9..be12458 100644 (file)
@@ -50,7 +50,6 @@ t_scene_data getScatteredScene(t_scene_data* pInitialScene)
     //make dummy scene
     t_scene_data scatteredScene = cloneToUniLayerScene(&initialScene);
 
-
     //get render order of surfaces in initial scene
     vector<t_ilm_surface> renderOrder = getSceneRenderOrder(&initialScene);
     //get surfaces' coordinates of surfaces in initial scene
@@ -72,7 +71,6 @@ t_scene_data getScatteredScene(t_scene_data* pInitialScene)
     int maxWidth = static_cast<int>(initialScene.screenWidth * scale);
     int maxHeight = static_cast<int>(initialScene.screenHeight * scale);
 
-
     //scale surface coordinates
     int counter = 0;
     for (vector<t_ilm_surface>::iterator it = renderOrder.begin();
@@ -101,10 +99,10 @@ void* scatterThreadCallback(void* param)
 {
     map<string, void*> * pParamMap = static_cast<map<string, void*>* >(param);
     t_ilm_surface* surface = static_cast<t_ilm_surface*>((*pParamMap)["pHighlighedSurface"]);
-    bool* stop= static_cast<bool*>((*pParamMap)["pStop"]);
-    while(! *stop)
+    bool* stop = static_cast<bool*>((*pParamMap)["pStop"]);
+    while (! *stop)
     {
-        if(*surface != 0xFFFFFFFF)
+        if (*surface != 0xFFFFFFFF)
         {
             t_ilm_surface currentSurface = *surface;
 
@@ -112,7 +110,7 @@ void* scatterThreadCallback(void* param)
             if (ILM_SUCCESS != callResult)
             {
                 cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                cout << "Failed to set visibility "<< false << " for surface with ID " << currentSurface << "\n";
+                cout << "Failed to set visibility " << false << " for surface with ID " << currentSurface << "\n";
             }
 
             ilm_commitChanges();
@@ -122,7 +120,7 @@ void* scatterThreadCallback(void* param)
             if (ILM_SUCCESS != callResult)
             {
                 cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-                cout << "Failed to set visibility "<< true << " for surface with ID " << currentSurface << "\n";
+                cout << "Failed to set visibility " << true << " for surface with ID " << currentSurface << "\n";
             }
 
             ilm_commitChanges();
@@ -141,7 +139,7 @@ void scatterHandleUserInput(t_scene_data* pOriginalScene, t_scene_data* pScatter
     //make keys map
     map<string, t_ilm_surface> keySurfaceMap;
 
-    for(int i = 0 ; i < n ; ++i)
+    for (int i = 0; i < n; ++i)
     {
         int row = i / cols;
         int col = i % cols;
@@ -165,10 +163,10 @@ void scatterHandleUserInput(t_scene_data* pOriginalScene, t_scene_data* pScatter
     pthread_create(& highlightThread, NULL, scatterThreadCallback, &threadParamMap);
 
     char userInput[3];
-    while(true)
+    while (true)
     {
         //print Grid
-        for(int i = 0 ; i < n ; ++i)
+        for (int i = 0; i < n; ++i)
         {
             int row = i / cols;
             int col = i % cols;
@@ -177,18 +175,18 @@ void scatterHandleUserInput(t_scene_data* pOriginalScene, t_scene_data* pScatter
             key[0] = 'A' + row;
             key[1] = '0' + col;
             key[2] = '\0';
-            if(col == 0)
+            if (col == 0)
             {
-                cout<<endl;
-                cout<<string(5 * cols + 1, '-')<<endl;
-                cout <<"| ";
+                cout << endl;
+                cout << string(5 * cols + 1, '-') << endl;
+                cout << "| ";
             }
-            cout<<key<<" | ";
+            cout << key << " | ";
         }
 
-        cout<<endl<<string(5 * cols + 1, '-')<<endl;
+        cout << endl << string(5 * cols + 1, '-') << endl;
         //take input from user
-        cout<<"Choose a surface [Or press ENTER to exit...]:"<<endl;
+        cout << "Choose a surface [Or press ENTER to exit...]:" << endl;
 
         userInput[0] = cin.get();
 
@@ -207,21 +205,21 @@ void scatterHandleUserInput(t_scene_data* pOriginalScene, t_scene_data* pScatter
 
         userInput[1] = cin.get();
         //if the user presses Enter by mistake: reset input
-        if(userInput[1] == '\n')
+        if (userInput[1] == '\n')
         {
             continue;
         }
 
         userInput[2] = cin.get();
         //if the user DOES NOT press Enter by mistake: reset input
-        if(userInput[2] != '\n')
+        if (userInput[2] != '\n')
         {
             continue;
         }
 
         userInput[2] = '\0';
 
-        if(keySurfaceMap.find(userInput) != keySurfaceMap.end())
+        if (keySurfaceMap.find(userInput) != keySurfaceMap.end())
         {
             //this change is reflected in the highligh thread
             hightlightThreadSurface = keySurfaceMap[userInput];
@@ -253,26 +251,26 @@ void scatterHandleUserInput(t_scene_data* pOriginalScene, t_scene_data* pScatter
             stringstream tempStream;
             char fillChar = '-';
             int width = 20;
-            tempStream <<"\n--------------------------------\n";
-            tempStream <<std::setw(width)<<std::left<<std::setfill(fillChar)<<"Surface"<< ":" << hightlightThreadSurface << "\n";
-            tempStream <<std::setw(width)<<std::left<<std::setfill(fillChar)<<"Destination Region"<< ":" << "[x:"<< surfaceProperties.destX<< ", y:" << surfaceProperties.destY<< ", w:"<< surfaceProperties.destWidth<< ", h:"<< surfaceProperties.destHeight<< "]\n";
-            tempStream <<std::setw(width)<<std::left<<std::setfill(fillChar)<<"Source Region"<< ":" << "[x:"<< surfaceProperties.sourceX<< ", y:" << surfaceProperties.sourceY<< ", w:"<< surfaceProperties.sourceWidth<< ", h:"<< surfaceProperties.sourceHeight<< "]\n";
-            tempStream <<std::setw(width)<<std::left<<std::setfill(fillChar)<<"Original Dimensions"<< ":" << "[w:"<< surfaceProperties.origSourceWidth<< ", h:" << surfaceProperties.origSourceHeight<< "]\n";
-            tempStream <<std::setw(width)<<std::left<<std::setfill(fillChar)<<"Opacity"<< ":" << surfaceProperties.opacity  << "\n";
-            tempStream <<std::setw(width)<<std::left<<std::setfill(fillChar)<<"Visibility"<< ":" << surfaceProperties.visibility << "\n";
-            tempStream <<std::setw(width)<<std::left<<std::setfill(fillChar)<<"Input Devices"<< ":" << surfaceProperties.inputDevicesAcceptance << " [" << inputDeviceAcceptance<<"]\n";
-            tempStream <<std::setw(width)<<std::left<<std::setfill(fillChar)<<"Native Surface"<< ":" << surfaceProperties.nativeSurface << "\n";
-            tempStream <<std::setw(width)<<std::left<<std::setfill(fillChar)<<"Orientation"<< ":" << surfaceProperties.orientation  << " ["<< orientations[surfaceProperties.orientation]<< "]\n";
-            tempStream <<std::setw(width)<<std::left<<std::setfill(fillChar)<<"Pixel Format"<< ":" << surfaceProperties.pixelformat  << " ["<< pixelFormats[surfaceProperties.pixelformat]<< "]\n";
-            tempStream <<std::setw(width)<<std::left<<std::setfill(fillChar)<<"Update Counter"<< ":" << surfaceProperties.updateCounter << "\n";
-            tempStream <<std::setw(width)<<std::left<<std::setfill(fillChar)<<"Draw Counter"<< ":" << surfaceProperties.drawCounter << "\n";
-            tempStream <<std::setw(width)<<std::left<<std::setfill(fillChar)<<"Frame Counter"<< ":" << surfaceProperties.frameCounter << "\n";
-
-            cout<<tempStream.str();
+            tempStream << "\n--------------------------------\n";
+            tempStream << std::setw(width) << std::left << std::setfill(fillChar) << "Surface" << ":" << hightlightThreadSurface << "\n";
+            tempStream << std::setw(width) << std::left << std::setfill(fillChar) << "Destination Region" << ":" << "[x:" << surfaceProperties.destX << ", y:" << surfaceProperties.destY << ", w:" << surfaceProperties.destWidth << ", h:" << surfaceProperties.destHeight << "]\n";
+            tempStream << std::setw(width) << std::left << std::setfill(fillChar) << "Source Region" << ":" << "[x:" << surfaceProperties.sourceX << ", y:" << surfaceProperties.sourceY << ", w:" << surfaceProperties.sourceWidth << ", h:" << surfaceProperties.sourceHeight << "]\n";
+            tempStream << std::setw(width) << std::left << std::setfill(fillChar) << "Original Dimensions" << ":" << "[w:" << surfaceProperties.origSourceWidth << ", h:" << surfaceProperties.origSourceHeight << "]\n";
+            tempStream << std::setw(width) << std::left << std::setfill(fillChar) << "Opacity" << ":" << surfaceProperties.opacity << "\n";
+            tempStream << std::setw(width) << std::left << std::setfill(fillChar) << "Visibility" << ":" << surfaceProperties.visibility << "\n";
+            tempStream << std::setw(width) << std::left << std::setfill(fillChar) << "Input Devices" << ":" << surfaceProperties.inputDevicesAcceptance << " [" << inputDeviceAcceptance << "]\n";
+            tempStream << std::setw(width) << std::left << std::setfill(fillChar) << "Native Surface" << ":" << surfaceProperties.nativeSurface << "\n";
+            tempStream << std::setw(width) << std::left << std::setfill(fillChar) << "Orientation" << ":" << surfaceProperties.orientation << " [" << orientations[surfaceProperties.orientation] << "]\n";
+            tempStream << std::setw(width) << std::left << std::setfill(fillChar) << "Pixel Format" << ":" << surfaceProperties.pixelformat << " [" << pixelFormats[surfaceProperties.pixelformat] << "]\n";
+            tempStream << std::setw(width) << std::left << std::setfill(fillChar) << "Update Counter" << ":" << surfaceProperties.updateCounter << "\n";
+            tempStream << std::setw(width) << std::left << std::setfill(fillChar) << "Draw Counter" << ":" << surfaceProperties.drawCounter << "\n";
+            tempStream << std::setw(width) << std::left << std::setfill(fillChar) << "Frame Counter" << ":" << surfaceProperties.frameCounter << "\n";
+
+            cout << tempStream.str();
         }
         else
         {
-            cout<<"Unrecognized input!"<<endl;
+            cout << "Unrecognized input!" << endl;
         }
     }
 }
@@ -291,7 +289,6 @@ void scatter()
     //transform from initial to scattered scene
     transformScene(&initialScene, &scatteredScene, 1000, 50);
 
-
     //wait for user input
     scatterHandleUserInput(&initialScene, &scatteredScene);
 
@@ -319,7 +316,7 @@ void scatterAll()
         t_ilm_surface surface = *it;
 
         //if surface does not belong to a layer or layer does not belong to a surface
-        if( ! surfaceRenderedOnScreen(initialScene, surface ))
+        if (! surfaceRenderedOnScreen(initialScene, surface))
         {
             modifiedScene.surfaces.push_back(surface);
             modifiedScene.surfaceProperties[surface] = initialScene.surfaceProperties[surface];
@@ -338,7 +335,6 @@ void scatterAll()
         modifiedScene.surfaceProperties[surface].visibility = true;
     }
 
-
     //just scatter !!
     setScene(&modifiedScene);
     scatter();
index 6f29081..39bd5f9 100644 (file)
@@ -9,9 +9,9 @@
  *
  *        http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed in writing, software
+ * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either inputess or implied.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
@@ -41,7 +41,6 @@ using namespace std;
 
 
 namespace {
-
 void captureSceneDataHelper(t_ilm_surface surfaceId, t_scene_data* pSceneData, IlmSurface* pSurface)
 {
     ilmSurfaceProperties& props = pSceneData->surfaceProperties[surfaceId];
@@ -371,14 +370,14 @@ void createSceneContentsHelper(IlmSurface* pIlmsurface)
         cout << "Failed to get available surface IDs\n";
     }
 
-
     if (find(surfaceArray, surfaceArray + surfaceCount, surfaceId)
             == surfaceArray + surfaceCount)
     {
         ilmPixelFormat pixelFormat;
         pixelFormat = toPixelFormat(props.pixelformat);
 
-        ilmErrorTypes callResult = ilm_surfaceCreate(props.nativeSurface, props.origSourceWidth, props.origSourceHeight, pixelFormat, &surfaceId);
+        ilmErrorTypes callResult = ilm_surfaceCreate(props.nativeSurface, props.origSourceWidth,
+                                                        props.origSourceHeight, pixelFormat, &surfaceId);
         if (ILM_SUCCESS != callResult)
         {
             cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
@@ -411,7 +410,7 @@ void createSceneContentsHelper(IlmLayer* pIlmlayer)
         if (ILM_SUCCESS != callResult)
         {
             cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-            cout << "Failed to create layer width dimensions (" << props.origSourceWidth <<" ,"<< props.origSourceHeight << ")\n";
+            cout << "Failed to create layer width dimensions (" << props.origSourceWidth << " ," << props.origSourceHeight << ")\n";
         }
 
         ilm_commitChanges();
@@ -434,7 +433,7 @@ void createSceneContentsHelper(IlmLayer* pIlmlayer)
     if (ILM_SUCCESS != callResult)
     {
         cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-        cout << "Failed to set render order for layer with ID "<< layerId << ")\n";
+        cout << "Failed to set render order for layer with ID " << layerId << ")\n";
     }
 
     ilm_commitChanges();
@@ -462,7 +461,7 @@ void createSceneContentsHelper(IlmDisplay* pIlmdisplay)
     if (ILM_SUCCESS != callResult)
     {
         cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-        cout << "Failed to set render order for display with ID "<< displayId << ")\n";
+        cout << "Failed to set render order for display with ID " << displayId << ")\n";
     }
 
     ilm_commitChanges();
@@ -502,11 +501,12 @@ void restoreSceneHelper(IlmSurface* pIlmsurface)
     ilmPixelFormat pixelFormat;
     pixelFormat = toPixelFormat(props.pixelformat);
 
-    ilmErrorTypes callResult = ilm_surfaceSetNativeContent(props.nativeSurface, props.origSourceWidth, props.origSourceHeight, pixelFormat, surfaceId);
+    ilmErrorTypes callResult = ilm_surfaceSetNativeContent(props.nativeSurface, props.origSourceWidth,
+                                                            props.origSourceHeight, pixelFormat, surfaceId);
     if (ILM_SUCCESS != callResult)
     {
         cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-        cout << "Failed to set native content for surface with ID "<< surfaceId << ")\n";
+        cout << "Failed to set native content for surface with ID " << surfaceId << ")\n";
     }
 
     ilm_commitChanges();
@@ -535,7 +535,7 @@ void restoreSceneHelper(IlmLayer* pIlmlayer)
     if (ILM_SUCCESS != callResult)
     {
         cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-        cout << "Failed to set destination rectangle for layer with ID "<< layerId << ")\n";
+        cout << "Failed to set destination rectangle for layer with ID " << layerId << ")\n";
     }
 
     ilm_commitChanges();
@@ -591,7 +591,7 @@ void restoreScene(IlmScene* pIlmscene)
         if (ILM_SUCCESS != callResult)
         {
             cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
-            cout << "Failed to remove surface "<< it->first << " from layer " << it->second << ")\n";
+            cout << "Failed to remove surface " << it->first << " from layer " << it->second << ")\n";
         }
     }
 
@@ -622,7 +622,6 @@ void restoreScene(IlmScene* pIlmscene)
         restoreSceneHelper(*it);
     }
 }
-
 } //end of anonymous namespace
 
 
@@ -662,7 +661,7 @@ void exportSceneToFile(string filename)
 
     fstream stream(filename.c_str(), ios::out);
 
-    cout<<buffer.str()<<endl;
+    cout << buffer.str() << endl;
     stream << buffer.str();
     stream.flush();
     stream.close();
index 94ce7af..6a08c55 100644 (file)
@@ -26,8 +26,8 @@
 *
 ****************************************************************************/
 
-#ifndef WAYLAND_SERVERINFO_CLIENT_PROTOCOL_H
-#define WAYLAND_SERVERINFO_CLIENT_PROTOCOL_H
+#ifndef WAYLANDSERVERINFOCLIENTPROTOCOL_H
+#define WAYLANDSERVERINFOCLIENTPROTOCOL_H
 
 #ifdef  __cplusplus
 extern "C" {
@@ -89,4 +89,4 @@ serverinfo_get_connection_id(struct serverinfo *serverinfo)
 }
 #endif
 
-#endif
+#endif /* WAYLANDSERVERINFOCLIENTPROTOCOL_H */
index 15f3a0e..6282236 100644 (file)
@@ -17,8 +17,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _WL_CONTEXT_H_
-#define _WL_CONTEXT_H_
+#ifndef _WLCONTEXT_H_
+#define _WLCONTEXT_H_
 
 #include <wayland-client.h>
 #include <wayland-client-protocol.h>
@@ -120,4 +120,4 @@ inline void WLContext::SetWLKeyboard(struct wl_keyboard* wlKeyboard)
 inline void WLContext::SetWLTouch(struct wl_touch* wlTouch)
     { m_wlTouch = wlTouch; }
 
-#endif
+#endif /* _WLCONTEXT_H_ */
index f9c17f7..577930d 100644 (file)
@@ -17,8 +17,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _WL_EGL_SURFACE_H_
-#define _WL_EGL_SURFACE_H_
+#ifndef _WLEGLSURFACE_H_
+#define _WLEGLSURFACE_H_
 
 #include <EGL/egl.h>
 #include <wayland-egl.h>
@@ -51,4 +51,4 @@ inline EGLDisplay WLEGLSurface::GetEGLDisplay() const { return m_eglDisplay; }
 inline EGLSurface WLEGLSurface::GetEGLSurface() const { return m_eglSurface; }
 inline EGLContext WLEGLSurface::GetEGLContext() const { return m_eglContext; }
 
-#endif
+#endif /* _WLEGLSURFACE_H_ */
index e4d9552..0cc062e 100644 (file)
@@ -17,8 +17,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _WL_EYES_H_
-#define _WL_EYES_H_
+#ifndef _WLEYES_H_
+#define _WLEYES_H_
 
 #include "transform.h"
 
@@ -82,4 +82,4 @@ private:
     WLEyes();
 };
 
-#endif
+#endif /* _WLEYES_H_ */
index b268be7..e630ecc 100644 (file)
@@ -17,8 +17,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _WL_EYES_RENDERER_H_
-#define _WL_EYES_RENDERER_H_
+#ifndef _WLEYESRENDERER_H_
+#define _WLEYESRENDERER_H_
 
 #include <wayland-client.h>
 #include "WLEGLSurface.h"
@@ -66,4 +66,4 @@ extern const struct wl_pointer_listener PointerListener;
 extern const struct wl_keyboard_listener KeyboardListener;
 extern const struct wl_touch_listener TouchListener;
 
-#endif
+#endif /* _WLEYESRENDERER_H_ */
index 7d9a10e..3d7ecdd 100644 (file)
@@ -17,8 +17,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _WL_SURFACE_H_
-#define _WL_SURFACE_H_
+#ifndef _WLSURFACE_H_
+#define _WLSURFACE_H_
 
 #include "ilm_client.h"
 #include "WLContext.h"
@@ -57,4 +57,4 @@ inline struct wl_surface* WLSurface::GetWLSurface() const { return m_wlSurface;
 inline struct wl_display* WLSurface::GetWLDisplay() const
     { return m_wlContext->GetWLDisplay(); }
 
-#endif
+#endif /* _WLSURFACE_H_ */
index 94ce7af..6a08c55 100644 (file)
@@ -26,8 +26,8 @@
 *
 ****************************************************************************/
 
-#ifndef WAYLAND_SERVERINFO_CLIENT_PROTOCOL_H
-#define WAYLAND_SERVERINFO_CLIENT_PROTOCOL_H
+#ifndef WAYLANDSERVERINFOCLIENTPROTOCOL_H
+#define WAYLANDSERVERINFOCLIENTPROTOCOL_H
 
 #ifdef  __cplusplus
 extern "C" {
@@ -89,4 +89,4 @@ serverinfo_get_connection_id(struct serverinfo *serverinfo)
 }
 #endif
 
-#endif
+#endif /* WAYLANDSERVERINFOCLIENTPROTOCOL_H */
index 0bca6f5..ccb4e4f 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _Argument_h
-#define _Argument_h
+#ifndef _ARGUMENT_H
+#define _ARGUMENT_H
 
 #include <string>
 using std::string;
@@ -58,4 +58,4 @@ private:
     unsigned int value;
 };
 
-#endif
+#endif /* _ARGUMENT_H */
index aaf9011..c0e3cbd 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _Camera_h
-#define _Camera_h
+#ifndef _CAMERA_H
+#define _CAMERA_H
 
 #include "IUpdateable.h"
 #include "IlmMatrix.h"
@@ -42,4 +42,4 @@ private:
     IlmMatrix m_identityMatrix;
 };
 
-#endif
+#endif /* _CAMERA_H */
index d495576..9627c20 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _Car_h
-#define _Car_h
+#ifndef _CAR_H
+#define _CAR_H
 
 #include "IRenderable.h"
 #include "vec.h"
@@ -43,4 +43,4 @@ private:
     ShaderBase* m_pShader;
 };
 
-#endif
+#endif /* _CAR_H */
index 2cf5d6b..859858e 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _Ground_h
-#define _Ground_h
+#ifndef _GROUND_H
+#define _GROUND_H
 
 #include "IRenderable.h"
 #include "vec.h"
@@ -44,4 +44,4 @@ private:
     ShaderBase* m_pShader;
 };
 
-#endif
+#endif /* _GROUND_H */
index 811a12c..0a99104 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _MockNaviHouse_h
-#define _MockNaviHouse_h
+#ifndef _HOUSE_H
+#define _HOUSE_H
 
 #include "IRenderable.h"
 #include "IUpdateable.h"
@@ -51,4 +51,4 @@ private:
     ShaderBase* m_pShader;
 };
 
-#endif
+#endif /* _HOUSE_H */
index 0db7d63..436a3ea 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _IRenderable_h
-#define _IRenderable_h
+#ifndef _IRENDERABLE_H
+#define _IRENDERABLE_H
 
 class IRenderable
 {
@@ -26,4 +26,4 @@ public:
     virtual void render() = 0;
 };
 
-#endif
+#endif /* _IRENDERABLE_H */
index ad2df52..9391259 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _IUpdateable_h
-#define _IUpdateable_h
+#ifndef _IUPDATEABLE_H
+#define _IUPDATEABLE_H
 
 class IUpdateable
 {
@@ -26,4 +26,4 @@ public:
     virtual void update(int currentTimeInMs, int lastFrameTime) = 0;
 };
 
-#endif
+#endif /* _IUPDATEABLE_H */
index 3708e43..978c398 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _MockNavi_h
-#define _MockNavi_h
+#ifndef _MOCKNAVI_H
+#define _MOCKNAVI_H
 
 #include "OpenGLES2App.h"
 #include "IRenderable.h"
@@ -47,4 +47,4 @@ private:
     list<IUpdateable*> m_updateList;
 };
 
-#endif
+#endif /* _MOCKNAVI_H */
index bce66f0..4d5d92d 100644 (file)
@@ -17,8 +17,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _OpenGLES2App_h
-#define _OpenGLES2App_h
+#ifndef _OPENGLES2APP_H
+#define _OPENGLES2APP_H
 
 #include "wayland-client.h"
 #include "wayland-egl.h"
@@ -100,4 +100,4 @@ protected:
     WLContextStruct m_wlContextStruct;
 };
 
-#endif
+#endif /* _OPENGLES2APP_H */
index 40d54bd..fdbe7e3 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _Street_h
-#define _Street_h
+#ifndef _STREET_H
+#define _STREET_H
 
 #include "IRenderable.h"
 #include "IUpdateable.h"
@@ -45,4 +45,4 @@ private:
     ShaderBase* m_shader;
 };
 
-#endif
+#endif /* _STREET_H */
index 94ce7af..6a08c55 100644 (file)
@@ -26,8 +26,8 @@
 *
 ****************************************************************************/
 
-#ifndef WAYLAND_SERVERINFO_CLIENT_PROTOCOL_H
-#define WAYLAND_SERVERINFO_CLIENT_PROTOCOL_H
+#ifndef WAYLANDSERVERINFOCLIENTPROTOCOL_H
+#define WAYLANDSERVERINFOCLIENTPROTOCOL_H
 
 #ifdef  __cplusplus
 extern "C" {
@@ -89,4 +89,4 @@ serverinfo_get_connection_id(struct serverinfo *serverinfo)
 }
 #endif
 
-#endif
+#endif /* WAYLANDSERVERINFOCLIENTPROTOCOL_H */
index b1327e8..df318c2 100644 (file)
@@ -17,8 +17,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _vec_h
-#define _vec_h
+#ifndef _VEC_H
+#define _VEC_H
 
 #include <GLES2/gl2.h>
 
@@ -122,4 +122,4 @@ typedef vec4<GLfloat> vec4f;
 typedef vec4<GLint>   vec4i;
 typedef vec4<GLushort>  vec4u;
 
-#endif
+#endif /* _VEC_H */
index aa207cb..3713ec9 100644 (file)
@@ -52,7 +52,8 @@ t_ilm_bool createX11Context(t_ilm_int width, t_ilm_int height)
     XSetWindowAttributes windowAttributes;
     unsigned int windowMask;
     int colorDepth;
-    int widthCorrected, heightCorrected;
+    int widthCorrected;
+    int heightCorrected;
 
     g_x11ContextStruct.x11Window = 0;
     g_x11ContextStruct.x11Display = NULL;
@@ -130,14 +131,16 @@ t_ilm_bool createEGLContext(t_ilm_int width, t_ilm_int height)
     g_eglContextStruct.eglSurface = NULL;
     g_eglContextStruct.eglContext = NULL;
 
-    g_eglContextStruct.eglDisplay = eglGetDisplay((EGLNativeDisplayType) g_x11ContextStruct.x11Display); // TODO: remove all C style casts in C++ code; use C++ casts
+    g_eglContextStruct.eglDisplay = eglGetDisplay(
+                        (EGLNativeDisplayType) g_x11ContextStruct.x11Display); // TODO: remove all C style casts in C++ code; use C++ casts
     EGLint eglstatus = eglGetError();
     if (!g_eglContextStruct.eglDisplay)
     {
         printf("Error: eglGetDisplay() failed.\n");
     }
 
-    EGLint iMajorVersion, iMinorVersion;
+    EGLint iMajorVersion;
+    EGLint iMinorVersion;
     if (!eglInitialize(g_eglContextStruct.eglDisplay, &iMajorVersion,
             &iMinorVersion))
     {
@@ -194,7 +197,7 @@ t_ilm_bool createEGLContext(t_ilm_int width, t_ilm_int height)
     t_ilm_surface surfaceid = (t_ilm_surface)SURFACE_EXAMPLE_EGLX11_APPLICATION;
 
     printf("create a surface %lu\n", (t_ilm_nativehandle) g_x11ContextStruct.x11Window);
-    ilm_surfaceCreate( (t_ilm_nativehandle) g_x11ContextStruct.x11Window, width, height,
+    ilm_surfaceCreate((t_ilm_nativehandle) g_x11ContextStruct.x11Window, width, height,
             ILM_PIXELFORMAT_RGBA_8888, &surfaceid);
 
     printf("set surface dest region\n");
index a5aac05..176263a 100644 (file)
@@ -58,15 +58,15 @@ const char * sourceVertShader = "\
 
 GLfloat triangleVertexData[] =
 {
-        -0.4f, -0.4f, 0.0f, -0.2f, -0.4f, 0.0f, -0.3f, -0.2f, 0.0f,
-        -0.2f, -0.4f, 0.0f, -0.0f, -0.4f, 0.0f, -0.1f, -0.2f, 0.0f,
-        -0.0f, -0.4f, 0.0f,  0.2f, -0.4f, 0.0f,  0.1f, -0.2f, 0.0f,
-         0.2f, -0.4f, 0.0f,  0.4f, -0.4f, 0.0f,  0.3f, -0.2f, 0.0f,
-        -0.3f, -0.2f, 0.0f, -0.1f, -0.2f, 0.0f, -0.2f, -0.0f, 0.0f,
-         0.1f, -0.2f, 0.0f,  0.3f, -0.2f, 0.0f,  0.2f, -0.0f, 0.0f,
-        -0.2f, -0.0f, 0.0f, -0.0f, -0.0f, 0.0f, -0.1f,  0.2f, 0.0f,
-         0.0f, -0.0f, 0.0f,  0.2f, -0.0f, 0.0f,  0.1f,  0.2f, 0.0f,
-        -0.1f,  0.2f, 0.0f,  0.1f,  0.2f, 0.0f,  0.0f,  0.4f, 0.0f
+    -0.4f, -0.4f, 0.0f, -0.2f, -0.4f, 0.0f, -0.3f, -0.2f, 0.0f,
+    -0.2f, -0.4f, 0.0f, -0.0f, -0.4f, 0.0f, -0.1f, -0.2f, 0.0f,
+    -0.0f, -0.4f, 0.0f, 0.2f, -0.4f, 0.0f, 0.1f, -0.2f, 0.0f,
+    0.2f, -0.4f, 0.0f, 0.4f, -0.4f, 0.0f, 0.3f, -0.2f, 0.0f,
+    -0.3f, -0.2f, 0.0f, -0.1f, -0.2f, 0.0f, -0.2f, -0.0f, 0.0f,
+    0.1f, -0.2f, 0.0f, 0.3f, -0.2f, 0.0f, 0.2f, -0.0f, 0.0f,
+    -0.2f, -0.0f, 0.0f, -0.0f, -0.0f, 0.0f, -0.1f, 0.2f, 0.0f,
+    0.0f, -0.0f, 0.0f, 0.2f, -0.0f, 0.0f, 0.1f, 0.2f, 0.0f,
+    -0.1f, 0.2f, 0.0f, 0.1f, 0.2f, 0.0f, 0.0f, 0.4f, 0.0f
 };
 
 t_ilm_bool initGlApplication()
@@ -104,7 +104,8 @@ t_ilm_bool initShader()
 
     if (!result)
     {
-        t_ilm_int infoLength, numberChars;
+        t_ilm_int infoLength;
+        t_ilm_int numberChars;
         glGetShaderiv(shader.fragmentShaderId, GL_INFO_LOG_LENGTH, &infoLength);
 
         // Allocate Log Space
@@ -130,7 +131,8 @@ t_ilm_bool initShader()
 
     if (!result)
     {
-        t_ilm_int infoLength, numberChars;
+        t_ilm_int infoLength;
+        t_ilm_int numberChars;
         glGetShaderiv(shader.vertexShaderId, GL_INFO_LOG_LENGTH, &infoLength);
 
         // Allocate Log Space
@@ -156,7 +158,8 @@ t_ilm_bool initShader()
 
     if (!result)
     {
-        t_ilm_int infoLength, numberChars;
+        t_ilm_int infoLength;
+        t_ilm_int numberChars;
         glGetShaderiv(shader.shaderProgramId, GL_INFO_LOG_LENGTH, &infoLength);
 
         // Allocate Log Space
@@ -203,7 +206,6 @@ void attachVertexBuffer()
     glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer.vbo);
     glEnableVertexAttribArray(0);
     glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
-
 }
 
 void detachVertexBuffer()
@@ -256,7 +258,6 @@ void draw(t_ilm_uint animTime)
         swapBuffers();
         startTime = currentTime;
     }
-
 }
 
 void destroyGlApplication()
index 0bca6f5..ccb4e4f 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _Argument_h
-#define _Argument_h
+#ifndef _ARGUMENT_H
+#define _ARGUMENT_H
 
 #include <string>
 using std::string;
@@ -58,4 +58,4 @@ private:
     unsigned int value;
 };
 
-#endif
+#endif /* _ARGUMENT_H */
index aaf9011..c0e3cbd 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _Camera_h
-#define _Camera_h
+#ifndef _CAMERA_H
+#define _CAMERA_H
 
 #include "IUpdateable.h"
 #include "IlmMatrix.h"
@@ -42,4 +42,4 @@ private:
     IlmMatrix m_identityMatrix;
 };
 
-#endif
+#endif /* _CAMERA_H */
index d495576..9627c20 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _Car_h
-#define _Car_h
+#ifndef _CAR_H
+#define _CAR_H
 
 #include "IRenderable.h"
 #include "vec.h"
@@ -43,4 +43,4 @@ private:
     ShaderBase* m_pShader;
 };
 
-#endif
+#endif /* _CAR_H */
index 2cf5d6b..859858e 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _Ground_h
-#define _Ground_h
+#ifndef _GROUND_H
+#define _GROUND_H
 
 #include "IRenderable.h"
 #include "vec.h"
@@ -44,4 +44,4 @@ private:
     ShaderBase* m_pShader;
 };
 
-#endif
+#endif /* _GROUND_H */
index 811a12c..0a99104 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _MockNaviHouse_h
-#define _MockNaviHouse_h
+#ifndef _HOUSE_H
+#define _HOUSE_H
 
 #include "IRenderable.h"
 #include "IUpdateable.h"
@@ -51,4 +51,4 @@ private:
     ShaderBase* m_pShader;
 };
 
-#endif
+#endif /* _HOUSE_H */
index 0db7d63..436a3ea 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _IRenderable_h
-#define _IRenderable_h
+#ifndef _IRENDERABLE_H
+#define _IRENDERABLE_H
 
 class IRenderable
 {
@@ -26,4 +26,4 @@ public:
     virtual void render() = 0;
 };
 
-#endif
+#endif /* _IRENDERABLE_H */
index ad2df52..9391259 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _IUpdateable_h
-#define _IUpdateable_h
+#ifndef _IUPDATEABLE_H
+#define _IUPDATEABLE_H
 
 class IUpdateable
 {
@@ -26,4 +26,4 @@ public:
     virtual void update(int currentTimeInMs, int lastFrameTime) = 0;
 };
 
-#endif
+#endif /* _IUPDATEABLE_H */
index 3708e43..978c398 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _MockNavi_h
-#define _MockNavi_h
+#ifndef _MOCKNAVI_H
+#define _MOCKNAVI_H
 
 #include "OpenGLES2App.h"
 #include "IRenderable.h"
@@ -47,4 +47,4 @@ private:
     list<IUpdateable*> m_updateList;
 };
 
-#endif
+#endif /* _MOCKNAVI_H */
index 33512f7..b80f587 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _OpenGLES2App_h
-#define _OpenGLES2App_h
+#ifndef _OPENGLES2APP_H
+#define _OPENGLES2APP_H
 
 #include <GLES2/gl2.h>
 
@@ -89,4 +89,4 @@ protected:
 
 };
 
-#endif
+#endif /* _OPENGLES2APP_H */
index 40d54bd..fdbe7e3 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _Street_h
-#define _Street_h
+#ifndef _STREET_H
+#define _STREET_H
 
 #include "IRenderable.h"
 #include "IUpdateable.h"
@@ -45,4 +45,4 @@ private:
     ShaderBase* m_shader;
 };
 
-#endif
+#endif /* _STREET_H */
index d068bb3..7193ea8 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _vec_h
-#define _vec_h
+#ifndef _VEC_H
+#define _VEC_H
 
 #include <GLES2/gl2.h>
 
@@ -121,4 +121,4 @@ typedef vec4<GLfloat> vec4f;
 typedef vec4<GLint>   vec4i;
 typedef vec4<GLuint>  vec4u;
 
-#endif
+#endif /* _VEC_H */
index f3cbea0..042c4fe 100644 (file)
 BoolArgument::BoolArgument(string name, bool default_value, int argc, const char * const argv[])
 : value(default_value)
 {
-    for (int arg = 1; arg < argc; ++arg) {
+    for (int arg = 1; arg < argc; ++arg)
+    {
         const char* lpArgNow = argv[arg];
-        
-        if ((lpArgNow[0] == '-') && (name == &lpArgNow[1])) {
+
+        if ((lpArgNow[0] == '-') && (name == &lpArgNow[1]))
+        {
             value = !value;
         }
     }
index faab4e8..c5a17c3 100644 (file)
@@ -34,17 +34,17 @@ Car::Car(vec3f position, vec3f size, vec4f color, ShaderBase* shader)
 , m_index(0, 1, 2)
 , m_pShader(shader)
 {
-       m_vertex[0].x = 0.0;
-       m_vertex[0].y = 0.0;
-       m_vertex[0].z = 0.0;
-    
-       m_vertex[1].x = 0.5 * m_size.x;
-       m_vertex[1].y = 0.0;
-       m_vertex[1].z = -m_size.z;
-    
-       m_vertex[2].x = m_size.x;
-       m_vertex[2].y = 0.0;
-       m_vertex[2].z = 0.0;
+    m_vertex[0].x = 0.0;
+    m_vertex[0].y = 0.0;
+    m_vertex[0].z = 0.0;
+
+    m_vertex[1].x = 0.5 * m_size.x;
+    m_vertex[1].y = 0.0;
+    m_vertex[1].z = -m_size.z;
+
+    m_vertex[2].x = m_size.x;
+    m_vertex[2].y = 0.0;
+    m_vertex[2].z = 0.0;
 }
 
 void Car::render()
index f9674f6..63e7080 100644 (file)
@@ -35,30 +35,30 @@ Ground::Ground(vec3f position, vec3f size, vec4f color, ShaderBase* pShader)
 , m_color(color)
 , m_pShader(pShader)
 {
-       m_index[0] = vec3u(0, 1, 2);
-       m_index[1] = vec3u(2, 3, 0);
-    
+    m_index[0] = vec3u(0, 1, 2);
+    m_index[1] = vec3u(2, 3, 0);
+
     //                             y  z
     //     3-------------2         | /
     //    /             /          |/
     //   /             /           ------x
     //  0-------------1
-    
-       m_vertex[0].x = m_position.x;
-       m_vertex[0].y = m_position.y;
-       m_vertex[0].z = m_position.z;
-    
-       m_vertex[1].x = m_position.x + m_size.x;
-       m_vertex[1].y = m_position.y;
-       m_vertex[1].z = m_position.z;
-    
-       m_vertex[2].x = m_position.x + m_size.x;
-       m_vertex[2].y = m_position.y;
-       m_vertex[2].z = m_position.z + m_size.z;
-    
-       m_vertex[3].x = m_position.x;
-       m_vertex[3].y = m_position.y;
-       m_vertex[3].z = m_position.z + m_size.z;
+
+    m_vertex[0].x = m_position.x;
+    m_vertex[0].y = m_position.y;
+    m_vertex[0].z = m_position.z;
+
+    m_vertex[1].x = m_position.x + m_size.x;
+    m_vertex[1].y = m_position.y;
+    m_vertex[1].z = m_position.z;
+
+    m_vertex[2].x = m_position.x + m_size.x;
+    m_vertex[2].y = m_position.y;
+    m_vertex[2].z = m_position.z + m_size.z;
+
+    m_vertex[3].x = m_position.x;
+    m_vertex[3].y = m_position.y;
+    m_vertex[3].z = m_position.z + m_size.z;
 }
 
 void Ground::render()
index ca74017..071ca0b 100644 (file)
@@ -37,7 +37,7 @@ House::House(vec3f position, vec3f size, vec4f houseColor, ShaderBase* pShader)
 , m_color(houseColor)
 , m_pShader(pShader)
 {
-       /*
+    /*
     //     5-------------6
     //    /|            /|
     //   / |           / |
@@ -51,7 +51,7 @@ House::House(vec3f position, vec3f size, vec4f houseColor, ShaderBase* pShader)
     //  0-------------3
     */
 
-       float height = 0.1 + 1.5 * random() / INT_MAX;
+    float height = 0.1 + 1.5 * random() / INT_MAX;
 
     m_index[0] = vec3u(7, 4, 0); // bottom
     m_index[1] = vec3u(0, 3, 7); // bottom
@@ -66,15 +66,37 @@ House::House(vec3f position, vec3f size, vec4f houseColor, ShaderBase* pShader)
     m_index[10] = vec3u(0, 1, 2); // front
     m_index[11] = vec3u(2, 3, 0); // front
 
+    m_vertex[0].x = 0.0f;
+    m_vertex[0].y = 0.0f;
+    m_vertex[0].z = 1.0f;
 
-       m_vertex[0].x =  0.0f;  m_vertex[0].y =  0.0f;          m_vertex[0].z =  1.0f;
-       m_vertex[1].x =  1.0f;  m_vertex[1].y =  0.0f;          m_vertex[1].z =  1.0f;
-       m_vertex[2].x =  1.0f;  m_vertex[2].y =  height;        m_vertex[2].z =  1.0f;
-       m_vertex[3].x =  0.0f;  m_vertex[3].y =  height;        m_vertex[3].z =  1.0f;
-       m_vertex[4].x =  0.0f;  m_vertex[4].y =  0.0f;          m_vertex[4].z =  0.0f;
-       m_vertex[5].x =  1.0f;  m_vertex[5].y =  0.0f;          m_vertex[5].z =  0.0f;
-       m_vertex[6].x =  1.0f;  m_vertex[6].y =  height;        m_vertex[6].z =  0.0f;
-       m_vertex[7].x =  0.0f;  m_vertex[7].y =  height;        m_vertex[7].z =  0.0f;
+    m_vertex[1].x = 1.0f;
+    m_vertex[1].y = 0.0f;
+    m_vertex[1].z = 1.0f;
+
+    m_vertex[2].x = 1.0f;
+    m_vertex[2].y = height;
+    m_vertex[2].z = 1.0f;
+
+    m_vertex[3].x = 0.0f;
+    m_vertex[3].y = height;
+    m_vertex[3].z = 1.0f;
+
+    m_vertex[4].x = 0.0f;
+    m_vertex[4].y = 0.0f;
+    m_vertex[4].z = 0.0f;
+
+    m_vertex[5].x = 1.0f;
+    m_vertex[5].y = 0.0f;
+    m_vertex[5].z = 0.0f;
+
+    m_vertex[6].x = 1.0f;
+    m_vertex[6].y = height;
+    m_vertex[6].z = 0.0f;
+
+    m_vertex[7].x = 0.0f;
+    m_vertex[7].y = height;
+    m_vertex[7].z = 0.0f;
 }
 
 House::~House()
@@ -93,12 +115,12 @@ void House::render()
 
 void House::update(int currentTimeInMs, int lastFrameTime)
 {
-       (void)currentTimeInMs; //prevent warning
+    (void)currentTimeInMs; //prevent warning
 
-       m_position.z += 0.0005f * (GLfloat)lastFrameTime;
+    m_position.z += 0.0005f * (GLfloat)lastFrameTime;
 
-       if (m_position.z > 3.0)
-       {
-               m_position.z -= 15.0 * 2.0 * 1.0;
-       }
+    if (m_position.z > 3.0)
+    {
+        m_position.z -= 15.0 * 2.0 * 1.0;
+    }
 }
index 5e155e0..fd81c1f 100644 (file)
@@ -39,11 +39,11 @@ MockNavi::MockNavi(float fps, float animationSpeed, SurfaceConfiguration* config
 
 void MockNavi::update(int currentTimeInMs, int lastFrameTime)
 {
-       m_camera.update(currentTimeInMs, lastFrameTime);
+    m_camera.update(currentTimeInMs, lastFrameTime);
 
-       list<IUpdateable*>::const_iterator iter = m_updateList.begin();
+    list<IUpdateable*>::const_iterator iter = m_updateList.begin();
     list<IUpdateable*>::const_iterator iterEnd = m_updateList.end();
-    
+
     for (; iter != iterEnd; ++iter)
     {
         (*iter)->update(currentTimeInMs, lastFrameTime);
@@ -54,7 +54,7 @@ void MockNavi::render()
 {
     list<IRenderable*>::const_iterator iter = m_renderList.begin();
     list<IRenderable*>::const_iterator iterEnd = m_renderList.end();
-        
+
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
     for (; iter != iterEnd; ++iter)
@@ -65,11 +65,11 @@ void MockNavi::render()
 
 void MockNavi::generateCity()
 {
-       IlmMatrix* projection = m_camera.getViewProjectionMatrix();
+    IlmMatrix* projection = m_camera.getViewProjectionMatrix();
     ShaderLighting* pShader = new ShaderLighting(projection);
 
     // generate base plate
-       vec4f groundColor(0.8, 0.8, 0.6, 1.0);
+    vec4f groundColor(0.8, 0.8, 0.6, 1.0);
     vec3f position = vec3f(0.0, -0.001, 0.0);
     vec3f size = vec3f(CITY_GRID_SIZE * 3, 0.0, -CITY_GRID_SIZE * 2.0 * m_houseCount);
     Ground* ground = new Ground(position, size, groundColor, pShader);
@@ -101,7 +101,7 @@ void MockNavi::generateCity()
     m_renderList.push_back(car);
 
     // generate houses
-       vec4f houseColor(0.6, 0.6, 0.8, 1.0);
+    vec4f houseColor(0.6, 0.6, 0.8, 1.0);
     for (int x = 0; x < 2; ++x)
     {
         for (int z = 0; z < m_houseCount; ++z)
index 1237233..bcead53 100644 (file)
@@ -103,7 +103,8 @@ bool OpenGLES2App::createX11Context(SurfaceConfiguration* config)
     XSetWindowAttributes windowAttributes;
     unsigned int windowMask;
     int colorDepth;
-    int widthCorrected, heightCorrected;
+    int widthCorrected;
+    int heightCorrected;
 
     m_x11ContextStruct.x11Window = 0;
     m_x11ContextStruct.x11Display = NULL;
@@ -182,14 +183,16 @@ bool OpenGLES2App::createEGLContext()
     m_eglContextStruct.eglSurface = NULL;
     m_eglContextStruct.eglContext = NULL;
 
-    m_eglContextStruct.eglDisplay = eglGetDisplay((EGLNativeDisplayType) m_x11ContextStruct.x11Display); // TODO: remove all C style casts in C++ code; use C++ casts
+    m_eglContextStruct.eglDisplay = eglGetDisplay(
+                        (EGLNativeDisplayType) m_x11ContextStruct.x11Display); // TODO: remove all C style casts in C++ code; use C++ casts
     EGLint eglstatus = eglGetError();
     if (!m_eglContextStruct.eglDisplay)
     {
         cout << "Error: eglGetDisplay() failed.\n";
     }
 
-    EGLint iMajorVersion, iMinorVersion;
+    EGLint iMajorVersion;
+    EGLint iMinorVersion;
     if (!eglInitialize(m_eglContextStruct.eglDisplay, &iMajorVersion,
             &iMinorVersion))
     {
@@ -258,7 +261,7 @@ bool OpenGLES2App::setupLayerMangement(SurfaceConfiguration* config)
     float opacity = config->opacity;
 
     cout << "creating surface " << surfaceid << "\n";
-    ilm_surfaceCreate( (t_ilm_nativehandle) m_x11ContextStruct.x11Window, width, height,
+    ilm_surfaceCreate((t_ilm_nativehandle) m_x11ContextStruct.x11Window, width, height,
             ILM_PIXELFORMAT_RGBA_8888, &surfaceid);
 
     cout << "set surface " << surfaceid << " dest region " << posX << ", " << posY << ", " << width << ", " << height << "\n";
index 271ed54..f8b2eda 100644 (file)
@@ -29,14 +29,14 @@ ShaderBase::ShaderBase(string vertexCode, string fragmentCode, IlmMatrix* projec
 , m_fragmentCode(fragmentCode)
 , m_projectionMatrix(projectionMatrix)
 {
-       m_vertexCode = "uniform mediump mat4 u_projectionMatrix;\n";
-       m_vertexCode += vertexCode;
-       initShader();
+    m_vertexCode = "uniform mediump mat4 u_projectionMatrix;\n";
+    m_vertexCode += vertexCode;
+    initShader();
 }
 
 ShaderBase::~ShaderBase()
 {
-       destroyShader();
+    destroyShader();
 }
 
 bool ShaderBase::initShader()
@@ -57,7 +57,8 @@ bool ShaderBase::initShader()
 
     if (glResult == GL_FALSE)
     {
-        t_ilm_int infoLength, numberChars;
+        t_ilm_int infoLength;
+        t_ilm_int numberChars;
         glGetShaderiv(fragmentShaderId, GL_INFO_LOG_LENGTH, &infoLength);
 
         // Allocate Log Space
@@ -84,7 +85,8 @@ bool ShaderBase::initShader()
 
     if (glResult == GL_FALSE)
     {
-        t_ilm_int infoLength, numberChars;
+        t_ilm_int infoLength;
+        t_ilm_int numberChars;
         glGetShaderiv(vertexShaderId, GL_INFO_LOG_LENGTH, &infoLength);
 
         // Allocate Log Space
@@ -110,7 +112,8 @@ bool ShaderBase::initShader()
 
     if (glResult == GL_FALSE)
     {
-        t_ilm_int infoLength, numberChars;
+        t_ilm_int infoLength;
+        t_ilm_int numberChars;
         glGetShaderiv(shaderProgramId, GL_INFO_LOG_LENGTH, &infoLength);
 
         // Allocate Log Space
@@ -144,9 +147,9 @@ bool ShaderBase::destroyShader()
 
 void ShaderBase::use(vec3f* position, vec4f* color)
 {
-       (void)position; // prevent warning
-       (void)color; // prevent warning
+    (void)position; // prevent warning
+    (void)color; // prevent warning
 
-       glUseProgram(shaderProgramId);
-       glUniformMatrix4fv(m_uniformProjectionMatrix, 1, GL_FALSE, m_projectionMatrix->f);
+    glUseProgram(shaderProgramId);
+    glUniformMatrix4fv(m_uniformProjectionMatrix, 1, GL_FALSE, m_projectionMatrix->f);
 }
index 94e49a8..a427a8c 100644 (file)
 #include "IlmMatrix.h"
 
 const char* vertexShaderCode =
-                   "attribute mediump vec4 a_vertex;                                 \
-                    uniform mediump mat4 u_modelMatrix;                              \
-                    varying mediump vec4 v_normal;                                   \
-             void main(void)                                                  \
-             {                                                                \
-                 gl_Position = u_projectionMatrix * u_modelMatrix * a_vertex; \
-                        v_normal = normalize(a_vertex);                              \
-             }";
+            "attribute mediump vec4 a_vertex;                                 \
+            uniform mediump mat4 u_modelMatrix;                              \
+            varying mediump vec4 v_normal;                                   \
+            void main(void)                                                  \
+            {                                                                \
+                gl_Position = u_projectionMatrix * u_modelMatrix * a_vertex; \
+                v_normal = normalize(a_vertex);                              \
+            }";
 
 const char* fragmentShaderCode =
-                   "uniform mediump vec4 u_color;   \
-                    varying mediump vec4 v_normal;  \
-                    mediump vec4 lightPosition;     \
-             void main (void)                \
-                    {                               \
-                        lightPosition = normalize(vec4(-3.0, -5.0, 10.0, 1.0));   \
-                        gl_FragColor = max(dot(v_normal, lightPosition), 0.0) * 0.5 * u_color + 0.8 * u_color;   \
-                        gl_FragColor.a = 1.0;   \
-                    }";
+            "uniform mediump vec4 u_color;   \
+            varying mediump vec4 v_normal;  \
+            mediump vec4 lightPosition;     \
+            void main (void)                \
+            {                               \
+                lightPosition = normalize(vec4(-3.0, -5.0, 10.0, 1.0));   \
+                gl_FragColor = max(dot(v_normal, lightPosition), 0.0) * 0.5 * u_color + 0.8 * u_color;   \
+                gl_FragColor.a = 1.0;   \
+            }";
 
 ShaderLighting::ShaderLighting(IlmMatrix* projectionMatrix)
 : ShaderBase(vertexShaderCode, fragmentShaderCode, projectionMatrix)
@@ -54,13 +54,12 @@ ShaderLighting::~ShaderLighting()
 
 void ShaderLighting::use(vec3f* position, vec4f* color)
 {
-       ShaderBase::use(position, color);
+    ShaderBase::use(position, color);
 
     IlmMatrix translation;
-       IlmMatrixTranslation(translation, position->x, position->y, position->z);
+    IlmMatrixTranslation(translation, position->x, position->y, position->z);
 
-       glUseProgram(shaderProgramId);
-       glUniformMatrix4fv(m_uniformModelMatrix, 1, GL_FALSE, translation.f);
+    glUseProgram(shaderProgramId);
+    glUniformMatrix4fv(m_uniformModelMatrix, 1, GL_FALSE, translation.f);
     glUniform4fv(m_uniformColor, 1, &color->r);
-
 }
index 843da83..49334fe 100644 (file)
@@ -35,30 +35,30 @@ Street::Street(vec3f position, vec3f size, vec4f color, ShaderBase* shader)
 , m_color(color)
 , m_shader(shader)
 {
-       m_index[0] = vec3u(0, 3, 2);
-       m_index[1] = vec3u(2, 1, 0);
-    
+    m_index[0] = vec3u(0, 3, 2);
+    m_index[1] = vec3u(2, 1, 0);
+
     //                             y  z
     //     3-------------2         | /
     //    /             /          |/
     //   /             /           ------x
     //  0-------------1
-    
-       m_vertex[0].x = m_position.x;
-       m_vertex[0].y = m_position.y;
-       m_vertex[0].z = m_position.z;
 
-       m_vertex[1].x = m_position.x + m_size.x;
-       m_vertex[1].y = m_position.y;
-       m_vertex[1].z = m_position.z;
-    
-       m_vertex[2].x = m_position.x + m_size.x;
-       m_vertex[2].y = m_position.y;
-       m_vertex[2].z = m_position.z + m_size.z;
-    
-       m_vertex[3].x = m_position.x;
-       m_vertex[3].y = m_position.y;
-       m_vertex[3].z = m_position.z + m_size.z;
+    m_vertex[0].x = m_position.x;
+    m_vertex[0].y = m_position.y;
+    m_vertex[0].z = m_position.z;
+
+    m_vertex[1].x = m_position.x + m_size.x;
+    m_vertex[1].y = m_position.y;
+    m_vertex[1].z = m_position.z;
+
+    m_vertex[2].x = m_position.x + m_size.x;
+    m_vertex[2].y = m_position.y;
+    m_vertex[2].z = m_position.z + m_size.z;
+
+    m_vertex[3].x = m_position.x;
+    m_vertex[3].y = m_position.y;
+    m_vertex[3].z = m_position.z + m_size.z;
 }
 
 void Street::render()
@@ -73,11 +73,11 @@ void Street::render()
 
 void Street::update(int currentTimeInMs, int lastFrameTime)
 {
-       (void)currentTimeInMs; //prevent warning
-       m_position.z += 0.0005 * lastFrameTime;
+    (void)currentTimeInMs; //prevent warning
+    m_position.z += 0.0005 * lastFrameTime;
 
-       if (m_position.z > 3.0)
-       {
-               m_position.z -= 2 * 2.0;
-       }
+    if (m_position.z > 3.0)
+    {
+        m_position.z -= 2 * 2.0;
+    }
 }
index f8e1235..e0a9c60 100644 (file)
@@ -35,7 +35,7 @@ using std::cout;
 #define DEFAULT_NOSKY    false
 #define DEFAULT_HELP     false
 
-int main (int argc, const char * argv[])
+int main(int argc, const char * argv[])
 {
     FloatArgument fps("fps", DEFAULT_FPS, argc, argv);
     FloatArgument animSpeed("anim", DEFAULT_ANIM, argc, argv);
@@ -48,7 +48,7 @@ int main (int argc, const char * argv[])
     FloatArgument opacity("opacity", DEFAULT_OPACITY, argc, argv);
     BoolArgument nosky("nosky", DEFAULT_NOSKY, argc, argv);
     BoolArgument help("help", DEFAULT_HELP, argc, argv);
-    
+
     if (help.get())
     {
         cout << "\nUsage: " << argv[0] << " [options]\n"
index 0ccf454..da92580 100644 (file)
@@ -85,7 +85,7 @@ ilmErrorTypes createLayers(t_ilm_uint LayerWidth, t_ilm_uint LayerHeight)
     for(index = 0; index < 3; ++index)
     {
         printf("Creating Layer... ");
-        error = ilm_layerCreateWithDimension(&layer[index],LayerWidth,LayerHeight);
+        error = ilm_layerCreateWithDimension(&layer[index], LayerWidth, LayerHeight);
         if(ILM_SUCCESS == error)
         {
             printf("success\n");
@@ -100,7 +100,7 @@ ilmErrorTypes createLayers(t_ilm_uint LayerWidth, t_ilm_uint LayerHeight)
         printf("Setting Layer source rectangle(0, 0, %d, %d)... \n", LayerWidth, LayerHeight);
         error = ilm_layerSetSourceRectangle(layer[index], 0, 0, LayerWidth, LayerHeight);
         printf("Setting Layer visibility(%d)... \n", 1);
-        error = ilm_layerSetVisibility(layer[index],1);
+        error = ilm_layerSetVisibility(layer[index], 1);
         if(ILM_SUCCESS == error)
         {
             printf("success\n");
@@ -144,14 +144,14 @@ int main(int argc, char **argv)
     t_ilm_uint LayerWidth = LAYERWIDTH;
     t_ilm_uint LayerHeight = LAYERHEIGHT;
 
-    if (ILM_SUCCESS != init())
+    if(ILM_SUCCESS != init())
     {
         return -1;
     }
 
     ilm_getScreenResolution(0, &LayerWidth, &LayerHeight);
 
-    if (argc == 2 && atoi(argv[1]) == 1)
+    if(argc == 2 && atoi(argv[1]) == 1)
     {
         doSceneLayeout(LayerWidth, LayerHeight);
 
@@ -162,7 +162,7 @@ int main(int argc, char **argv)
 
         changeLayerOpacity();
     }
-    else if (argc == 2 && atoi(argv[1]) == 2)
+    else if(argc == 2 && atoi(argv[1]) == 2)
     {
         RemoveSceneLayout();
     }
index 892e760..f07ebd5 100644 (file)
@@ -17,8 +17,8 @@
  *
  ****************************************************************************/
  
-#ifndef _LAYERSCENE_PROVIDER_H_
-#define _LAYERSCENE_PROVIDER_H_
+#ifndef _LAYERSCENEPROVIDER_H_
+#define _LAYERSCENEPROVIDER_H_
 
 #include "ISceneProvider.h"
 
@@ -41,4 +41,4 @@ public:
 };
 
 
-#endif /* _LAYERSCENE_PROVIDER_H_ */
+#endif /* _LAYERSCENEPROVIDER_H_ */
index db8f7e0..09c2ffb 100644 (file)
@@ -17,8 +17,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef SERVERINFO_CLIENT_PROTOCOL_H
-#define SERVERINFO_CLIENT_PROTOCOL_H
+#ifndef SERVERINFO-CLIENT-PROTOCOL_H
+#define SERVERINFO-CLIENT-PROTOCOL_H
 
 #ifdef  __cplusplus
 extern "C" {
@@ -84,4 +84,4 @@ serverinfo_get_connection_id(struct serverinfo *serverinfo)
 }
 #endif
 
-#endif /* SERVERINFO_CLIENT_PROTOCOL_H */
+#endif /* SERVERINFO-CLIENT-PROTOCOL_H */
index 7f6c014..d744581 100644 (file)
@@ -49,13 +49,13 @@ struct MethodTable
     const char *name;
     CallBackMethod function;
 };
-typedef std::map<std::string,MethodTable> CallBackTable;
+typedef std::map<std::string, MethodTable> CallBackTable;
 
 
 //=============================================================================
 // interface
 //=============================================================================
-class GenericCommunicator: public ICommunicator, protected ThreadBase, public PluginBase
+class GenericCommunicator : public ICommunicator, protected ThreadBase, public PluginBase
 {
 public:
     GenericCommunicator(ICommandExecutor& executor, Configuration& config);
@@ -69,7 +69,7 @@ public:
 
     // from ThreadBase
     virtual t_ilm_bool threadMainLoop();
-    
+
     // from PluginBase
     virtual t_ilm_const_string pluginGetName() const;
     virtual HealthCondition pluginGetHealth();
index 7ca35fe..e2056fd 100644 (file)
@@ -95,83 +95,83 @@ GenericCommunicator::GenericCommunicator(ICommandExecutor& executor, Configurati
 {
     MethodTable manager_methods[] =
     {
-        { "ServiceConnect",                   &GenericCommunicator::ServiceConnect },
-        { "ServiceDisconnect",                &GenericCommunicator::ServiceDisconnect },
-        { "Debug",                            &GenericCommunicator::Debug },
-        { "ScreenShot",                       &GenericCommunicator::ScreenShot },
-        { "ScreenShotOfLayer",                &GenericCommunicator::ScreenShotOfLayer },
-        { "ScreenShotOfSurface",              &GenericCommunicator::ScreenShotOfSurface },
-        { "GetScreenResolution",              &GenericCommunicator::GetScreenResolution },
-        { "GetNumberOfHardwareLayers",        &GenericCommunicator::GetNumberOfHardwareLayers },
-        { "GetScreenIDs",                     &GenericCommunicator::GetScreenIDs },
-        { "ListAllLayerIDS",                  &GenericCommunicator::ListAllLayerIDS },
-        { "ListAllLayerIDsOnScreen",          &GenericCommunicator::ListAllLayerIDsOnScreen },
-        { "ListAllSurfaceIDS",                &GenericCommunicator::ListAllSurfaceIDS },
-        { "ListSurfaceofLayer",               &GenericCommunicator::ListSurfaceofLayer },
-        { "GetPropertiesOfSurface",           &GenericCommunicator::GetPropertiesOfSurface },
-        { "GetPropertiesOfLayer",             &GenericCommunicator::GetPropertiesOfLayer },
-        { "CreateSurface",                    &GenericCommunicator::CreateSurface },
-        { "CreateSurfaceFromId",              &GenericCommunicator::CreateSurfaceFromId },
-        { "InitializeSurface",                &GenericCommunicator::InitializeSurface },
-        { "InitializeSurfaceFromId",          &GenericCommunicator::InitializeSurfaceFromId },
-        { "SetSurfaceNativeContent",          &GenericCommunicator::SetSurfaceNativeContent },
-        { "RemoveSurfaceNativeContent",       &GenericCommunicator::RemoveSurfaceNativeContent },
-        { "RemoveSurface",                    &GenericCommunicator::RemoveSurface },
-        { "CreateLayer",                      &GenericCommunicator::CreateLayer },
-        { "CreateLayerFromId",                &GenericCommunicator::CreateLayerFromId },
-        { "CreateLayerWithDimension",         &GenericCommunicator::CreateLayerWithDimension },
-        { "CreateLayerFromIdWithDimension",   &GenericCommunicator::CreateLayerFromIdWithDimension },
-        { "RemoveLayer",                      &GenericCommunicator::RemoveLayer },
-        { "AddSurfaceToLayer",                &GenericCommunicator::AddSurfaceToLayer },
-        { "RemoveSurfaceFromLayer",           &GenericCommunicator::RemoveSurfaceFromLayer },
-        { "SetSurfaceSourceRegion",           &GenericCommunicator::SetSurfaceSourceRegion },
-        { "SetLayerSourceRegion",             &GenericCommunicator::SetLayerSourceRegion },
-        { "SetSurfaceDestinationRegion",      &GenericCommunicator::SetSurfaceDestinationRegion },
-        { "SetSurfacePosition",               &GenericCommunicator::SetSurfacePosition },
-        { "GetSurfacePosition",               &GenericCommunicator::GetSurfacePosition },
-        { "SetSurfaceDimension",              &GenericCommunicator::SetSurfaceDimension },
-        { "SetLayerDestinationRegion",        &GenericCommunicator::SetLayerDestinationRegion },
-        { "SetLayerPosition",                 &GenericCommunicator::SetLayerPosition },
-        { "GetLayerPosition",                 &GenericCommunicator::GetLayerPosition },
-        { "SetLayerDimension",                &GenericCommunicator::SetLayerDimension },
-        { "GetLayerDimension",                &GenericCommunicator::GetLayerDimension },
-        { "GetSurfaceDimension",              &GenericCommunicator::GetSurfaceDimension },
-        { "SetSurfaceOpacity",                &GenericCommunicator::SetSurfaceOpacity },
-        { "SetLayerOpacity",                  &GenericCommunicator::SetLayerOpacity },
-        { "GetSurfaceOpacity",                &GenericCommunicator::GetSurfaceOpacity },
-        { "GetLayerOpacity",                  &GenericCommunicator::GetLayerOpacity },
-        { "SetSurfaceOrientation",            &GenericCommunicator::SetSurfaceOrientation },
-        { "GetSurfaceOrientation",            &GenericCommunicator::GetSurfaceOrientation },
-        { "SetLayerOrientation",              &GenericCommunicator::SetLayerOrientation },
-        { "GetLayerOrientation",              &GenericCommunicator::GetLayerOrientation },
-        { "GetSurfacePixelformat",            &GenericCommunicator::GetSurfacePixelformat },
-        { "SetSurfaceVisibility",             &GenericCommunicator::SetSurfaceVisibility },
-        { "SetLayerVisibility",               &GenericCommunicator::SetLayerVisibility },
-        { "GetSurfaceVisibility",             &GenericCommunicator::GetSurfaceVisibility },
-        { "GetLayerVisibility",               &GenericCommunicator::GetLayerVisibility },
-        { "SetRenderOrderOfLayers",           &GenericCommunicator::SetRenderOrderOfLayers },
+        { "ServiceConnect", &GenericCommunicator::ServiceConnect },
+        { "ServiceDisconnect", &GenericCommunicator::ServiceDisconnect },
+        { "Debug", &GenericCommunicator::Debug },
+        { "ScreenShot", &GenericCommunicator::ScreenShot },
+        { "ScreenShotOfLayer", &GenericCommunicator::ScreenShotOfLayer },
+        { "ScreenShotOfSurface", &GenericCommunicator::ScreenShotOfSurface },
+        { "GetScreenResolution", &GenericCommunicator::GetScreenResolution },
+        { "GetNumberOfHardwareLayers", &GenericCommunicator::GetNumberOfHardwareLayers },
+        { "GetScreenIDs", &GenericCommunicator::GetScreenIDs },
+        { "ListAllLayerIDS", &GenericCommunicator::ListAllLayerIDS },
+        { "ListAllLayerIDsOnScreen", &GenericCommunicator::ListAllLayerIDsOnScreen },
+        { "ListAllSurfaceIDS", &GenericCommunicator::ListAllSurfaceIDS },
+        { "ListSurfaceofLayer", &GenericCommunicator::ListSurfaceofLayer },
+        { "GetPropertiesOfSurface", &GenericCommunicator::GetPropertiesOfSurface },
+        { "GetPropertiesOfLayer", &GenericCommunicator::GetPropertiesOfLayer },
+        { "CreateSurface", &GenericCommunicator::CreateSurface },
+        { "CreateSurfaceFromId", &GenericCommunicator::CreateSurfaceFromId },
+        { "InitializeSurface", &GenericCommunicator::InitializeSurface },
+        { "InitializeSurfaceFromId", &GenericCommunicator::InitializeSurfaceFromId },
+        { "SetSurfaceNativeContent", &GenericCommunicator::SetSurfaceNativeContent },
+        { "RemoveSurfaceNativeContent", &GenericCommunicator::RemoveSurfaceNativeContent },
+        { "RemoveSurface", &GenericCommunicator::RemoveSurface },
+        { "CreateLayer", &GenericCommunicator::CreateLayer },
+        { "CreateLayerFromId", &GenericCommunicator::CreateLayerFromId },
+        { "CreateLayerWithDimension", &GenericCommunicator::CreateLayerWithDimension },
+        { "CreateLayerFromIdWithDimension", &GenericCommunicator::CreateLayerFromIdWithDimension },
+        { "RemoveLayer", &GenericCommunicator::RemoveLayer },
+        { "AddSurfaceToLayer", &GenericCommunicator::AddSurfaceToLayer },
+        { "RemoveSurfaceFromLayer", &GenericCommunicator::RemoveSurfaceFromLayer },
+        { "SetSurfaceSourceRegion", &GenericCommunicator::SetSurfaceSourceRegion },
+        { "SetLayerSourceRegion", &GenericCommunicator::SetLayerSourceRegion },
+        { "SetSurfaceDestinationRegion", &GenericCommunicator::SetSurfaceDestinationRegion },
+        { "SetSurfacePosition", &GenericCommunicator::SetSurfacePosition },
+        { "GetSurfacePosition", &GenericCommunicator::GetSurfacePosition },
+        { "SetSurfaceDimension", &GenericCommunicator::SetSurfaceDimension },
+        { "SetLayerDestinationRegion", &GenericCommunicator::SetLayerDestinationRegion },
+        { "SetLayerPosition", &GenericCommunicator::SetLayerPosition },
+        { "GetLayerPosition", &GenericCommunicator::GetLayerPosition },
+        { "SetLayerDimension", &GenericCommunicator::SetLayerDimension },
+        { "GetLayerDimension", &GenericCommunicator::GetLayerDimension },
+        { "GetSurfaceDimension", &GenericCommunicator::GetSurfaceDimension },
+        { "SetSurfaceOpacity", &GenericCommunicator::SetSurfaceOpacity },
+        { "SetLayerOpacity", &GenericCommunicator::SetLayerOpacity },
+        { "GetSurfaceOpacity", &GenericCommunicator::GetSurfaceOpacity },
+        { "GetLayerOpacity", &GenericCommunicator::GetLayerOpacity },
+        { "SetSurfaceOrientation", &GenericCommunicator::SetSurfaceOrientation },
+        { "GetSurfaceOrientation", &GenericCommunicator::GetSurfaceOrientation },
+        { "SetLayerOrientation", &GenericCommunicator::SetLayerOrientation },
+        { "GetLayerOrientation", &GenericCommunicator::GetLayerOrientation },
+        { "GetSurfacePixelformat", &GenericCommunicator::GetSurfacePixelformat },
+        { "SetSurfaceVisibility", &GenericCommunicator::SetSurfaceVisibility },
+        { "SetLayerVisibility", &GenericCommunicator::SetLayerVisibility },
+        { "GetSurfaceVisibility", &GenericCommunicator::GetSurfaceVisibility },
+        { "GetLayerVisibility", &GenericCommunicator::GetLayerVisibility },
+        { "SetRenderOrderOfLayers", &GenericCommunicator::SetRenderOrderOfLayers },
         { "SetSurfaceRenderOrderWithinLayer", &GenericCommunicator::SetSurfaceRenderOrderWithinLayer },
-        { "GetLayerType",                     &GenericCommunicator::GetLayerType },
-        { "GetLayertypeCapabilities",         &GenericCommunicator::GetLayertypeCapabilities },
-        { "GetLayerCapabilities",             &GenericCommunicator::GetLayerCapabilities },
-        { "Exit",                             &GenericCommunicator::Exit },
-        { "CommitChanges",                    &GenericCommunicator::CommitChanges },
-        { "CreateShader",                     &GenericCommunicator::CreateShader },
-        { "DestroyShader",                    &GenericCommunicator::DestroyShader },
-        { "SetShader",                        &GenericCommunicator::SetShader },
-        { "SetUniforms",                      &GenericCommunicator::SetUniforms },
-        { "SetKeyboardFocusOn",               &GenericCommunicator::SetKeyboardFocusOn },
-        { "GetKeyboardFocusSurfaceId",        &GenericCommunicator::GetKeyboardFocusSurfaceId },
-        { "UpdateInputEventAcceptanceOn",     &GenericCommunicator::UpdateInputEventAcceptanceOn },
-        { "SetSurfaceChromaKey",              &GenericCommunicator::SetSurfaceChromaKey },
-        { "SetLayerChromaKey",                &GenericCommunicator::SetLayerChromaKey },
-        { "LayerAddNotification",             &GenericCommunicator::LayerAddNotification },
-        { "SurfaceAddNotification",           &GenericCommunicator::SurfaceAddNotification },
-        { "LayerRemoveNotification",          &GenericCommunicator::LayerRemoveNotification },
-        { "SurfaceRemoveNotification",        &GenericCommunicator::SurfaceRemoveNotification },
-        { "SetOptimizationMode",              &GenericCommunicator::SetOptimizationMode },
-        { "GetOptimizationMode",              &GenericCommunicator::GetOptimizationMode },
-        { "GetPropertiesOfScreen",            &GenericCommunicator::GetPropertiesOfScreen }
+        { "GetLayerType", &GenericCommunicator::GetLayerType },
+        { "GetLayertypeCapabilities", &GenericCommunicator::GetLayertypeCapabilities },
+        { "GetLayerCapabilities", &GenericCommunicator::GetLayerCapabilities },
+        { "Exit", &GenericCommunicator::Exit },
+        { "CommitChanges", &GenericCommunicator::CommitChanges },
+        { "CreateShader", &GenericCommunicator::CreateShader },
+        { "DestroyShader", &GenericCommunicator::DestroyShader },
+        { "SetShader", &GenericCommunicator::SetShader },
+        { "SetUniforms", &GenericCommunicator::SetUniforms },
+        { "SetKeyboardFocusOn", &GenericCommunicator::SetKeyboardFocusOn },
+        { "GetKeyboardFocusSurfaceId", &GenericCommunicator::GetKeyboardFocusSurfaceId },
+        { "UpdateInputEventAcceptanceOn", &GenericCommunicator::UpdateInputEventAcceptanceOn },
+        { "SetSurfaceChromaKey", &GenericCommunicator::SetSurfaceChromaKey },
+        { "SetLayerChromaKey", &GenericCommunicator::SetLayerChromaKey },
+        { "LayerAddNotification", &GenericCommunicator::LayerAddNotification },
+        { "SurfaceAddNotification", &GenericCommunicator::SurfaceAddNotification },
+        { "LayerRemoveNotification", &GenericCommunicator::LayerRemoveNotification },
+        { "SurfaceRemoveNotification", &GenericCommunicator::SurfaceRemoveNotification },
+        { "SetOptimizationMode", &GenericCommunicator::SetOptimizationMode },
+        { "GetOptimizationMode", &GenericCommunicator::GetOptimizationMode },
+        { "GetPropertiesOfScreen", &GenericCommunicator::GetPropertiesOfScreen }
     };
 
     int entryCount = sizeof(manager_methods) / sizeof(MethodTable);
@@ -221,10 +221,10 @@ bool GenericCommunicator::start()
 
 void GenericCommunicator::stop()
 {
-    LOG_INFO("GenericCommunicator","stopping");
+    LOG_INFO("GenericCommunicator", "stopping");
 
     threadStop();
-    
+
     if (m_running)
     {
         m_ipcModule.destroy();
@@ -244,37 +244,37 @@ void GenericCommunicator::process(int timeout_ms)
     t_ilm_const_string name = m_ipcModule.getMessageName(message);
     t_ilm_client_handle senderHandle = m_ipcModule.getSenderHandle(message);
 
-    switch(messageType)
+    switch (messageType)
     {
     case IpcMessageTypeCommand:
         if (m_callBackTable.end() != m_callBackTable.find(name))
         {
             LOG_DEBUG("GenericCommunicator", "received: " << name << " from "
-                       << m_executor->getSenderName(senderHandle)
-                       << "(" << m_executor->getSenderPid(senderHandle) << ")");
+                        << m_executor->getSenderName(senderHandle)
+                        << "(" << m_executor->getSenderPid(senderHandle) << ")");
             CallBackMethod method = m_callBackTable[name].function;
             (this->*method)(message);
         }
         else
         {
             LOG_WARNING("GenericCommunicator", "Received unknown command " << name
-                  << " from " << m_executor->getSenderName(senderHandle)
-                  << "(pid " << m_executor->getSenderPid(senderHandle) << ")");
+                    << " from " << m_executor->getSenderName(senderHandle)
+                    << "(pid " << m_executor->getSenderPid(senderHandle) << ")");
         }
         processNotificationQueue();
         break;
 
     case IpcMessageTypeConnect:
         LOG_DEBUG("GenericCommunicator", "client " << m_executor->getSenderName(senderHandle)
-                  << "(pid " << m_executor->getSenderPid(senderHandle) << ") connected");
+                    << "(pid " << m_executor->getSenderPid(senderHandle) << ") connected");
         break;
 
     case IpcMessageTypeDisconnect:
         LOG_DEBUG("GenericCommunicator", "client " << m_executor->getSenderName(senderHandle)
-                  << "(pid " << m_executor->getSenderPid(senderHandle) << ") disconnected");
+                    << "(pid " << m_executor->getSenderPid(senderHandle) << ") disconnected");
         {
             const LayerMap& layers = m_executor->getScene()->getAllLayers();
-            LayerMapConstIterator layerIter =  layers.begin();
+            LayerMapConstIterator layerIter = layers.begin();
             LayerMapConstIterator layerIterEnd = layers.end();
             for (; layerIter != layerIterEnd; ++layerIter)
             {
@@ -283,7 +283,7 @@ void GenericCommunicator::process(int timeout_ms)
             }
 
             const SurfaceMap& surfaces = m_executor->getScene()->getAllSurfaces();
-            SurfaceMapConstIterator surfaceIter =  surfaces.begin();
+            SurfaceMapConstIterator surfaceIter = surfaces.begin();
             SurfaceMapConstIterator surfaceIterEnd = surfaces.end();
             for (; surfaceIter != surfaceIterEnd; ++surfaceIter)
             {
@@ -295,8 +295,8 @@ void GenericCommunicator::process(int timeout_ms)
 
     case IpcMessageTypeError:
         LOG_DEBUG("GenericCommunicator", "Received error message " << name << " from "
-                  << m_executor->getSenderName(senderHandle)
-                  << "(pid " << m_executor->getSenderPid(senderHandle) << ")");
+                    << m_executor->getSenderName(senderHandle)
+                    << "(pid " << m_executor->getSenderPid(senderHandle) << ")");
         break;
 
     case IpcMessageTypeShutdown:
@@ -305,8 +305,8 @@ void GenericCommunicator::process(int timeout_ms)
 
     default:
         LOG_DEBUG("GenericCommunicator", "Received unknown data from "
-                  << m_executor->getSenderName(senderHandle)
-                  << "(pid " << m_executor->getSenderPid(senderHandle) << "), Message type: " << messageType);
+                    << m_executor->getSenderName(senderHandle)
+                    << "(pid " << m_executor->getSenderPid(senderHandle) << "), Message type: " << messageType);
         break;
     }
     m_ipcModule.destroyMessage(message);
@@ -341,8 +341,8 @@ void GenericCommunicator::ServiceConnect(t_ilm_message message)
     m_executor->addApplicationReference(clientHandle, new IApplicationReference(processName, processId));
 
     LOG_DEBUG("GenericCommunicator", "ServiceConnect called from "
-              << m_executor->getSenderName(clientHandle)
-              << "(" << m_executor->getSenderPid(clientHandle) << ")");
+                << m_executor->getSenderName(clientHandle)
+                << "(" << m_executor->getSenderPid(clientHandle) << ")");
 
     response = m_ipcModule.createResponse(message);
     m_ipcModule.sendToClients(response, &clientHandle, 1);
@@ -355,8 +355,8 @@ void GenericCommunicator::ServiceDisconnect(t_ilm_message message)
     t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
 
     LOG_DEBUG("GenericCommunicator", "ServiceDisconnect called from "
-              << m_executor->getSenderName(clientHandle)
-              << "(" << m_executor->getSenderPid(clientHandle) << ")");
+                << m_executor->getSenderName(clientHandle)
+                << "(" << m_executor->getSenderPid(clientHandle) << ")");
 
     m_executor->removeApplicationReference(clientHandle);
 
@@ -720,7 +720,6 @@ void GenericCommunicator::CreateSurface(t_ilm_message message)
 
     pf = (PixelFormat) pixelformat;
 
-
     // First of all create the surface
     t_ilm_bool status = m_executor->execute(new SurfaceCreateCommand(clientPid, &id));
 
@@ -2330,149 +2329,149 @@ void GenericCommunicator::sendNotification(GraphicalObject* object, t_ilm_notifi
     switch (object->type)
     {
     case TypeLayer:
-    {
-        Layer* layer = static_cast<Layer*>(object);
-        if (layer)
         {
-            ApplicationReferenceList& arl = layer->getNotificationClients();
-
-            if (arl.size())
+            Layer* layer = static_cast<Layer*>(object);
+            if (layer)
             {
-                t_ilm_message notification;
-                Rectangle dest = layer->getDestinationRegion();
-                Rectangle src = layer->getSourceRegion();
-                OrientationType orientation = layer->getOrientation();
-
-                unsigned char chromaKeyRed = 0;
-                unsigned char chromaKeyGreen = 0;
-                unsigned char chromaKeyBlue = 0;
-                layer->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
-
-                std::stringstream notificationName;
-                notificationName << "NotificationForLayer" << layer->getID();
-
-                notification = m_ipcModule.createNotification(notificationName.str().c_str());
-                m_ipcModule.appendUint(notification, layer->getID());
-                m_ipcModule.appendUint(notification, mask);
-
-                m_ipcModule.appendDouble(notification, layer->getOpacity());
-                m_ipcModule.appendUint(notification, src.x);
-                m_ipcModule.appendUint(notification, src.y);
-                m_ipcModule.appendUint(notification, src.width);
-                m_ipcModule.appendUint(notification, src.height);
-                m_ipcModule.appendUint(notification, layer->OriginalSourceWidth);
-                m_ipcModule.appendUint(notification, layer->OriginalSourceHeight);
-                m_ipcModule.appendUint(notification, dest.x);
-                m_ipcModule.appendUint(notification, dest.y);
-                m_ipcModule.appendUint(notification, dest.width);
-                m_ipcModule.appendUint(notification, dest.height);
-                m_ipcModule.appendUint(notification, orientation);
-                m_ipcModule.appendBool(notification, layer->getVisibility());
-                m_ipcModule.appendUint(notification, layer->getLayerType());
-                m_ipcModule.appendBool(notification, layer->getChromaKeyEnabled());
-                m_ipcModule.appendUint(notification, chromaKeyRed);
-                m_ipcModule.appendUint(notification, chromaKeyGreen);
-                m_ipcModule.appendUint(notification, chromaKeyBlue);
-                m_ipcModule.appendInt(notification, layer->getCreatorPid());
-
-                int clientCount = arl.size();
-                t_ilm_client_handle clientArray[256];
-
-                ApplicationReferenceList::iterator iter = arl.begin();
-                ApplicationReferenceList::iterator end = arl.end();
-
-                for (int clientNumber = 0;
-                     iter != end, clientNumber < 256;
-                     ++iter, ++clientNumber)
-                {
-                    t_ilm_client_handle client = *iter;
-                    clientArray[clientNumber] = client;
-                }
+                ApplicationReferenceList& arl = layer->getNotificationClients();
 
-                LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): layer " << layer->getID() << " was updated.");
-
-                if (!m_ipcModule.sendToClients(notification, clientArray, clientCount))
+                if (arl.size())
                 {
-                    LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
+                    t_ilm_message notification;
+                    Rectangle dest = layer->getDestinationRegion();
+                    Rectangle src = layer->getSourceRegion();
+                    OrientationType orientation = layer->getOrientation();
+
+                    unsigned char chromaKeyRed = 0;
+                    unsigned char chromaKeyGreen = 0;
+                    unsigned char chromaKeyBlue = 0;
+                    layer->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
+
+                    std::stringstream notificationName;
+                    notificationName << "NotificationForLayer" << layer->getID();
+
+                    notification = m_ipcModule.createNotification(notificationName.str().c_str());
+                    m_ipcModule.appendUint(notification, layer->getID());
+                    m_ipcModule.appendUint(notification, mask);
+
+                    m_ipcModule.appendDouble(notification, layer->getOpacity());
+                    m_ipcModule.appendUint(notification, src.x);
+                    m_ipcModule.appendUint(notification, src.y);
+                    m_ipcModule.appendUint(notification, src.width);
+                    m_ipcModule.appendUint(notification, src.height);
+                    m_ipcModule.appendUint(notification, layer->OriginalSourceWidth);
+                    m_ipcModule.appendUint(notification, layer->OriginalSourceHeight);
+                    m_ipcModule.appendUint(notification, dest.x);
+                    m_ipcModule.appendUint(notification, dest.y);
+                    m_ipcModule.appendUint(notification, dest.width);
+                    m_ipcModule.appendUint(notification, dest.height);
+                    m_ipcModule.appendUint(notification, orientation);
+                    m_ipcModule.appendBool(notification, layer->getVisibility());
+                    m_ipcModule.appendUint(notification, layer->getLayerType());
+                    m_ipcModule.appendBool(notification, layer->getChromaKeyEnabled());
+                    m_ipcModule.appendUint(notification, chromaKeyRed);
+                    m_ipcModule.appendUint(notification, chromaKeyGreen);
+                    m_ipcModule.appendUint(notification, chromaKeyBlue);
+                    m_ipcModule.appendInt(notification, layer->getCreatorPid());
+
+                    int clientCount = arl.size();
+                    t_ilm_client_handle clientArray[256];
+
+                    ApplicationReferenceList::iterator iter = arl.begin();
+                    ApplicationReferenceList::iterator end = arl.end();
+
+                    for (int clientNumber = 0;
+                            iter != end, clientNumber < 256;
+                            ++iter, ++clientNumber)
+                    {
+                        t_ilm_client_handle client = *iter;
+                        clientArray[clientNumber] = client;
+                    }
+
+                    LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): layer " << layer->getID() << " was updated.");
+
+                    if (!m_ipcModule.sendToClients(notification, clientArray, clientCount))
+                    {
+                        LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
+                    }
+
+                    m_ipcModule.destroyMessage(notification);
                 }
-
-                m_ipcModule.destroyMessage(notification);
             }
         }
-    }
-    break;
+        break;
     case TypeSurface:
-    {
-        Surface* surface = static_cast<Surface*>(object);
-        if (surface)
         {
-            ApplicationReferenceList& arl = surface->getNotificationClients();
-
-            if (arl.size())
+            Surface* surface = static_cast<Surface*>(object);
+            if (surface)
             {
-                t_ilm_message notification;
-                std::stringstream notificationName;
-                notificationName << "NotificationForSurface" << surface->getID();
-
-                unsigned char chromaKeyRed = 0;
-                unsigned char chromaKeyGreen = 0;
-                unsigned char chromaKeyBlue = 0;
-                surface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
-
-                notification = m_ipcModule.createNotification(notificationName.str().c_str());
-                m_ipcModule.appendUint(notification, surface->getID());
-                m_ipcModule.appendUint(notification, mask);
-
-                m_ipcModule.appendDouble(notification, surface->getOpacity());
-                m_ipcModule.appendUint(notification, surface->getSourceRegion().x);
-                m_ipcModule.appendUint(notification, surface->getSourceRegion().y);
-                m_ipcModule.appendUint(notification, surface->getSourceRegion().width);
-                m_ipcModule.appendUint(notification, surface->getSourceRegion().height);
-                m_ipcModule.appendUint(notification, surface->OriginalSourceWidth);
-                m_ipcModule.appendUint(notification, surface->OriginalSourceHeight);
-                m_ipcModule.appendUint(notification, surface->getDestinationRegion().x);
-                m_ipcModule.appendUint(notification, surface->getDestinationRegion().y);
-                m_ipcModule.appendUint(notification, surface->getDestinationRegion().width);
-                m_ipcModule.appendUint(notification, surface->getDestinationRegion().height);
-                m_ipcModule.appendUint(notification, surface->getOrientation());
-                m_ipcModule.appendBool(notification, surface->getVisibility());
-                m_ipcModule.appendUint(notification, surface->frameCounter);
-                m_ipcModule.appendUint(notification, surface->drawCounter);
-                m_ipcModule.appendUint(notification, surface->updateCounter);
-                m_ipcModule.appendUint(notification, surface->getPixelFormat());
-                m_ipcModule.appendUint(notification, surface->getNativeContent());
-                m_ipcModule.appendUint(notification, surface->getInputEventAcceptanceOnDevices());
-                m_ipcModule.appendBool(notification, surface->getChromaKeyEnabled());
-                m_ipcModule.appendUint(notification, chromaKeyRed);
-                m_ipcModule.appendUint(notification, chromaKeyGreen);
-                m_ipcModule.appendUint(notification, chromaKeyBlue);
-                m_ipcModule.appendInt(notification, surface->getCreatorPid());
-
-                int clientCount = arl.size();
-                t_ilm_client_handle clients[256];
-
-                ApplicationReferenceList::iterator iter = arl.begin();
-                ApplicationReferenceList::iterator end = arl.end();
-
-                for (int clientNumber = 0;
-                     iter != end, clientNumber < 256;
-                     ++iter, ++clientNumber)
-                {
-                    clients[clientNumber] = *iter;
-                }
+                ApplicationReferenceList& arl = surface->getNotificationClients();
 
-                LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): surface " << surface->getID() << " was updated.");
-
-                if (!m_ipcModule.sendToClients(notification, clients, clientCount))
+                if (arl.size())
                 {
-                    LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
+                    t_ilm_message notification;
+                    std::stringstream notificationName;
+                    notificationName << "NotificationForSurface" << surface->getID();
+
+                    unsigned char chromaKeyRed = 0;
+                    unsigned char chromaKeyGreen = 0;
+                    unsigned char chromaKeyBlue = 0;
+                    surface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
+
+                    notification = m_ipcModule.createNotification(notificationName.str().c_str());
+                    m_ipcModule.appendUint(notification, surface->getID());
+                    m_ipcModule.appendUint(notification, mask);
+
+                    m_ipcModule.appendDouble(notification, surface->getOpacity());
+                    m_ipcModule.appendUint(notification, surface->getSourceRegion().x);
+                    m_ipcModule.appendUint(notification, surface->getSourceRegion().y);
+                    m_ipcModule.appendUint(notification, surface->getSourceRegion().width);
+                    m_ipcModule.appendUint(notification, surface->getSourceRegion().height);
+                    m_ipcModule.appendUint(notification, surface->OriginalSourceWidth);
+                    m_ipcModule.appendUint(notification, surface->OriginalSourceHeight);
+                    m_ipcModule.appendUint(notification, surface->getDestinationRegion().x);
+                    m_ipcModule.appendUint(notification, surface->getDestinationRegion().y);
+                    m_ipcModule.appendUint(notification, surface->getDestinationRegion().width);
+                    m_ipcModule.appendUint(notification, surface->getDestinationRegion().height);
+                    m_ipcModule.appendUint(notification, surface->getOrientation());
+                    m_ipcModule.appendBool(notification, surface->getVisibility());
+                    m_ipcModule.appendUint(notification, surface->frameCounter);
+                    m_ipcModule.appendUint(notification, surface->drawCounter);
+                    m_ipcModule.appendUint(notification, surface->updateCounter);
+                    m_ipcModule.appendUint(notification, surface->getPixelFormat());
+                    m_ipcModule.appendUint(notification, surface->getNativeContent());
+                    m_ipcModule.appendUint(notification, surface->getInputEventAcceptanceOnDevices());
+                    m_ipcModule.appendBool(notification, surface->getChromaKeyEnabled());
+                    m_ipcModule.appendUint(notification, chromaKeyRed);
+                    m_ipcModule.appendUint(notification, chromaKeyGreen);
+                    m_ipcModule.appendUint(notification, chromaKeyBlue);
+                    m_ipcModule.appendInt(notification, surface->getCreatorPid());
+
+                    int clientCount = arl.size();
+                    t_ilm_client_handle clients[256];
+
+                    ApplicationReferenceList::iterator iter = arl.begin();
+                    ApplicationReferenceList::iterator end = arl.end();
+
+                    for (int clientNumber = 0;
+                            iter != end, clientNumber < 256;
+                            ++iter, ++clientNumber)
+                    {
+                        clients[clientNumber] = *iter;
+                    }
+
+                    LOG_DEBUG("GenericCommunicator", "Sending " << clientCount << " notification(s): surface " << surface->getID() << " was updated.");
+
+                    if (!m_ipcModule.sendToClients(notification, clients, clientCount))
+                    {
+                        LOG_ERROR("GenericCommunicator", "Sending notification to clients failed.")
+                    }
+
+                    m_ipcModule.destroyMessage(notification);
                 }
-
-                m_ipcModule.destroyMessage(notification);
             }
         }
-    }
-    break;
+        break;
     default:
         LOG_INFO("GenericCommunicator", "Unknown notification found in queue.");
         break;
@@ -2494,26 +2493,26 @@ void GenericCommunicator::SetOptimizationMode(t_ilm_message message)
     t_ilm_message response;
     OptimizationType optimizationId;
     OptimizationModeType optimizationMode;
-    unsigned int o;    
+    unsigned int optMode;
     t_ilm_client_handle clientHandle = m_ipcModule.getSenderHandle(message);
     t_ilm_uint clientPid = m_executor->getSenderPid(clientHandle);
 
-    m_ipcModule.getUint(message,&o);
-    optimizationId = (OptimizationType) o;
-    m_ipcModule.getUint(message,&o);
-    optimizationMode = (OptimizationModeType) o;
+    m_ipcModule.getUint(message, &optMode);
+    optimizationId = (OptimizationType)optMode;
+    m_ipcModule.getUint(message, &optMode);
+    optimizationMode = (OptimizationModeType)optMode;
 
     t_ilm_bool status = m_executor->execute(new SetOptimizationModeCommand(clientPid, optimizationId, optimizationMode));
     if (status)
     {
-        response = m_ipcModule.createResponse(message);       
+        response = m_ipcModule.createResponse(message);
     }
     else
     {
         response = m_ipcModule.createErrorResponse(message);
         m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
     }
-    m_ipcModule.sendToClients(response,&clientHandle,1);
+    m_ipcModule.sendToClients(response, &clientHandle, 1);
     m_ipcModule.destroyMessage(response);
 }
 
@@ -2526,24 +2525,22 @@ void GenericCommunicator::GetOptimizationMode(t_ilm_message message)
     OptimizationModeType optimizationMode;
     unsigned int o;
 
-    m_ipcModule.getUint(message,&o);
+    m_ipcModule.getUint(message, &o);
     optimizationId = (OptimizationType)o;
 
     t_ilm_bool status = m_executor->execute(new GetOptimizationModeCommand(clientPid, optimizationId, &optimizationMode));
     if (status)
     {
-        
         response = m_ipcModule.createResponse(message);
-        m_ipcModule.appendUint(response,(unsigned int)optimizationMode);
+        m_ipcModule.appendUint(response, (unsigned int)optimizationMode);
     }
     else
     {
         response = m_ipcModule.createErrorResponse(message);
         m_ipcModule.appendUint(response, ILM_ERROR_RESOURCE_NOT_FOUND);
     }
-    m_ipcModule.sendToClients(response,&clientHandle,1);
+    m_ipcModule.sendToClients(response, &clientHandle, 1);
     m_ipcModule.destroyMessage(response);
-
 }
 
 void GenericCommunicator::GetPropertiesOfScreen(t_ilm_message message)
@@ -2571,7 +2568,7 @@ void GenericCommunicator::GetPropertiesOfScreen(t_ilm_message message)
 
         response = m_ipcModule.createResponse(message);
         m_ipcModule.appendUintArray(response, layerIdVector.data(), layerIdVector.size());
-        m_ipcModule.appendUint(response,numberOfHardwareLayers);
+        m_ipcModule.appendUint(response, numberOfHardwareLayers);
         m_ipcModule.appendUint(response, resolution[0]);
         m_ipcModule.appendUint(response, resolution[1]);
     }
index 6006505..80a6287 100644 (file)
@@ -17,8 +17,8 @@
 *
 ****************************************************************************/
 
-#ifndef MockCommandExecutor_H_
-#define MockCommandExecutor_H_
+#ifndef MOCK_COMMANDEXECUTOR_H_
+#define MOCK_COMMANDEXECUTOR_H_
 
 #include "GraphicalSurface.h"
 #include "ICommand.h"
@@ -61,4 +61,4 @@ class MockCommandExecutor : public ICommandExecutor {
   MOCK_METHOD1(getEnqueuedCommands, CommandList&(unsigned int clientPid));
 };
 
-#endif /* MockCommandExecutor_H_ */
+#endif /* MOCK_COMMANDEXECUTOR_H_ */
index 4fffdb9..d258557 100644 (file)
@@ -17,8 +17,8 @@
 *
 ****************************************************************************/
 
-#ifndef MockCommunicator_H_
-#define MockCommunicator_H_
+#ifndef MOCK_COMMUNICATOR_H_
+#define MOCK_COMMUNICATOR_H_
 
 #include "AbstractCommunicator.h"
 #include <list>
@@ -32,4 +32,4 @@ class MockCommunicator : public AbstractCommunicator {
 
 };
 
-#endif /* MockCommunicator_H_ */
+#endif /* MOCK_COMMUNICATOR_H_ */
index 3595f42..4cf9061 100644 (file)
@@ -17,8 +17,8 @@
 *
 ****************************************************************************/
 
-#ifndef MockLayerList_H_
-#define MockLayerList_H_
+#ifndef MOCK_LAYERLIST_H_
+#define MOCK_LAYERLIST_H_
 
 #include "Scene.h"
 #include <list>
@@ -39,4 +39,4 @@ class MockLayerList : public Scene {
   MOCK_METHOD0(unlockScene, void());
 };
 
-#endif /* MockLayerList_H_ */
+#endif /* MOCK_LAYERLIST_H_ */
index ef33d73..39d0009 100644 (file)
@@ -17,8 +17,8 @@
 *
 ****************************************************************************/
 
-#ifndef MockRenderer_H_
-#define MockRenderer_H_
+#ifndef MOCK_RENDERER_H_
+#define MOCK_RENDERER_H_
 
 #include "AbstractRenderer.h"
 #include <list>
@@ -33,4 +33,4 @@ class MockRenderer : public AbstractRenderer {
 };
 
 
-#endif /* MockRenderer_H_ */
+#endif /* MOCK_RENDERER_H_ */
index 2d36718..21eb536 100644 (file)
@@ -17,8 +17,8 @@
 *
 ****************************************************************************/
 
-#ifndef __HEALTHSYSTEMD_H__
-#define __HEALTHSYSTEMD_H__
+#ifndef __SYSTEMDHEALTHMONITOR_H__
+#define __SYSTEMDHEALTHMONITOR_H__
 
 #include "IHealthMonitor.h"
 #include "ThreadBase.h"
@@ -45,9 +45,9 @@ private:
 
     // from ThreadBase
     virtual t_ilm_bool threadMainLoop();
-    
+
 private:
     int mIntervalInMs;
 };
 
-#endif // __HEALTHSYSTEMD_H__
\ No newline at end of file
+#endif // __SYSTEMDHEALTHMONITOR_H__
index ca3b681..f63cd88 100644 (file)
@@ -102,4 +102,4 @@ t_ilm_bool SystemdHealthMonitor::threadMainLoop()
     return ILM_TRUE;
 }
 
-DECLARE_LAYERMANAGEMENT_PLUGIN(SystemdHealthMonitor)
\ No newline at end of file
+DECLARE_LAYERMANAGEMENT_PLUGIN(SystemdHealthMonitor)
index a2df9bf..7b9d87d 100644 (file)
  *
  ****************************************************************************/
 
-#ifndef _DBUSINTROSPECTION_H_
-#define _DBUSINTROSPECTION_H_
+#ifndef _INTROSPECTION_H_
+#define _INTROSPECTION_H_
 
 #include "common.h"
 
 void generateIntrospectionString(char* msgBuffer);
 
-#endif /* _DBUSINTROSPECTION_H_ */
+#endif /* _INTROSPECTION_H_ */
index f2b6c93..79dc68f 100644 (file)
@@ -186,7 +186,9 @@ DBusHandlerResult filterNameOwnerChanged(DBusConnection *connection, DBusMessage
 
     if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS, "NameOwnerChanged"))
     {
-        char *name, *old, *new;
+        char* name;
+        char* old;
+        char* new;
         if (!dbus_message_get_args(message, NULL,
                                   DBUS_TYPE_STRING, &name,
                                   DBUS_TYPE_STRING, &old,
@@ -203,7 +205,6 @@ DBusHandlerResult filterNameOwnerChanged(DBusConnection *connection, DBusMessage
             gpIncomingMessage->pMessage = dbus_message_copy(message);
             dbus_message_set_sender(gpIncomingMessage->pMessage, old);
         }
-
     }
 
     return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
index cb333c1..822462e 100644 (file)
@@ -47,9 +47,9 @@ t_ilm_bool initServiceMode()
     int ret;
 
     const char* rule = "type='signal',"
-                           "sender='"DBUS_INTERFACE_DBUS"',"
-                           "interface='"DBUS_INTERFACE_DBUS"',"
-                           "member='NameOwnerChanged'";
+                        "sender='"DBUS_INTERFACE_DBUS"',"
+                        "interface='"DBUS_INTERFACE_DBUS"',"
+                        "member='NameOwnerChanged'";
 
     memset(&gDbus, 0, sizeof(gDbus));
 
@@ -61,7 +61,7 @@ t_ilm_bool initServiceMode()
     dbus_error_init(&gDbus.error);
 
     useSessionBus = getenv("LM_USE_SESSION_BUS");
-    if (useSessionBus && strcmp(useSessionBus, "enable") == 0 )
+    if (useSessionBus && strcmp(useSessionBus, "enable") == 0)
     {
         gDbus.type = DBUS_BUS_SESSION;
         printf("DbusIpcmodule: using session bus\n");
@@ -155,7 +155,7 @@ t_ilm_bool initServiceMode()
         exit(1);
     }
 
-    if(!dbus_connection_set_watch_functions(gDbus.connection,
+    if (!dbus_connection_set_watch_functions(gDbus.connection,
                                             addWatch,
                                             removeWatch,
                                             toggleWatch,
@@ -183,7 +183,7 @@ t_ilm_bool initClientMode()
     dbus_error_init(&gDbus.error);
 
     useSessionBus = getenv("LM_USE_SESSION_BUS");
-    if (useSessionBus && strcmp(useSessionBus, "enable") == 0 )
+    if (useSessionBus && strcmp(useSessionBus, "enable") == 0)
     {
         gDbus.type = DBUS_BUS_SESSION;
         printf("DbusIpcmodule: using session bus\n");
@@ -252,7 +252,7 @@ t_ilm_bool initClientMode()
         exit(1);
     }
 
-    if(!dbus_connection_set_watch_functions(gDbus.connection,
+    if (!dbus_connection_set_watch_functions(gDbus.connection,
                                             addWatch,
                                             removeWatch,
                                             toggleWatch,
@@ -307,9 +307,9 @@ t_ilm_bool destroyService()
     t_ilm_bool errorset;
 
     const char* rule = "type='signal',"
-                       "sender='"DBUS_INTERFACE_DBUS"',"
-                       "interface='"DBUS_INTERFACE_DBUS"',"
-                       "member='NameOwnerChanged'";
+                        "sender='"DBUS_INTERFACE_DBUS"',"
+                        "interface='"DBUS_INTERFACE_DBUS"',"
+                        "member='NameOwnerChanged'";
 
     dbus_error_init(&err);
 
index 297cc95..96ed45e 100644 (file)
@@ -69,80 +69,80 @@ void generateIntrospectionString(char* msgBuffer)
      */
     struct IntrospectionTable introspectionInterface[] =
     {
-        { "ServiceConnect",                   "u",     ""               },
-        { "ServiceDisconnect",                "u",     ""               },
-        { "Debug",                            "b",     ""               },
-        { "ScreenShot",                       "us",    ""               },
-        { "ScreenShotOfLayer",                "su",    ""               },
-        { "ScreenShotOfSurface",              "su",    ""               },
-        { "GetScreenResolution",              "u",     "uu"             },
-        { "GetNumberOfHardwareLayers",        "u",     "u"              },
-        { "GetScreenIDs",                     "",      "au"             },
-        { "ListAllLayerIDS",                  "",      "au"             },
-        { "ListAllLayerIDsOnScreen",          "u",     "au"             },
-        { "ListAllSurfaceIDS",                "",      "au"             },
-        { "ListSurfaceofLayer",               "u",     "au"             },
-        { "GetPropertiesOfSurface",           "u",     "duuuuuuuuuuybu" },
-        { "GetPropertiesOfLayer",             "u",     "duuuuuuuuuuyb"  },
-        { "CreateSurface",                    "uuuu",  "u"              },
-        { "CreateSurfaceFromId",              "uuuuu", "u"              },
-        { "InitializeSurface",                "",      "u"              },
-        { "InitializeSurfaceFromId",          "u",     "u"              },
-        { "SetSurfaceNativeContent",          "uuuuu", ""               },
-        { "RemoveSurfaceNativeContent",       "u",     ""               },
-        { "RemoveSurface",                    "u",     ""               },
-        { "CreateLayer",                      "",      "u"              },
-        { "CreateLayerFromId",                "u",     "u"              },
-        { "CreateLayerWithDimension",         "uu",    "u"              },
-        { "CreateLayerFromIdWithDimension",   "uuu",   "u"              },
-        { "RemoveLayer",                      "u",     ""               },
-        { "AddSurfaceToLayer",                "uu",    ""               },
-        { "RemoveSurfaceFromLayer",           "uu",    ""               },
-        { "SetSurfaceSourceRegion",           "uuuuu", ""               },
-        { "SetLayerSourceRegion",             "uuuuu", ""               },
-        { "SetSurfaceDestinationRegion",      "uuuuu", ""               },
-        { "SetSurfacePosition",               "uuu",   ""               },
-        { "GetSurfacePosition",               "u",     "uu"             },
-        { "SetSurfaceDimension",              "uuu",   ""               },
-        { "SetLayerDestinationRegion",        "uuuuu", ""               },
-        { "SetLayerPosition",                 "uuu",   ""               },
-        { "GetLayerPosition",                 "u",     "uu"             },
-        { "SetLayerDimension",                "uuu",   ""               },
-        { "GetLayerDimension",                "u",     "uu"             },
-        { "GetSurfaceDimension",              "u",     "uu"             },
-        { "SetSurfaceOpacity",                "ud",    ""               },
-        { "SetLayerOpacity",                  "ud",    ""               },
-        { "GetSurfaceOpacity",                "u",     "d"              },
-        { "GetLayerOpacity",                  "u",     "d"              },
-        { "SetSurfaceOrientation",            "uu",    ""               },
-        { "GetSurfaceOrientation",            "uu",    ""               },
-        { "SetLayerOrientation",              "uu",    ""               },
-        { "GetLayerOrientation",              "uu",    ""               },
-        { "GetSurfacePixelformat",            "u",     "u"              },
-        { "SetSurfaceVisibility",             "ub",    ""               },
-        { "SetLayerVisibility",               "ub",    ""               },
-        { "GetSurfaceVisibility",             "u",     "b"              },
-        { "GetLayerVisibility",               "u",     "b"              },
-        { "SetRenderOrderOfLayers",           "auu",   ""               },
-        { "SetSurfaceRenderOrderWithinLayer", "uau",   ""               },
-        { "GetLayerType",                     "u",     "u"              },
-        { "GetLayertypeCapabilities",         "u",     "u"              },
-        { "GetLayerCapabilities",             "u",     "u"              },
-        { "Exit",                             "",      ""               },
-        { "CommitChanges",                    "",      ""               },
-        { "CreateShader",                     "ss",    "u"              },
-        { "DestroyShader",                    "u",     ""               },
-        { "SetShader",                        "uu",    ""               },
-        { "SetUniforms",                      "uas",   ""               },
-        { "SetKeyboardFocusOn",               "u",     ""               },
-        { "GetKeyboardFocusSurfaceId",        "",      "u"              },
-        { "UpdateInputEventAcceptanceOn",     "uub",   ""               },
-        { "LayerAddNotification",             "u",     ""               },
-        { "LayerRemoveNotification",          "u",     ""               },
-        { "SurfaceAddNotification",           "u",     ""               },
-        { "SurfaceRemoveNotification",        "u",     ""               },
-        { "SetOptimizationMode",              "uu",    ""               },
-        { "GetOptimizationMode",              "u",     "u"              }
+        { "ServiceConnect", "u", "" },
+        { "ServiceDisconnect", "u", "" },
+        { "Debug", "b", ""},
+        { "ScreenShot", "us", "" },
+        { "ScreenShotOfLayer", "su", "" },
+        { "ScreenShotOfSurface", "su", "" },
+        { "GetScreenResolution", "u", "uu" },
+        { "GetNumberOfHardwareLayers", "u", "u" },
+        { "GetScreenIDs", "", "au" },
+        { "ListAllLayerIDS", "", "au" },
+        { "ListAllLayerIDsOnScreen", "u", "au" },
+        { "ListAllSurfaceIDS", "", "au" },
+        { "ListSurfaceofLayer", "u", "au" },
+        { "GetPropertiesOfSurface", "u", "duuuuuuuuuuybu" },
+        { "GetPropertiesOfLayer", "u", "duuuuuuuuuuyb" },
+        { "CreateSurface", "uuuu", "u" },
+        { "CreateSurfaceFromId", "uuuuu", "u" },
+        { "InitializeSurface", "", "u" },
+        { "InitializeSurfaceFromId", "u", "u" },
+        { "SetSurfaceNativeContent", "uuuuu", "" },
+        { "RemoveSurfaceNativeContent", "u", "" },
+        { "RemoveSurface", "u", "" },
+        { "CreateLayer", "", "u" },
+        { "CreateLayerFromId", "u", "u" },
+        { "CreateLayerWithDimension", "uu", "u" },
+        { "CreateLayerFromIdWithDimension", "uuu", "u" },
+        { "RemoveLayer", "u", "" },
+        { "AddSurfaceToLayer", "uu", "" },
+        { "RemoveSurfaceFromLayer", "uu", "" },
+        { "SetSurfaceSourceRegion", "uuuuu", "" },
+        { "SetLayerSourceRegion", "uuuuu", "" },
+        { "SetSurfaceDestinationRegion", "uuuuu", "" },
+        { "SetSurfacePosition", "uuu", "" },
+        { "GetSurfacePosition", "u", "uu" },
+        { "SetSurfaceDimension", "uuu", "" },
+        { "SetLayerDestinationRegion", "uuuuu", "" },
+        { "SetLayerPosition", "uuu", "" },
+        { "GetLayerPosition", "u", "uu" },
+        { "SetLayerDimension", "uuu", "" },
+        { "GetLayerDimension", "u", "uu" },
+        { "GetSurfaceDimension", "u", "uu" },
+        { "SetSurfaceOpacity", "ud", "" },
+        { "SetLayerOpacity", "ud", "" },
+        { "GetSurfaceOpacity", "u", "d" },
+        { "GetLayerOpacity", "u", "d" },
+        { "SetSurfaceOrientation", "uu", "" },
+        { "GetSurfaceOrientation", "uu", "" },
+        { "SetLayerOrientation", "uu", "" },
+        { "GetLayerOrientation", "uu", "" },
+        { "GetSurfacePixelformat", "u", "u" },
+        { "SetSurfaceVisibility", "ub", "" },
+        { "SetLayerVisibility", "ub", "" },
+        { "GetSurfaceVisibility", "u", "b" },
+        { "GetLayerVisibility", "u", "b" },
+        { "SetRenderOrderOfLayers", "auu", "" },
+        { "SetSurfaceRenderOrderWithinLayer", "uau", "" },
+        { "GetLayerType", "u", "u" },
+        { "GetLayertypeCapabilities", "u", "u" },
+        { "GetLayerCapabilities", "u", "u" },
+        { "Exit", "", "" },
+        { "CommitChanges", "", "" },
+        { "CreateShader", "ss", "u" },
+        { "DestroyShader", "u", "" },
+        { "SetShader", "uu", "" },
+        { "SetUniforms", "uas", "" },
+        { "SetKeyboardFocusOn", "u", "" },
+        { "GetKeyboardFocusSurfaceId", "", "u" },
+        { "UpdateInputEventAcceptanceOn", "uub", "" },
+        { "LayerAddNotification", "u", "" },
+        { "LayerRemoveNotification", "u", "" },
+        { "SurfaceAddNotification", "u", "" },
+        { "SurfaceRemoveNotification", "u", "" },
+        { "SetOptimizationMode", "uu", "" },
+        { "GetOptimizationMode", "u", "u" }
     };
 
     int introspectionInterfaceCount = sizeof(introspectionInterface) / sizeof(struct IntrospectionTable);
@@ -171,31 +171,31 @@ void generateIntrospectionString(char* msgBuffer)
 
         msgBuffer += openMethod(msgBuffer, methodName);
 
-        for(i = 0; i < parameterLength; ++i)
+        for (i = 0; i < parameterLength; ++i)
         {
             switch (parameter[i])
             {
-                case 'a':
-                    i++;
-                    msgBuffer += addArrayArgument(msgBuffer, "", "in", &parameter[i]);
-                    break;
-                default:
-                    msgBuffer += addArgument(msgBuffer, "", "in", &parameter[i]);
-                    break;
+            case 'a':
+                i++;
+                msgBuffer += addArrayArgument(msgBuffer, "", "in", &parameter[i]);
+                break;
+            default:
+                msgBuffer += addArgument(msgBuffer, "", "in", &parameter[i]);
+                break;
             }
         }
 
-        for(i = 0; i < returnValueLength; ++i)
+        for (i = 0; i < returnValueLength; ++i)
         {
             switch (returnValue[i])
             {
-                case 'a':
-                    i++;
-                    msgBuffer += addArrayArgument(msgBuffer, "", "out", &returnValue[i]);
-                    break;
-                default:
-                    msgBuffer += addArgument(msgBuffer, "", "out", &returnValue[i]);
-                    break;
+            case 'a':
+                i++;
+                msgBuffer += addArrayArgument(msgBuffer, "", "out", &returnValue[i]);
+                break;
+            default:
+                msgBuffer += addArgument(msgBuffer, "", "out", &returnValue[i]);
+                break;
             }
         }
 
index 9e0d0c5..49da87d 100644 (file)
@@ -257,7 +257,7 @@ t_ilm_message receive(t_ilm_int timeoutInMs)
     readFds = gDbus.incomingSockets;
     writeFds = gDbus.outgoingSockets;
     fdMax = (gDbus.incomingSocketsMax > gDbus.outgoingSocketsMax) ?
-                 gDbus.incomingSocketsMax : gDbus.outgoingSocketsMax;
+                gDbus.incomingSocketsMax : gDbus.outgoingSocketsMax;
 
     fdsReady = 0;
 
@@ -417,8 +417,8 @@ void registerSignalForNotification(dbusmessage* message, char* signalName)
     char rule[1024];
     t_ilm_uint id;
     dbus_message_get_args(message->pMessage, NULL,
-                          DBUS_TYPE_UINT32, &id,
-                          DBUS_TYPE_INVALID);
+                            DBUS_TYPE_UINT32, &id,
+                            DBUS_TYPE_INVALID);
 
     sprintf(rule,
             "type='signal',sender='%s',interface='%s',member='%s%u'",
@@ -444,8 +444,8 @@ void unregisterSignalForNotification(dbusmessage* message, char* signalName)
     char rule[1024];
     t_ilm_uint id;
     dbus_message_get_args(message->pMessage, NULL,
-                          DBUS_TYPE_UINT32, &id,
-                          DBUS_TYPE_INVALID);
+                            DBUS_TYPE_UINT32, &id,
+                            DBUS_TYPE_INVALID);
 
     sprintf(rule,
             "type='signal',sender='%s',interface='%s',member='%s%d'",
index 459a996..cd00331 100644 (file)
@@ -17,8 +17,8 @@
  *
  ****************************************************************************/
 
-#ifndef _TCPSOCKETCONFIGURATION_H_
-#define _TCPSOCKETCONFIGURATION_H_
+#ifndef _SOCKETCONFIGURATION_H_
+#define _SOCKETCONFIGURATION_H_
 
 //=============================================================================
 // tcp socket configuration
@@ -38,4 +38,4 @@
 #define ENV_TCP_HOST                    "LM_TCP_HOST"
 #define ENV_TCP_PORT                    "LM_TCP_PORT"
 
-#endif // _TCPSOCKETCONFIGURATION_H_
+#endif // _SOCKETCONFIGURATION_H_
index f5adb6a..ef679af 100644 (file)
@@ -36,7 +36,7 @@ t_ilm_bool getGenericValue(struct SocketMessage* msg, void* value, const char pr
     {
         msg->index -= sizeof(readType);
         printf("command value type mismatch: expected '%s', got '%s'.\n",
-               &protocolType, &readType);
+                &protocolType, &readType);
         return ILM_FALSE;
     }
 
@@ -52,8 +52,8 @@ t_ilm_bool getGenericValue(struct SocketMessage* msg, void* value, const char pr
         msg->index -= sizeof(readType);
         msg->index -= sizeof(size);
         printf("command value size mismatch for type '%s': "
-               "expected %d bytes, got %d bytes.\n",
-               &protocolType, expectedSize, size);
+                "expected %d bytes, got %d bytes.\n",
+                &protocolType, expectedSize, size);
         return ILM_FALSE;
     }
 
@@ -118,7 +118,7 @@ t_ilm_bool getGenericArray(struct SocketMessage* msg, t_ilm_int* arraySize, void
     {
         msg->index -= sizeof(readType);
         printf("command value type mismatch: expected '%c', got '%s'.\n",
-               SOCKET_MESSAGE_TYPE_ARRAY, &readType);
+                SOCKET_MESSAGE_TYPE_ARRAY, &readType);
         return ILM_FALSE;
     }
 
index 06e7b20..26c3e08 100644 (file)
@@ -76,8 +76,8 @@ t_ilm_bool initServiceMode()
         }
 
         if (0 != connect(gState.socket,
-                         (struct sockaddr *) &gState.serverAddrIn,
-                         sizeof(gState.serverAddrIn)))
+                        (struct sockaddr *) &gState.serverAddrIn,
+                        sizeof(gState.serverAddrIn)))
         {
             result = ILM_FALSE;
         }
@@ -98,7 +98,7 @@ t_ilm_bool initServiceMode()
 
         if (0 > bind(gState.socket,
                     (struct sockaddr *) &gState.serverAddrIn,
-                     sizeof(gState.serverAddrIn)))
+                    sizeof(gState.serverAddrIn)))
         {
             printf("TcpIpcModule: bind()...failed\n");
             result = ILM_FALSE;
@@ -170,8 +170,8 @@ t_ilm_bool initClientMode()
         }
 
         if (0 != connect(gState.socket,
-                         (struct sockaddr *) &gState.serverAddrIn,
-                         sizeof(gState.serverAddrIn)))
+                        (struct sockaddr *) &gState.serverAddrIn,
+                        sizeof(gState.serverAddrIn)))
         {
             result = ILM_FALSE;
         }
@@ -192,7 +192,7 @@ t_ilm_bool initClientMode()
 
         if (0 > bind(gState.socket,
                     (struct sockaddr *) &gState.serverAddrIn,
-                     sizeof(gState.serverAddrIn)))
+                    sizeof(gState.serverAddrIn)))
         {
             printf("TcpIpcModule: bind()...failed\n");
             result = ILM_FALSE;
index ddd1a5d..ef904e1 100644 (file)
@@ -209,14 +209,14 @@ t_ilm_message receive(t_ilm_int timeoutInMs)
                     // receive data from socket
                     receiveFromSocket(msg, socketNumber);
 
-                    if(msg->paket.size > 0)
+                    if (msg->paket.size > 0)
                     {
                         // new message from client
                         getString(msg, msg->name);
                         continue;
                     }
 
-                    if(msg->paket.size == 0)
+                    if (msg->paket.size == 0)
                     {
                         // client disconnected
                         msg->paket.type = IpcMessageTypeDisconnect;
@@ -305,9 +305,9 @@ t_ilm_bool sendToSocket(struct SocketMessage* msg, int socketNumber)
     do
     {
         retVal += send(socketNumber,
-                       &msg->paket + sentBytes,
-                       sendSize - sentBytes,
-                       0);
+                        &msg->paket + sentBytes,
+                        sendSize - sentBytes,
+                        0);
         sentBytes += retVal;
     } while (retVal > 0 && sentBytes < sendSize);
 
@@ -329,9 +329,9 @@ void receiveFromSocket(struct SocketMessage* msg, int socketNumber)
     do
     {
         retVal = recv(msg->sender,
-                      &messageBuffer[receivedBytes],
-                      msg->paket.size - receivedBytes,
-                      0);
+                        &messageBuffer[receivedBytes],
+                        msg->paket.size - receivedBytes,
+                        0);
         receivedBytes += retVal;
     } while ((retVal > 0) && (receivedBytes < msg->paket.size));
 
index 77bc21a..f900f60 100644 (file)
@@ -26,7 +26,7 @@
 #include "IRenderer.h"
 #include "WindowSystems/BaseWindowSystem.h"
 
-class BaseRenderer: public IRenderer, public PluginBase
+class BaseRenderer : public IRenderer, public PluginBase
 {
 public:
     BaseRenderer(ICommandExecutor& executor, Configuration& config);
@@ -38,8 +38,12 @@ public:
 
     virtual void doScreenShot(std::string fileToSave) = 0;
     virtual uint getLayerTypeCapabilities(LayerType layerType);
-    virtual InputManager* getInputManager() const {return m_pInputManager;}
-    virtual Shader* createShader(const string* vertexName, const string* fragmentName); 
+    virtual InputManager* getInputManager() const
+    {
+        return m_pInputManager;
+    }
+
+    virtual Shader* createShader(const string* vertexName, const string* fragmentName);
     virtual bool setOptimizationMode(unsigned int id, unsigned int mode)
     {
         (void)id;
@@ -60,10 +64,10 @@ private:
     static bool debugMode;
 };
 
-inline Shader* BaseRenderer::createShader(const string* vertexName, const string* fragmentName) 
+inline Shader* BaseRenderer::createShader(const string* vertexName, const string* fragmentName)
 {
-       (void)vertexName; // TODO: removed, prevents warning
-       (void)fragmentName; // TODO: removed, prevents warning
+    (void)vertexName; // TODO: removed, prevents warning
+    (void)fragmentName; // TODO: removed, prevents warning
     return NULL;
 }
 inline void BaseRenderer::setdebug(bool onoff)
index d034b85..5059341 100644 (file)
 // Loads a file containing shader code
 static char* RenderUtilLoadShaderFile(const char *szFilename)
 {
-    if(!szFilename)
+    if (!szFilename)
     {
-        return(NULL);
+        return (NULL);
     }
 
     FILE* pFile = fopen(szFilename, "rb");
-    if(!pFile)
+    if (!pFile)
     {
-        LOG_ERROR("RenderUtilLoadShaderFile","Unable to open ShaderFile " << szFilename);
-        return(NULL);
+        LOG_ERROR("RenderUtilLoadShaderFile", "Unable to open ShaderFile " << szFilename);
+        return (NULL);
     }
 
     fseek(pFile, 0, SEEK_END);
@@ -47,33 +47,33 @@ static char* RenderUtilLoadShaderFile(const char *szFilename)
 
     if (size < 0)
     {
-        LOG_ERROR("RenderUtilLoadShaderFile","Unable get size of ShaderFile " << szFilename);
+        LOG_ERROR("RenderUtilLoadShaderFile", "Unable get size of ShaderFile " << szFilename);
         fclose(pFile);
-        return(NULL);
+        return (NULL);
     }
 
     fseek(pFile, 0, SEEK_SET);
 
-    char *pBuffer = new char[size+1];
-    if(!pBuffer)
+    char *pBuffer = new char[size + 1];
+    if (!pBuffer)
     {
-        LOG_ERROR("RenderUtilLoadShaderFile","Unable to allocate Memory for ShaderFile " << szFilename);
+        LOG_ERROR("RenderUtilLoadShaderFile", "Unable to allocate Memory for ShaderFile " << szFilename);
         fclose(pFile);
-        return(NULL);
+        return (NULL);
     }
 
-    if(1 != fread(pBuffer, size, 1, pFile))
+    if (1 != fread(pBuffer, size, 1, pFile))
     {
-        LOG_ERROR("RenderUtilLoadShaderFile","Unable to allocate Memory for ShaderFile " << szFilename);
+        LOG_ERROR("RenderUtilLoadShaderFile", "Unable to allocate Memory for ShaderFile " << szFilename);
         fclose(pFile);
         delete [] pBuffer;
-        return(NULL);
+        return (NULL);
     }
 
     pBuffer[size] = 0;
     fclose(pFile);
-    LOG_DEBUG("RenderUtilShaderDebug","loaded file with bytes: " << size);
-    return(pBuffer);
+    LOG_DEBUG("RenderUtilShaderDebug", "loaded file with bytes: " << size);
+    return (pBuffer);
 }
 
 
@@ -106,11 +106,11 @@ static void RenderUtilShaderDebug(GLuint obj, GLenum status, const char* op)
     }
     if (str != NULL && *str != '\0')
     {
-        strncpy(errorMessage, "--- ",1024); // TODO: sizeof(errorMessage)
+        strncpy(errorMessage, "--- ", 1024); // TODO: sizeof(errorMessage)
         strncat(errorMessage, op, 1000); // TODO: why 1000? dangerous
         strncat(errorMessage, " log ---", 8);
-        LOG_ERROR("RenderUtilShaderDebug",errorMessage);
-        LOG_ERROR("RenderUtilShaderDebug",str);
+        LOG_ERROR("RenderUtilShaderDebug", errorMessage);
+        LOG_ERROR("RenderUtilShaderDebug", str);
     }
 
     if (str)
@@ -131,11 +131,11 @@ static void RenderUtilShaderDebug(GLuint obj, GLenum status, const char* op)
                 glGetShaderSource(obj, len, NULL, str);
                 if (str != NULL && *str != '\0')
                 {
-                    strncpy(errorMessage, "--- ",1024);// TODO: sizeof(errorMessage)
-                    strncat(errorMessage,op, 1000); // TODO: why 1000? dangerous
+                    strncpy(errorMessage, "--- ", 1024);// TODO: sizeof(errorMessage)
+                    strncat(errorMessage, op, 1000); // TODO: why 1000? dangerous
                     strncat(errorMessage, " log ---", 8);
-                    LOG_ERROR("RenderUtilShaderDebug",errorMessage);
-                    LOG_ERROR("RenderUtilShaderDebug",str);
+                    LOG_ERROR("RenderUtilShaderDebug", errorMessage);
+                    LOG_ERROR("RenderUtilShaderDebug", str);
                 }
                 delete[] str;
             }
@@ -148,10 +148,10 @@ static void RenderUtilShaderDebug(GLuint obj, GLenum status, const char* op)
 
     if (!success)
     {
-        strncpy(errorMessage, "--- ",1024);// TODO: sizeof(errorMessage)
-           strncat(errorMessage,op, 1000); // TODO: why 1000? dangerous
-          strncat(errorMessage, " failed ---", 7);
-        LOG_ERROR("RenderUtilShaderDebug",errorMessage);
+        strncpy(errorMessage, "--- ", 1024);// TODO: sizeof(errorMessage)
+        strncat(errorMessage, op, 1000); // TODO: why 1000? dangerous
+        strncat(errorMessage, " failed ---", 7);
+        LOG_ERROR("RenderUtilShaderDebug", errorMessage);
     }
 }
 
@@ -163,7 +163,7 @@ static GLuint RenderUtilLoadShaderBinaries(
     GLuint binaryFormat,
     GLboolean debugging)
 {
-    LOG_DEBUG("RenderUtil","Loading shaders binaries. Size " << vertBinSize << " : " << fragBinSize );
+    LOG_DEBUG("RenderUtil", "Loading shaders binaries. Size " << vertBinSize << " : " << fragBinSize);
     // Binary shaders not supportable for non-ES OpenGL
     GLuint prog;
     GLuint vertShader;
@@ -194,7 +194,7 @@ static GLuint RenderUtilLoadShaderBinaries(
 
     // Link the shader program
     glLinkProgram(prog);
-    if (debugging) 
+    if (debugging)
     {
         RenderUtilShaderDebug(prog, GL_LINK_STATUS, "Program Link");
     }
@@ -205,9 +205,9 @@ static GLuint RenderUtilLoadShaderBinaries(
 // Takes shader source files, compiles them, and builds a shader program
 static GLuint RenderUtilLoadShaderSources(const char* vertFile, const char* fragFile, GLboolean debugging)
 {
-    LOG_DEBUG("RenderUtilShaderDebug","loading shaders sources");
-    LOG_DEBUG("RenderUtilShaderDebug","loading vertex shader: " << vertFile);
-    LOG_DEBUG("RenderUtilShaderDebug","loading fragment shader: " << fragFile);
+    LOG_DEBUG("RenderUtilShaderDebug", "loading shaders sources");
+    LOG_DEBUG("RenderUtilShaderDebug", "loading vertex shader: " << vertFile);
+    LOG_DEBUG("RenderUtilShaderDebug", "loading fragment shader: " << fragFile);
 
     GLuint prog = 0;
     char*  vertSource;
@@ -220,19 +220,19 @@ static GLuint RenderUtilLoadShaderSources(const char* vertFile, const char* frag
     GLint linked;
 
     // Load the shader files
-    vertSource    =RenderUtilLoadShaderFile(vertFile);
-    fragSource    = RenderUtilLoadShaderFile(fragFile);
-    LOG_DEBUG("RenderUtilShaderDebug","loaded shaders source files");
+    vertSource RenderUtilLoadShaderFile(vertFile);
+    fragSource = RenderUtilLoadShaderFile(fragFile);
+    LOG_DEBUG("RenderUtilShaderDebug", "loaded shaders source files");
     if (!vertSource || !fragSource) goto done;
     vertSourceLen = (GLint)strlen(vertSource);
     fragSourceLen = (GLint)strlen(fragSource);
 
     // Create the program
     prog = glCreateProgram();
-    if (prog==0)
+    if (prog == 0)
     {
-        LOG_DEBUG("RenderUtilShaderDebug","glError occured : " << glGetError()); 
-        LOG_DEBUG("RenderUtilShaderDebug","could not create prog, prog is 0");
+        LOG_DEBUG("RenderUtilShaderDebug", "glError occured : " << glGetError());
+        LOG_DEBUG("RenderUtilShaderDebug", "could not create prog, prog is 0");
     }
 
     // Create the GL shader objects
@@ -283,17 +283,17 @@ static GLuint RenderUtilLoadShaderSources(const char* vertFile, const char* frag
             glGetProgramiv(prog, GL_LINK_STATUS, &linked);
             if (!linked)
             {
-                LOG_DEBUG("RenderUtilShaderDebug","could not link shader");
+                LOG_DEBUG("RenderUtilShaderDebug", "could not link shader");
             }
         }
         else
         {
-         LOG_DEBUG("RenderUtilShaderDebug","could not compile fragment shader");
+            LOG_DEBUG("RenderUtilShaderDebug", "could not compile fragment shader");
         }
     }
     else
     {
-        LOG_DEBUG("RenderUtilShaderDebug","could not compile vertex shader");
+        LOG_DEBUG("RenderUtilShaderDebug", "could not compile vertex shader");
     }
 
     if (!compiled || !linked)
@@ -302,7 +302,7 @@ static GLuint RenderUtilLoadShaderSources(const char* vertFile, const char* frag
         prog = 0;
     }
 
-    done:
+done:
 
     delete[] fragSource;
     delete[] vertSource;
index eed215d..d8a738d 100644 (file)
@@ -45,18 +45,18 @@ BaseRenderer::~BaseRenderer()
 uint BaseRenderer::getLayerTypeCapabilities(LayerType layerType)
 {
     uint result = 0;
-    switch(layerType)
+    switch (layerType)
     {
-        case Software_2D:
-            result = LayerPosition | LayerScalable | LayerOrientable | LayerComposedByAlpha;
-            break;
+    case Software_2D:
+        result = LayerPosition | LayerScalable | LayerOrientable | LayerComposedByAlpha;
+        break;
 
-        case Software_2_5D:
-            result = LayerPosition | LayerScalable | LayerOrientable | LayerComposedByAlpha;
-            break;
+    case Software_2_5D:
+        result = LayerPosition | LayerScalable | LayerOrientable | LayerComposedByAlpha;
+        break;
 
-        default :
-            break;
+    default :
+        break;
     }
     return result;
 }
index 2d93b1e..9cb2ddf 100644 (file)
 
 struct gbm_device;
 
-struct DrmMode {
-       uint32_t                flags;
-       int32_t                 width;
-       int32_t                 height;
-       uint32_t                refresh;
-       drmModeModeInfo modeInfo;
-       wl_list                 link;
+struct DrmMode
+{
+    uint32_t        flags;
+    int32_t         width;
+    int32_t         height;
+    uint32_t        refresh;
+    drmModeModeInfo modeInfo;
+    wl_list         link;
 };
 
 struct DrmOutput;
-struct DrmFb {
-       struct gbm_bo    *bo;
-       struct DrmOutput *output;
-       uint32_t          fbId;
+struct DrmFb
+{
+    struct gbm_bo    *bo;
+    struct DrmOutput *output;
+    uint32_t          fbId;
 };
 
-struct DrmOutput {
-       struct wl_list  link;
-       struct DrmMode* currentMode;
-       struct wl_list  modeList;
-       uint32_t        crtcID;
-       uint32_t        connectorID;
-       drmModeCrtcPtr  orgCrtc;
-       int             pageFlipPending;
-       int             fdDev;
-       struct gbm_surface *surface;
-       struct DrmFb       *current, *next;
-       EGLSurface      eglSurface;
-       uint32_t        screenID;
-       BaseWindowSystem *windowSystem;
+struct DrmOutput
+{
+    struct wl_list  link;
+    struct DrmMode* currentMode;
+    struct wl_list  modeList;
+    uint32_t        crtcID;
+    uint32_t        connectorID;
+    drmModeCrtcPtr  orgCrtc;
+    int             pageFlipPending;
+    int             fdDev;
+    struct gbm_surface *surface;
+    struct DrmFb       *current, *next;
+    EGLSurface  eglSurface;
+    uint32_t    screenID;
+    BaseWindowSystem *windowSystem;
 };
 
-class DrmGLESGraphicSystem: public GLESGraphicsystem
+class DrmGLESGraphicSystem : public GLESGraphicsystem
 {
 // functions
 public:
     DrmGLESGraphicSystem(int windowWidth, int windowHeight,
-                 PfnShaderProgramCreator shaderProgram);
+                        PfnShaderProgramCreator shaderProgram);
     virtual ~DrmGLESGraphicSystem();
 
     virtual bool init(EGLNativeDisplayType display, EGLNativeWindowType window);
@@ -86,26 +89,26 @@ public:
 
 // proterties
 private:
-       struct wl_list m_outputList;
+    struct wl_list m_outputList;
 
-       gbm_device*    m_gbm;
-       int            m_fdDev;
-       uint32_t*      m_crtcs;
-       int            m_crtcsNum;
-       uint32_t       m_crtcAllocator;
-       uint32_t       m_connectorAllocator;
-       DrmOutput*     m_currentOutput;
+    gbm_device*    m_gbm;
+    int            m_fdDev;
+    uint32_t*      m_crtcs;
+    int            m_crtcsNum;
+    uint32_t       m_crtcAllocator;
+    uint32_t       m_connectorAllocator;
+    DrmOutput*     m_currentOutput;
 
-       PFNEGLBINDWAYLANDDISPLAYWL                                              m_pfEglBindWaylandDisplayWL;
-       PFNEGLUNBINDWAYLANDDISPLAYWL                                    m_pfEglUnbindWaylandDisplayWL;
+    PFNEGLBINDWAYLANDDISPLAYWL      m_pfEglBindWaylandDisplayWL;
+    PFNEGLUNBINDWAYLANDDISPLAYWL    m_pfEglUnbindWaylandDisplayWL;
 
 // private functions
 private:
     bool initializeSystem();
-       bool createOutputs();
-       int  createOutputForConnector(drmModeRes* resources, drmModeConnector* connector, int x, int y);
-       int  drmOutputAddMode(struct DrmOutput* output, drmModeModeInfo* info);
-       int  drmOutputPrepareRender(struct DrmOutput* output);
+    bool createOutputs();
+    int  createOutputForConnector(drmModeRes* resources, drmModeConnector* connector, int x, int y);
+    int  drmOutputAddMode(struct DrmOutput* output, drmModeModeInfo* info);
+    int  drmOutputPrepareRender(struct DrmOutput* output);
 };
 
 #endif /* _DRMGLESGRAPHICSYSTEM_H_ */
index 1eab619..081cd0c 100644 (file)
@@ -36,7 +36,7 @@ struct MultiSurfaceRegion
     SurfaceList m_surfaces;
 };
 
-class GLESGraphicsystem: public BaseGraphicSystem<EGLNativeDisplayType, EGLNativeWindowType>
+class GLESGraphicsystem : public BaseGraphicSystem<EGLNativeDisplayType, EGLNativeWindowType>
 {
 public:
 
@@ -80,11 +80,11 @@ public:
 
     virtual bool needsBlending(SurfaceList surfaces);
     virtual unsigned shaderKey(int numSurfaces,
-                               int needsBlend,
-                               int hasTransparency1, int hasAlphaChannel1, int hasChromakey1,
-                               int hasTransparency2, int hasAlphaChannel2, int hasChromakey2,
-                               int hasTransparency3, int hasAlphaChannel3, int hasChromakey3,
-                               int hasTransparency4, int hasAlphaChannel4, int hasChromakey4);
+                                int needsBlend,
+                                int hasTransparency1, int hasAlphaChannel1, int hasChromakey1,
+                                int hasTransparency2, int hasAlphaChannel2, int hasChromakey2,
+                                int hasTransparency3, int hasAlphaChannel3, int hasChromakey3,
+                                int hasTransparency4, int hasAlphaChannel4, int hasChromakey4);
     virtual void debugShaderKey(unsigned key);
 protected:
 
index 09a0cfc..8f39fe5 100644 (file)
@@ -27,7 +27,7 @@
 class GLXGraphicsystem : public BaseGraphicSystem<Display*, Window>
 {
 public:
-    GLXGraphicsystem( int windowWidth, int windowHeight);
+    GLXGraphicsystem(int windowWidth, int windowHeight);
     virtual ~GLXGraphicsystem();
     static XVisualInfo* GetMatchingVisual(Display *dpy);
     virtual bool init(Display* x11Display, Window x11Window);
@@ -47,8 +47,8 @@ public:
     virtual void swapBuffers();
     virtual void saveScreenShotOfFramebuffer(std::string fileToSave);
     GLXFBConfig* GetMatchingPixmapConfig(Display *curDisplay);
-    bool CheckConfigValue(Display *curDisplay,GLXFBConfig currentConfig, int attribute, int expectedValue);
-    bool CheckConfigMask(Display *curDisplay,GLXFBConfig currentConfig, int attribute, int expectedValue);
+    bool CheckConfigValue(Display *curDisplay, GLXFBConfig currentConfig, int attribute, int expectedValue);
+    bool CheckConfigMask(Display *curDisplay, GLXFBConfig currentConfig, int attribute, int expectedValue);
     virtual void renderSurface(Surface* currentSurface);
     virtual void activateGraphicContext();
     virtual void releaseGraphicContext();
index ea60cd5..82cbc42 100644 (file)
@@ -41,7 +41,7 @@ typedef struct _NATIVE_PIXMAP_STRUCT
 class BeaglePlatformSurface : public PlatformSurface
 {
 public:
-    BeaglePlatformSurface (Surface* surface)
+    BeaglePlatformSurface(Surface* surface)
     : PlatformSurface(surface)
     , eglImage(0)
     {
index fd61410..6250e03 100644 (file)
@@ -1,6 +1,6 @@
 /***************************************************************************
  *
- * Copyright 2010, 2011 BMW Car IT GmbH  
+ * Copyright 2010, 2011 BMW Car IT GmbH
  * Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
  *
  *
@@ -27,7 +27,7 @@
 #include "EGL/eglext.h"
 #include "WaylandPlatformSurface.h"
 
-class EglWaylandPlatformSurface: public WaylandPlatformSurface
+class EglWaylandPlatformSurface : public WaylandPlatformSurface
 {
 public:
     EglWaylandPlatformSurface(Surface* surface)
index d0d1dbc..36866ff 100644 (file)
@@ -26,7 +26,7 @@
 #include "EGL/eglext.h"
 #include "XPlatformSurface.h"
 
-class EglXPlatformSurface: public XPlatformSurface
+class EglXPlatformSurface : public XPlatformSurface
 {
 public:
     EglXPlatformSurface(Surface* surface)
index 1796425..c4c7f70 100644 (file)
@@ -24,7 +24,7 @@
 #include "Surface.h"
 #include "GL/glx.h"
 
-class GLXPlatformSurface: public XPlatformSurface
+class GLXPlatformSurface : public XPlatformSurface
 {
 public:
     GLXPlatformSurface(Surface* surface)
index 1e983f4..559a589 100644 (file)
@@ -1,6 +1,6 @@
 /***************************************************************************
  *
- * Copyright 2010, 2011 BMW Car IT GmbH  
+ * Copyright 2010, 2011 BMW Car IT GmbH
  * Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
  *
  *
@@ -24,7 +24,7 @@
 #include "PlatformSurface.h"
 #include "Surface.h"
 
-class WaylandPlatformSurface: public PlatformSurface
+class WaylandPlatformSurface : public PlatformSurface
 {
 public:
     unsigned short connectionId;
@@ -42,17 +42,17 @@ public:
     ~WaylandPlatformSurface()
     {
     }
-    
+
     bool enableRendering()
     {
         m_isReadyForRendering = true;
-       return true;
+        return true;
     }
 
     bool disableRendering()
     {
         m_isReadyForRendering = false;
-       return true;
+        return true;
     }
 
     bool isReadyForRendering()
@@ -60,7 +60,7 @@ public:
         return m_isReadyForRendering;
     }
     uint texture;
-    bool m_isReadyForRendering;    
+    bool m_isReadyForRendering;
 };
 
 #endif /* _WAYLANDPLATFORMSURFACE_H_ */
index a76be1d..9b5e464 100644 (file)
@@ -24,7 +24,7 @@
 #include "Surface.h"
 #include "X11/X.h"
 
-class XPlatformSurface: public PlatformSurface
+class XPlatformSurface : public PlatformSurface
 {
 public:
     XPlatformSurface(Surface* surface)
@@ -39,7 +39,7 @@ public:
     ~XPlatformSurface()
     {
     }
-    
+
     bool enableRendering()
     {
         m_isReadyForRendering = true;
@@ -60,7 +60,7 @@ public:
     bool isMapped;
     Pixmap pixmap;
     uint texture;
-    bool m_isReadyForRendering;    
+    bool m_isReadyForRendering;
 };
 
 #endif /* _XPLATFORMSURFACE_H_ */
index e96b810..9b72163 100644 (file)
@@ -28,7 +28,7 @@
 #include <cmem.h>
 #include "PlatformSurfaces/BeaglePlatformSurface.h"
 
-class BeagleEglImage: public ITextureBinder
+class BeagleEglImage : public ITextureBinder
 {
 public:
     BeagleEglImage(EGLDisplay eglDisplay)
@@ -65,7 +65,6 @@ public:
 
     void unbindSurfaceTexture(Surface*s)
     {
-
     }
 
     PlatformSurface* createPlatformSurface(Surface* s)
@@ -100,8 +99,7 @@ public:
                 EGL_NO_CONTEXT, //eglContext,
                 EGL_NATIVE_PIXMAP_KHR, //EGL_GL_TEXTURE_2D_KHR,
                 pNativePixmap, //(void*)textureId0,//
-                NULL //miplevel 0 is fine, thank you
-                );
+                NULL); //miplevel 0 is fine, thank you
 
         if (nativeSurface->eglImage == 0)
         {
index 359ce68..fdba8e5 100644 (file)
@@ -27,7 +27,7 @@
 #include <GLES2/gl2.h>
 #include <GLES2/gl2ext.h>
 
-class WaylandGLESTexture: public ITextureBinder
+class WaylandGLESTexture : public ITextureBinder
 {
 public:
     virtual PlatformSurface* createPlatformSurface(Surface* surface);
index 3900282..7c69935 100644 (file)
@@ -26,7 +26,7 @@
 #include "PlatformSurfaces/XPlatformSurface.h"
 #include <X11/extensions/Xcomposite.h>
 
-class X11Copy: public ITextureBinder
+class X11Copy : public ITextureBinder
 {
 public:
     X11Copy(Display* display);
index 2f96f2a..56bc2dc 100644 (file)
 #include <X11/extensions/Xcomposite.h>
 #include <EGL/egl.h>
 
-class X11CopyGLES: public X11Copy
+class X11CopyGLES : public X11Copy
 {
 public:
     X11CopyGLES(EGLDisplay eglDisplay, Display* display) : X11Copy(display)
     {
-
         // pseudo require EGL to have been initialised
         // we dont really need the handle
         // remove compiler Warning
         (void)eglDisplay; // TODO
     };
-    void swapPixmap(unsigned char* src,unsigned char* dest,unsigned int width,unsigned int height,bool swaprgb,bool includeAlpha);
+    void swapPixmap(unsigned char* src, unsigned char* dest, unsigned int width, unsigned int height, bool swaprgb, bool includeAlpha);
     bool bindSurfaceTexture(Surface* surface);
     void createClientBuffer(Surface* surface);
     void destroyClientBuffer(Surface* surface);
-
 };
 
 #endif /* _X11COPYGLES_H_ */
index cea8a45..90fa837 100644 (file)
@@ -26,7 +26,7 @@
 #include "PlatformSurfaces/XPlatformSurface.h"
 #include <X11/extensions/Xcomposite.h>
 
-class X11CopyGLX: public X11Copy
+class X11CopyGLX : public X11Copy
 {
 public:
     X11CopyGLX(Display* display)
@@ -37,7 +37,6 @@ public:
     bool bindSurfaceTexture(Surface* surface);
     void createClientBuffer(Surface* surface);
     void destroyClientBuffer(Surface* surface);
-
 };
 
 #endif /* _X11COPYGLX_H_ */
index 3a8aeae..dea1394 100644 (file)
@@ -29,7 +29,7 @@
 #include <GLES2/gl2.h>
 #include <GLES2/gl2ext.h>
 
-class X11EglImage: public ITextureBinder
+class X11EglImage : public ITextureBinder
 {
 public:
     virtual PlatformSurface* createPlatformSurface(Surface* surface);
index 3a639eb..de079c4 100644 (file)
@@ -27,7 +27,7 @@
 #include "TextureBinders/ITextureBinder.h"
 #include "PlatformSurfaces/GLXPlatformSurface.h"
 
-class X11TextureFromPixmap: public ITextureBinder
+class X11TextureFromPixmap : public ITextureBinder
 {
 public:
     X11TextureFromPixmap(Display* display, GLXFBConfig pixmapConfig);
index d560ed9..536a946 100644 (file)
@@ -26,7 +26,7 @@
 class BaseWindowSystem
 {
 public:
-    BaseWindowSystem(Scene* pScene, InputManager* pInputManager )
+    BaseWindowSystem(Scene* pScene, InputManager* pInputManager)
 
     : m_pInputManager(pInputManager)
     , m_pScene(pScene)
index 6ed7b65..8616d05 100644 (file)
@@ -27,8 +27,8 @@
  *
  ****************************************************************************/
 
-#ifndef _WAYLANDWINDOWSYSTEM_H_
-#define _WAYLANDWINDOWSYSTEM_H_
+#ifndef _WAYLANDBASEWINDOWSYSTEM_H_
+#define _WAYLANDBASEWINDOWSYSTEM_H_
 #include "WindowSystems/BaseWindowSystem.h"
 #include "GraphicSystems/BaseGraphicSystem.h"
 #include "Surface.h"
@@ -52,8 +52,10 @@ typedef enum waylandWindowSystemStates
     UNKOWN_STATE
 } WaylandWindowSystemStates;
 
-typedef struct _wlevent {
-    int        x, y;
+typedef struct _wlevent
+{
+    int        x;
+    int y;
     int32_t    button;
     enum wl_pointer_button_state buttonState;
     long       keyCode;
@@ -64,12 +66,11 @@ typedef struct _wlevent {
     int        touchId;
     int        touchType;
 } WLEvent;
-
 } // extern "C"
 
 struct native_surface;
 
-class WaylandBaseWindowSystem: public BaseWindowSystem
+class WaylandBaseWindowSystem : public BaseWindowSystem
 {
 public:
     WaylandBaseWindowSystem(const char* displayname, int width, int height, Scene* pScene, InputManager* pInputManager);
@@ -145,14 +146,14 @@ protected:
     struct native_surface* getNativeSurfaceFromSurface(Surface* surface);
     virtual void checkForNewSurfaceNativeContent();
     void calculateFps();
-    void calculateSurfaceFps(Surface *currentSurface, float time) ;
+    void calculateSurfaceFps(Surface *currentSurface, float time);
     void printDebug();
     void* eventLoop();
 
     static void bindCompositor(struct wl_client* client, void* data, uint32_t version, uint32_t id);
     static int signalEventOnTerm(int signal_number, void *data);
-    static void destroyListenerSurfaceBuffer(struct wl_listener* listener,void *data);
-    static void destroyListenerSurfacePendingBuffer(struct wl_listener* listener,void *data);
+    static void destroyListenerSurfaceBuffer(struct wl_listener* listener, void *data);
+    static void destroyListenerSurfacePendingBuffer(struct wl_listener* listener, void *data);
     static void idleEventRepaint(void *data);
     bool createWaylandClient();
     void releaseWaylandClient();
@@ -167,17 +168,34 @@ public:
     static void destroySurfaceCallback(struct wl_resource* resource);
     static void destroyFrameCallback(struct wl_resource *resource);
     static void* eventLoopCallback(void* ptr);
-    static void registryHandleGlobalClient(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version);
+    static void registryHandleGlobalClient(void* data,
+                                            struct wl_registry* registry,
+                                            uint32_t name,
+                                            const char* interface,
+                                            uint32_t version);
     static void surfaceListenerFrame(void* data, struct wl_callback* callback, uint32_t time);
     static int finishFrameHandler(void *data);
 
     // wl_surface interface
-    static void surfaceIFDestroy(struct wl_client *client, struct wl_resource *resource);
-    static void surfaceIFAttach(struct wl_client *client, struct wl_resource *resource, struct wl_resource *buffer_resource, int32_t x, int32_t y);
-    static void surfaceIFDamage(struct wl_client *client, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
-    static void surfaceIFFrame(struct wl_client *client, struct wl_resource *resource, uint32_t callback);
-    static void surfaceIFCommit(struct wl_client *client, struct wl_resource *resource);
-    
+    static void surfaceIFDestroy(struct wl_client *client,
+                                struct wl_resource *resource);
+    static void surfaceIFAttach(struct wl_client *client,
+                                struct wl_resource *resource,
+                                struct wl_resource *buffer_resource,
+                                int32_t x,
+                                int32_t y);
+    static void surfaceIFDamage(struct wl_client *client,
+                                struct wl_resource *resource,
+                                int32_t x,
+                                int32_t y,
+                                int32_t width,
+                                int32_t height);
+    static void surfaceIFFrame(struct wl_client *client,
+                                struct wl_resource *resource,
+                                uint32_t callback);
+    static void surfaceIFCommit(struct wl_client *client,
+                                struct wl_resource *resource);
+
     // wl_compositor interface
     static void compositorIFCreateSurface(struct wl_client *client, struct wl_resource* resource, uint32_t id);
 
@@ -187,12 +205,12 @@ public:
     void manageWLInputEvent(const InputDevice type, const InputEventState state, const WLEvent *wlEvent);
 };
 
-inline void WaylandBaseWindowSystem::setSystemState (WaylandWindowSystemStates state)
+inline void WaylandBaseWindowSystem::setSystemState(WaylandWindowSystemStates state)
 {
     m_systemState = state;
 }
 
-inline WaylandWindowSystemStates WaylandBaseWindowSystem::getSystemState ()
+inline WaylandWindowSystemStates WaylandBaseWindowSystem::getSystemState()
 {
     return m_systemState;
 }
@@ -207,51 +225,62 @@ inline bool WaylandBaseWindowSystem::createInputEvent()
     return false;
 }
 
-inline int WaylandBaseWindowSystem::getWindowWidth() const { return m_width; }
-inline int WaylandBaseWindowSystem::getWindowHeight() const { return m_height; }
+inline int WaylandBaseWindowSystem::getWindowWidth() const
+{
+    return m_width;
+}
+
+inline int WaylandBaseWindowSystem::getWindowHeight() const
+{
+    return m_height;
+}
 
 extern "C" {
-    struct native_surface {
-        struct wl_surface surface;
-        WaylandBaseWindowSystem* windowSystem;
-        struct wl_buffer* buffer;
-        int connectionId;
+struct native_surface
+{
+    struct wl_surface surface;
+    WaylandBaseWindowSystem* windowSystem;
+    struct wl_buffer* buffer;
+    int connectionId;
 
-        uint32_t visual; // TODO confirm:it's necessary or not
-        struct wl_listener buffer_destroy_listener;
-        struct wl_list link;
+    uint32_t visual; // TODO confirm:it's necessary or not
+    struct wl_listener buffer_destroy_listener;
+    struct wl_list link;
 
-        /* All the pending state, that wl_surface.commit will apply. */
-        struct {
-            /* wl_surface.attach */
-            int remove_contents;
-            struct wl_buffer *buffer;
-            struct wl_listener buffer_destroy_listener;
-            int32_t sx;
-            int32_t sy;
+    /* All the pending state, that wl_surface.commit will apply. */
+    struct
+    {
+        /* wl_surface.attach */
+        int remove_contents;
+        struct wl_buffer *buffer;
+        struct wl_listener buffer_destroy_listener;
+        int32_t sx;
+        int32_t sy;
 
-            /* wl_surface.damage */
-            Rectangle damage;
-            bool damaged;
+        /* wl_surface.damage */
+        Rectangle damage;
+        bool damaged;
 
-            /* wl_surface.frame */
-            struct wl_list frame_callback_list;
-        } pending;
-    };
+        /* wl_surface.frame */
+        struct wl_list frame_callback_list;
+    } pending;
+};
 
-    struct native_frame_callback {
-        struct wl_resource resource;
-        struct wl_list link;
-    };
+struct native_frame_callback
+{
+    struct wl_resource resource;
+    struct wl_list link;
+};
 
-    struct native_process;
-    typedef void (*cleanupFuncForNativeProcess)(struct native_process* process, int status);
+struct native_process;
+typedef void (*cleanupFuncForNativeProcess)(struct native_process* process, int status);
 
-    struct native_process {
-        pid_t pid;
-        cleanupFuncForNativeProcess cleanup;
-        struct wl_list link;
-    };
+struct native_process
+{
+    pid_t pid;
+    cleanupFuncForNativeProcess cleanup;
+    struct wl_list link;
+};
 }
 
-#endif /* _WAYLANDWINDOWSYSTEM_H_ */
+#endif /* _WAYLANDBASEWINDOWSYSTEM_H_ */
index 8f99c81..d1d8991 100644 (file)
@@ -33,7 +33,7 @@
 
 struct gbm_device;
 
-class WaylandDrmWindowSystem: public WaylandBaseWindowSystem
+class WaylandDrmWindowSystem : public WaylandBaseWindowSystem
 {
 public:
     WaylandDrmWindowSystem(const char* displayname, int width, int height, Scene* pScene, InputManager* pInputManager);
index 6e853ff..b930ec6 100644 (file)
@@ -39,7 +39,8 @@
 //////////////////////////////////////////////////////////////////////////////
 #define MAX_SLOTS 16
 
-enum evdev_event_type {
+enum evdev_event_type
+{
     EVDEV_ABSOLUTE_MOTION    = (1 << 0),
     EVDEV_ABSOLUTE_MT_DOWN   = (1 << 1),
     EVDEV_ABSOLUTE_MT_MOTION = (1 << 2),
@@ -47,7 +48,8 @@ enum evdev_event_type {
     EVDEV_RELATIVE_MOTION    = (1 << 4)
 };
 
-enum evdev_device_capability {
+enum evdev_device_capability
+{
     EVDEV_KEYBOARD   = (1 << 0),
     EVDEV_BUTTON     = (1 << 1),
     EVDEV_MOTION_ABS = (1 << 2),
@@ -55,7 +57,8 @@ enum evdev_device_capability {
     EVDEV_TOUCH      = (1 << 4)
 };
 
-enum key_state_update {
+enum key_state_update
+{
     STATE_UPDATE_AUTOMATIC,
     STATE_UPDATE_NONE
 };
@@ -63,27 +66,37 @@ enum key_state_update {
 class WaylandEvdevInputEvent;
 struct evdev_dispatch;
 
-struct evdev_input_device {
+struct evdev_input_device
+{
     WaylandEvdevInputEvent *master;
     struct wl_list          link;
     struct wl_event_source *source;
     struct evdev_dispatch  *dispatch;
     char *devnode;
     int   fd;
-    struct {
-        int min_x, max_x, min_y, max_y;
-        int32_t x, y;
+    struct
+    {
+        int min_x;
+        int max_x;
+        int min_y;
+        int max_y;
+
+        int32_t x;
+        int32_t y;
     } abs;
 
-    struct {
+    struct
+    {
         int slot;
         int32_t x[MAX_SLOTS];
         int32_t y[MAX_SLOTS];
     } mt;
     struct mtdev* mtdev;
 
-    struct {
-        wl_fixed_t dx, dy;
+    struct
+    {
+        wl_fixed_t dx;
+        wl_fixed_t dy;
     } rel;
 
     unsigned int pending_events;
@@ -91,7 +104,8 @@ struct evdev_input_device {
     int isMt;
 };
 
-struct evdev_dispatch_interface {
+struct evdev_dispatch_interface
+{
     // Process an evdev input event
     void (*process)(struct evdev_dispatch *dispatch,
                     struct evdev_input_device *device,
@@ -102,7 +116,8 @@ struct evdev_dispatch_interface {
     void (*destroy)(struct evdev_dispatch *dispatch);
 };
 
-struct evdev_dispatch {
+struct evdev_dispatch
+{
     struct evdev_dispatch_interface *interface;
 };
 
@@ -114,7 +129,8 @@ struct evdev_dispatch {
 #define DEFAULT_MAX_ACCEL_FACTOR 1.0
 #define DEFAULT_HYSTERESIS_MARGIN_DENOMINATOR 700.0
 
-enum touchpad_model {
+enum touchpad_model
+{
     TOUCHPAD_MODEL_UNKNOWN = 0,
     TOUCHPAD_MODEL_SYNAPTICS,
     TOUCHPAD_MODEL_ALPS,
@@ -128,13 +144,15 @@ enum touchpad_model {
 #define TOUCHPAD_EVENT_ABSOLUTE_Y    (1 << 2)
 #define TOUCHPAD_EVENT_REPORT        (1 << 3)
 
-struct touchpad_model_spec {
+struct touchpad_model_spec
+{
     short vendor;
     short product;
     enum touchpad_model model;
 };
 
-enum touchpad_state {
+enum touchpad_state
+{
     TOUCHPAD_STATE_NONE = 0,
     TOUCHPAD_STATE_TOUCH,
     TOUCHPAD_STATE_PRESS
@@ -142,18 +160,21 @@ enum touchpad_state {
 
 #define TOUCHPAD_HISTORY_LENGTH 4
 
-struct touchpad_motion {
+struct touchpad_motion
+{
     int32_t x;
     int32_t y;
 };
 
-enum touchpad_fingers_state {
+enum touchpad_fingers_state
+{
     TOUCHPAD_FINGERS_ONE   = (1 << 0),
     TOUCHPAD_FINGERS_TWO   = (1 << 1),
     TOUCHPAD_FINGERS_THREE = (1 << 2)
 };
 
-struct touchpad_dispatch {
+struct touchpad_dispatch
+{
     struct evdev_dispatch base;
     struct evdev_input_device *device;
 
@@ -171,19 +192,22 @@ struct touchpad_dispatch {
 
     int reset;
 
-    struct {
+    struct
+    {
         int32_t x;
         int32_t y;
     } hw_abs;
 
     int has_pressure;
-    struct {
+    struct
+    {
         int32_t touch_low;
         int32_t touch_high;
         int32_t press;
     } pressure;
 
-    struct {
+    struct
+    {
         int32_t margin_x;
         int32_t margin_y;
         int32_t center_x;
@@ -197,37 +221,43 @@ struct touchpad_dispatch {
     struct wl_list motion_filters;
 };
 
-struct motion_params {
-    double dx, dy;
+struct motion_params
+{
+    double dx;
+    double dy;
 };
 
 struct motion_filter;
 
-struct motion_filter_interface {
+struct motion_filter_interface
+{
     void (*filter)(struct motion_filter *filter,
-                   struct motion_params *motion,
-                   void *data, uint32_t time);
+                    struct motion_params *motion,
+                    void *data, uint32_t time);
     void (*destroy)(struct motion_filter *filter);
 };
 
-struct motion_filter {
+struct motion_filter
+{
     struct motion_filter_interface *interface;
     struct wl_list link;
 };
 
 typedef double (*accel_profile_func_t)(struct motion_filter *filter,
-                                       void *data,
-                                       double velocity,
-                                       uint32_t time);
+                                        void *data,
+                                        double velocity,
+                                        uint32_t time);
 
-struct pointer_tracker {
+struct pointer_tracker
+{
     double   dx;
     double   dy;
     uint32_t time;
     int      dir;
 };
 
-struct pointer_accelerator {
+struct pointer_accelerator
+{
     struct motion_filter base;
     accel_profile_func_t profile;
 
@@ -240,14 +270,15 @@ struct pointer_accelerator {
     int cur_tracker;
 };
 
-enum directions {
-    N  = 1 << 0,
+enum directions
+{
+    N = 1 << 0,
     NE = 1 << 1,
-    E  = 1 << 2,
+    E = 1 << 2,
     SE = 1 << 3,
-    S  = 1 << 4,
+    S = 1 << 4,
     SW = 1 << 5,
-    W  = 1 << 6,
+    W = 1 << 6,
     NW = 1 << 7,
     UNDEFINED_DIRECTION = 0xff
 };
@@ -289,13 +320,13 @@ public:
 private:
     static int  handleInputEvent(int fd, uint32_t mask, void *data);
     static void processEvents(struct evdev_input_device *device,
-                              struct input_event *ev, int count);
+                                struct input_event *ev, int count);
 
     // Default event handler
     static void evdevProcessRelative(struct evdev_input_device *device,
-                                     uint32_t time, struct input_event *e);
+                                        uint32_t time, struct input_event *e);
     static void evdevProcessAbsolute(struct evdev_input_device *device,
-                                     struct input_event *e);
+                                        struct input_event *e);
     static void evdevProcessKey(struct evdev_input_device *device,
                                 uint32_t time, struct input_event *e);
 
@@ -304,20 +335,20 @@ private:
                                         struct evdev_input_device *device,
                                         struct input_event *e);
     static void touchpadProcessKey(struct touchpad_dispatch *touchpad,
-                                   struct evdev_input_device *device,
-                                   struct input_event *e,
-                                   uint32_t time);
+                                    struct evdev_input_device *device,
+                                    struct input_event *e,
+                                    uint32_t time);
     static void touchpadUpdateState(struct touchpad_dispatch *touchpad,
                                     uint32_t time);
 
     // Notifier
     static void notifyButton(struct evdev_input_device *device, uint32_t time,
-                             int32_t button, enum wl_pointer_button_state state);
+                                int32_t button, enum wl_pointer_button_state state);
     static void notifyMotion(struct evdev_input_device *device, uint32_t time,
-                             wl_fixed_t fx, wl_fixed_t fy);
+                                wl_fixed_t fx, wl_fixed_t fy);
     static void notifyKey(struct evdev_input_device *device, uint32_t time,
-                          uint32_t key, enum wl_keyboard_key_state state,
-                          bool bUpdateAutomatic);
+                            uint32_t key, enum wl_keyboard_key_state state,
+                            bool bUpdateAutomatic);
     static void notifyTouch(struct evdev_input_device *device);
 
     bool addDevices();
@@ -326,18 +357,17 @@ private:
     void createInputDevice(struct wl_display *display, const char *path);
     int  configureDevice(struct evdev_input_device *device);
     void dispatchProcess(struct evdev_input_device *device,
-                         struct input_event *ev,
-                         uint32_t time);
+                            struct input_event *ev,
+                            uint32_t time);
     void notifyKeyboardFocus();
     void notifyKeyboardFocusIn(struct wl_array *keys, enum key_state_update updateState);
     void updateModifierState(struct wl_seat *wlSeat, uint32_t serial, uint32_t key,
-                             enum wl_keyboard_key_state state);
+                                enum wl_keyboard_key_state state);
     void notifyModifiers(struct wl_seat *wlSeat, uint32_t serial);
 
     struct evdev_dispatch* createTouchpad(struct evdev_input_device *device);
     void configureTouchpad(struct touchpad_dispatch *touchpad,
-                           struct evdev_input_device *device);
-
+                            struct evdev_input_device *device);
 };
 
 #endif /* _WAYLANDEVDEVINPUTEVENT_H_ */
index d160c17..1047167 100644 (file)
@@ -31,7 +31,7 @@
 #define _WAYLANDFBDEVWINDOWSYSTEM_H_
 #include "WindowSystems/WaylandBaseWindowSystem.h"
 
-class WaylandFbdevWindowSystem: public WaylandBaseWindowSystem
+class WaylandFbdevWindowSystem : public WaylandBaseWindowSystem
 {
 public:
     WaylandFbdevWindowSystem(const char* displayname, int width, int height, Scene* pScene, InputManager* pInputManager);
index e60c942..a391aa8 100644 (file)
@@ -50,7 +50,8 @@ private:
     struct wl_resource* m_wlTouchFocusResource;
     struct wl_listener  m_wlTouchFocusResourceListener;
 
-    struct {
+    struct
+    {
         struct wl_pointer  wlPointer;
         struct wl_keyboard wlKeyboard;
         struct wl_touch    wlTouch;
@@ -79,18 +80,18 @@ public:
     const struct wl_touch    *touchDevice() const;
 
     void sendMousePressEvent(const Point& globalPos, const Point& localPos,
-                             uint32_t button, uint32_t time);
+                                uint32_t button, uint32_t time);
     void sendMouseReleaseEvent(const Point& globalPos, const Point& localPos,
-                               uint32_t button, uint32_t time);
+                                uint32_t button, uint32_t time);
     void sendMouseMotionEvent(struct wl_surface *surface,
-                              const Point& globalPos, const Point& localPos, uint32_t time);
+                                const Point& globalPos, const Point& localPos, uint32_t time);
 
     void sendKeyPressEvent(struct wl_surface *surface, uint32_t time, uint32_t code);
     void sendKeyReleaseEvent(struct wl_surface *surface, uint32_t time, uint32_t code);
     void setKeyboardFocus(struct wl_surface *surface);
 
     void sendTouchPointEvent(struct wl_surface *surface, uint32_t time,
-                             int touchId, int touchState, const Point& touchPos);
+                                int touchId, int touchState, const Point& touchPos);
     void sendTouchFrameEvent();
     void sendTouchCancelEvent();
 
@@ -101,11 +102,11 @@ private:
     void cleanupDataDeviceForClient(struct wl_client *client, bool destroyDev);
 
     void setMouseFocus(struct wl_surface *surface,
-                       const Point& globalPos,
-                       const Point& localPos);
+                        const Point& globalPos,
+                        const Point& localPos);
     void sendMouseMotionEvent(const Point& globalPos,
-                              const Point& localPos,
-                              uint32_t time);
+                                const Point& localPos,
+                                uint32_t time);
 
     void setTouchFocus(struct wl_surface *surface);
 
@@ -119,34 +120,69 @@ private:
     static void destroyDeviceResource(struct wl_resource *resource);
 
     static void getPointer(struct wl_client *client,
-                           struct wl_resource *resource,
-                           uint32_t id);
+                            struct wl_resource *resource,
+                            uint32_t id);
     static void getKeyboard(struct wl_client *client,
                             struct wl_resource *resource,
                             uint32_t id);
     static void getTouch(struct wl_client *client,
-                         struct wl_resource *resource,
-                         uint32_t id);
+                            struct wl_resource *resource,
+                            uint32_t id);
 };
 
-inline struct wl_display* WaylandInputDevice::display() { return m_wlDisplay; }
-inline struct wl_seat* WaylandInputDevice::seat() { return &m_wlSeat; }
-inline bool WaylandInputDevice::hasPointer() const { return m_hasPointer; }
-inline bool WaylandInputDevice::hasKeyboard() const { return m_hasKeyboard; }
-inline bool WaylandInputDevice::hasTouch() const { return m_hasTouch; }
+inline struct wl_display* WaylandInputDevice::display()
+{
+    return m_wlDisplay;
+}
+
+inline struct wl_seat* WaylandInputDevice::seat()
+{
+    return &m_wlSeat;
+}
+
+inline bool WaylandInputDevice::hasPointer() const
+{
+    return m_hasPointer;
+}
+
+inline bool WaylandInputDevice::hasKeyboard() const
+{
+    return m_hasKeyboard;
+}
+
+inline bool WaylandInputDevice::hasTouch() const
+{
+    return m_hasTouch;
+}
 
 inline struct wl_pointer* WaylandInputDevice::pointerDevice()
-    { return &m_deviceInterfaces.wlPointer; }
+{
+    return &m_deviceInterfaces.wlPointer;
+}
+
 inline struct wl_keyboard* WaylandInputDevice::keyboardDevice()
-    { return &m_deviceInterfaces.wlKeyboard; }
+{
+    return &m_deviceInterfaces.wlKeyboard;
+}
+
 inline struct wl_touch* WaylandInputDevice::touchDevice()
-    { return &m_deviceInterfaces.wlTouch; }
+{
+    return &m_deviceInterfaces.wlTouch;
+}
 
 inline const struct wl_pointer* WaylandInputDevice::pointerDevice() const
-    { return &m_deviceInterfaces.wlPointer; }
+{
+    return &m_deviceInterfaces.wlPointer;
+}
+
 inline const struct wl_keyboard* WaylandInputDevice::keyboardDevice() const
-    { return &m_deviceInterfaces.wlKeyboard; }
+{
+    return &m_deviceInterfaces.wlKeyboard;
+}
+
 inline const struct wl_touch* WaylandInputDevice::touchDevice() const
-    { return &m_deviceInterfaces.wlTouch; }
+{
+    return &m_deviceInterfaces.wlTouch;
+}
 
 #endif /* _WAYLANDINPUTDEVICE_H_ */
index 6216bb4..f33afd7 100644 (file)
 #include "config.h"
 #include "WindowSystems/WaylandInputDevice.h"
 
-enum keyboard_modifier {
+enum keyboard_modifier
+{
     MODIFIER_CTRL  = (1 << 0),
     MODIFIER_ALT   = (1 << 1),
     MODIFIER_SUPER = (1 << 2),
     MODIFIER_SHIFT = (1 << 3)
 };
 
-enum keyboard_led {
+enum keyboard_led
+{
     LED_NUM_LOCK    = (1 << 0),
     LED_CAPS_LOCK   = (1 << 1),
     LED_SCROLL_LOCK = (1 << 2)
@@ -60,7 +62,8 @@ protected:
     struct wl_event_source  *m_wlEventSource;
     int m_fd;
 
-    struct weston_xkb_info {
+    struct weston_xkb_info
+    {
         struct xkb_keymap *keymap;
         int keymap_fd;
         size_t keymap_size;
@@ -78,7 +81,8 @@ protected:
         xkb_led_index_t scroll_led;
     } m_xkbInfo;
 
-    struct weston_xkb_state {
+    struct weston_xkb_state
+    {
         struct xkb_state *state;
         enum keyboard_led leds;
     } m_xkbState;
@@ -110,7 +114,13 @@ private:
     void buildGlobalKeymap();
 };
 
-inline WaylandInputDevice& WaylandInputEvent::inputDevice() const { return *m_inputDevice; }
-inline WaylandBaseWindowSystem& WaylandInputEvent::windowSystem() const { return *m_windowSystem; }
+inline WaylandInputDevice& WaylandInputEvent::inputDevice() const
+{
+    return *m_inputDevice;
+}
+inline WaylandBaseWindowSystem& WaylandInputEvent::windowSystem() const
+{
+    return *m_windowSystem;
+}
 
 #endif /* _WAYLANDINPUTEVENT_H_ */
index f4016a0..9bed7bf 100644 (file)
@@ -1,6 +1,6 @@
 /***************************************************************************
  *
- * Copyright 2010, 2011 BMW Car IT GmbH  
+ * Copyright 2010, 2011 BMW Car IT GmbH
  * Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
  *
  *
@@ -26,8 +26,8 @@
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  ****************************************************************************/
 
-#ifndef WAYLAND_SERVERINFO_SERVER_PROTOCOL_H
-#define WAYLAND_SERVERINFO_SERVER_PROTOCOL_H
+#ifndef WAYLANDSERVERINFOSERVERPROTOCOL_H
+#define WAYLANDSERVERINFOSERVERPROTOCOL_H
 
 #ifdef  __cplusplus
 extern "C" {
@@ -46,15 +46,16 @@ struct serverinfo;
 
 extern const struct wl_interface serverinfo_interface;
 
-struct serverinfo_interface {
-       void (*get_connection_id)(struct wl_client *client,
-                                 struct wl_resource *resource);
+struct serverinfo_interface
+{
+    void (*get_connection_id)(struct wl_client *client,
+                    struct wl_resource *resource);
 };
 
-#define SERVERINFO_CONNECTION_ID       0
+#define SERVERINFO_CONNECTION_ID    0
 
 #ifdef  __cplusplus
 }
 #endif
 
-#endif
+#endif /* WAYLANDSERVERINFOSERVERPROTOCOL_H */
index 087a7c6..63fb78a 100644 (file)
@@ -37,9 +37,9 @@
 #include <wayland-server.h>
 #include <xcb/xcb.h>
 #ifdef HAVE_XCB_XKB // XCB-XKB Extension: not required
-  #define explicit tmpexplicit
-  #include <xcb/xkb.h>
-  #undef explicit
+#   define explicit tmpexplicit
+#   include <xcb/xkb.h>
+#   undef explicit
 #endif
 #include <xkbcommon/xkbcommon.h>
 #include <X11/Xlib.h>
 //////////////////////////////////////////////////////////////////////////////
 extern "C"
 {
-    struct atom_ {
-        xcb_atom_t xkbNames;
-        xcb_atom_t string;
-    };
+struct atom_
+{
+    xcb_atom_t xkbNames;
+    xcb_atom_t string;
+};
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -90,8 +91,19 @@ private:
     uint8_t xkbEventBase();
 };
 
-inline bool WaylandX11InputEvent::hasXkb() { return m_hasXkb; }
-inline xcb_connection_t* WaylandX11InputEvent::connection() { return m_xcbConn; }
-inline uint8_t WaylandX11InputEvent::xkbEventBase() { return m_xkbEventBase; }
+inline bool WaylandX11InputEvent::hasXkb()
+{
+    return m_hasXkb;
+}
+
+inline xcb_connection_t* WaylandX11InputEvent::connection()
+{
+    return m_xcbConn;
+}
+
+inline uint8_t WaylandX11InputEvent::xkbEventBase()
+{
+    return m_xkbEventBase;
+}
 
 #endif /* _WAYLANDX11INPUTEVENT_H_ */
index 4023166..e0e3d14 100644 (file)
@@ -35,7 +35,7 @@
 #include <EGL/egl.h>
 #include <EGL/eglext.h>
 
-class WaylandX11WindowSystem: public WaylandBaseWindowSystem
+class WaylandX11WindowSystem : public WaylandBaseWindowSystem
 {
 public:
     WaylandX11WindowSystem(const char* displayname, int width, int height, Scene* pScene, InputManager* pInputManager);
@@ -61,6 +61,9 @@ private:
     Colormap m_x11Colormap;
 };
 
-inline Display* WaylandX11WindowSystem::x11Display() const { return m_x11Display; }
+inline Display* WaylandX11WindowSystem::x11Display() const
+{
+    return m_x11Display;
+}
 
 #endif /* _WAYLANDX11WINDOWSYSTEM_H_ */
index 3e5c474..ba40aa2 100644 (file)
@@ -39,10 +39,15 @@ typedef enum x11WindowSystemStates
     UNKOWN_STATE
 } X11WindowSystemStates;
 
-class X11WindowSystem: public BaseWindowSystem
+class X11WindowSystem : public BaseWindowSystem
 {
 public:
-    X11WindowSystem(const char* displayname, int width, int height, Scene* pScene, InputManager* pInputManager, GetVisualInfoFunction func = X11WindowSystem::getDefaultVisual);
+    X11WindowSystem(const char* displayname,
+                    int width,
+                    int height,
+                    Scene* pScene,
+                    InputManager* pInputManager,
+                    GetVisualInfoFunction func = X11WindowSystem::getDefaultVisual);
     virtual ~X11WindowSystem();
     bool init(BaseGraphicSystem<Display*, Window>* sys);
     bool start();
@@ -50,8 +55,8 @@ public:
     static XVisualInfo * getDefaultVisual(Display *dpy);
     void signalRedrawEvent();
     void wakeUpRendererThread();
-    void setSystemState (X11WindowSystemStates state);
-    X11WindowSystemStates getSystemState ();
+    void setSystemState(X11WindowSystemStates state);
+    X11WindowSystemStates getSystemState();
     Display* getNativeDisplayHandle();
     Window getCompositorNativeWindowHandle();
     virtual void allocatePlatformSurface(Surface *surface);
@@ -70,13 +75,17 @@ private:
     int resolutionWidth;
     int resolutionHeight;
     static int composite_opcode;
-    int composite_event, composite_error;
-    int composite_major, composite_minor;
+    int composite_event;
+    int composite_error;
+    int composite_major;
+    int composite_minor;
     static int damage_opcode;
-    int damage_event, damage_error;
-    int damage_major, damage_minor;
+    int damage_event;
+    int damage_error;
+    int damage_major;
+    int damage_minor;
     static const char CompositorWindowTitle[];
-    bool m_running; 
+    bool m_running;
 /*    bool m_initialized; */
     bool m_success;
     X11WindowSystemStates m_systemState;
@@ -92,7 +101,7 @@ protected:
     //    Window background;
     Window CompositorWindow;
     XVisualInfo* windowVis;
-    float m_fpsinterval;    
+    float m_fpsinterval;
     pthread_mutex_t run_lock;
     pthread_mutex_t init_lock;
     pthread_cond_t init_condition;
@@ -102,7 +111,7 @@ protected:
     virtual void RedrawAllLayers(bool clear, bool swap);
     virtual void renderHWLayer(Layer* layer);
     virtual void calculateFps();
-    virtual void calculateSurfaceFps(Surface *currentSurface, float time) ;
+    virtual void calculateSurfaceFps(Surface *currentSurface, float time);
 private:
     void cleanup();
     void Screenshot();
@@ -131,16 +140,15 @@ private:
     void ManageXInputEvent(InputDevice type, InputEventState state, XEvent *pevent);
     static bool m_xerror;
 
-
     friend void * X11eventLoopCallback(void *);
 };
 
-inline void X11WindowSystem::setSystemState (X11WindowSystemStates state)
+inline void X11WindowSystem::setSystemState(X11WindowSystemStates state)
 {
     m_systemState = state;
 }
 
-inline X11WindowSystemStates X11WindowSystem::getSystemState () 
+inline X11WindowSystemStates X11WindowSystem::getSystemState()
 {
     return m_systemState;
 }
index 8584c9e..4a54fa9 100644 (file)
 #include <libudev.h>
 
 static drmModeModeInfo builtin_800x480_for_Crossville = {
-       31746,
-       800, 859, 999, 999, 0,
-       480, 507, 538, 524, 0,
-       0,
-       DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC,
-       0,
-       "800x480"
+    31746,
+    800, 859, 999, 999, 0,
+    480, 507, 538, 524, 0,
+    0,
+    DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC,
+    0,
+    "800x480"
 };
 
 static void
 pageFlipHandler(int /*fd*/, unsigned int /*frame*/, unsigned int /*sec*/,
-                               unsigned int /*usec*/, void *data)
+                    unsigned int /*usec*/, void *data)
 {
-       struct DrmOutput *output = static_cast<struct DrmOutput*>(data);
+    struct DrmOutput *output = static_cast<struct DrmOutput*>(data);
 
-       output->pageFlipPending = 0;
+    output->pageFlipPending = 0;
 
-       if (output->current)
-       {
-               gbm_surface_release_buffer(output->surface, output->current->bo);
-       }
+    if (output->current)
+    {
+        gbm_surface_release_buffer(output->surface, output->current->bo);
+    }
 
-       output->current = output->next;
-       output->next = NULL;
+    output->current = output->next;
+    output->next = NULL;
 
-       if (output->windowSystem)
-       {
-               output->windowSystem->finishFrame();
-       }
+    if (output->windowSystem)
+    {
+        output->windowSystem->finishFrame();
+    }
 }
 
 static int
 onDrmInput(int fd, uint32_t /*mask*/, void * /*data*/)
 {
-       drmEventContext evctx;
-       memset(&evctx, 0, sizeof evctx);
+    drmEventContext evctx;
+    memset(&evctx, 0, sizeof evctx);
 
-       evctx.version = DRM_EVENT_CONTEXT_VERSION;
-       evctx.page_flip_handler = pageFlipHandler;
-       evctx.vblank_handler = NULL;
+    evctx.version = DRM_EVENT_CONTEXT_VERSION;
+    evctx.page_flip_handler = pageFlipHandler;
+    evctx.vblank_handler = NULL;
 
-       drmHandleEvent(fd, &evctx);
+    drmHandleEvent(fd, &evctx);
 
-       return 1;
+    return 1;
 }
 
 static void
 drmFbDestroyCallback(struct gbm_bo *bo, void *data)
 {
-       struct DrmFb *fb = (struct DrmFb*)data;
-       struct gbm_device *gbm = gbm_bo_get_device(bo);
+    struct DrmFb *fb = (struct DrmFb*)data;
+    struct gbm_device *gbm = gbm_bo_get_device(bo);
 
-       if (fb->fbId)
-               drmModeRmFB(gbm_device_get_fd(gbm), fb->fbId);
+    if (fb->fbId)
+        drmModeRmFB(gbm_device_get_fd(gbm), fb->fbId);
 
-       free(data);
+    free(data);
 }
 
 struct DrmFb*
 drmFbGetFromBo(struct gbm_bo *bo, int fdDev, struct DrmOutput *output)
 {
-       struct DrmFb *fb = (struct DrmFb*)gbm_bo_get_user_data(bo);
-       uint32_t width, height, stride, handle;
-       int ret;
-
-       if (fb)
-               return fb;
-
-       fb = (struct DrmFb*)malloc(sizeof *fb);
-       fb->bo = bo;
-       fb->output = output;
-
-       width  = gbm_bo_get_width(bo);
-       height = gbm_bo_get_height(bo);
-       stride = gbm_bo_get_stride(bo);
-       handle = gbm_bo_get_handle(bo).u32;
-
-       ret = drmModeAddFB(fdDev, width, height, 24, 32, stride, handle, &fb->fbId);
-       if (ret)
-       {
-               return NULL;
-       }
+    struct DrmFb *fb = (struct DrmFb*)gbm_bo_get_user_data(bo);
+    uint32_t width;
+    uint32_t height;
+    uint32_t stride;
+    uint32_t handle;
+    int ret;
+
+    if (fb)
+        return fb;
+
+    fb = (struct DrmFb*)malloc(sizeof *fb);
+    fb->bo = bo;
+    fb->output = output;
+
+    width = gbm_bo_get_width(bo);
+    height = gbm_bo_get_height(bo);
+    stride = gbm_bo_get_stride(bo);
+    handle = gbm_bo_get_handle(bo).u32;
+
+    ret = drmModeAddFB(fdDev, width, height, 24, 32, stride, handle, &fb->fbId);
+    if (ret)
+    {
+        return NULL;
+    }
 
-       gbm_bo_set_user_data(bo, fb, drmFbDestroyCallback);
+    gbm_bo_set_user_data(bo, fb, drmFbDestroyCallback);
 
-       return fb;
+    return fb;
 }
 
 DrmGLESGraphicSystem::DrmGLESGraphicSystem(int windowWidth, int windowHeight,
@@ -138,113 +141,115 @@ DrmGLESGraphicSystem::DrmGLESGraphicSystem(int windowWidth, int windowHeight,
 {
     LOG_DEBUG("DrmGLESGraphicSystem", "creating DrmGLESGraphicSystem");
 
-       m_pfEglBindWaylandDisplayWL = (PFNEGLBINDWAYLANDDISPLAYWL)eglGetProcAddress("eglBindWaylandDisplayWL");
-       m_pfEglUnbindWaylandDisplayWL = (PFNEGLUNBINDWAYLANDDISPLAYWL)eglGetProcAddress("eglUnbindWaylandDisplayWL");
+    m_pfEglBindWaylandDisplayWL = (PFNEGLBINDWAYLANDDISPLAYWL)eglGetProcAddress("eglBindWaylandDisplayWL");
+    m_pfEglUnbindWaylandDisplayWL = (PFNEGLUNBINDWAYLANDDISPLAYWL)eglGetProcAddress("eglUnbindWaylandDisplayWL");
 
-       if (!m_pfEglBindWaylandDisplayWL ||
-               !m_pfEglUnbindWaylandDisplayWL)
-       {
-               LOG_ERROR("DrmGLESGraphicSystem", "Query EGL extensions failed.");
-       }
+    if (!m_pfEglBindWaylandDisplayWL ||
+        !m_pfEglUnbindWaylandDisplayWL)
+    {
+        LOG_ERROR("DrmGLESGraphicSystem", "Query EGL extensions failed.");
+    }
 }
 
 DrmGLESGraphicSystem::~DrmGLESGraphicSystem()
 {
-       WaylandBaseWindowSystem* windowSystem = dynamic_cast<WaylandBaseWindowSystem*>(m_baseWindowSystem);
-       struct wl_display* wlDisplay = windowSystem->getNativeDisplayHandle();
-
-       if (NULL != m_eglContext)
-       {
-               eglDestroyContext(m_eglDisplay, m_eglContext);
-               m_eglContext = NULL;
-       }
-
-       struct DrmOutput* output = NULL;
-       wl_list_for_each(output, &m_outputList, link) {
-               if (NULL != output->eglSurface)
-               {
-                       eglDestroySurface(m_eglDisplay, output->eglSurface);
-                       output->eglSurface = NULL;
-               }
-
-               if (NULL != output->surface)
-               {
-                       gbm_surface_destroy(output->surface);
-                       output->surface = NULL;
-               }
-               free(output);
-       }
-
-       if (wlDisplay)
-               m_pfEglUnbindWaylandDisplayWL(m_eglDisplay, wlDisplay);
+    WaylandBaseWindowSystem* windowSystem = dynamic_cast<WaylandBaseWindowSystem*>(m_baseWindowSystem);
+    struct wl_display* wlDisplay = windowSystem->getNativeDisplayHandle();
+
+    if (NULL != m_eglContext)
+    {
+        eglDestroyContext(m_eglDisplay, m_eglContext);
+        m_eglContext = NULL;
+    }
+
+    struct DrmOutput* output = NULL;
+    wl_list_for_each(output, &m_outputList, link)
+    {
+        if (NULL != output->eglSurface)
+        {
+            eglDestroySurface(m_eglDisplay, output->eglSurface);
+            output->eglSurface = NULL;
+        }
+
+        if (NULL != output->surface)
+        {
+            gbm_surface_destroy(output->surface);
+            output->surface = NULL;
+        }
+        free(output);
+    }
+
+    if (wlDisplay)
+        m_pfEglUnbindWaylandDisplayWL(m_eglDisplay, wlDisplay);
 }
 
 bool DrmGLESGraphicSystem::init(EGLNativeDisplayType display, EGLNativeWindowType NativeWindow)
 {
-       bool ret = true;
-    LOG_DEBUG("DrmGLESGraphicSystem", "init..display:"  << display <<
-                                                                         ", NativeWindow:" << NativeWindow);
-
-       m_nativeDisplay = display;
-       m_nativeWindow  = NativeWindow;
-
-       wl_list_init(&m_outputList);
-
-       m_gbm = (gbm_device*)display;
-       if (m_gbm == NULL)
-       {
-               LOG_ERROR("DrmGLESGraphicSystem", "gbm device is NULL.");
-               return false;
-       }
-
-       m_fdDev = gbm_device_get_fd(m_gbm);
-       if (m_fdDev < 0)
-       {
-               LOG_ERROR("DrmGLESGraphicSystem", "failed to get device fd.");
-               return false;
-       }
-
-       m_eglDisplay = eglGetDisplay((EGLNativeDisplayType)m_gbm);
-       if (m_eglDisplay == EGL_NO_DISPLAY)
-       {
-               LOG_ERROR("DrmGLESGraphicSystem", "failed to get EGL display.");
-               return false;
-       }
-
-       EGLint major, minor;
-       if (!eglInitialize(m_eglDisplay, &major, &minor))
-       {
-               LOG_ERROR("DrmGLESGraphicSystem", "failed to initialising EGL.");
-               return false;
-       }
-
-       static const EGLint configAttribs[] = {
-               EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
-               EGL_RED_SIZE,   1,
-               EGL_GREEN_SIZE, 1,
-               EGL_BLUE_SIZE,  1,
-               EGL_ALPHA_SIZE, 0,
-               EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
-               EGL_NONE
-       };
-       EGLint n = 0;
-       if (!eglChooseConfig(m_eglDisplay, configAttribs, &m_eglConfig, 1, &n) || n != 1)
-       {
-               LOG_ERROR("DrmGLESGraphicSystem", "failed to choose config.");
-               return false;
-       }
-
-       if (!initializeSystem())
-       {
-               LOG_ERROR("DrmGLESGraphicSystem", "failed to initialize system.");
-               return false;
-       }
-
-       if (!GLESGraphicsystem::initOpenGLES(m_windowWidth, m_windowHeight))
-       {
-               LOG_ERROR("DrmGLESGraphicSystem", "failed to initialize gles.");
-               return false;
-       }
+    bool ret = true;
+    LOG_DEBUG("DrmGLESGraphicSystem", "init..display:" << display <<
+                                        ", NativeWindow:" << NativeWindow);
+
+    m_nativeDisplay = display;
+    m_nativeWindow = NativeWindow;
+
+    wl_list_init(&m_outputList);
+
+    m_gbm = (gbm_device*)display;
+    if (m_gbm == NULL)
+    {
+        LOG_ERROR("DrmGLESGraphicSystem", "gbm device is NULL.");
+        return false;
+    }
+
+    m_fdDev = gbm_device_get_fd(m_gbm);
+    if (m_fdDev < 0)
+    {
+        LOG_ERROR("DrmGLESGraphicSystem", "failed to get device fd.");
+        return false;
+    }
+
+    m_eglDisplay = eglGetDisplay((EGLNativeDisplayType)m_gbm);
+    if (m_eglDisplay == EGL_NO_DISPLAY)
+    {
+        LOG_ERROR("DrmGLESGraphicSystem", "failed to get EGL display.");
+        return false;
+    }
+
+    EGLint major;
+    EGLint minor;
+    if (!eglInitialize(m_eglDisplay, &major, &minor))
+    {
+        LOG_ERROR("DrmGLESGraphicSystem", "failed to initialising EGL.");
+        return false;
+    }
+
+    static const EGLint configAttribs[] = {
+        EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+        EGL_RED_SIZE, 1,
+        EGL_GREEN_SIZE, 1,
+        EGL_BLUE_SIZE, 1,
+        EGL_ALPHA_SIZE, 0,
+        EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+        EGL_NONE
+    };
+    EGLint n = 0;
+    if (!eglChooseConfig(m_eglDisplay, configAttribs, &m_eglConfig, 1, &n) || n != 1)
+    {
+        LOG_ERROR("DrmGLESGraphicSystem", "failed to choose config.");
+        return false;
+    }
+
+    if (!initializeSystem())
+    {
+        LOG_ERROR("DrmGLESGraphicSystem", "failed to initialize system.");
+        return false;
+    }
+
+    if (!GLESGraphicsystem::initOpenGLES(m_windowWidth, m_windowHeight))
+    {
+        LOG_ERROR("DrmGLESGraphicSystem", "failed to initialize gles.");
+        return false;
+    }
 
     return ret;
 }
@@ -294,294 +299,297 @@ bool DrmGLESGraphicSystem::initializeSystem()
 {
     LOG_DEBUG("DrmGLESGraphicSystem", "initializeSystem IN");
 
-       WaylandBaseWindowSystem* windowSystem = dynamic_cast<WaylandBaseWindowSystem*>(m_baseWindowSystem);
-       struct wl_display* wlDisplay = windowSystem->getNativeDisplayHandle();
+    WaylandBaseWindowSystem* windowSystem = dynamic_cast<WaylandBaseWindowSystem*>(m_baseWindowSystem);
+    struct wl_display* wlDisplay = windowSystem->getNativeDisplayHandle();
 
-       // bind display
-       m_pfEglBindWaylandDisplayWL(m_eglDisplay, wlDisplay);
+    // bind display
+    m_pfEglBindWaylandDisplayWL(m_eglDisplay, wlDisplay);
 
-       if (!createOutputs())
-               return false;
+    if (!createOutputs())
+        return false;
 
-       if (!eglBindAPI(EGL_OPENGL_ES_API))
-       {
-               LOG_ERROR("DrmGLESGraphicSystem", "failed to bind api EGL_OPENGL_ES_API.");
-               return false;
-       }
+    if (!eglBindAPI(EGL_OPENGL_ES_API))
+    {
+        LOG_ERROR("DrmGLESGraphicSystem", "failed to bind api EGL_OPENGL_ES_API.");
+        return false;
+    }
 
-       EGLint contextAttrs[] = {
-               EGL_CONTEXT_CLIENT_VERSION, 2,
-               EGL_NONE
-       };
+    EGLint contextAttrs[] = {
+        EGL_CONTEXT_CLIENT_VERSION, 2,
+        EGL_NONE
+    };
 
-       m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, contextAttrs);
-       if (!m_eglContext)
-       {
-               LOG_ERROR("DrmGLESGraphicSystem", "failed to create EGL context.");
-               return false;
-       }
+    m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, contextAttrs);
+    if (!m_eglContext)
+    {
+        LOG_ERROR("DrmGLESGraphicSystem", "failed to create EGL context.");
+        return false;
+    }
 
-       struct DrmOutput *output = wl_container_of(m_outputList.prev, output, link);
+    struct DrmOutput *output = wl_container_of(m_outputList.prev, output, link);
 
-       if (!eglMakeCurrent(m_eglDisplay, output->eglSurface, output->eglSurface, m_eglContext))
-       {
-               LOG_ERROR("DrmGLESGraphicSystem", "failed to make context current.");
-               return false;
-       }
+    if (!eglMakeCurrent(m_eglDisplay, output->eglSurface, output->eglSurface, m_eglContext))
+    {
+        LOG_ERROR("DrmGLESGraphicSystem", "failed to make context current.");
+        return false;
+    }
 
-       struct wl_event_loop *loop = wl_display_get_event_loop(wlDisplay);
-       wl_event_loop_add_fd(loop, m_fdDev, WL_EVENT_READABLE, onDrmInput, NULL);
+    struct wl_event_loop *loop = wl_display_get_event_loop(wlDisplay);
+    wl_event_loop_add_fd(loop, m_fdDev, WL_EVENT_READABLE, onDrmInput, NULL);
 
     LOG_DEBUG("DrmGLESGraphicSystem", "initializeSystem OUT");
 
-       return true;
+    return true;
 }
 
 bool DrmGLESGraphicSystem::createOutputs()
 {
     LOG_DEBUG("DrmGLESGraphicSystem", "createOutputs IN");
 
-       drmModeConnector* connector;
-       drmModeRes*       resources;
-       int x = 0, y = 0;
-
-       resources = drmModeGetResources(m_fdDev);
-       if (!resources)
-       {
-               LOG_DEBUG("DrmGLESGraphicSystem", "drmModeGetResources failed.");
-               return false;
-       }
-
-       m_crtcs = (uint32_t*)calloc(resources->count_crtcs, sizeof(uint32_t));
-       if (!m_crtcs)
-       {
-               drmModeFreeResources(resources);
-               return false;
-       }
-       m_crtcsNum = resources->count_crtcs;
-
-       memcpy(m_crtcs, resources->crtcs, sizeof(uint32_t) * m_crtcsNum);
-
-       for (int ii = 0; ii < resources->count_connectors; ++ii)
-       {
-               connector = drmModeGetConnector(m_fdDev, resources->connectors[ii]);
-               if (connector == NULL)
-                       continue;
-
-               if (connector->connection == DRM_MODE_CONNECTED)
-               {
-                       if (createOutputForConnector(resources, connector, x, y) < 0)
-                       {
-                               drmModeFreeConnector(connector);
-                               continue;
-                       }
-
-                       //x += container_of(m_outputList.prev, struct DrmOutput, link)->currentMode->width;
-               }
-
-               drmModeFreeConnector(connector);
-       }
-
-       if (wl_list_empty(&m_outputList))
-       {
-               LOG_ERROR("DrmGLESGraphicSystem", "DrmOutput list is empty.");
-               drmModeFreeResources(resources);
-               return false;
-       }
-
-       drmModeFreeResources(resources);
+    drmModeConnector* connector;
+    drmModeRes*       resources;
+    int x = 0, y = 0;
+
+    resources = drmModeGetResources(m_fdDev);
+    if (!resources)
+    {
+        LOG_DEBUG("DrmGLESGraphicSystem", "drmModeGetResources failed.");
+        return false;
+    }
+
+    m_crtcs = (uint32_t*)calloc(resources->count_crtcs, sizeof(uint32_t));
+    if (!m_crtcs)
+    {
+        drmModeFreeResources(resources);
+        return false;
+    }
+    m_crtcsNum = resources->count_crtcs;
+
+    memcpy(m_crtcs, resources->crtcs, sizeof(uint32_t) * m_crtcsNum);
+
+    for (int ii = 0; ii < resources->count_connectors; ++ii)
+    {
+        connector = drmModeGetConnector(m_fdDev, resources->connectors[ii]);
+        if (connector == NULL)
+            continue;
+
+        if (connector->connection == DRM_MODE_CONNECTED)
+        {
+            if (createOutputForConnector(resources, connector, x, y) < 0)
+            {
+                drmModeFreeConnector(connector);
+                continue;
+            }
+
+            //x += container_of(m_outputList.prev, struct DrmOutput, link)->currentMode->width;
+        }
+
+        drmModeFreeConnector(connector);
+    }
+
+    if (wl_list_empty(&m_outputList))
+    {
+        LOG_ERROR("DrmGLESGraphicSystem", "DrmOutput list is empty.");
+        drmModeFreeResources(resources);
+        return false;
+    }
+
+    drmModeFreeResources(resources);
 
     LOG_DEBUG("DrmGLESGraphicSystem", "createOutputs OUT");
-       return true;
+    return true;
 }
 
 int DrmGLESGraphicSystem::createOutputForConnector(drmModeRes* resources,
-                                                                                                  drmModeConnector* connector,
-                                                                                                  int, int)
+                                                    drmModeConnector* connector,
+                                                    int, int)
 {
-       LOG_DEBUG("DrmGLESGraphicSystem", "createOutputForConnector IN");
-       int ii;
-       drmModeEncoder* encoder;
-       struct DrmMode* drmMode = NULL;
-
-       encoder = drmModeGetEncoder(m_fdDev, connector->encoders[0]);
-       if (encoder == NULL){
-               LOG_ERROR("DrmGLESGraphicSystem", "No encoder for connector.");
-               return -1;
-       }
-
-       for (ii = 0; ii < resources->count_crtcs; ++ii)
-       {
-               if (encoder->possible_crtcs & (1 << ii) &&
-                       !(m_crtcAllocator & (1 << resources->crtcs[ii])))
-               {
-                       break;
-               }
-       }
-       if (ii == resources->count_crtcs)
-       {
-               LOG_ERROR("DrmGLESGraphicSystem", "No usable crtc for encoder.");
-               return -1;
-       }
-
-       DrmOutput* output = (DrmOutput*)malloc(sizeof *output);
-       if (output == NULL)
-       {
-               drmModeFreeEncoder(encoder);
-               return -1;
-       }
-       memset(output, 0x00, sizeof *output);
-
-       output->windowSystem = m_baseWindowSystem;
-       output->fdDev       = m_fdDev;
-       output->crtcID      = resources->crtcs[ii];
-       output->connectorID = connector->connector_id;
-
-       m_crtcAllocator      |= (1 << output->crtcID);
-       m_connectorAllocator |= (1 << output->connectorID);
-
-       wl_list_init(&output->modeList);
-
-       output->orgCrtc = drmModeGetCrtc(m_fdDev, output->crtcID);
-       drmModeFreeEncoder(encoder);
-
-       for (ii = 0; ii < connector->count_modes; ++ii)
-       {
-               if (drmOutputAddMode(output, &connector->modes[ii]))
-                       goto err_free;
-       }
-
-       if (connector->count_modes == 0)
-       {
-               if (drmOutputAddMode(output, &builtin_800x480_for_Crossville))
-                       goto err_free;
-       }
-
-       drmMode = wl_container_of(output->modeList.next, drmMode, link);
-       output->currentMode = drmMode;
-       drmMode->flags = WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
-
-       output->surface = gbm_surface_create(m_gbm,
-                                                      output->currentMode->width,
-                                                      output->currentMode->height,
-                                                      GBM_BO_FORMAT_XRGB8888,
-                                                      GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
-       if (!output->surface) {
-               LOG_ERROR("DrmGLESGraphicSystem", "failed to create gbm surface.");
-               goto err_gbm_surface;
-       }
-
-       output->eglSurface = eglCreateWindowSurface(m_eglDisplay, m_eglConfig,
-               (EGLNativeWindowType)output->surface, NULL);
-       if (output->eglSurface == EGL_NO_SURFACE) {
-               LOG_ERROR("DrmGLESGraphicSystem", "failed to create egl surface.");
-               goto err_egl_surface;
-       }
-
-       output->screenID = (uint)wl_list_length(&m_outputList);
-       m_currentOutput = output;
-
-       wl_list_insert(m_outputList.prev, &output->link);
-
-       LOG_DEBUG("DrmGLESGraphicSystem", "createOutputForConnector OUT (NORMAL)");
-       return 0;
+    LOG_DEBUG("DrmGLESGraphicSystem", "createOutputForConnector IN");
+    int ii;
+    drmModeEncoder* encoder;
+    struct DrmMode* drmMode = NULL;
+
+    encoder = drmModeGetEncoder(m_fdDev, connector->encoders[0]);
+    if (encoder == NULL)
+    {
+        LOG_ERROR("DrmGLESGraphicSystem", "No encoder for connector.");
+        return -1;
+    }
+
+    for (ii = 0; ii < resources->count_crtcs; ++ii)
+    {
+        if (encoder->possible_crtcs & (1 << ii) &&
+            !(m_crtcAllocator & (1 << resources->crtcs[ii])))
+        {
+            break;
+        }
+    }
+    if (ii == resources->count_crtcs)
+    {
+        LOG_ERROR("DrmGLESGraphicSystem", "No usable crtc for encoder.");
+        return -1;
+    }
+
+    DrmOutput* output = (DrmOutput*)malloc(sizeof *output);
+    if (output == NULL)
+    {
+        drmModeFreeEncoder(encoder);
+        return -1;
+    }
+    memset(output, 0x00, sizeof *output);
+
+    output->windowSystem = m_baseWindowSystem;
+    output->fdDev = m_fdDev;
+    output->crtcID = resources->crtcs[ii];
+    output->connectorID = connector->connector_id;
+
+    m_crtcAllocator      |= (1 << output->crtcID);
+    m_connectorAllocator |= (1 << output->connectorID);
+
+    wl_list_init(&output->modeList);
+
+    output->orgCrtc = drmModeGetCrtc(m_fdDev, output->crtcID);
+    drmModeFreeEncoder(encoder);
+
+    for (ii = 0; ii < connector->count_modes; ++ii)
+    {
+        if (drmOutputAddMode(output, &connector->modes[ii]))
+            goto err_free;
+    }
+
+    if (connector->count_modes == 0)
+    {
+        if (drmOutputAddMode(output, &builtin_800x480_for_Crossville))
+            goto err_free;
+    }
+
+    drmMode = wl_container_of(output->modeList.next, drmMode, link);
+    output->currentMode = drmMode;
+    drmMode->flags = WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
+
+    output->surface = gbm_surface_create(m_gbm,
+                                output->currentMode->width,
+                                output->currentMode->height,
+                                GBM_BO_FORMAT_XRGB8888,
+                                GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
+    if (!output->surface)
+    {
+        LOG_ERROR("DrmGLESGraphicSystem", "failed to create gbm surface.");
+        goto err_gbm_surface;
+    }
+
+    output->eglSurface = eglCreateWindowSurface(m_eglDisplay, m_eglConfig,
+        (EGLNativeWindowType)output->surface, NULL);
+    if (output->eglSurface == EGL_NO_SURFACE)
+    {
+        LOG_ERROR("DrmGLESGraphicSystem", "failed to create egl surface.");
+        goto err_egl_surface;
+    }
+
+    output->screenID = (uint)wl_list_length(&m_outputList);
+    m_currentOutput = output;
+
+    wl_list_insert(m_outputList.prev, &output->link);
+
+    LOG_DEBUG("DrmGLESGraphicSystem", "createOutputForConnector OUT (NORMAL)");
+    return 0;
 
 err_egl_surface:
-       if (output->eglSurface)
-               eglDestroySurface(m_eglDisplay, output->eglSurface);
+    if (output->eglSurface)
+        eglDestroySurface(m_eglDisplay, output->eglSurface);
 
 err_gbm_surface:
-       if (output->surface)
-               gbm_surface_destroy(output->surface);
+    if (output->surface)
+        gbm_surface_destroy(output->surface);
 
 err_free:
-       drmModeFreeCrtc(output->orgCrtc);
-       m_crtcAllocator &= ~(1 << output->crtcID);
-       m_connectorAllocator &= ~(1 << output->connectorID);
+    drmModeFreeCrtc(output->orgCrtc);
+    m_crtcAllocator &= ~(1 << output->crtcID);
+    m_connectorAllocator &= ~(1 << output->connectorID);
 
-       free(output);
-       LOG_DEBUG("DrmGLESGraphicSystem", "createOutputForConnector OUT (ERROR)");
-       return -1;
+    free(output);
+    LOG_DEBUG("DrmGLESGraphicSystem", "createOutputForConnector OUT (ERROR)");
+    return -1;
 }
 
 int DrmGLESGraphicSystem::drmOutputAddMode(struct DrmOutput* output, drmModeModeInfo* info)
 {
-       struct DrmMode* mode;
+    struct DrmMode* mode;
 
-       mode = (struct DrmMode*)malloc(sizeof *mode);
-       if (mode == NULL)
-               return -1;
+    mode = (struct DrmMode*)malloc(sizeof *mode);
+    if (mode == NULL)
+        return -1;
 
-       mode->flags    = 0;
-       mode->width    = info->hdisplay;
-       mode->height   = info->vdisplay;
-       mode->refresh  = info->vrefresh;
-       mode->modeInfo = *info;
-       wl_list_insert(output->modeList.prev, &mode->link);
+    mode->flags = 0;
+    mode->width = info->hdisplay;
+    mode->height = info->vdisplay;
+    mode->refresh = info->vrefresh;
+    mode->modeInfo = *info;
+    wl_list_insert(output->modeList.prev, &mode->link);
 
-       return 0;
+    return 0;
 }
 
 int DrmGLESGraphicSystem::drmOutputPrepareRender(struct DrmOutput* output)
 {
-       if (!eglMakeCurrent(m_eglDisplay, output->eglSurface, output->eglSurface, m_eglContext))
-       {
-               LOG_ERROR("DrmGLESGraphicSystem", "failed to make current.");
-               return -1;
-       }
-       return 0;
+    if (!eglMakeCurrent(m_eglDisplay, output->eglSurface, output->eglSurface, m_eglContext))
+    {
+        LOG_ERROR("DrmGLESGraphicSystem", "failed to make current.");
+        return -1;
+    }
+    return 0;
 }
 
 void DrmGLESGraphicSystem::swapBuffers()
 {
     LOG_DEBUG("DrmGLESGraphicSystem", "swapBuffers IN");
 
-       struct DrmOutput* output = NULL;
-
-       wl_list_for_each(output, &m_outputList, link)
-       {
-               if (output != m_currentOutput)
-               {
-                       continue;
-               }
-
-               if (!output->next)
-               {
-                       eglSwapBuffers(m_eglDisplay, output->eglSurface);
-                       struct gbm_bo *bo = gbm_surface_lock_front_buffer(output->surface);
-                       if (!bo)
-                               break;
-
-                       output->next = drmFbGetFromBo(bo, m_fdDev, output);
-                       if (!output->next)
-                       {
-                               gbm_surface_release_buffer(output->surface, bo);
-                               break;
-                       }
-               }
-
-               if (!output->current)
-               {
-                       if (drmModeSetCrtc(m_fdDev, output->crtcID,
-                                                                output->next->fbId, 0, 0,
-                                                                &output->connectorID, 1,
-                                                                &output->currentMode->modeInfo))
-                       {
-                               LOG_ERROR("DrmGLESGraphicSystem", "failed to set mode in swapBuffers.");
-                               break;
-                       }
-               }
-
-               if (drmModePageFlip(m_fdDev, output->crtcID, output->next->fbId,
-                       DRM_MODE_PAGE_FLIP_EVENT, output) < 0)
-               {
-                       LOG_ERROR("DrmGLESGraphicSystem", "queueing pageflip failed");
-                       break;
-               }
-
-               output->pageFlipPending = 1;
-               break;
-       }
+    struct DrmOutput* output = NULL;
+
+    wl_list_for_each(output, &m_outputList, link)
+    {
+        if (output != m_currentOutput)
+        {
+            continue;
+        }
+
+        if (!output->next)
+        {
+            eglSwapBuffers(m_eglDisplay, output->eglSurface);
+            struct gbm_bo *bo = gbm_surface_lock_front_buffer(output->surface);
+            if (!bo)
+                break;
+
+            output->next = drmFbGetFromBo(bo, m_fdDev, output);
+            if (!output->next)
+            {
+                gbm_surface_release_buffer(output->surface, bo);
+                break;
+            }
+        }
+
+        if (!output->current)
+        {
+            if (drmModeSetCrtc(m_fdDev, output->crtcID,
+                                    output->next->fbId, 0, 0,
+                                    &output->connectorID, 1,
+                                    &output->currentMode->modeInfo))
+            {
+                LOG_ERROR("DrmGLESGraphicSystem", "failed to set mode in swapBuffers.");
+                break;
+            }
+        }
+
+        if (drmModePageFlip(m_fdDev, output->crtcID, output->next->fbId,
+            DRM_MODE_PAGE_FLIP_EVENT, output) < 0)
+        {
+            LOG_ERROR("DrmGLESGraphicSystem", "queueing pageflip failed");
+            break;
+        }
+
+        output->pageFlipPending = 1;
+        break;
+    }
 
     LOG_DEBUG("DrmGLESGraphicSystem", "swapBuffers OUT");
 }
index 4b81179..5711d89 100644 (file)
 #include <algorithm>
 
 static const float vertices[8 * 12] =
-{ 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0,
-
-0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0,
+{
+    0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0,
 
-0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0,
+    0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0,
 
-1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0,
+    0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0,
 
-0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0,
+    1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0,
 
-1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0,
+    0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0,
 
-0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0,
+    1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0,
 
-0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0
+    0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0,
 
+    0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0
 };
 
 GLESGraphicsystem::GLESGraphicsystem(int windowWidth, int windowHeight, PfnShaderProgramCreator shaderProgram)
@@ -83,7 +83,7 @@ GLESGraphicsystem::GLESGraphicsystem(int windowWidth, int windowHeight, PfnShade
 , m_texId(0)
 {
     LOG_DEBUG("GLESGraphicsystem", "creating GLESGraphicsystem");
-    for (int i=0; i < OPT_COUNT; i++)
+    for (int i = 0; i < OPT_COUNT; i++)
     {
         m_optimizations[i] = OPT_MODE_HEURISTIC;
     }
@@ -113,7 +113,7 @@ void GLESGraphicsystem::activateGraphicContext()
     eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
 }
 
-void GLESGraphicsystem::releaseGraphicContext() 
+void GLESGraphicsystem::releaseGraphicContext()
 {
     eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
 }
@@ -123,11 +123,13 @@ bool GLESGraphicsystem::init(EGLNativeDisplayType display, EGLNativeWindowType N
     m_nativeDisplay = display;
     m_nativeWindow = NativeWindow;
     LOG_INFO("GLESGraphicsystem", "Initialisation");
-    EGLint iMajorVersion, iMinorVersion;
+    EGLint iMajorVersion;
+    EGLint iMinorVersion;
     LOG_DEBUG("GLESGraphicsystem", "Getting EGL Display with native display " << m_nativeDisplay);
     m_eglDisplay = eglGetDisplay(m_nativeDisplay);
 
-    if (m_eglDisplay == EGL_NO_DISPLAY){
+    if (m_eglDisplay == EGL_NO_DISPLAY)
+    {
         LOG_ERROR("GLESGraphicsystem", "failed to Get EGL Display");
         return false;
     }
@@ -143,11 +145,11 @@ bool GLESGraphicsystem::init(EGLNativeDisplayType display, EGLNativeWindowType N
     eglBindAPI(EGL_OPENGL_ES_API);
 
     EGLint pi32ConfigAttribs[] = {
-            EGL_SURFACE_TYPE,    EGL_WINDOW_BIT | EGL_PBUFFER_BIT,
-            EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
-            EGL_RED_SIZE,        8,
-            EGL_ALPHA_SIZE,      8,
-            EGL_NONE
+        EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT,
+        EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+        EGL_RED_SIZE, 8,
+        EGL_ALPHA_SIZE, 8,
+        EGL_NONE
     };
 
     LOG_DEBUG("GLESGraphicsystem", "EGLChooseConfig");
@@ -169,21 +171,21 @@ bool GLESGraphicsystem::init(EGLNativeDisplayType display, EGLNativeWindowType N
     if (!m_eglSurface)
     {
         EGLenum status = eglGetError();
-        LOG_ERROR("GLESGraphicsystem", "Window Surface creation failed with EGL Error Code: "<< status);
+        LOG_ERROR("GLESGraphicsystem", "Window Surface creation failed with EGL Error Code: " << status);
         return false;
     }
     LOG_DEBUG("GLESGraphicsystem", "Window Surface creation successfull");
 
     EGLint contextAttrs[] = {
-            EGL_CONTEXT_CLIENT_VERSION,
-            2,
-            EGL_NONE
+        EGL_CONTEXT_CLIENT_VERSION,
+        2,
+        EGL_NONE
     };
 
     m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, NULL, contextAttrs);
     if (!m_eglContext)
     {
-        LOG_ERROR("GLESGraphicsystem","EGL couldn't create context\n");
+        LOG_ERROR("GLESGraphicsystem", "EGL couldn't create context\n");
         return false;
     }
     LOG_DEBUG("GLESGraphicsystem", "EGL make current ...");
@@ -224,11 +226,11 @@ bool GLESGraphicsystem::init(EGLNativeDisplayType display, EGLNativeWindowType N
 #define SHADERKEY_TRANSPARENCY_MASK(x)  (0x1 << (SHADERKEY_TRANSPARENCY_SHIFT(x)))
 
 unsigned int GLESGraphicsystem::shaderKey(int numSurfaces,
-                                 int needsBlend,
-                                 int hasTransparency0, int hasAlphaChannel0, int hasChromakey0,
-                                 int hasTransparency1, int hasAlphaChannel1, int hasChromakey1,
-                                 int hasTransparency2, int hasAlphaChannel2, int hasChromakey2,
-                                 int hasTransparency3, int hasAlphaChannel3, int hasChromakey3)
+                                    int needsBlend,
+                                    int hasTransparency0, int hasAlphaChannel0, int hasChromakey0,
+                                    int hasTransparency1, int hasAlphaChannel1, int hasChromakey1,
+                                    int hasTransparency2, int hasAlphaChannel2, int hasChromakey2,
+                                    int hasTransparency3, int hasAlphaChannel3, int hasChromakey3)
 {
     return (((numSurfaces << SHADERKEY_NUM_SURF_SHIFT) & SHADERKEY_NUM_SURF_MASK) |
             ((needsBlend << SHADERKEY_BLEND_SHIFT) & SHADERKEY_BLEND_MASK) |
@@ -255,8 +257,8 @@ void GLESGraphicsystem::debugShaderKey(unsigned int key)
     int needsBlend =  ((key & SHADERKEY_BLEND_MASK) >> SHADERKEY_BLEND_SHIFT);
 
     LOG_DEBUG("GLESGraphicsystem", "Key: " << std::hex << key
-                               << " numSurfaces:" << numSurfaces
-                               << " needsBlend:" << needsBlend);
+                                            << " numSurfaces:" << numSurfaces
+                                            << " needsBlend:" << needsBlend);
 
     for (int i = 0; i < SHADERKEY_MAX_SURFACES; i++)
     {
@@ -264,9 +266,9 @@ void GLESGraphicsystem::debugShaderKey(unsigned int key)
         int hasAlphaChannel = ((key & SHADERKEY_ALPHA_CHANNEL_MASK(i)) >> SHADERKEY_ALPHA_CHANNEL_SHIFT(i));
         int hasTransparency = ((key & SHADERKEY_TRANSPARENCY_MASK(i)) >> SHADERKEY_TRANSPARENCY_SHIFT(i));
         LOG_DEBUG("GLESGraphicsystem", "    Surface" << i << ":"
-                                   << " hasTransparency:" << hasTransparency
-                                   << " hasAlphaChannel:" << hasAlphaChannel
-                                   << " hasChromakey:" << hasChromakey);
+                                                << " hasTransparency:" << hasTransparency
+                                                << " hasAlphaChannel:" << hasAlphaChannel
+                                                << " hasChromakey:" << hasChromakey);
     }
 }
 
@@ -299,7 +301,7 @@ bool GLESGraphicsystem::needsRedraw(Layer *layer)
     if (layer->visibility && layer->opacity > 0.0)
     {
         SurfaceList surfaces = layer->getAllSurfaces();
-        for(SurfaceListConstIterator currentS = surfaces.begin(); currentS != surfaces.end(); currentS++)
+        for (SurfaceListConstIterator currentS = surfaces.begin(); currentS != surfaces.end(); currentS++)
         {
             if ((*currentS)->renderPropertyChanged)
             {
@@ -356,7 +358,7 @@ void GLESGraphicsystem::renderSWLayer(Layer *layer, bool clear)
         clearBackground();
     }
 
-    if ( layer->visibility && layer->opacity > 0.0 )
+    if (layer->visibility && layer->opacity > 0.0)
     {
         bool bChromaKeyEnabled = m_currentLayer->getChromaKeyEnabled();
         if (bChromaKeyEnabled && !setupTextureForChromaKey())
@@ -366,7 +368,7 @@ void GLESGraphicsystem::renderSWLayer(Layer *layer, bool clear)
         }
 
         SurfaceList surfaces = m_currentLayer->getAllSurfaces();
-        for(std::list<Surface*>::const_iterator currentS = surfaces.begin(); currentS != surfaces.end(); currentS++)
+        for (std::list<Surface*>::const_iterator currentS = surfaces.begin(); currentS != surfaces.end(); currentS++)
         {
             if ((*currentS)->hasNativeContent() && (*currentS)->visibility && (*currentS)->opacity>0.0f)
             {
@@ -389,7 +391,7 @@ bool GLESGraphicsystem::setOptimizationMode(OptimizationType id, OptimizationMod
 {
     if ((int)id >= OPT_COUNT)
     {
-       return false;
+        return false;
     }
 
     if ((int)mode >= OPT_MODE_COUNT)
@@ -406,7 +408,7 @@ bool GLESGraphicsystem::getOptimizationMode(OptimizationType id, OptimizationMod
 {
     if ((int)id >= OPT_COUNT)
     {
-       return false;
+        return false;
     }
 
     *mode = m_optimizations[id];
@@ -423,7 +425,7 @@ bool GLESGraphicsystem::canMultitexture(LayerList layers)
     {
         // No layer rotation support currently for multitexture rendering
         // No multitexture rendering if one layer has chromaKeyEnabled
-        if ((*layer)->getOrientation() != 0 || (*layer)->getChromaKeyEnabled() )
+        if ((*layer)->getOrientation() != 0 || (*layer)->getChromaKeyEnabled())
         {
             return false;
         }
@@ -440,7 +442,7 @@ bool GLESGraphicsystem::canMultitexture(LayerList layers)
             }
 
             // TODO, other custom shaders okay too.
-            if ( (shader && shader != m_defaultShader) || (*surface)->getChromaKeyEnabled())
+            if ((shader && shader != m_defaultShader) || (*surface)->getChromaKeyEnabled())
             {
                 return false;
             }
@@ -457,7 +459,7 @@ bool GLESGraphicsystem::useMultitexture()
     static int count = 0;
     count++;
 
-    switch(m_optimizations[OPT_MULTITEXTURE])
+    switch (m_optimizations[OPT_MULTITEXTURE])
     {
     case OPT_MODE_FORCE_OFF:
         return false;
@@ -490,12 +492,14 @@ bool GLESGraphicsystem::canSkipClear()
 // not always wise.
 bool GLESGraphicsystem::useSkipClear(LayerList layers)
 {
-    float surfaceArea, displayArea, threshold;
+    float surfaceArea;
+    float displayArea;
+    float threshold;
     SurfaceList surfaces;
     static int count = 0;
     count++;
 
-    switch(m_optimizations[OPT_SKIP_CLEAR])
+    switch (m_optimizations[OPT_SKIP_CLEAR])
     {
     case OPT_MODE_FORCE_OFF:
         return false;
@@ -509,14 +513,14 @@ bool GLESGraphicsystem::useSkipClear(LayerList layers)
         displayArea = m_displayWidth * m_displayHeight;
         surfaceArea = 0;
         threshold = .75; // 75% (Needs to be refined by experimentation)
-        for(LayerListConstIterator layer = layers.begin(); layer != layers.end(); layer++)
+        for (LayerListConstIterator layer = layers.begin(); layer != layers.end(); layer++)
         {
             surfaces = (*layer)->getAllSurfaces();
 
             if (surfaces.size() == 0) continue;
             if (!(*layer)->visibility || (*layer)->getOpacity() <= 0.0f) continue;
 
-            for(SurfaceListConstIterator currentS = surfaces.begin(); currentS != surfaces.end(); currentS++)
+            for (SurfaceListConstIterator currentS = surfaces.begin(); currentS != surfaces.end(); currentS++)
             {
                 if ((*currentS)->visibility == true && (*currentS)->getOpacity() > 0.0f)
                 {
@@ -540,14 +544,14 @@ bool GLESGraphicsystem::useSkipClear(LayerList layers)
 
 static void incrementDrawCounters(LayerList layers)
 {
-    for(LayerListConstIterator layer = layers.begin(); layer != layers.end(); layer++)
+    for (LayerListConstIterator layer = layers.begin(); layer != layers.end(); layer++)
     {
         SurfaceList surfaces = (*layer)->getAllSurfaces();
 
         if (surfaces.size() == 0) continue;
         if (!(*layer)->visibility || (*layer)->getOpacity() <= 0.0f) continue;
 
-        for(SurfaceListConstIterator surface = surfaces.begin(); surface != surfaces.end(); surface++)
+        for (SurfaceListConstIterator surface = surfaces.begin(); surface != surfaces.end(); surface++)
         {
             if ((*surface)->visibility == true && (*surface)->getOpacity() > 0.0f)
             {
@@ -616,7 +620,9 @@ void GLESGraphicsystem::renderSWLayers(LayerList layers, bool clear)
                 {
                     renderRegion(*region, false); //don't blend
                 }
-            } else {
+            }
+            else
+            {
                 renderSWLayer(*layer, clear);
                 countersIncremented = true;
             }
@@ -658,7 +664,7 @@ Shader *GLESGraphicsystem::pickOptimizedShader(SurfaceList surfaces, bool needsB
 
         hastransparency[i] = ((*surface)->getOpacity() * layer->getOpacity()) < 1.0f;
         hasalphachannel[i] = PixelFormatHasAlpha((*surface)->getPixelFormat());
-        haschromakey[i] = (*surface)->getChromaKeyEnabled() ? 1:0 ;
+        haschromakey[i] = (*surface)->getChromaKeyEnabled() ? 1 : 0;
     }
 
     unsigned int key = shaderKey(numSurfaces,
@@ -678,14 +684,17 @@ Shader *GLESGraphicsystem::pickOptimizedShader(SurfaceList surfaces, bool needsB
         LOG_WARNING("GLESGraphicsystem", "No optimal shader found for key=" << std::hex << key);
         LOG_WARNING("GLESGraphicsystem", "Falling back to default shader");
 
-        switch (numSurfaces) {
+        switch (numSurfaces)
+        {
         case 0:
             return m_defaultShaderClear;
         case 1:
             if (haschromakey[0])
             {
                 return m_defaultShaderAddUniformChromaKey;
-            } else { 
+            }
+            else
+            {
                 return needsBlend ? m_defaultShader : m_defaultShaderNoBlend;
             }
         case 2:
@@ -751,18 +760,20 @@ void GLESGraphicsystem::renderSurface(Surface* surface)
         shader = layerShader;
     }
 
-
     FloatRectangle targetSurfaceSource = surface->getTargetSourceRegion();
     FloatRectangle targetSurfaceDestination = surface->getTargetDestinationRegion();
 
     float textureCoordinates[4];
-    ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSource, surface->OriginalSourceWidth, surface->OriginalSourceHeight, textureCoordinates);
+    ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSource,
+                                                                surface->OriginalSourceWidth,
+                                                                surface->OriginalSourceHeight,
+                                                                textureCoordinates);
 
     applyLayerMatrix(layerMatrix);
     // update all common uniforms, scale values to display size
     // offsets are generated w.r.t lower left corner (following GL conventions)
     uniforms.x = targetSurfaceDestination.x / m_displayWidth;
-    uniforms.y = 1.0f - (targetSurfaceDestination.y + targetSurfaceDestination.height) / m_displayHeight;;
+    uniforms.y = 1.0f - (targetSurfaceDestination.y + targetSurfaceDestination.height) / m_displayHeight;
     uniforms.width = targetSurfaceDestination.width / m_displayWidth;
     uniforms.height = targetSurfaceDestination.height / m_displayHeight;
     uniforms.opacity[0] = (surface)->getOpacity() * m_currentLayer->getOpacity();
@@ -787,29 +798,29 @@ void GLESGraphicsystem::renderSurface(Surface* surface)
     //We only know about specific Shaders, only do this if we start with the defaultShader
     if (shader == m_defaultShader && uniforms.opacity[0] == 1.0f)
     {
-        if(!PixelFormatHasAlpha((surface)->getPixelFormat()))
+        if (!PixelFormatHasAlpha((surface)->getPixelFormat()))
         {
             //disable alpha blend completely
-            glDisable (GL_BLEND);
+            glDisable(GL_BLEND);
         }
         else
         {
             //make sure alpha blend is enabled
-            glEnable (GL_BLEND);
+            glEnable(GL_BLEND);
         }
     }
     else
     {
         //make sure alpha blend is enabled
-        glEnable (GL_BLEND);
+        glEnable(GL_BLEND);
     }
 
     {
         SurfaceList sl;
         sl.push_back(surface);
         bool needblend = shader != m_defaultShader ||
-                         PixelFormatHasAlpha((surface)->getPixelFormat()) ||
-                         uniforms.opacity[0] < 1.0f;
+                            PixelFormatHasAlpha((surface)->getPixelFormat()) ||
+                            uniforms.opacity[0] < 1.0f;
         shader = pickOptimizedShader(sl, needblend);
     }
 
@@ -849,9 +860,9 @@ void GLESGraphicsystem::renderSurface(Surface* surface)
 
     m_binder->unbindSurfaceTexture(surface);
     glErrorCode = glGetError();
-    if ( GL_NO_ERROR != glErrorCode )
+    if (GL_NO_ERROR != glErrorCode)
     {
-        LOG_ERROR("GLESGraphicsystem", "GL Error occured :" << glErrorCode );
+        LOG_ERROR("GLESGraphicsystem", "GL Error occured :" << glErrorCode);
     };
 }
 
@@ -876,7 +887,7 @@ bool GLESGraphicsystem::renderSurfaces(SurfaceList surfaces, FloatRectangle targ
     // update all common uniforms, scale values to display size
     // offsets are generated w.r.t lower left corner (following GL conventions)
     uniforms.x = targetDestination.x / m_displayWidth;
-    uniforms.y = 1.0f - (targetDestination.y + targetDestination.height) / m_displayHeight;;
+    uniforms.y = 1.0f - (targetDestination.y + targetDestination.height) / m_displayHeight;
     uniforms.width = targetDestination.width / m_displayWidth;
     uniforms.height = targetDestination.height / m_displayHeight;
     uniforms.matrix = &identityMatrix.f[0];
@@ -961,11 +972,11 @@ bool GLESGraphicsystem::renderSurfaces(SurfaceList surfaces, FloatRectangle targ
     // Set GL blend state (ignored for binary shaders)
     if (blend)
     {
-        glEnable (GL_BLEND);
+        glEnable(GL_BLEND);
     }
     else
     {
-        glDisable (GL_BLEND);
+        glDisable(GL_BLEND);
     }
 
     shader->use();
@@ -1022,9 +1033,9 @@ bool GLESGraphicsystem::renderSurfaces(SurfaceList surfaces, FloatRectangle targ
     }
 
     glErrorCode = glGetError();
-    if ( GL_NO_ERROR != glErrorCode )
+    if (GL_NO_ERROR != glErrorCode)
     {
-        LOG_ERROR("GLESGraphicsystem", "GL Error occured :" << glErrorCode );
+        LOG_ERROR("GLESGraphicsystem", "GL Error occured :" << glErrorCode);
         return false;
     };
 
@@ -1036,7 +1047,7 @@ void GLESGraphicsystem::renderRegion(MultiSurfaceRegion* region, bool blend)
     // Render all surfaces in this region, performing as many rendering
     // passes as necessary, each with up to MAX_MULTI_SURFACE surfaces.
     SurfaceList surfaceBatch;
-    for(SurfaceListConstIterator currentS = region->m_surfaces.begin(); currentS != region->m_surfaces.end(); currentS++)
+    for (SurfaceListConstIterator currentS = region->m_surfaces.begin(); currentS != region->m_surfaces.end(); currentS++)
     {
         surfaceBatch.push_back(*currentS);
 
@@ -1064,20 +1075,31 @@ void GLESGraphicsystem::renderRegion(MultiSurfaceRegion* region, bool blend)
     }
 }
 
-struct OrderedSurface {
+struct OrderedSurface
+{
     Surface *surface;
     int depth;
-    OrderedSurface(Surface *s, int d):surface(s),depth(d) {}
-    bool operator<(OrderedSurface rhs) const { return depth < rhs.depth; }
-    bool operator==(OrderedSurface rhs) const { return surface == rhs.surface; }
+    OrderedSurface(Surface *s, int d):surface(s), depth(d) {}
+    bool operator<(OrderedSurface rhs) const
+    {
+        return depth < rhs.depth;
+    }
+    bool operator==(OrderedSurface rhs) const
+    {
+        return surface == rhs.surface;
+    }
 };
 
-struct RegionLimit {
+struct RegionLimit
+{
     float value; // Location on either X or Y axis
     bool entry;  // 1=in, 0=out
     OrderedSurface orderedSurface;
-    RegionLimit(float v, bool e, OrderedSurface s):value(v),entry(e),orderedSurface(s) {}
-    bool operator<(RegionLimit rhs) const { return value < rhs.value; }
+    RegionLimit(float v, bool e, OrderedSurface s):value(v), entry(e), orderedSurface(s) {}
+    bool operator<(RegionLimit rhs) const
+    {
+        return value < rhs.value;
+    }
 };
 
 // Creates a list of non-overlapping screen-space regions, each with a list of
@@ -1123,14 +1145,14 @@ std::list<MultiSurfaceRegion*> GLESGraphicsystem::computeRegions(std::list<Layer
     std::list<MultiSurfaceRegion*> regions;
     std::vector<RegionLimit> xlimits;
     std::vector<RegionLimit> ylimits;
+
     // If clear is needed enable a dummy surface so that additional zero-surface
     // regions will be created around the edges to fill screen (when necessary)
     if (clear)
     {
-        xlimits.push_back(RegionLimit(0,               true,  OrderedSurface(NULL, 0)));
-        xlimits.push_back(RegionLimit(m_displayWidth,  false, OrderedSurface(NULL, 0)));
-        ylimits.push_back(RegionLimit(0,               true,  OrderedSurface(NULL, 0)));
+        xlimits.push_back(RegionLimit(0, true, OrderedSurface(NULL, 0)));
+        xlimits.push_back(RegionLimit(m_displayWidth, false, OrderedSurface(NULL, 0)));
+        ylimits.push_back(RegionLimit(0, true, OrderedSurface(NULL, 0)));
         ylimits.push_back(RegionLimit(m_displayHeight, false, OrderedSurface(NULL, 0)));
     }
 
@@ -1139,7 +1161,7 @@ std::list<MultiSurfaceRegion*> GLESGraphicsystem::computeRegions(std::list<Layer
     // also stored in the edge information.
     LayerListConstIterator layer;
     int depth = 0;
-    for(layer = layers.begin(); layer != layers.end(); layer++)
+    for (layer = layers.begin(); layer != layers.end(); layer++)
     {
         if ((*layer)->visibility == false || (*layer)->getOpacity() <= 0.0f)
         {
@@ -1148,7 +1170,7 @@ std::list<MultiSurfaceRegion*> GLESGraphicsystem::computeRegions(std::list<Layer
 
         SurfaceList surfaces = (*layer)->getAllSurfaces();
         SurfaceListConstIterator surface;
-        for(surface = surfaces.begin(); surface != surfaces.end(); surface++)
+        for (surface = surfaces.begin(); surface != surfaces.end(); surface++)
         {
             if (!(*surface)->hasNativeContent())
             {
@@ -1164,9 +1186,9 @@ std::list<MultiSurfaceRegion*> GLESGraphicsystem::computeRegions(std::list<Layer
 
             FloatRectangle rect = (*surface)->getTargetDestinationRegion();
 
-            xlimits.push_back(RegionLimit(rect.x,               true,  OrderedSurface((*surface), depth)));
-            xlimits.push_back(RegionLimit(rect.x + rect.width,  false, OrderedSurface((*surface), depth)));
-            ylimits.push_back(RegionLimit(rect.y,               true,  OrderedSurface((*surface), depth)));
+            xlimits.push_back(RegionLimit(rect.x, true, OrderedSurface((*surface), depth)));
+            xlimits.push_back(RegionLimit(rect.x + rect.width, false, OrderedSurface((*surface), depth)));
+            ylimits.push_back(RegionLimit(rect.y, true, OrderedSurface((*surface), depth)));
             ylimits.push_back(RegionLimit(rect.y + rect.height, false, OrderedSurface((*surface), depth)));
         }
     }
@@ -1324,7 +1346,7 @@ bool GLESGraphicsystem::initOpenGLES(EGLint displayWidth, EGLint displayHeight)
     m_defaultShader = Shader::createShader("default", "default");
     m_defaultShaderNoBlend = Shader::createShader("default", "default_no_blend");
     m_defaultShaderNoUniformAlpha = Shader::createShader("default", "default_no_uniform_alpha");
-    m_defaultShaderAddUniformChromaKey= Shader::createShader("default", "default_add_uniform_chromakey");
+    m_defaultShaderAddUniformChromaKey = Shader::createShader("default", "default_add_uniform_chromakey");
     m_defaultShaderNoUniformAlphaNoBlend = Shader::createShader("default", "default_no_blend_no_uniform_alpha");
     m_defaultShader2surf = Shader::createShader("default_2surf", "default_2surf");
     m_defaultShader2surfNoBlend = Shader::createShader("default_2surf", "default_2surf_no_blend");
@@ -1376,22 +1398,22 @@ bool GLESGraphicsystem::initOpenGLES(EGLint displayWidth, EGLint displayHeight)
     //   C: Texture n has chromakey
     //                         0      1      2      3
     //                       -----  -----  -----  -----
-    //                  # B  T A C  T A C  T A C  T A C
-    m_shaders[shaderKey(0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0)] = m_defaultShaderClear;
-    m_shaders[shaderKey(1,1, 1,1,0, 0,0,0, 0,0,0, 0,0,0)] = m_defaultShader;
-    m_shaders[shaderKey(1,1, 1,1,1, 0,0,0, 0,0,0, 0,0,0)] = m_defaultShaderAddUniformChromaKey;
-    m_shaders[shaderKey(1,0, 1,1,0, 0,0,0, 0,0,0, 0,0,0)] = m_defaultShaderNoBlend;
-    m_shaders[shaderKey(1,1, 0,1,0, 0,0,0, 0,0,0, 0,0,0)] = m_defaultShaderNoUniformAlpha;
-    m_shaders[shaderKey(1,0, 0,1,0, 0,0,0, 0,0,0, 0,0,0)] = m_defaultShaderNoUniformAlphaNoBlend;
-
-    m_shaders[shaderKey(2,1, 1,1,0, 1,1,0, 0,0,0, 0,0,0)] = m_defaultShader2surf;
-    m_shaders[shaderKey(2,0, 1,1,0, 1,1,0, 0,0,0, 0,0,0)] = m_defaultShader2surfNoBlend;
-    m_shaders[shaderKey(2,1, 0,1,0, 0,1,0, 0,0,0, 0,0,0)] = m_defaultShader2surfNoUniformAlpha;
-    m_shaders[shaderKey(2,0, 0,1,0, 0,1,0, 0,0,0, 0,0,0)] = m_defaultShader2surfNoUniformAlphaNoBlend;
-    m_shaders[shaderKey(2,1, 0,1,0, 1,1,0, 0,0,0, 0,0,0)] = m_defaultShader2surfNoUniformAlpha0;
-    m_shaders[shaderKey(2,0, 0,1,0, 1,1,0, 0,0,0, 0,0,0)] = m_defaultShader2surfNoUniformAlpha0NoBlend;
-    m_shaders[shaderKey(2,1, 1,1,0, 0,1,0, 0,0,0, 0,0,0)] = m_defaultShader2surfNoUniformAlpha1;
-    m_shaders[shaderKey(2,0, 1,1,0, 0,1,0, 0,0,0, 0,0,0)] = m_defaultShader2surfNoUniformAlpha1NoBlend;
+    //                  #  B  T  A  C  T  A  C  T  A  C  T  A  C
+    m_shaders[shaderKey(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)] = m_defaultShaderClear;
+    m_shaders[shaderKey(1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)] = m_defaultShader;
+    m_shaders[shaderKey(1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0)] = m_defaultShaderAddUniformChromaKey;
+    m_shaders[shaderKey(1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)] = m_defaultShaderNoBlend;
+    m_shaders[shaderKey(1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)] = m_defaultShaderNoUniformAlpha;
+    m_shaders[shaderKey(1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)] = m_defaultShaderNoUniformAlphaNoBlend;
+
+    m_shaders[shaderKey(2, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0)] = m_defaultShader2surf;
+    m_shaders[shaderKey(2, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0)] = m_defaultShader2surfNoBlend;
+    m_shaders[shaderKey(2, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0)] = m_defaultShader2surfNoUniformAlpha;
+    m_shaders[shaderKey(2, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0)] = m_defaultShader2surfNoUniformAlphaNoBlend;
+    m_shaders[shaderKey(2, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0)] = m_defaultShader2surfNoUniformAlpha0;
+    m_shaders[shaderKey(2, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0)] = m_defaultShader2surfNoUniformAlpha0NoBlend;
+    m_shaders[shaderKey(2, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0)] = m_defaultShader2surfNoUniformAlpha1;
+    m_shaders[shaderKey(2, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0)] = m_defaultShader2surfNoUniformAlpha1NoBlend;
 
     return result;
 }
@@ -1407,15 +1429,15 @@ void GLESGraphicsystem::saveScreenShotOfFramebuffer(std::string fileToSave)
 {
     // clear error if any
     int error = glGetError();
-    LOG_DEBUG("GLESGraphicSystem","taking screenshot and saving it to:" << fileToSave);
+    LOG_DEBUG("GLESGraphicSystem", "taking screenshot and saving it to:" << fileToSave);
 
-    LOG_DEBUG("GLESGraphicSystem","Screenshot: " << m_displayWidth << " * " << m_displayHeight);
-    char *buffer = (char *) malloc( m_displayWidth * m_displayHeight * 4 * sizeof(char));
+    LOG_DEBUG("GLESGraphicSystem", "Screenshot: " << m_displayWidth << " * " << m_displayHeight);
+    char *buffer = (char *) malloc(m_displayWidth * m_displayHeight * 4 * sizeof(char));
     glReadPixels(0, 0, m_displayWidth, m_displayHeight, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
     error = glGetError();
     if (error != GL_NO_ERROR)
     {
-        LOG_DEBUG("GLESGraphicSystem","error reading pixels for screenshot: " << error);
+        LOG_DEBUG("GLESGraphicSystem", "error reading pixels for screenshot: " << error);
     }
     // convert to RGB for bitmap
     int pixelcount = m_displayHeight * m_displayWidth;
@@ -1459,11 +1481,11 @@ void GLESGraphicsystem::createPbufferSurface()
     }
 
     const FloatRectangle layerDestRegion = m_currentLayer->getDestinationRegion();
-    EGLint width  = static_cast<EGLint>(layerDestRegion.width);
+    EGLint width = static_cast<EGLint>(layerDestRegion.width);
     EGLint height = static_cast<EGLint>(layerDestRegion.height);
 
     EGLint pb_attrs[] = {
-        EGL_WIDTH,  width,
+        EGL_WIDTH, width,
         EGL_HEIGHT, height,
         EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA,
         EGL_TEXTURE_TARGET, EGL_TEXTURE_2D,
@@ -1515,8 +1537,8 @@ void GLESGraphicsystem::destroyTempTexture()
 
 void GLESGraphicsystem::renderTempTexture()
 {
-    // TODO FIX IT , IS NOT ALREADY WORKING ANYMORE WITH MULTITEXTURE OPTIMIZATION, IF WE HAVE CHROMAKEY LAYER    
-    const FloatRectangle layerSourceRegion      = m_currentLayer->getSourceRegion();
+    // TODO FIX IT , IS NOT ALREADY WORKING ANYMORE WITH MULTITEXTURE OPTIMIZATION, IF WE HAVE CHROMAKEY LAYER
+    const FloatRectangle layerSourceRegion = m_currentLayer->getSourceRegion();
     const FloatRectangle layerDestinationRegion = m_currentLayer->getDestinationRegion();
     float textureCoordinates[4];
 
@@ -1532,8 +1554,8 @@ void GLESGraphicsystem::renderTempTexture()
 
     uniforms.x = layerDestinationRegion.x / m_displayWidth;
     uniforms.y = 1.0f - (layerDestinationRegion.y + layerDestinationRegion.height) / m_displayHeight;
-    uniforms.width   = layerDestinationRegion.width  / m_displayWidth;
-    uniforms.height  = layerDestinationRegion.height / m_displayHeight;
+    uniforms.width = layerDestinationRegion.width  / m_displayWidth;
+    uniforms.height = layerDestinationRegion.height / m_displayHeight;
     uniforms.opacity[0] = m_currentLayer->getOpacity();
     uniforms.texRange[0][0]  = textureCoordinates[2] - textureCoordinates[0];
     uniforms.texRange[0][1]  = textureCoordinates[3] - textureCoordinates[1];
@@ -1542,36 +1564,39 @@ void GLESGraphicsystem::renderTempTexture()
     uniforms.texUnit[0] = 0;
     uniforms.matrix = layerMatrix.f;
     uniforms.chromaKeyEnabled = m_currentLayer->getChromaKeyEnabled();
-    if (uniforms.chromaKeyEnabled == true) {
-        unsigned char red   = 0;
+    if (uniforms.chromaKeyEnabled == true)
+    {
+        unsigned char red = 0;
         unsigned char green = 0;
-        unsigned char blue  = 0;
+        unsigned char blue = 0;
         m_currentLayer->getChromaKey(red, green, blue);
         uniforms.chromaKey[0] = (float)red   / 255.0f;
         uniforms.chromaKey[1] = (float)green / 255.0f;
         uniforms.chromaKey[2] = (float)blue  / 255.0f;
     }
 
-    glEnable (GL_BLEND);
+    glEnable(GL_BLEND);
 
     Shader* shader = m_currentLayer->getShader();
-    if (!shader) {
+    if (!shader)
+    {
         shader = m_defaultShader;
     }
     //shader = pickOptimizedShader(shader, uniforms);
     shader = m_defaultShaderAddUniformChromaKey;
     shader->use();
-    shader->loadCommonUniforms(uniforms,0);
+    shader->loadCommonUniforms(uniforms, 0);
     shader->loadUniforms();
 
     glBindTexture(GL_TEXTURE_2D, m_texId);
 
     int orientation = m_currentLayer->getOrientation() % 4;
-    GLint index     = orientation * 12;
+    GLint index = orientation * 12;
     glDrawArrays(GL_TRIANGLES, index, 6);
 
     GLenum glErrorCode = glGetError();
-    if ( GL_NO_ERROR != glErrorCode ) {
-        LOG_ERROR("GLESGraphicsystem", "GL Error occured in renderTempTexture:" << glErrorCode );
+    if (GL_NO_ERROR != glErrorCode)
+    {
+        LOG_ERROR("GLESGraphicsystem", "GL Error occured in renderTempTexture:" << glErrorCode);
     }
 }
index ce53d68..c19c37d 100644 (file)
@@ -51,15 +51,15 @@ XVisualInfo* GLXGraphicsystem::GetMatchingVisual(Display *dpy)
     int screen = DefaultScreen(dpy);
     XVisualInfo *visinfo;
     int attribs[] = {
-            GLX_RGBA,
-            GLX_ALPHA_SIZE,8,
-            GLX_RED_SIZE, 1,
-            GLX_GREEN_SIZE, 1,
-            GLX_BLUE_SIZE, 1,
-            GLX_DEPTH_SIZE,8,
-            GLX_BUFFER_SIZE,32,
-            GLX_DOUBLEBUFFER,
-            None
+        GLX_RGBA,
+        GLX_ALPHA_SIZE, 8,
+        GLX_RED_SIZE, 1,
+        GLX_GREEN_SIZE, 1,
+        GLX_BLUE_SIZE, 1,
+        GLX_DEPTH_SIZE, 8,
+        GLX_BUFFER_SIZE, 32,
+        GLX_DOUBLEBUFFER,
+        None
     };
 
     visinfo = glXChooseVisual(dpy, screen, attribs);
@@ -69,12 +69,12 @@ XVisualInfo* GLXGraphicsystem::GetMatchingVisual(Display *dpy)
     }
     return visinfo;
 }
-bool GLXGraphicsystem::CheckConfigMask(Display *curDisplay,GLXFBConfig currentConfig, int attribute, int expectedValue)
+bool GLXGraphicsystem::CheckConfigMask(Display *curDisplay, GLXFBConfig currentConfig, int attribute, int expectedValue)
 {
     bool result = true;
     int returnedValue = 0;
 
-    glXGetFBConfigAttrib(curDisplay,currentConfig,attribute,&returnedValue);
+    glXGetFBConfigAttrib(curDisplay, currentConfig, attribute, &returnedValue);
     if (!(returnedValue & expectedValue))
     {
         result = false;
@@ -82,12 +82,12 @@ bool GLXGraphicsystem::CheckConfigMask(Display *curDisplay,GLXFBConfig currentCo
     return result;
 }
 
-bool GLXGraphicsystem::CheckConfigValue(Display *curDisplay,GLXFBConfig currentConfig, int attribute, int expectedValue)
+bool GLXGraphicsystem::CheckConfigValue(Display *curDisplay, GLXFBConfig currentConfig, int attribute, int expectedValue)
 {
     bool result = true;
     int returnedValue = 0;
 
-    glXGetFBConfigAttrib(curDisplay,currentConfig,attribute,&returnedValue);
+    glXGetFBConfigAttrib(curDisplay, currentConfig, attribute, &returnedValue);
     if ((returnedValue != expectedValue))
     {
         result = false;
@@ -97,10 +97,10 @@ bool GLXGraphicsystem::CheckConfigValue(Display *curDisplay,GLXFBConfig currentC
 
 void GLXGraphicsystem::activateGraphicContext()
 {
-    glXMakeCurrent(m_x11display, m_window, m_context);   
+    glXMakeCurrent(m_x11display, m_window, m_context);
 }
 
-void GLXGraphicsystem::releaseGraphicContext() 
+void GLXGraphicsystem::releaseGraphicContext()
 {
     glXMakeCurrent(m_x11display, None, NULL);
 }
@@ -109,16 +109,16 @@ GLXFBConfig* GLXGraphicsystem::GetMatchingPixmapConfig(Display *curDisplay)
 {
     int neededMaskAttribute[] =
     {
-        GLX_DRAWABLE_TYPE,GLX_PIXMAP_BIT,
-        GLX_DRAWABLE_TYPE,GLX_WINDOW_BIT,
-        GLX_BIND_TO_TEXTURE_TARGETS_EXT,GLX_TEXTURE_2D_BIT_EXT,
+        GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT,
+        GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
+        GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT,
         None
     };
     int neededValueAttribute[] =
     {
-        GLX_BUFFER_SIZE,32,
-        GLX_ALPHA_SIZE,8,
-        GLX_BIND_TO_TEXTURE_RGBA_EXT,True,
+        GLX_BUFFER_SIZE, 32,
+        GLX_ALPHA_SIZE, 8,
+        GLX_BIND_TO_TEXTURE_RGBA_EXT, True,
         None
     };
     LOG_DEBUG("GLXGraphicsystem", "Choose pixmap GL configuration");
@@ -135,13 +135,13 @@ GLXFBConfig* GLXGraphicsystem::GetMatchingPixmapConfig(Display *curDisplay)
         bool result = true;
         /* check first all mask values */
         j = 0;
-        while ( neededMaskAttribute[j] != None && result == true )
+        while (neededMaskAttribute[j] != None && result == true)
         {
-           result = CheckConfigMask(curDisplay,config, neededMaskAttribute[j], neededMaskAttribute[j+1]);
-           j += 2;
+            result = CheckConfigMask(curDisplay, config, neededMaskAttribute[j], neededMaskAttribute[j + 1]);
+            j += 2;
         }
         /* no matching found in needed mask attribute, skip config take next */
-        if (result == false )
+        if (result == false)
         {
             continue;
         }
@@ -150,14 +150,14 @@ GLXFBConfig* GLXGraphicsystem::GetMatchingPixmapConfig(Display *curDisplay)
         /* reset attribute counter */
         j = 0;
         /* check all fixed values */
-        while ( neededValueAttribute[j] != None && result == true )
+        while (neededValueAttribute[j] != None && result == true)
         {
-           result = CheckConfigValue(curDisplay,config, neededValueAttribute[j], neededValueAttribute[j+1]);
-           j += 2;
+            result = CheckConfigValue(curDisplay, config, neededValueAttribute[j], neededValueAttribute[j + 1]);
+            j += 2;
         }
         /* no matching found in needed fixed value attribute, skip config take next */
 
-        if (result == false )
+        if (result == false)
         {
             continue;
         }
@@ -203,14 +203,14 @@ bool GLXGraphicsystem::init(Display* x11Display, Window x11Window)
     }
     LOG_DEBUG("GLXGraphicsystem", "Make GLX Context current");
     glXMakeCurrent(m_x11display, m_window, m_context);
-    glEnable (GL_BLEND);
-    glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+    glEnable(GL_BLEND);
+    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     glClearColor(0.0, 0.0, 0.0, 1.0);
     glEnable(GL_TEXTURE_2D);
     glMatrixMode(GL_MODELVIEW);
     const char *ext;
     ext = glXQueryExtensionsString(m_x11display, 0);
-    if (!strstr(ext, "GLX_EXT_texture_from_pixmap") )
+    if (!strstr(ext, "GLX_EXT_texture_from_pixmap"))
     {
         m_zerocopy = false;
     }
@@ -260,7 +260,7 @@ bool GLXGraphicsystem::needsRedraw(Layer *layer)
     if (layer->visibility && layer->opacity > 0.0)
     {
         SurfaceList surfaces = layer->getAllSurfaces();
-        for(SurfaceListConstIterator currentS = surfaces.begin(); currentS != surfaces.end(); currentS++)
+        for (SurfaceListConstIterator currentS = surfaces.begin(); currentS != surfaces.end(); currentS++)
         {
             if ((*currentS)->renderPropertyChanged)
             {
@@ -307,11 +307,11 @@ void GLXGraphicsystem::renderSWLayer(Layer *layer, bool clear)
         clearBackground();
     }
 
-    if ( layer->visibility && layer->opacity > 0.0 )
+    if (layer->visibility && layer->opacity > 0.0)
     {
         SurfaceList surfaces = layer->getAllSurfaces();
         beginLayer(layer);
-        for(SurfaceListConstIterator currentS = surfaces.begin(); currentS != surfaces.end(); currentS++)
+        for (SurfaceListConstIterator currentS = surfaces.begin(); currentS != surfaces.end(); currentS++)
         {
             if ((*currentS)->hasNativeContent() && (*currentS)->visibility && (*currentS)->opacity>0.0f)
             {
@@ -352,16 +352,19 @@ void GLXGraphicsystem::renderSurface(Surface* currentSurface)
 {
 //    LOG_DEBUG("GLXGraphicsystem", "renderSurface " << currentSurface->getID() );
     GLenum glErrorCode = GL_NO_ERROR;
-    
+
     if (currentSurface->isCropped())
         return; // skip rendering of this surface, because it is cropped by layer source region
-        
+
     // check if surface is cropped completely, if so then skip rendering
     FloatRectangle targetSurfaceSource = currentSurface->getTargetSourceRegion();
     FloatRectangle targetSurfaceDestination = currentSurface->getTargetDestinationRegion();
 
     float textureCoordinates[4];
-    ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSource, currentSurface->OriginalSourceWidth, currentSurface->OriginalSourceHeight, textureCoordinates);
+    ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSource,
+                                                                currentSurface->OriginalSourceWidth,
+                                                                currentSurface->OriginalSourceHeight,
+                                                                textureCoordinates);
 
     glPushMatrix();
     if (false == m_binder->bindSurfaceTexture(currentSurface))
@@ -370,7 +373,7 @@ void GLXGraphicsystem::renderSurface(Surface* currentSurface)
         return;
     }
 //    glPushMatrix();
-    glColor4f(1.0f,1.0f,1.0f,currentSurface->opacity*(m_currentLayer)->opacity);
+    glColor4f(1.0f, 1.0f, 1.0f, currentSurface->opacity*(m_currentLayer)->opacity);
 
     glBegin(GL_QUADS);
 
@@ -380,28 +383,31 @@ void GLXGraphicsystem::renderSurface(Surface* currentSurface)
 //    LOG_DEBUG("GLXGraphicsystem","window: " << m_windowWidth << " " << m_windowHeight  );
 
     //bottom left
-    glTexCoord2d(textureCoordinates[0],textureCoordinates[3]);
-    glVertex2d((float)targetSurfaceDestination.x/m_windowWidth*2-1,  1-(float)(targetSurfaceDestination.y+targetSurfaceDestination.height)/m_windowHeight*2);
+    glTexCoord2d(textureCoordinates[0], textureCoordinates[3]);
+    glVertex2d((float)targetSurfaceDestination.x / m_windowWidth * 2 - 1,
+               1 - (float)(targetSurfaceDestination.y + targetSurfaceDestination.height) / m_windowHeight * 2);
 
     // bottom right
-    glTexCoord2f(textureCoordinates[2],textureCoordinates[3]);
-    glVertex2d( (float)(targetSurfaceDestination.x+targetSurfaceDestination.width)/m_windowWidth*2-1, 1-(float)(targetSurfaceDestination.y+targetSurfaceDestination.height)/m_windowHeight*2);
+    glTexCoord2f(textureCoordinates[2], textureCoordinates[3]);
+    glVertex2d((float)(targetSurfaceDestination.x + targetSurfaceDestination.width) / m_windowWidth * 2 - 1,
+               1 - (float)(targetSurfaceDestination.y + targetSurfaceDestination.height) / m_windowHeight * 2);
 
     // top right
     glTexCoord2f(textureCoordinates[2], textureCoordinates[1]);
-    glVertex2d((float)(targetSurfaceDestination.x+targetSurfaceDestination.width)/m_windowWidth*2-1, 1-(float)targetSurfaceDestination.y/m_windowHeight*2);
+    glVertex2d((float)(targetSurfaceDestination.x + targetSurfaceDestination.width) / m_windowWidth * 2 - 1,
+               1 - (float)targetSurfaceDestination.y / m_windowHeight * 2);
 
     // top left
     glTexCoord2f(textureCoordinates[0], textureCoordinates[1]);
-    glVertex2d((float)targetSurfaceDestination.x/m_windowWidth*2-1 ,  1-(float)targetSurfaceDestination.y/m_windowHeight*2);
+    glVertex2d((float)targetSurfaceDestination.x/m_windowWidth * 2 - 1, 1 - (float)targetSurfaceDestination.y / m_windowHeight * 2);
     glEnd();
 
     m_binder->unbindSurfaceTexture(currentSurface);
     glPopMatrix();
     glErrorCode = glGetError();
-    if ( GL_NO_ERROR != glErrorCode )
+    if (GL_NO_ERROR != glErrorCode)
     {
-        LOG_ERROR("GLXGraphicsystem", "GL Error occured :" << glErrorCode );
+        LOG_ERROR("GLXGraphicsystem", "GL Error occured :" << glErrorCode);
     }
     currentSurface->frameCounter++;
     currentSurface->drawCounter++;
@@ -409,19 +415,19 @@ void GLXGraphicsystem::renderSurface(Surface* currentSurface)
 
 void GLXGraphicsystem::saveScreenShotOfFramebuffer(std::string fileToSave)
 {
-    LOG_DEBUG("GLXGraphicsystem","taking screenshot and saving it to:" << fileToSave);
+    LOG_DEBUG("GLXGraphicsystem", "taking screenshot and saving it to:" << fileToSave);
 
     GLint viewport[4];
-    glGetIntegerv(GL_VIEWPORT,viewport); // x,y,width,height
+    glGetIntegerv(GL_VIEWPORT, viewport); // x,y,width,height
 
-    int WINDOW_WIDTH= viewport[2];
-    int WINDOW_HEIGHT= viewport[3];
-    LOG_DEBUG("GLXGraphicsystem","Screenshot: " << WINDOW_WIDTH << " * " << WINDOW_HEIGHT);
+    int WINDOW_WIDTH = viewport[2];
+    int WINDOW_HEIGHT = viewport[3];
+    LOG_DEBUG("GLXGraphicsystem", "Screenshot: " << WINDOW_WIDTH << " * " << WINDOW_HEIGHT);
     char *buffer = (char *)malloc(WINDOW_WIDTH * WINDOW_HEIGHT * 3 * sizeof(unsigned char));
-    glReadPixels(0,0,WINDOW_WIDTH,WINDOW_HEIGHT,GL_BGR,GL_UNSIGNED_BYTE, buffer);
+    glReadPixels(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, GL_BGR, GL_UNSIGNED_BYTE, buffer);
 
-    writeBitmap(fileToSave,buffer,WINDOW_WIDTH,WINDOW_HEIGHT);
+    writeBitmap(fileToSave, buffer, WINDOW_WIDTH, WINDOW_HEIGHT);
     free(buffer);
-    LOG_DEBUG("GLXGraphicsystem","done taking screenshot");
+    LOG_DEBUG("GLXGraphicsystem", "done taking screenshot");
 }
 
index 11ad447..8eeeb9f 100644 (file)
@@ -59,13 +59,14 @@ bool WaylandGLESTexture::bindSurfaceTexture(Surface* surface)
         {
             /* Wayland SHM buffer */
             unsigned int* pBuf = (unsigned int*)wl_shm_buffer_get_data(buffer);
-            if( (NULL != buffer) && (NULL != pBuf) )
+            if ((NULL != buffer) && (NULL != pBuf))
             {
-                LOG_DEBUG("WaylandGLESTexture", "SHM buffer address:"<<pBuf);
+                LOG_DEBUG("WaylandGLESTexture", "SHM buffer address:" << pBuf);
                 unsigned int* pTmp = (unsigned int*)pBuf;
                 unsigned int col = 0;
                 int cnt = 0;
-                unsigned int* pCnvImg = (unsigned int*)malloc(sizeof(unsigned int) * surface->OriginalSourceWidth * surface->OriginalSourceHeight);
+                unsigned int* pCnvImg = (unsigned int*)malloc(sizeof(unsigned int)
+                                                * surface->OriginalSourceWidth * surface->OriginalSourceHeight);
                 unsigned int* pCnvImgTmp = pCnvImg;
                 for (cnt = 0; cnt < surface->OriginalSourceWidth * surface->OriginalSourceHeight; cnt++, pTmp++, pCnvImgTmp++)
                 {
@@ -75,22 +76,29 @@ bool WaylandGLESTexture::bindSurfaceTexture(Surface* surface)
                 }
 
                 glBindTexture(GL_TEXTURE_2D, nativeSurface->texture);
-                glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,     GL_CLAMP_TO_EDGE);
-                glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,     GL_CLAMP_TO_EDGE);
+                glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+                glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
                 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
                 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-                glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surface->OriginalSourceWidth, surface->OriginalSourceHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, pCnvImg);
+                glTexImage2D(GL_TEXTURE_2D,
+                             0,
+                             GL_RGBA,
+                             surface->OriginalSourceWidth,
+                             surface->OriginalSourceHeight,
+                             0,
+                             GL_RGBA,
+                             GL_UNSIGNED_BYTE,
+                             pCnvImg);
                 free(pCnvImg);
             }
             return true;
-
         }
         else
         {
             /* Wayland Not SHM buffer */
             if (nativeSurface->eglImage)
             {
-                LOG_DEBUG("WaylandGLESTexture", "nativeSurface->eglImage:"<<nativeSurface->eglImage);
+                LOG_DEBUG("WaylandGLESTexture", "nativeSurface->eglImage:" << nativeSurface->eglImage);
                 glBindTexture(GL_TEXTURE_2D, nativeSurface->texture);
                 return true;
             }
@@ -114,17 +122,17 @@ void WaylandGLESTexture::createClientBuffer(Surface* surface)
     LOG_DEBUG("WaylandGLESTexture", "creating client buffer with native display: " << m_wlDisplay << " for native handle: " << surface->getNativeContent());
     EglWaylandPlatformSurface* nativeSurface = (EglWaylandPlatformSurface*)surface->platform;
 
-    if (NULL!=nativeSurface)
+    if (NULL != nativeSurface)
     {
         struct wl_buffer* buffer = (struct wl_buffer*)surface->getNativeContent();
         if (wl_buffer_is_shm(buffer))
         {
             if (nativeSurface->texture)
-           {
-                glDeleteTextures(1,&nativeSurface->texture);
+            {
+                glDeleteTextures(1, &nativeSurface->texture);
                 nativeSurface->texture = 0;
             }
-            glGenTextures(1,&nativeSurface->texture);
+            glGenTextures(1, &nativeSurface->texture);
         }
         else
         {
@@ -133,15 +141,15 @@ void WaylandGLESTexture::createClientBuffer(Surface* surface)
             if (nativeSurface->eglImage)
             {
                 m_pfEglDestroyImageKHR(m_eglDisplay, nativeSurface->eglImage);
-                glDeleteTextures(1,&nativeSurface->texture);
+                glDeleteTextures(1, &nativeSurface->texture);
                 nativeSurface->eglImage = 0;
                 nativeSurface->texture = 0;
             }
             eglImage = m_pfEglCreateImageKHR(m_eglDisplay,
-                                         EGL_NO_CONTEXT,
-                                         EGL_WAYLAND_BUFFER_WL,
-                                         (EGLClientBuffer)buffer,
-                                         NULL);
+                                            EGL_NO_CONTEXT,
+                                            EGL_WAYLAND_BUFFER_WL,
+                                            (EGLClientBuffer)buffer,
+                                            NULL);
             if (!eglImage)
             {
                 LOG_DEBUG("WaylandGLESTexture", "could not allocate EGL Image for window");
@@ -149,14 +157,14 @@ void WaylandGLESTexture::createClientBuffer(Surface* surface)
             else
             {
                 nativeSurface->eglImage = eglImage;
-                glGenTextures(1,&nativeSurface->texture);
+                glGenTextures(1, &nativeSurface->texture);
                 glBindTexture(GL_TEXTURE_2D, nativeSurface->texture);
-                glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,     GL_CLAMP_TO_EDGE);
-                glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,     GL_CLAMP_TO_EDGE);
+                glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+                glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
                 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
                 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
                 m_pfGLEglImageTargetTexture2DOES(GL_TEXTURE_2D, nativeSurface->eglImage);
-           }
+            }
         }
     }
 }
@@ -175,7 +183,7 @@ void WaylandGLESTexture::destroyClientBuffer(Surface* surface)
     {
         if (nativeSurface && nativeSurface->texture)
         {
-            glDeleteTextures(1,&nativeSurface->texture);
+            glDeleteTextures(1, &nativeSurface->texture);
             nativeSurface->texture = 0;
         }
     }
@@ -184,7 +192,7 @@ void WaylandGLESTexture::destroyClientBuffer(Surface* surface)
         if (nativeSurface && nativeSurface->eglImage)
         {
             m_pfEglDestroyImageKHR(m_eglDisplay, nativeSurface->eglImage);
-            glDeleteTextures(1,&nativeSurface->texture);
+            glDeleteTextures(1, &nativeSurface->texture);
             nativeSurface->eglImage = 0;
             nativeSurface->texture = 0;
         }
index 5e4441a..18c6743 100644 (file)
@@ -33,33 +33,40 @@ bool X11CopyGLES::bindSurfaceTexture(Surface* surface)
     unsigned char* swapedData = NULL;
     bool swaprgb = false;
     bool includeAlpha = false;
-    if (surface != NULL )
+    if (surface != NULL)
     {
         nativeSurface = (XPlatformSurface*)surface->platform;
     }
-    ifnativeSurface != NULL && surface->getNativeContent() != -1 && nativeSurface->isReadyForRendering())
+    if (nativeSurface != NULL && surface->getNativeContent() != -1 && nativeSurface->isReadyForRendering())
     {
-        pixmap = XCompositeNameWindowPixmap (dpy, surface->getNativeContent());
+        pixmap = XCompositeNameWindowPixmap(dpy, surface->getNativeContent());
         if (!pixmap)
         {
             LOG_ERROR("X11CopyGLES", "didnt create pixmap!");
             return false;
         }
         nativeSurface->pixmap = pixmap;
-        XImage * xim = XGetImage(dpy, nativeSurface->pixmap, 0, 0, surface->OriginalSourceWidth, surface->OriginalSourceHeight, AllPlanes, ZPixmap);
-        if ( xim != NULL )
+        XImage * xim = XGetImage(dpy,
+                                nativeSurface->pixmap,
+                                0,
+                                0,
+                                surface->OriginalSourceWidth,
+                                surface->OriginalSourceHeight,
+                                AllPlanes,
+                                ZPixmap);
+        if (xim != NULL)
         {
             glBindTexture(GL_TEXTURE_2D, nativeSurface->texture);
             glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
             glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-            if ( surface->getPixelFormat() == PIXELFORMAT_RGB888)
+            if (surface->getPixelFormat() == PIXELFORMAT_RGB888)
             {
                 targetType = GL_RGB;
                 sourceType = GL_RGB;
                 swaprgb = true;
                 swapedData = new unsigned char[surface->OriginalSourceWidth*surface->OriginalSourceHeight*3];
             }
-            else if ( surface->getPixelFormat() == PIXELFORMAT_RGBA8888)
+            else if (surface->getPixelFormat() == PIXELFORMAT_RGBA8888)
             {
                 if (xim->depth == 24)
                 {
@@ -69,45 +76,68 @@ bool X11CopyGLES::bindSurfaceTexture(Surface* surface)
             }
             else
             {
-                LOG_ERROR("X11CopyGLES","Pixelformat currently not supported : " << surface->getPixelFormat());
+                LOG_ERROR("X11CopyGLES", "Pixelformat currently not supported : " << surface->getPixelFormat());
                 XDestroyImage(xim);
                 return false;
             }
-            swapPixmap((unsigned char*)xim->data, swapedData, surface->OriginalSourceWidth, surface->OriginalSourceHeight,swaprgb,includeAlpha);
-            glTexImage2D(GL_TEXTURE_2D, 0, sourceType, surface->OriginalSourceWidth, surface->OriginalSourceHeight, 0, targetType, GL_UNSIGNED_BYTE, swapedData);
+            swapPixmap((unsigned char*)xim->data,
+                        swapedData,
+                        surface->OriginalSourceWidth,
+                        surface->OriginalSourceHeight,
+                        swaprgb,
+                        includeAlpha);
+            glTexImage2D(GL_TEXTURE_2D,
+                        0,
+                        sourceType,
+                        surface->OriginalSourceWidth,
+                        surface->OriginalSourceHeight,
+                        0,
+                        targetType,
+                        GL_UNSIGNED_BYTE,
+                        swapedData);
             XDestroyImage(xim);
             delete[] swapedData;
             return true;
-        } else {
+        }
+        else
+        {
             LOG_ERROR("X11CopyGLES", "X image data empty");
             return false;
         }
     }
     return false;
 }
-void X11CopyGLES::swapPixmap(unsigned char* src,unsigned char* dest, unsigned int width,unsigned int height,bool swaprgb,bool includeAlpha)
+void X11CopyGLES::swapPixmap(unsigned char* src,
+                            unsigned char* dest,
+                            unsigned int width,
+                            unsigned int height,
+                            bool swaprgb,
+                            bool includeAlpha)
 {
     unsigned int count = 0;
     if (swaprgb == false)
     {
         count = width*height;
-        for (uint j=0;j<count; j++) {
-            dest[j*4]=src[j*4+2];
-            dest[j*4+1]=src[j*4+1];
-            dest[j*4+2]=src[j*4];
-            dest[j*4+3]=src[j*4+3];
+        for (uint j = 0; j < count; j++)
+        {
+            dest[j * 4] = src[j * 4 + 2];
+            dest[j *4 + 1] = src[j * 4 + 1];
+            dest[j *4 + 2] = src[j * 4];
+            dest[j *4 + 3] = src[j * 4 + 3];
             if (includeAlpha)
             {
-                dest[j*4+3]=255;
+                dest[j * 4 + 3] = 255;
             }
         }
-    } else {
+    }
+    else
+    {
         count = width*height;
-        for (uint j=0;j<count; j++)
+        for (uint j = 0; j < count; j++)
         {
-            dest[j*3]=src[j*3+2];
-            dest[j*3+1]=src[j*3+1];
-            dest[j*3+2]=src[j*3];
+            dest[j * 3] = src[j * 3 + 2];
+            dest[j * 3 + 1]=src[j * 3 + 1];
+            dest[j * 3 + 2]=src[j *3];
         }
     }
 }
@@ -115,7 +145,7 @@ void X11CopyGLES::swapPixmap(unsigned char* src,unsigned char* dest, unsigned in
 void X11CopyGLES::createClientBuffer(Surface* surface)
 {
     XPlatformSurface* nativeSurface = (XPlatformSurface*)surface->platform;
-    glGenTextures(1,&nativeSurface->texture);
+    glGenTextures(1, &nativeSurface->texture);
 }
 
 void X11CopyGLES::destroyClientBuffer(Surface* surface)
@@ -123,8 +153,8 @@ void X11CopyGLES::destroyClientBuffer(Surface* surface)
     XPlatformSurface* nativeSurface = (XPlatformSurface*) surface->platform;
     if (nativeSurface && nativeSurface->pixmap)
     {
-          glDeleteTextures(1,&nativeSurface->texture);
-          XFreePixmap(dpy, nativeSurface->pixmap);
-          nativeSurface->pixmap = None;
+        glDeleteTextures(1, &nativeSurface->texture);
+        XFreePixmap(dpy, nativeSurface->pixmap);
+        nativeSurface->pixmap = None;
     }
 }
index e176fc6..d156b9d 100644 (file)
@@ -30,13 +30,13 @@ bool X11CopyGLX::bindSurfaceTexture(Surface* surface)
     Pixmap pixmap = 0;
     GLenum targetType = GL_BGRA;
     GLenum sourceType = GL_RGBA;
-    if (surface != NULL )
+    if (surface != NULL)
     {
         nativeSurface = (XPlatformSurface*)surface->platform;
     }
-    ifnativeSurface != NULL && surface->getNativeContent() != -1 && nativeSurface->isReadyForRendering())
+    if (nativeSurface != NULL && surface->getNativeContent() != -1 && nativeSurface->isReadyForRendering())
     {
-        pixmap = XCompositeNameWindowPixmap (dpy, surface->getNativeContent());
+        pixmap = XCompositeNameWindowPixmap(dpy, surface->getNativeContent());
         if (!pixmap)
         {
             LOG_ERROR("X11CopyGLX", "didnt create pixmap!");
@@ -44,18 +44,24 @@ bool X11CopyGLX::bindSurfaceTexture(Surface* surface)
         }
 
         nativeSurface->pixmap = pixmap;
-        XImage * xim = XGetImage(dpy, nativeSurface->pixmap, 0, 0, surface->OriginalSourceWidth, surface->OriginalSourceHeight, AllPlanes, ZPixmap);
+        XImage * xim = XGetImage(dpy,
+                                nativeSurface->pixmap,
+                                0, 0,
+                                surface->OriginalSourceWidth,
+                                surface->OriginalSourceHeight,
+                                AllPlanes,
+                                ZPixmap);
         if (xim)
         {
             glBindTexture(GL_TEXTURE_2D, nativeSurface->texture);
             glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
             glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-            if ( surface->getPixelFormat() == PIXELFORMAT_RGB888 )
+            if (surface->getPixelFormat() == PIXELFORMAT_RGB888)
             {
                 targetType = GL_BGR;
                 sourceType = GL_RGB;
-            } 
-            else if ( surface->getPixelFormat() == PIXELFORMAT_RGBA8888 )
+            }
+            else if (surface->getPixelFormat() == PIXELFORMAT_RGBA8888)
             {
                 targetType = GL_BGRA;
                 sourceType = GL_RGBA;
@@ -63,17 +69,27 @@ bool X11CopyGLX::bindSurfaceTexture(Surface* surface)
                 {
                     /* Set alpha value */
                     int count = surface->OriginalSourceWidth*surface->OriginalSourceHeight;
-                    for (int j=0;j<count; j++)
+                    for (int j = 0; j < count; j++)
                     {
-                        xim->data[j*4+3] = (char)255;
+                        xim->data[j * 4 + 3] = (char)255;
                     }
                 }
-            } else {
-                LOG_ERROR("X11CopyGLX","Pixelformat currently not supported : " << surface->getPixelFormat());
+            }
+            else
+            {
+                LOG_ERROR("X11CopyGLX", "Pixelformat currently not supported : " << surface->getPixelFormat());
                 XDestroyImage(xim);
                 return false;
             }
-            glTexImage2D(GL_TEXTURE_2D, 0, sourceType, surface->OriginalSourceWidth, surface->OriginalSourceHeight, 0, targetType, GL_UNSIGNED_BYTE, xim->data);
+            glTexImage2D(GL_TEXTURE_2D,
+                         0,
+                         sourceType,
+                         surface->OriginalSourceWidth,
+                         surface->OriginalSourceHeight,
+                         0,
+                         targetType,
+                         GL_UNSIGNED_BYTE,
+                         xim->data);
             XDestroyImage(xim);
             return true;
         }
@@ -84,7 +100,7 @@ bool X11CopyGLX::bindSurfaceTexture(Surface* surface)
 void X11CopyGLX::createClientBuffer(Surface* surface)
 {
     XPlatformSurface* nativeSurface = (XPlatformSurface*)surface->platform;
-    glGenTextures(1,&nativeSurface->texture);
+    glGenTextures(1, &nativeSurface->texture);
 }
 
 void X11CopyGLX::destroyClientBuffer(Surface* surface)
@@ -92,7 +108,7 @@ void X11CopyGLX::destroyClientBuffer(Surface* surface)
     XPlatformSurface* nativeSurface = (XPlatformSurface*) surface->platform;
     if (nativeSurface && nativeSurface->pixmap)
     {
-          glDeleteTextures(1,&nativeSurface->texture);
-          XFreePixmap(dpy, nativeSurface->pixmap);
+        glDeleteTextures(1, &nativeSurface->texture);
+        XFreePixmap(dpy, nativeSurface->pixmap);
     }
 }
index 8ed04d7..109fa30 100644 (file)
@@ -65,11 +65,11 @@ void X11EglImage::createClientBuffer(Surface* surface)
 {
     LOG_DEBUG("X11EglImage", "creating client buffer with native display: " << m_x11display << " for native handle: " << surface->getNativeContent());
     EglXPlatformSurface* nativeSurface = (EglXPlatformSurface*)surface->platform;
-    if (NULL!=nativeSurface)
+    if (NULL != nativeSurface)
     {
         Pixmap windowPixmap = 0;
-        windowPixmap= XCompositeNameWindowPixmap (m_x11display, surface->getNativeContent());
-        if (windowPixmap==0)
+        windowPixmap = XCompositeNameWindowPixmap(m_x11display, surface->getNativeContent());
+        if (windowPixmap == 0)
         {
             LOG_ERROR("X11EglImage", "didnt create pixmap!");
         }
@@ -79,15 +79,15 @@ void X11EglImage::createClientBuffer(Surface* surface)
         if (nativeSurface->eglImage)
         {
             m_pfEglDestroyImageKHR(m_eglDisplay, nativeSurface->eglImage);
-            glDeleteTextures(1,&nativeSurface->texture);
+            glDeleteTextures(1, &nativeSurface->texture);
             nativeSurface->eglImage = 0;
             nativeSurface->texture = 0;
         }
         eglImage = m_pfEglCreateImageKHR(m_eglDisplay,
-                                     EGL_NO_CONTEXT,
-                                     EGL_NATIVE_PIXMAP_KHR,
-                                     (EGLClientBuffer)windowPixmap,
-                                     NULL);
+                                        EGL_NO_CONTEXT,
+                                        EGL_NATIVE_PIXMAP_KHR,
+                                        (EGLClientBuffer)windowPixmap,
+                                        NULL);
         if (!eglImage)
         {
             LOG_DEBUG("X11EglImage", "could not allocate EGL Image for window");
@@ -95,10 +95,10 @@ void X11EglImage::createClientBuffer(Surface* surface)
         else
         {
             nativeSurface->eglImage = eglImage;
-            glGenTextures(1,&nativeSurface->texture);
+            glGenTextures(1, &nativeSurface->texture);
             glBindTexture(GL_TEXTURE_2D, nativeSurface->texture);
-            glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,     GL_CLAMP_TO_EDGE);
-            glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,     GL_CLAMP_TO_EDGE);
+            glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+            glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
             glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
             glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
             m_pfGLEglImageTargetTexture2DOES(GL_TEXTURE_2D, nativeSurface->eglImage);
@@ -117,7 +117,7 @@ void X11EglImage::destroyClientBuffer(Surface* surface)
     if (nativeSurface && nativeSurface->eglImage)
     {
         m_pfEglDestroyImageKHR(m_eglDisplay, nativeSurface->eglImage);
-        glDeleteTextures(1,&nativeSurface->texture);
+        glDeleteTextures(1, &nativeSurface->texture);
         nativeSurface->eglImage = 0;
         nativeSurface->texture = 0;
     }
index ccaa700..24f3172 100644 (file)
@@ -25,8 +25,8 @@
 #include "Log.h"
 
 const int X11TextureFromPixmap::pixmapAttribs[] = {
-        GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT,
-        GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGBA_EXT, None
+    GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT,
+    GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGBA_EXT, None
 };
 
 X11TextureFromPixmap::X11TextureFromPixmap(Display* display, GLXFBConfig pixmapConfig)
@@ -52,7 +52,7 @@ bool X11TextureFromPixmap::bindSurfaceTexture(Surface* surface)
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
         return true;
     }
-   return false;
+    return false;
 }
 
 bool X11TextureFromPixmap::unbindSurfaceTexture(Surface* surface)
@@ -66,15 +66,16 @@ bool X11TextureFromPixmap::unbindSurfaceTexture(Surface* surface)
     return false;
 }
 
-void X11TextureFromPixmap::createClientBuffer(Surface* surface){
+void X11TextureFromPixmap::createClientBuffer(Surface* surface)
+{
     LOG_DEBUG("X11TextureFromPixmap", "creating clientBuffer for window: " << surface->getNativeContent());
     GLXPlatformSurface* platformSurface = (GLXPlatformSurface*)surface->platform;
-    if (NULL!=platformSurface)
+    if (NULL != platformSurface)
     {
         Pixmap pixmap = 0;
         LOG_DEBUG("X11TextureFromPixmap", "get X Pixmap");
-        pixmap= XCompositeNameWindowPixmap (dpy, surface->getNativeContent());
-        if (pixmap==0)
+        pixmap = XCompositeNameWindowPixmap(dpy, surface->getNativeContent());
+        if (pixmap == 0)
         {
             LOG_ERROR("X11TextureFromPixmap", "didnt create pixmap!");
         }
@@ -83,7 +84,7 @@ void X11TextureFromPixmap::createClientBuffer(Surface* surface){
         GLXPixmap glxPixmap = 0;
         LOG_DEBUG("X11TextureFromPixmap", "creating glx pixmap from xpixmap");
         glxPixmap = glXCreatePixmap(dpy, pixmapConfig, pixmap, pixmapAttribs);
-        if (glxPixmap ==0)
+        if (glxPixmap == 0)
         {
             LOG_DEBUG("X11TextureFromPixmap", "could not allocate glxpixmap for window");
         }
@@ -102,7 +103,7 @@ void X11TextureFromPixmap::destroyClientBuffer(Surface* surface)
     LOG_ERROR("X11TextureFromPixmap", "destroying clientBuffer");
     GLXPlatformSurface* platformSurface = (GLXPlatformSurface*)surface->platform;
     LOG_DEBUG("X11TextureFromPixmap", "removing GLX Pixmap");
-    if (NULL!=platformSurface)
+    if (NULL != platformSurface)
     {
         //glXReleaseTexImageEXT_func(dpy, x11surf->glxPixmap, GLX_FRONT_LEFT_EXT);
         glXDestroyPixmap(dpy, platformSurface->glxPixmap);
@@ -111,7 +112,7 @@ void X11TextureFromPixmap::destroyClientBuffer(Surface* surface)
     XSync(dpy, 0);
 
     LOG_DEBUG("X11TextureFromPixmap", "removing X Pixmap");
-    if (NULL!=platformSurface)
+    if (NULL != platformSurface)
     {
         XFreePixmap(dpy, platformSurface->pixmap);
         platformSurface->pixmap = 0;
index 2229d0b..429fe54 100644 (file)
 #include "InputManager.h"
 
 extern "C" {
-    struct serverinfo {
-        struct wl_resource base;
-        WaylandBaseWindowSystem* windowSystem;
-    };
-
-    struct serverinfoClient {
-        struct wl_client *client;
-        uint connectionId;
-        struct wl_list link;
-    };
-
-    void WaylandBaseWindowSystem::serverinfoIFCreateConnection(struct wl_client *client, struct wl_resource *resource)
-    {
-        struct serverinfo* deliver = (struct serverinfo*)resource->data;
+struct serverinfo
+{
+    struct wl_resource base;
+    WaylandBaseWindowSystem* windowSystem;
+};
 
-        // creates new connection id and store it in memory
-        struct serverinfoClient* clientPair = (struct serverinfoClient*)malloc( sizeof *clientPair );
+struct serverinfoClient
+{
+    struct wl_client *client;
+    uint connectionId;
+    struct wl_list link;
+};
 
-        clientPair->client = client;
-        clientPair->connectionId = deliver->windowSystem->m_manageConnectionId;
-        deliver->windowSystem->m_manageConnectionId++;
+void WaylandBaseWindowSystem::serverinfoIFCreateConnection(struct wl_client *client, struct wl_resource *resource)
+{
+    struct serverinfo* deliver = (struct serverinfo*)resource->data;
 
-        wl_list_init(&clientPair->link);
-        wl_list_insert(&deliver->windowSystem->m_connectionList, &clientPair->link);
+    // creates new connection id and store it in memory
+    struct serverinfoClient* clientPair = (struct serverinfoClient*)malloc(sizeof *clientPair);
 
-        // send native client handle to this client.
-        // by protocol default, this information is not needed.
-        wl_resource_post_event(resource, SERVERINFO_CONNECTION_ID, clientPair->connectionId);
-        LOG_DEBUG("WaylandBaseWindowSystem", "serverinfoIFCreateConnection() create connection id" << clientPair->connectionId << " for client " << clientPair->client);
-    }
+    clientPair->client = client;
+    clientPair->connectionId = deliver->windowSystem->m_manageConnectionId;
+    deliver->windowSystem->m_manageConnectionId++;
 
-    struct serverinfo_interface g_serverinfoImplementation = {
-        WaylandBaseWindowSystem::serverinfoIFCreateConnection,
-    };
+    wl_list_init(&clientPair->link);
+    wl_list_insert(&deliver->windowSystem->m_connectionList, &clientPair->link);
 
-    void WaylandBaseWindowSystem::bindServerinfo(struct wl_client *client, void *data, uint32_t version, uint32_t id)
-    {
-        LOG_DEBUG("WaylandBaseWindowSystem", "bindServerinfo client:" << client << ", data:" << data << ", version:" << version << ", id:" << id);
-        wl_client_add_object(client, &serverinfo_interface, &g_serverinfoImplementation, id, data);
-    }
+    // send native client handle to this client.
+    // by protocol default, this information is not needed.
+    wl_resource_post_event(resource, SERVERINFO_CONNECTION_ID, clientPair->connectionId);
+    LOG_DEBUG("WaylandBaseWindowSystem", "serverinfoIFCreateConnection() create connection id" << clientPair->connectionId << " for client " << clientPair->client);
+}
 
-    void WaylandBaseWindowSystem::createServerinfo(WaylandBaseWindowSystem* windowSystem)
-    {
-        struct serverinfo* serverInfo;
+struct serverinfo_interface g_serverinfoImplementation = {
+    WaylandBaseWindowSystem::serverinfoIFCreateConnection,
+};
 
-        serverInfo = (struct serverinfo*)malloc(sizeof *serverInfo);
-        if (NULL == serverInfo){
-            LOG_ERROR("WaylandBaseWindowSystem", "failed to alloc serverinfo");
-            return;
-        }
+void WaylandBaseWindowSystem::bindServerinfo(struct wl_client *client, void *data, uint32_t version, uint32_t id)
+{
+    LOG_DEBUG("WaylandBaseWindowSystem", "bindServerinfo client:" << client << ", data:" << data << ", version:" << version << ", id:" << id);
+    wl_client_add_object(client, &serverinfo_interface, &g_serverinfoImplementation, id, data);
+}
 
-        serverInfo->base.object.interface = &serverinfo_interface;
-        serverInfo->base.object.implementation = (void(**)(void)) &g_serverinfoImplementation;
-        serverInfo->base.client = NULL;
-        serverInfo->base.data = NULL;
-        serverInfo->windowSystem = windowSystem;
+void WaylandBaseWindowSystem::createServerinfo(WaylandBaseWindowSystem* windowSystem)
+{
+    struct serverinfo* serverInfo;
 
-        m_serverInfoGlobal = wl_display_add_global(windowSystem->m_wlDisplay, &serverinfo_interface, serverInfo, WaylandBaseWindowSystem::bindServerinfo);
-        if (NULL == m_serverInfoGlobal)
-        {
-            LOG_ERROR("WaylandBaseWindowSystem", "failed wl_display_add_global");
-            free(serverInfo);
-            return;
-        }
+    serverInfo = (struct serverinfo*)malloc(sizeof *serverInfo);
+    if (NULL == serverInfo)
+    {
+        LOG_ERROR("WaylandBaseWindowSystem", "failed to alloc serverinfo");
+        return;
+    }
 
-        m_serverInfo = (void*)serverInfo;
+    serverInfo->base.object.interface = &serverinfo_interface;
+    serverInfo->base.object.implementation = (void(**)(void)) &g_serverinfoImplementation;
+    serverInfo->base.client = NULL;
+    serverInfo->base.data = NULL;
+    serverInfo->windowSystem = windowSystem;
+
+    m_serverInfoGlobal = wl_display_add_global(windowSystem->m_wlDisplay,
+                                                &serverinfo_interface,
+                                                serverInfo,
+                                                WaylandBaseWindowSystem::bindServerinfo);
+    if (NULL == m_serverInfoGlobal)
+    {
+        LOG_ERROR("WaylandBaseWindowSystem", "failed wl_display_add_global");
+        free(serverInfo);
+        return;
     }
 
-    int WaylandBaseWindowSystem::finishFrameHandler(void *data)
+    m_serverInfo = (void*)serverInfo;
+}
+
+int WaylandBaseWindowSystem::finishFrameHandler(void *data)
+{
+    BaseWindowSystem* windowSystem = static_cast<BaseWindowSystem*>(data);
+    if (windowSystem)
     {
-        BaseWindowSystem* windowSystem = static_cast<BaseWindowSystem*>(data);
-        if (windowSystem)
-        {
-            windowSystem->finishFrame();
-        }
-        return 1;
+        windowSystem->finishFrame();
     }
+    return 1;
+}
 }
 
 WaylandBaseWindowSystem::WaylandBaseWindowSystem(const char* displayname, int width, int height, Scene* pScene, InputManager* pInputManager)
@@ -182,7 +188,7 @@ void WaylandBaseWindowSystem::printDebug()
     LayerListConstIterator iter = list.begin();
     LayerListConstIterator iterEnd = list.end();
 
-    for(; iter != iterEnd; ++iter)
+    for (; iter != iterEnd; ++iter)
     {
         Rectangle dest = (*iter)->getDestinationRegion();
         debugmessage << "            " << std::setw(4) << (*iter)->getID() << " " << std::setw(3) << dest.x << " " << std::setw(3) << dest.y << " " << std::setw(3) << dest.width << " " << std::setw(3) << dest.height << " " << std::setw(3) << (*iter)->opacity << "\n";
@@ -194,28 +200,28 @@ void WaylandBaseWindowSystem::printDebug()
         SurfaceListIterator surfaceIter = surfaceList.begin();
         SurfaceListIterator surfaceIterEnd = surfaceList.end();
 
-        for(; surfaceIter != surfaceIterEnd ; ++surfaceIter)
+        for (; surfaceIter != surfaceIterEnd; ++surfaceIter)
         {
             Rectangle src = (*surfaceIter)->getSourceRegion();
             Rectangle dest = (*surfaceIter)->getDestinationRegion();
-            debugmessage << "                        " << std::setw(4) << (*surfaceIter)->getID() << " " << std::setprecision(3) << (*surfaceIter)->opacity<< " " << std::setw(3) << src.x << " " << std::setw(3) << src.y << " " << std::setw(3) << src.width << " " << std::setw(3) << src.height << " " << std::setw(3) << dest.x << " " << std::setw(3) << dest.y << " " << std::setw(3) << dest.width << " " << std::setw(3) << dest.height  << "\n";
+            debugmessage << "                        " << std::setw(4) << (*surfaceIter)->getID() << " " << std::setprecision(3) << (*surfaceIter)->opacity << " " << std::setw(3) << src.x << " " << std::setw(3) << src.y << " " << std::setw(3) << src.width << " " << std::setw(3) << src.height << " " << std::setw(3) << dest.x << " " << std::setw(3) << dest.y << " " << std::setw(3) << dest.width << " " << std::setw(3) << dest.height << "\n";
         }
     }
-    LOG_DEBUG("WaylandBaseWindowSystem",debugmessage.str());
+    LOG_DEBUG("WaylandBaseWindowSystem", debugmessage.str());
 }
 
 Surface* WaylandBaseWindowSystem::getSurfaceFromNativeSurface(struct native_surface* nativeSurface)
 {
     // go though all surfaces
-    const std::map<unsigned int,Surface*> surfaces = m_pScene->getAllSurfaces();
-    for(std::map<unsigned int, Surface*>::const_iterator currentS = surfaces.begin(); currentS != surfaces.end(); ++currentS)
+    const std::map<unsigned int, Surface*> surfaces = m_pScene->getAllSurfaces();
+    for (std::map<unsigned int, Surface*>::const_iterator currentS = surfaces.begin(); currentS != surfaces.end(); ++currentS)
     {
         Surface* currentSurface = (*currentS).second;
         if (!currentSurface)
         {
             continue;
         }
-    WaylandPlatformSurface* nativePlatform = (WaylandPlatformSurface*)currentSurface->platform;
+        WaylandPlatformSurface* nativePlatform = (WaylandPlatformSurface*)currentSurface->platform;
         if (!nativePlatform)
         {
             continue;
@@ -261,10 +267,10 @@ void WaylandBaseWindowSystem::checkForNewSurfaceNativeContent()
 {
     m_pScene->lockScene();
     LayerList layers = m_pScene->getCurrentRenderOrder(0);
-    for(LayerListConstIterator current = layers.begin(); current != layers.end(); current++)
+    for (LayerListConstIterator current = layers.begin(); current != layers.end(); current++)
     {
         SurfaceList surfaces = (*current)->getAllSurfaces();
-        for(SurfaceListConstIterator currentS = surfaces.begin(); currentS != surfaces.end(); currentS++)
+        for (SurfaceListConstIterator currentS = surfaces.begin(); currentS != surfaces.end(); currentS++)
         {
             if ((*currentS)->hasNativeContent())
             {
@@ -283,17 +289,17 @@ static struct timeval tv0;
 static struct timeval tv0_forRender;
 
 
-void WaylandBaseWindowSystem::calculateSurfaceFps(Surface *currentSurface, float time )
+void WaylandBaseWindowSystem::calculateSurfaceFps(Surface *currentSurface, float time)
 {
-        char floatStringBuffer[256];
-        float surfaceUpdateFps = ((float)(currentSurface->updateCounter)) / time ;
-        float surfaceDrawFps = ((float)(currentSurface->drawCounter)) / time ;
-        sprintf(floatStringBuffer, "0x%08x update fps: %3.2f", currentSurface->getID(),surfaceUpdateFps);
-        currentSurface->updateCounter = 0;
-        LOG_INFO("WaylandBaseWindowSystem", "Surface " << floatStringBuffer);
-        sprintf(floatStringBuffer, "0x%08x draw fps: %3.2f", currentSurface->getID(),surfaceDrawFps);
-        currentSurface->drawCounter = 0;
-        LOG_INFO("WaylandBaseWindowSystem", "Surface " << floatStringBuffer);
+    char floatStringBuffer[256];
+    float surfaceUpdateFps = ((float)(currentSurface->updateCounter)) / time;
+    float surfaceDrawFps = ((float)(currentSurface->drawCounter)) / time;
+    sprintf(floatStringBuffer, "0x%08x update fps: %3.2f", currentSurface->getID(), surfaceUpdateFps);
+    currentSurface->updateCounter = 0;
+    LOG_INFO("WaylandBaseWindowSystem", "Surface " << floatStringBuffer);
+    sprintf(floatStringBuffer, "0x%08x draw fps: %3.2f", currentSurface->getID(), surfaceDrawFps);
+    currentSurface->drawCounter = 0;
+    LOG_INFO("WaylandBaseWindowSystem", "Surface " << floatStringBuffer);
 }
 
 void WaylandBaseWindowSystem::calculateFps()
@@ -315,24 +321,24 @@ void WaylandBaseWindowSystem::calculateFps()
     // {
         //LOG_INFO("WaylandBaseWindowSystem", "tv.tv_sec:" << tv.tv_sec << ", tv.tv_usec:" << tv.tv_usec);
         //LOG_INFO("WaylandBaseWindowSystem", "timeSinceLastCalc " << timeSinceLastCalc);
-        FPS = ((float)(Frame)) / timeSinceLastCalc;
-        char floatStringBuffer[256];
-        sprintf(floatStringBuffer, "Overall fps: %f", FPS);
+    FPS = ((float)(Frame)) / timeSinceLastCalc;
+    char floatStringBuffer[256];
+    sprintf(floatStringBuffer, "Overall fps: %f", FPS);
 
-        timeSinceLastCalc = (float)(tv.tv_sec-tv0_forRender.tv_sec) + 0.000001*((float)(tv.tv_usec-tv0_forRender.tv_usec));
-        for(std::list<Layer*>::const_iterator current = layers.begin(); current != layers.end(); current++)
+    timeSinceLastCalc = (float)(tv.tv_sec-tv0_forRender.tv_sec) + 0.000001*((float)(tv.tv_usec-tv0_forRender.tv_usec));
+    for (std::list<Layer*>::const_iterator current = layers.begin(); current != layers.end(); current++)
+    {
+        SurfaceList surfaceList = (*current)->getAllSurfaces();
+        SurfaceListIterator surfaceIter = surfaceList.begin();
+        SurfaceListIterator surfaceIterEnd = surfaceList.end();
+        for (; surfaceIter != surfaceIterEnd; ++surfaceIter)
         {
-            SurfaceList surfaceList = (*current)->getAllSurfaces();
-            SurfaceListIterator surfaceIter = surfaceList.begin();
-            SurfaceListIterator surfaceIterEnd = surfaceList.end();
-            for(; surfaceIter != surfaceIterEnd ; ++surfaceIter)
-            {
-                calculateSurfaceFps((*surfaceIter),timeSinceLastCalc);
-            }
+            calculateSurfaceFps((*surfaceIter), timeSinceLastCalc);
         }
-        LOG_INFO("WaylandBaseWindowSystem", floatStringBuffer);
-        tv0 = tv;
-        Frame = 0;
+    }
+    LOG_INFO("WaylandBaseWindowSystem", floatStringBuffer);
+    tv0 = tv;
+    Frame = 0;
     // }
 }
 
@@ -353,7 +359,7 @@ void WaylandBaseWindowSystem::RedrawAllLayers(bool clear, bool swap)
         }
 #endif /* WL_OMIT_CLEAR_GB */
     }
-    for(std::list<Layer*>::const_iterator current = layers.begin(); current != layers.end(); current++)
+    for (std::list<Layer*>::const_iterator current = layers.begin(); current != layers.end(); current++)
     {
         if ((*current)->getLayerType() == Hardware)
         {
@@ -443,7 +449,7 @@ void WaylandBaseWindowSystem::Screenshot()
         LOG_DEBUG("WaylandBaseWindowSystem", "Taking screenshot");
         RedrawAllLayers(true, false); // Do clear, Don't swap
     }
-    else if(m_takeScreenshot == ScreenshotOfLayer)
+    else if (m_takeScreenshot == ScreenshotOfLayer)
     {
         LOG_DEBUG("WaylandBaseWindowSystem", "Taking screenshot of layer");
         Layer* layer = m_pScene->getLayer(m_screenShotLayerID);
@@ -453,7 +459,7 @@ void WaylandBaseWindowSystem::Screenshot()
             graphicSystem->renderSWLayer(layer, true); // Do clear
         }
     }
-    else if(m_takeScreenshot == ScreenshotOfSurface)
+    else if (m_takeScreenshot == ScreenshotOfSurface)
     {
         LOG_DEBUG("WaylandBaseWindowSystem", "Taking screenshot of surface");
         Layer* layer = m_pScene->getLayer(m_screenShotLayerID);
@@ -477,7 +483,7 @@ void WaylandBaseWindowSystem::Screenshot()
     /*LOG_INFO("WaylandBaseWindowSystem","UnLocking List");*/
 }
 
-void WaylandBaseWindowSystem::destroyListenerSurfaceBuffer(struct wl_listener* listener,void *data)
+void WaylandBaseWindowSystem::destroyListenerSurfaceBuffer(struct wl_listener* listener, void *data)
 {
     LOG_DEBUG("WaylandBaseWindowSystem", "destroyListenerSurfaceBuffer listener:" << listener << "data :" << data);
     struct native_surface *es = wl_container_of(listener, es, buffer_destroy_listener);
@@ -485,7 +491,7 @@ void WaylandBaseWindowSystem::destroyListenerSurfaceBuffer(struct wl_listener* l
     es->buffer = NULL;
 }
 
-void WaylandBaseWindowSystem::destroyListenerSurfacePendingBuffer(struct wl_listener* listener,void *data)
+void WaylandBaseWindowSystem::destroyListenerSurfacePendingBuffer(struct wl_listener* listener, void *data)
 {
     LOG_DEBUG("WaylandBaseWindowSystem", "destroyListenerSurfacePendingBuffer listener:" << listener << "data :" << data);
     struct native_surface *es = wl_container_of(listener, es, pending.buffer_destroy_listener);
@@ -503,9 +509,9 @@ struct native_surface* WaylandBaseWindowSystem::createNativeSurface()
         LOG_ERROR("WaylandBaseWindowSystem", "failed to create native surface");
         return NULL;
     }
-    
+
     wl_signal_init(&surface->surface.resource.destroy_signal);
-    
+
     wl_list_init(&surface->link);
 
     surface->surface.resource.client = NULL;
@@ -539,7 +545,7 @@ uint32_t WaylandBaseWindowSystem::getTime(void)
 void WaylandBaseWindowSystem::destroySurfaceCallback(struct wl_resource* resource)
 {
     struct native_surface* nativeSurface = wl_container_of(resource, nativeSurface, surface.resource);
-    WaylandBaseWindowSystem* windowSystem = static_cast<WaylandBaseWindowSystem*>( (WaylandBaseWindowSystem*)nativeSurface->windowSystem);
+    WaylandBaseWindowSystem* windowSystem = static_cast<WaylandBaseWindowSystem*>((WaylandBaseWindowSystem*)nativeSurface->windowSystem);
     Surface* ilmSurface = windowSystem->getSurfaceFromNativeSurface(nativeSurface);
 
     if (NULL != ilmSurface)
@@ -595,7 +601,7 @@ void WaylandBaseWindowSystem::attachBufferToNativeSurface(struct wl_buffer* buff
 {
     LOG_DEBUG("WaylandBaseWindowSystem", "attachBufferToNativeSurface IN");
     struct native_surface* nativeSurface = (struct native_surface*)surface;
-    WaylandBaseWindowSystem* windowSystem = static_cast<WaylandBaseWindowSystem*>( (WaylandBaseWindowSystem*)nativeSurface->windowSystem);
+    WaylandBaseWindowSystem* windowSystem = static_cast<WaylandBaseWindowSystem*>((WaylandBaseWindowSystem*)nativeSurface->windowSystem);
     Surface* ilmSurface = windowSystem->getSurfaceFromNativeSurface(nativeSurface);
     if (NULL == ilmSurface)
     {
@@ -612,7 +618,7 @@ void WaylandBaseWindowSystem::attachBufferToNativeSurface(struct wl_buffer* buff
         windowSystem->graphicSystem->activateGraphicContext();
         windowSystem->graphicSystem->getTextureBinder()->createClientBuffer(ilmSurface);
         windowSystem->graphicSystem->releaseGraphicContext();
-        LOG_DEBUG("WaylandBaseWindowSystem","nativePlatformSurface->enable");
+        LOG_DEBUG("WaylandBaseWindowSystem", "nativePlatformSurface->enable");
         nativePlatformSurface->enableRendering();
     }
 
@@ -620,8 +626,8 @@ void WaylandBaseWindowSystem::attachBufferToNativeSurface(struct wl_buffer* buff
 }
 
 extern "C" void WaylandBaseWindowSystem::surfaceIFAttach(struct wl_client* client,
-           struct wl_resource* resource,
-           struct wl_resource* buffer_resource, int32_t x, int32_t y)
+            struct wl_resource* resource,
+            struct wl_resource* buffer_resource, int32_t x, int32_t y)
 {
     LOG_DEBUG("WaylandBaseWindowSystem", "surfaceIFAttach client:" << client);
     LOG_DEBUG("WaylandBaseWindowSystem", "surfaceIFAttach IN");
@@ -655,8 +661,8 @@ extern "C" void WaylandBaseWindowSystem::surfaceIFAttach(struct wl_client* clien
 }
 
 extern "C" void WaylandBaseWindowSystem::surfaceIFDamage(struct wl_client *client,
-           struct wl_resource *resource,
-           int32_t x, int32_t y, int32_t width, int32_t height)
+            struct wl_resource *resource,
+            int32_t x, int32_t y, int32_t width, int32_t height)
 {
     LOG_DEBUG("WaylandBaseWindowSystem", "surfaceIFDamage client:" << client);
     LOG_DEBUG("WaylandBaseWindowSystem", "surfaceIFDamage IN");
@@ -685,7 +691,7 @@ extern "C" void WaylandBaseWindowSystem::destroyFrameCallback(struct wl_resource
 }
 
 extern "C" void WaylandBaseWindowSystem::surfaceIFFrame(struct wl_client *client,
-          struct wl_resource *resource, uint32_t callback)
+            struct wl_resource *resource, uint32_t callback)
 {
     LOG_DEBUG("WaylandBaseWindowSystem", "surfaceIFFrame IN");
     struct native_frame_callback* cb;
@@ -714,7 +720,7 @@ extern "C" void WaylandBaseWindowSystem::surfaceIFCommit(struct wl_client *clien
 {
     LOG_DEBUG("WaylandBaseWindowSystem", "surfaceIFCommit IN clinet:" << client);
     struct native_surface* nativeSurface = (struct native_surface*)resource->data;
-    WaylandBaseWindowSystem* windowSystem = static_cast<WaylandBaseWindowSystem*>( (WaylandBaseWindowSystem*)nativeSurface->windowSystem);
+    WaylandBaseWindowSystem* windowSystem = static_cast<WaylandBaseWindowSystem*>((WaylandBaseWindowSystem*)nativeSurface->windowSystem);
     Surface* surface = windowSystem->getSurfaceFromNativeSurface(nativeSurface);
     struct wl_buffer* buffer = NULL;
 
@@ -775,7 +781,7 @@ extern "C" void WaylandBaseWindowSystem::compositorIFCreateSurface
         (struct wl_client *client, struct wl_resource* resource, uint32_t id)
 {
     LOG_DEBUG("WaylandBaseWindowSystem", "compositorIFCreateSurface IN");
-    WaylandBaseWindowSystem* windowSystem = static_cast<WaylandBaseWindowSystem*>( (WaylandBaseWindowSystem*) resource->data);
+    WaylandBaseWindowSystem* windowSystem = static_cast<WaylandBaseWindowSystem*>((WaylandBaseWindowSystem*) resource->data);
     struct native_surface* surface;
 
     surface = windowSystem->createNativeSurface();
@@ -795,7 +801,8 @@ extern "C" void WaylandBaseWindowSystem::compositorIFCreateSurface
 
     struct serverinfoClient* serverinfoPairNode;
 
-    wl_list_for_each(serverinfoPairNode, &windowSystem->m_connectionList, link) {
+    wl_list_for_each(serverinfoPairNode, &windowSystem->m_connectionList, link)
+    {
         if (serverinfoPairNode->client != client)
         {
             continue;
@@ -810,7 +817,7 @@ extern "C" void WaylandBaseWindowSystem::compositorIFCreateSurface
     LOG_DEBUG("WaylandBaseWindowSystem", "compositorIFCreateSurface OUT");
 }
 
-const static struct wl_compositor_interface g_compositorInterface = 
+const static struct wl_compositor_interface g_compositorInterface =
 {
     WaylandBaseWindowSystem::compositorIFCreateSurface,
     NULL
@@ -822,7 +829,7 @@ const static struct wl_compositor_interface g_compositorInterface =
  */
 extern "C" void* WaylandBaseWindowSystem::eventLoopCallback(void *ptr)
 {
-    WaylandBaseWindowSystem *windowsys = static_cast<WaylandBaseWindowSystem*>( (WaylandBaseWindowSystem*) ptr);
+    WaylandBaseWindowSystem *windowsys = static_cast<WaylandBaseWindowSystem*>((WaylandBaseWindowSystem*) ptr);
     return windowsys->eventLoop();
 }
 
@@ -934,7 +941,7 @@ void WaylandBaseWindowSystem::wakeUpRendererThread()
 
 int WaylandBaseWindowSystem::signalEventOnTerm(int signal_number, void *data)
 {
-    WaylandBaseWindowSystem* windowSystem = static_cast<WaylandBaseWindowSystem*>( (WaylandBaseWindowSystem*)data);
+    WaylandBaseWindowSystem* windowSystem = static_cast<WaylandBaseWindowSystem*>((WaylandBaseWindowSystem*)data);
 
     LOG_INFO("WaylandBaseWindowSystem", "caught signal " << signal_number);
     windowSystem->cleanup();
@@ -1005,11 +1012,13 @@ void* WaylandBaseWindowSystem::eventLoop()
         status = createInputEvent();
         if (false == status)
         {
-             LOG_WARNING("WaylandBaseWindowSystem", "WARNING: failed to create input event");
-             status = true;
-         } else {
-             LOG_DEBUG("WaylandBaseWindowSystem", "SUCCESS:create InputEvent");
-         }
+            LOG_WARNING("WaylandBaseWindowSystem", "WARNING: failed to create input event");
+            status = true;
+        }
+        else
+        {
+            LOG_DEBUG("WaylandBaseWindowSystem", "SUCCESS:create InputEvent");
+        }
 
         this->m_success = status;
         this->m_initialized = true;
@@ -1022,24 +1031,21 @@ void* WaylandBaseWindowSystem::eventLoop()
         // run the main event loop while rendering
         gettimeofday(&tv0, NULL);
         LOG_DEBUG("WaylandBaseWindowSystem", "Enter render loop");
-       
+
         if (wl_display_add_socket(m_wlDisplay, NULL))
         {
             LOG_ERROR("WaylandBaseWindowSystem", "failed to add socket");
-                this->m_success = false;
-                this->m_initialized = false;
-                break;
+            this->m_success = false;
+            this->m_initialized = false;
+            break;
         }
-        
+
         // clear screen to avoid garbage on startup
         this->graphicSystem->clearBackground();
         this->graphicSystem->swapBuffers();
 
-
         wl_display_run(m_wlDisplay);
-
-    } while(0);
+    } while (0);
 
     this->cleanup();
     LOG_DEBUG("WaylandBaseWindowSystem", "Renderer thread finished");
@@ -1087,7 +1093,7 @@ void WaylandBaseWindowSystem::cleanup()
 extern "C" void WaylandBaseWindowSystem::registryHandleGlobalClient(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
 {
     LOG_DEBUG("WaylandBaseWindowSystem", "version " << version);
-    WaylandBaseWindowSystem* windowsys = static_cast<WaylandBaseWindowSystem*>( (WaylandBaseWindowSystem*) data);
+    WaylandBaseWindowSystem* windowsys = static_cast<WaylandBaseWindowSystem*>((WaylandBaseWindowSystem*) data);
     int ans_strcmp = 0;
 
     do
@@ -1098,7 +1104,7 @@ extern "C" void WaylandBaseWindowSystem::registryHandleGlobalClient(void* data,
             windowsys->m_wlCompositorClient = (wl_compositor*)wl_registry_bind(registry, name, &wl_compositor_interface, 1);
             break;
         }
-    } while(0);
+    } while (0);
 }
 
 extern "C" const struct wl_registry_listener g_registryListener = {
@@ -1139,7 +1145,7 @@ bool WaylandBaseWindowSystem::createWaylandClient()
         LOG_DEBUG("WaylandBaseWindowSystem", "create client surface");
 
         return true;
-    } while(0);
+    } while (0);
 
     releaseWaylandClient();
 
@@ -1181,9 +1187,9 @@ bool WaylandBaseWindowSystem::init(BaseGraphicSystem<void*, void*>* base)
     while (false == m_initialized)
     {
         usleep(10000); // TODO
-        LOG_DEBUG("WaylandBaseWindowSystem","Waiting start compositor complete " << m_initialized);
+        LOG_DEBUG("WaylandBaseWindowSystem", "Waiting start compositor complete " << m_initialized);
     }
-    LOG_INFO("WaylandBaseWindowSystem","Start complete [connect display]" << m_initialized << " success " << m_success);
+    LOG_INFO("WaylandBaseWindowSystem", "Start complete [connect display]" << m_initialized << " success " << m_success);
     return m_success;
 }
 
@@ -1192,10 +1198,12 @@ bool WaylandBaseWindowSystem::start()
     bool result = true;
     LOG_DEBUG("WaylandBaseWindowSystem", "Starting / Creating thread");
     // let thread actually run
-    if ( m_error == false )
+    if (m_error == false)
     {
         pthread_mutex_unlock(&run_lock);
-    } else {
+    }
+    else
+    {
         pthread_mutex_unlock(&run_lock);
         result = false;
     }
@@ -1211,7 +1219,7 @@ bool WaylandBaseWindowSystem::start()
 
 void WaylandBaseWindowSystem::stop()
 {
-    LOG_INFO("WaylandBaseWindowSystem","Stopping..");
+    LOG_INFO("WaylandBaseWindowSystem", "Stopping..");
     // needed if start was never called, we wake up thread, so it can immediatly finish
     // this->signalRedrawEvent();
 
@@ -1223,36 +1231,36 @@ void WaylandBaseWindowSystem::stop()
 
 void WaylandBaseWindowSystem::allocatePlatformSurface(Surface* surface)
 {
-    LOG_INFO("WaylandBaseWindowSystem","allocatePlatformSurface begin");
+    LOG_INFO("WaylandBaseWindowSystem", "allocatePlatformSurface begin");
     WaylandPlatformSurface* nativeSurface = (WaylandPlatformSurface*)surface->platform;
     if (!nativeSurface)
     {
-        LOG_DEBUG("WaylandBaseWindowSystem","creating native surface for new window");
+        LOG_DEBUG("WaylandBaseWindowSystem", "creating native surface for new window");
         // this surface does not have a native platform surface attached yet!
         nativeSurface = (WaylandPlatformSurface*)graphicSystem->getTextureBinder()->createPlatformSurface(surface);
         if (0 != nativeSurface)
         {
             unsigned int surfaceId = surface->getNativeContent();
-            LOG_DEBUG("WaylandBaseWindowSystem","surface->getNativeContent() : " << surfaceId);
+            LOG_DEBUG("WaylandBaseWindowSystem", "surface->getNativeContent() : " << surfaceId);
             nativeSurface->connectionId = (unsigned short)((surfaceId >> 16) & 0xFFFF);
             nativeSurface->surfaceId = (unsigned short)(surfaceId & 0xFFFF);
             surface->platform = nativeSurface;
         }
         else
         {
-            LOG_ERROR("WaylandBaseWindowSystem","failed to allocate platformsurface");
+            LOG_ERROR("WaylandBaseWindowSystem", "failed to allocate platformsurface");
         }
     }
-    LOG_INFO("WaylandBaseWindowSystem","allocatePlatformSurface end");
+    LOG_INFO("WaylandBaseWindowSystem", "allocatePlatformSurface end");
 }
 
 void WaylandBaseWindowSystem::deallocatePlatformSurface(Surface* surface)
 {
-    LOG_DEBUG("WaylandBaseWindowSystem","deallocatePlatformSurface begin");
+    LOG_DEBUG("WaylandBaseWindowSystem", "deallocatePlatformSurface begin");
     WaylandPlatformSurface* nativeSurface = (WaylandPlatformSurface*)surface->platform;
     if (nativeSurface)
     {
-        LOG_DEBUG("WaylandBaseWindowSystem","destroyingnative surface");
+        LOG_DEBUG("WaylandBaseWindowSystem", "destroyingnative surface");
 #if 0 // TODO
         graphicSystem->activateGraphicContext();
         graphicSystem->getTextureBinder()->destroyClientBuffer(surface);
@@ -1263,7 +1271,7 @@ void WaylandBaseWindowSystem::deallocatePlatformSurface(Surface* surface)
         surface->platform = NULL;
 #endif
     }
-    LOG_DEBUG("WaylandBaseWindowSystem","deallocatePlatformSurface end");
+    LOG_DEBUG("WaylandBaseWindowSystem", "deallocatePlatformSurface end");
 }
 
 void WaylandBaseWindowSystem::doScreenShot(std::string fileName)
@@ -1288,10 +1296,11 @@ void WaylandBaseWindowSystem::doScreenShotOfSurface(std::string fileName, const
 }
 
 void WaylandBaseWindowSystem::manageWLInputEvent(const InputDevice type,
-                                                 const InputEventState state,
-                                                 const WLEvent *wlEvent)
+                                                const InputEventState state,
+                                                const WLEvent *wlEvent)
 {
-    if (!m_inputEvent){
+    if (!m_inputEvent)
+    {
         LOG_WARNING("WaylandBaseWindowSystem", "InputEvent not available");
         return;
     }
@@ -1299,14 +1308,16 @@ void WaylandBaseWindowSystem::manageWLInputEvent(const InputDevice type,
     native_surface *nativeSurface = NULL;
     uint32_t time = getTime();
 
-    switch (type){
+    switch (type)
+    {
     case INPUT_DEVICE_KEYBOARD:
         {
             LOG_DEBUG("WaylandBaseWindowSystem",
-                      "INPUT_DEVICE_KEYBOARD: state = " << state <<
-                      ", keyCode = " << wlEvent->keyCode);
+                        "INPUT_DEVICE_KEYBOARD: state = " << state <<
+                        ", keyCode = " << wlEvent->keyCode);
             surface = m_pInputManager->reportKeyboardEvent(state, wlEvent->keyCode);
-            if (!surface){
+            if (!surface)
+            {
                 m_inputEvent->inputDevice().setKeyboardFocus(NULL);
                 break;
             }
@@ -1315,7 +1326,8 @@ void WaylandBaseWindowSystem::manageWLInputEvent(const InputDevice type,
             if (!nativeSurface)
                 break;
 
-            switch (state){
+            switch (state)
+            {
             case INPUT_STATE_PRESSED:
                 m_inputEvent->inputDevice().sendKeyPressEvent(
                     &nativeSurface->surface, time, wlEvent->keyCode);
@@ -1334,25 +1346,27 @@ void WaylandBaseWindowSystem::manageWLInputEvent(const InputDevice type,
     case INPUT_DEVICE_POINTER:
         {
             LOG_DEBUG("WaylandBaseWindowSystem",
-                      "INPUT_DEVICE_POINTER: state = " << state <<
-                      ", x = " << wlEvent->x <<
-                      ", y = " << wlEvent->y);
+                        "INPUT_DEVICE_POINTER: state = " << state <<
+                        ", x = " << wlEvent->x <<
+                        ", y = " << wlEvent->y);
             Point globalPos = {state, wlEvent->x, wlEvent->y};
-            Point localPos  = globalPos;
+            Point localPos = globalPos;
             surface = m_pInputManager->reportPointerEvent(localPos);
-            if (!surface){
+            if (!surface)
+            {
                 LOG_WARNING("WaylandBaseWindowSystem", "NO FOUND SURFACE!");
                 break;
             }
             LOG_DEBUG("WaylandBaseWindowSystem",
-                      "Local coordinates: x = " << localPos.x <<
-                      ", y = " << localPos.y);
+                        "Local coordinates: x = " << localPos.x <<
+                        ", y = " << localPos.y);
 
             nativeSurface = getNativeSurfaceFromSurface(surface);
             if (!nativeSurface)
                 break;
 
-            switch (state){
+            switch (state)
+            {
             case INPUT_STATE_PRESSED:
                 m_inputEvent->inputDevice().sendMousePressEvent(
                     globalPos, localPos, wlEvent->button, time);
@@ -1374,9 +1388,9 @@ void WaylandBaseWindowSystem::manageWLInputEvent(const InputDevice type,
     case INPUT_DEVICE_TOUCH:
         {
             LOG_DEBUG("WaylandBaseWindowSystem",
-                      "INPUT_DEVICE_TOUCH: state = " << state <<
-                      ", x = " << wlEvent->x <<
-                      ", y = " << wlEvent->y);
+                        "INPUT_DEVICE_TOUCH: state = " << state <<
+                        ", x = " << wlEvent->x <<
+                        ", y = " << wlEvent->y);
             Point pt = {state, wlEvent->x, wlEvent->y};
             PointVect ptVec(1, pt);
             surface = m_pInputManager->reportTouchEvent(ptVec);
@@ -1387,7 +1401,8 @@ void WaylandBaseWindowSystem::manageWLInputEvent(const InputDevice type,
             if (!nativeSurface)
                 break;
 
-            switch (state){
+            switch (state)
+            {
             case INPUT_STATE_PRESSED:
             case INPUT_STATE_MOTION:
             case INPUT_STATE_RELEASED:
index 246571d..4f4b8d2 100644 (file)
@@ -53,15 +53,15 @@ WaylandDrmWindowSystem::WaylandDrmWindowSystem(const char* displayname, int widt
 
 WaylandDrmWindowSystem::~WaylandDrmWindowSystem()
 {
-       if (m_gbm != NULL)
-               gbm_device_destroy(m_gbm);
-       if (m_fdDev >= 0)
-               drmDropMaster(m_fdDev);
+    if (m_gbm != NULL)
+        gbm_device_destroy(m_gbm);
+    if (m_fdDev >= 0)
+        drmDropMaster(m_fdDev);
 }
 
 bool WaylandDrmWindowSystem::initGraphicSystem()
 {
-       graphicSystem->setBaseWindowSystem(this);
+    graphicSystem->setBaseWindowSystem(this);
     bool ans = graphicSystem->init((void*)m_gbm, (void*)NULL);
     if (true != ans)
     {
@@ -76,67 +76,67 @@ bool WaylandDrmWindowSystem::initGraphicSystem()
 
 bool WaylandDrmWindowSystem::createNativeContext()
 {
-       struct udev* udev;
-       struct udev_device *device, *drm_device;
-       struct udev_enumerate* e;
-       struct udev_list_entry* entry;
-       const char *path, *device_seat;
-       const char *seat = default_seat;
-
-       udev = udev_new();
-       if (udev == NULL)
-       {
-               LOG_ERROR("WaylandDrmWindowSystem", "failed to initialize udev context.");
-               return false;
-       }
-
-       e = udev_enumerate_new(udev);
-       udev_enumerate_add_match_subsystem(e, "drm");
-       udev_enumerate_add_match_sysname(e, "card[0-9]*");
-
-       udev_enumerate_scan_devices(e);
-       drm_device = NULL;
-       udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e))
-       {
-               path = udev_list_entry_get_name(entry);
-               device = udev_device_new_from_syspath(udev, path);
-               device_seat = udev_device_get_property_value(device, "ID_SEAT");
-               if (!device_seat)
-                       device_seat = default_seat;
-               if (strcmp(device_seat, seat) == 0)
-               {
-                       drm_device = device;
-                       break;
-               }
-               udev_device_unref(device);
-       }
-
-       if (drm_device == NULL)
-       {
-               LOG_ERROR("WaylandDrmWindowSystem", "no drm device found");
-               return false;
-       }
-
-       const char* filename;
-
-       filename = udev_device_get_devnode(drm_device);
-       m_fdDev = open(filename, O_RDWR | O_CLOEXEC);
-       if (m_fdDev < 0)
-       {
+    struct udev* udev;
+    struct udev_device *device, *drm_device;
+    struct udev_enumerate* e;
+    struct udev_list_entry* entry;
+    const char *path, *device_seat;
+    const char *seat = default_seat;
+
+    udev = udev_new();
+    if (udev == NULL)
+    {
+        LOG_ERROR("WaylandDrmWindowSystem", "failed to initialize udev context.");
+        return false;
+    }
+
+    e = udev_enumerate_new(udev);
+    udev_enumerate_add_match_subsystem(e, "drm");
+    udev_enumerate_add_match_sysname(e, "card[0-9]*");
+
+    udev_enumerate_scan_devices(e);
+    drm_device = NULL;
+    udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e))
+    {
+        path = udev_list_entry_get_name(entry);
+        device = udev_device_new_from_syspath(udev, path);
+        device_seat = udev_device_get_property_value(device, "ID_SEAT");
+        if (!device_seat)
+            device_seat = default_seat;
+        if (strcmp(device_seat, seat) == 0)
+        {
+            drm_device = device;
+            break;
+        }
+        udev_device_unref(device);
+    }
+
+    if (drm_device == NULL)
+    {
+        LOG_ERROR("WaylandDrmWindowSystem", "no drm device found");
+        return false;
+    }
+
+    const char* filename;
+
+    filename = udev_device_get_devnode(drm_device);
+    m_fdDev = open(filename, O_RDWR | O_CLOEXEC);
+    if (m_fdDev < 0)
+    {
         LOG_ERROR("WaylandDrmWindowSystem", "failed to open device");
         return false;
-       }
+    }
 
-       LOG_DEBUG("WaylandDrmWindowSystem", "Device name: " << filename << " fd: " << m_fdDev);
+    LOG_DEBUG("WaylandDrmWindowSystem", "Device name: " << filename << " fd: " << m_fdDev);
 
-       m_gbm = gbm_create_device(m_fdDev);
-       if (m_gbm == NULL)
-       {
+    m_gbm = gbm_create_device(m_fdDev);
+    if (m_gbm == NULL)
+    {
         LOG_ERROR("WaylandDrmWindowSystem", "failed to create gbm device");
-               return false;
-       }
+        return false;
+    }
 
-       udev_device_unref(drm_device);
+    udev_device_unref(drm_device);
 
     LOG_DEBUG("WaylandDrmWindowSystem", "SUCCESS:create gbm device");
     return true;
@@ -158,10 +158,10 @@ void WaylandDrmWindowSystem::checkForNewSurfaceNativeContent()
     for (; iter != iterEnd; ++iter)
     {
         LayerList layers = m_pScene->getCurrentRenderOrder((*iter)->getID());
-        for(LayerListConstIterator current = layers.begin(); current != layers.end(); current++)
+        for (LayerListConstIterator current = layers.begin(); current != layers.end(); current++)
         {
             SurfaceList surfaces = (*current)->getAllSurfaces();
-            for(SurfaceListConstIterator currentS = surfaces.begin(); currentS != surfaces.end(); currentS++)
+            for (SurfaceListConstIterator currentS = surfaces.begin(); currentS != surfaces.end(); currentS++)
             {
                 if ((*currentS)->hasNativeContent())
                 {
@@ -199,7 +199,7 @@ void WaylandDrmWindowSystem::RedrawAllLayers(bool clear, bool swap)
                 graphicSystem->clearBackground();
             }
         }
-        for(std::list<Layer*>::const_iterator current = layers.begin(); current != layers.end(); current++)
+        for (std::list<Layer*>::const_iterator current = layers.begin(); current != layers.end(); current++)
         {
             if ((*current)->getLayerType() == Hardware)
             {
index d664eef..92fcecc 100644 (file)
@@ -71,7 +71,7 @@ struct evdev_dispatch_interface fallback_interface = {
 };
 
 // Function prototypes
-void acceleratorFilter (struct motion_filter *, struct motion_params *, void *, uint32_t);
+void acceleratorFilter(struct motion_filter *, struct motion_params *, void *, uint32_t);
 void acceleratorDestroy(struct motion_filter *);
 
 struct motion_filter_interface accelerator_interface = {
@@ -92,16 +92,19 @@ static struct touchpad_model_spec touchpad_spec_table[] = {
 static int
 isMotionEvent(struct input_event *e)
 {
-    switch (e->type){
+    switch (e->type)
+    {
     case EV_REL:
-        switch (e->code){
+        switch (e->code)
+        {
         case REL_X:
         case REL_Y:
             return 1;
         }
         break;
     case EV_ABS:
-        switch (e->code){
+        switch (e->code)
+        {
         case ABS_X:
         case ABS_Y:
         case ABS_MT_POSITION_X:
@@ -122,10 +125,12 @@ getTouchpadModel(struct evdev_input_device *device)
     if (ioctl(device->fd, EVIOCGID, &id) < 0)
         return TOUCHPAD_MODEL_UNKNOWN;
 
-    for (i = 0; i < sizeof(touchpad_spec_table); ++i){
+    for (i = 0; i < sizeof(touchpad_spec_table); ++i)
+    {
         if (touchpad_spec_table[i].vendor == id.vendor &&
             (!touchpad_spec_table[i].product ||
-            touchpad_spec_table[i].product == id.product)){
+            touchpad_spec_table[i].product == id.product))
+        {
             return touchpad_spec_table[i].model;
         }
     }
@@ -135,19 +140,20 @@ getTouchpadModel(struct evdev_input_device *device)
 
 static void
 configureTouchpadPressure(struct touchpad_dispatch *touchpad,
-                          int32_t pressure_min, int32_t pressure_max)
+                            int32_t pressure_min, int32_t pressure_max)
 {
     int32_t range = pressure_max - pressure_min + 1;
     touchpad->has_pressure = 1;
 
     // Magic numbers from xf86-input-synaptics
-    switch (touchpad->model){
+    switch (touchpad->model)
+    {
     case TOUCHPAD_MODEL_ELANTECH:
-        touchpad->pressure.touch_low  = pressure_min + 1;
+        touchpad->pressure.touch_low = pressure_min + 1;
         touchpad->pressure.touch_high = pressure_min + 1;
         break;
     default:
-        touchpad->pressure.touch_low  = pressure_min + range * (25.0/256.0);
+        touchpad->pressure.touch_low = pressure_min + range * (25.0/256.0);
         touchpad->pressure.touch_high = pressure_min + range * (30.0/256.0);
         break;
     }
@@ -203,7 +209,7 @@ createFallbackDispatch()
 {
     struct evdev_dispatch *dispatch =
         (struct evdev_dispatch*)malloc(sizeof(*dispatch));
-    if (dispatch ==   NULL)
+    if (dispatch == NULL)
         return NULL;
 
     dispatch->interface = &fallback_interface;
@@ -215,9 +221,10 @@ createFallbackDispatch()
 
 static void
 processTouch(struct evdev_input_device *device, struct input_event *e,
-             int screen_width, int screen_height)
+                int screen_width, int screen_height)
 {
-    switch (e->code) {
+    switch (e->code)
+    {
     case ABS_MT_SLOT:
         device->mt.slot = e->value;
         break;
@@ -246,9 +253,10 @@ processTouch(struct evdev_input_device *device, struct input_event *e,
 
 static void
 processAbsoluteMotion(struct evdev_input_device *device, struct input_event *e,
-                      int screen_width, int screen_height)
+                        int screen_width, int screen_height)
 {
-    switch (e->code) {
+    switch (e->code)
+    {
     case ABS_X:
         device->abs.x =
             (e->value - device->abs.min_x) * screen_width /
@@ -328,14 +336,14 @@ touchpadGetDelta(struct touchpad_dispatch *touchpad, double *dx, double *dy)
 
 static void
 filterDispatch(struct motion_filter *filter, struct motion_params *motion,
-               void *data, uint32_t time)
+                void *data, uint32_t time)
 {
     filter->interface->filter(filter, motion, data, time);
 }
 
 static void
 filterMotion(struct touchpad_dispatch *touchpad,
-             double *dx, double *dy, uint32_t time)
+                double *dx, double *dy, uint32_t time)
 {
     struct motion_filter *filter;
     struct motion_params  motion;
@@ -343,7 +351,8 @@ filterMotion(struct touchpad_dispatch *touchpad,
     motion.dx = *dx;
     motion.dy = *dy;
 
-    wl_list_for_each(filter, &touchpad->motion_filters, link){
+    wl_list_for_each(filter, &touchpad->motion_filters, link)
+    {
         filterDispatch(filter, &motion, touchpad, time);
     }
 
@@ -355,10 +364,12 @@ static int
 getDirection(int dx, int dy)
 {
     int dir = UNDEFINED_DIRECTION;
-    int d1, d2;
+    int d1;
+    int d2;
     double r;
 
-    if (abs(dx) < 2 && abs(dy) < 2) {
+    if (abs(dx) < 2 && abs(dy) < 2)
+    {
         if (dx > 0 && dy > 0)
             dir = S | SE | E;
         else if (dx > 0 && dy < 0)
@@ -376,7 +387,8 @@ getDirection(int dx, int dy)
         else if (dy < 0)
             dir = NE | N | NW;
     }
-    else {
+    else
+    {
         // Calculate r within the interval  [0 to 8)
         //
         // r = [0 .. 2Ï€] where 0 is North
@@ -399,12 +411,14 @@ getDirection(int dx, int dy)
 
 static void
 feedTrackers(struct pointer_accelerator *accel,
-             double dx, double dy, uint32_t time)
+                double dx, double dy, uint32_t time)
 {
-    int i, current;
+    int i;
+    int current;
     struct pointer_tracker *trackers = accel->trackers;
 
-    for (i = 0; i < NUM_POINTER_TRACKERS; ++i){
+    for (i = 0; i < NUM_POINTER_TRACKERS; ++i)
+    {
         trackers[i].dx += dx;
         trackers[i].dy += dy;
     }
@@ -415,7 +429,7 @@ feedTrackers(struct pointer_accelerator *accel,
     trackers[current].dx = 0.0;
     trackers[current].dy = 0.0;
     trackers[current].time = time;
-    trackers[current].dir  = getDirection(dx, dy);
+    trackers[current].dir = getDirection(dx, dy);
 }
 
 static struct pointer_tracker*
@@ -453,7 +467,8 @@ calculateVelocity(struct pointer_accelerator *accel, uint32_t time)
     unsigned int dir = trackerByOffset(accel, 0)->dir;
 
     // Find first velocity
-    for (offset = 1; offset < NUM_POINTER_TRACKERS; offset++) {
+    for (offset = 1; offset < NUM_POINTER_TRACKERS; offset++)
+    {
         tracker = trackerByOffset(accel, offset);
 
         if (time <= tracker->time)
@@ -467,7 +482,8 @@ calculateVelocity(struct pointer_accelerator *accel, uint32_t time)
 
     // Find least recent vector within a timelimit, maximum velocity diff
     // and direction threshold.
-    for (; offset < NUM_POINTER_TRACKERS; offset++) {
+    for (; offset < NUM_POINTER_TRACKERS; offset++)
+    {
         tracker = trackerByOffset(accel, offset);
 
         // Stop if too far away in time
@@ -502,16 +518,16 @@ accelerationProfile(struct pointer_accelerator *accel,
 
 static double
 calculateAcceleration(struct pointer_accelerator *accel,
-                      void *data, double velocity, uint32_t time)
+                        void *data, double velocity, uint32_t time)
 {
     double factor;
 
-    factor  = accelerationProfile(accel, data, velocity, time);
+    factor = accelerationProfile(accel, data, velocity, time);
     factor += accelerationProfile(accel, data, accel->last_velocity, time);
     factor += 4.0 *
-              accelerationProfile(accel, data,
-                                 (accel->last_velocity + velocity) / 2,
-                                  time);
+                    accelerationProfile(accel, data,
+                                    (accel->last_velocity + velocity) / 2,
+                                    time);
     factor = factor / 6.0;
     return factor;
 }
@@ -519,7 +535,8 @@ calculateAcceleration(struct pointer_accelerator *accel,
 static double
 softenDelta(double lastDelta, double delta)
 {
-    if (delta < -1.0 || delta > 1.0){
+    if (delta < -1.0 || delta > 1.0)
+    {
         if (delta > lastDelta)
             return delta - 0.5;
         else if (delta < lastDelta)
@@ -530,7 +547,7 @@ softenDelta(double lastDelta, double delta)
 
 static void
 applySoftening(struct pointer_accelerator *accel,
-               struct motion_params *motion)
+                struct motion_params *motion)
 {
     motion->dx = softenDelta(accel->last_dx, motion->dx);
     motion->dy = softenDelta(accel->last_dy, motion->dy);
@@ -538,7 +555,7 @@ applySoftening(struct pointer_accelerator *accel,
 
 void
 acceleratorFilter(struct motion_filter *filter, struct motion_params *motion,
-                  void *data, uint32_t time)
+                    void *data, uint32_t time)
 {
     struct pointer_accelerator *accel = (struct pointer_accelerator*)filter;
     double velocity;
@@ -581,13 +598,15 @@ WaylandEvdevInputEvent::WaylandEvdevInputEvent(WaylandBaseWindowSystem* windowSy
 
 WaylandEvdevInputEvent::~WaylandEvdevInputEvent()
 {
-    if (m_udev){
+    if (m_udev)
+    {
         udev_unref(m_udev);
     }
 
     struct evdev_input_device *device, *next;
 
-    wl_list_for_each_safe(device, next, &m_deviceList, link){
+    wl_list_for_each_safe(device, next, &m_deviceList, link)
+    {
         removeDevice(device);
     }
 }
@@ -616,12 +635,13 @@ WaylandEvdevInputEvent::setupInputEvent()
 
     WaylandInputEvent::setupInputEvent();
 
-    m_screenWidth  = m_windowSystem->getWindowWidth();
+    m_screenWidth = m_windowSystem->getWindowWidth();
     m_screenHeight = m_windowSystem->getWindowHeight();
 
     do {
         bool bRet = addDevices();
-        if (!bRet){
+        if (!bRet)
+        {
             break;
         }
     } while (0);
@@ -634,7 +654,8 @@ WaylandEvdevInputEvent::addDevices()
 {
     if (!m_udev)
         m_udev = udev_new();
-    if (!m_udev){
+    if (!m_udev)
+    {
         LOG_ERROR("WaylandEvdevInputEvent", "Failed to initialize udev context");
         return false;
     }
@@ -646,12 +667,14 @@ WaylandEvdevInputEvent::addDevices()
     struct udev_list_entry *entry;
     const char *path, *sysname;
     struct udev_device *device;
-    udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)){
+    udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e))
+    {
         path = udev_list_entry_get_name(entry);
         device = udev_device_new_from_syspath(m_udev, path);
 
         sysname = udev_device_get_sysname(device);
-        if (strncmp("event", sysname, 5) != 0){
+        if (strncmp("event", sysname, 5) != 0)
+        {
             udev_device_unref(device);
             continue;
         }
@@ -663,7 +686,8 @@ WaylandEvdevInputEvent::addDevices()
 
     notifyKeyboardFocus();
 
-    if (wl_list_empty(&m_deviceList)){
+    if (wl_list_empty(&m_deviceList))
+    {
         LOG_WARNING("WaylandEvdevInputEvent", "No input devices on entering service");
     }
 
@@ -691,25 +715,28 @@ WaylandEvdevInputEvent::createInputDevice(struct wl_display *display, const char
     struct wl_event_loop      *eventLoop;
 
     device = (struct evdev_input_device*)malloc(sizeof(*device));
-    if (device == NULL){
+    if (device == NULL)
+    {
         return;
     }
 
-    device->master   = this;
-    device->isMt     = 0;
-    device->mtdev    = NULL;
-    device->devnode  = strdup(path);
-    device->mt.slot  = -1;
-    device->rel.dx   = 0;
-    device->rel.dy   = 0;
+    device->master = this;
+    device->isMt = 0;
+    device->mtdev = NULL;
+    device->devnode = strdup(path);
+    device->mt.slot = -1;
+    device->rel.dx = 0;
+    device->rel.dy = 0;
     device->dispatch = NULL;
 
     device->fd = open(path, O_RDWR | O_NONBLOCK);
-    if (device->fd < 0){
+    if (device->fd < 0)
+    {
         goto err0;
     }
 
-    if (configureDevice(device) < 0){
+    if (configureDevice(device) < 0)
+    {
         goto err1;
     }
 
@@ -719,18 +746,21 @@ WaylandEvdevInputEvent::createInputDevice(struct wl_display *display, const char
     if (device->dispatch == NULL)
         goto err1;
 
-    if (device->isMt){
+    if (device->isMt)
+    {
         device->mtdev = mtdev_new_open(device->fd);
-        if  (!device->mtdev){
+        if (!device->mtdev)
+        {
             LOG_WARNING("WaylandEvdevInputEvent", "mtdev failed to open for " << path);
         }
     }
 
     eventLoop = wl_display_get_event_loop(display);
     device->source = wl_event_loop_add_fd(eventLoop, device->fd, WL_EVENT_READABLE,
-                                          WaylandEvdevInputEvent::handleInputEvent,
-                                          device);
-    if (device->source == NULL){
+                                            WaylandEvdevInputEvent::handleInputEvent,
+                                            device);
+    if (device->source == NULL)
+    {
         goto err2;
     }
 
@@ -763,58 +793,71 @@ WaylandEvdevInputEvent::configureDevice(struct evdev_input_device *device)
     device->caps = 0;
 
     ioctl(device->fd, EVIOCGBIT(0, sizeof(ev_bits)), ev_bits);
-    if (TEST_BIT(ev_bits, EV_ABS)){
+    if (TEST_BIT(ev_bits, EV_ABS))
+    {
         hasAbs = 1;
 
         ioctl(device->fd, EVIOCGBIT(EV_ABS, sizeof(abs_bits)), abs_bits);
-        if (TEST_BIT(abs_bits, ABS_X)){
+        if (TEST_BIT(abs_bits, ABS_X))
+        {
             ioctl(device->fd, EVIOCGABS(ABS_X), &absinfo);
             device->abs.min_x = absinfo.minimum;
             device->abs.max_x = absinfo.maximum;
             device->caps |= EVDEV_MOTION_ABS;
         }
-        if (TEST_BIT(abs_bits, ABS_Y)){
+        if (TEST_BIT(abs_bits, ABS_Y))
+        {
             ioctl(device->fd, EVIOCGABS(ABS_Y), &absinfo);
             device->abs.min_y = absinfo.minimum;
             device->abs.max_y = absinfo.maximum;
             device->caps |= EVDEV_MOTION_ABS;
         }
-        if (TEST_BIT(abs_bits, ABS_MT_SLOT)){
+        if (TEST_BIT(abs_bits, ABS_MT_SLOT))
+        {
             device->isMt = 1;
             device->mt.slot = 0;
             device->caps |= EVDEV_TOUCH;
         }
     }
-    if (TEST_BIT(ev_bits, EV_REL)){
+    if (TEST_BIT(ev_bits, EV_REL))
+    {
         ioctl(device->fd, EVIOCGBIT(EV_REL, sizeof(rel_bits)), rel_bits);
-        if (TEST_BIT(rel_bits, REL_X) || TEST_BIT(rel_bits, REL_Y)){
+        if (TEST_BIT(rel_bits, REL_X) || TEST_BIT(rel_bits, REL_Y))
+        {
             device->caps |= EVDEV_MOTION_REL;
         }
     }
-    if (TEST_BIT(ev_bits, EV_KEY)){
+    if (TEST_BIT(ev_bits, EV_KEY))
+    {
         hasKey = 1;
         ioctl(device->fd, EVIOCGBIT(EV_KEY, sizeof(key_bits)), key_bits);
         if (TEST_BIT(key_bits, BTN_TOOL_FINGER) &&
-            !TEST_BIT(key_bits, BTN_TOOL_PEN) && hasAbs){
+            !TEST_BIT(key_bits, BTN_TOOL_PEN) && hasAbs)
+        {
             device->dispatch = createTouchpad(device);
         }
 
-        for (i = KEY_ESC; i < KEY_MAX; ++i){
+        for (i = KEY_ESC; i < KEY_MAX; ++i)
+        {
             if (i >= BTN_MISC && i < KEY_OK)
                 continue;
-            if (TEST_BIT(key_bits, i)){
+            if (TEST_BIT(key_bits, i))
+            {
                 device->caps |= EVDEV_KEYBOARD;
                 break;
             }
         }
-        for (i = BTN_MISC; i < KEY_OK; ++i){
-            if (TEST_BIT(key_bits, i)){
+        for (i = BTN_MISC; i < KEY_OK; ++i)
+        {
+            if (TEST_BIT(key_bits, i))
+            {
                 device->caps |= EVDEV_BUTTON;
                 break;
             }
         }
     }
-    if (TEST_BIT(ev_bits, EV_LED)){
+    if (TEST_BIT(ev_bits, EV_LED))
+    {
         device->caps |= EVDEV_KEYBOARD;
     }
 
@@ -836,7 +879,8 @@ WaylandEvdevInputEvent::configureDevice(struct evdev_input_device *device)
             (device->caps & EVDEV_MOTION_ABS) ? "TRUE" : "FALSE",
             (device->caps & EVDEV_MOTION_REL) ? "TRUE" : "FALSE",
             (device->caps & EVDEV_TOUCH)      ? "TRUE" : "FALSE");
-    if (device->caps & EVDEV_MOTION_ABS){
+    if (device->caps & EVDEV_MOTION_ABS)
+    {
         fprintf(stdout, "        abs: min_x(%4d), min_y(%4d)\n", device->abs.min_x, device->abs.min_y);
         fprintf(stdout, "             max_x(%4d), max_y(%4d)\n", device->abs.max_x, device->abs.max_y);
         fprintf(stdout, "                 x(%4d),     y(%4d)\n", device->abs.x, device->abs.y);
@@ -844,13 +888,16 @@ WaylandEvdevInputEvent::configureDevice(struct evdev_input_device *device)
     fprintf(stdout, "\n");
 #endif
 
-    if ((device->caps & (EVDEV_MOTION_ABS | EVDEV_MOTION_REL | EVDEV_BUTTON))){
+    if ((device->caps & (EVDEV_MOTION_ABS | EVDEV_MOTION_REL | EVDEV_BUTTON)))
+    {
         initPointerDevice();
     }
-    if ((device->caps & (EVDEV_KEYBOARD))){
+    if ((device->caps & (EVDEV_KEYBOARD)))
+    {
         initKeyboardDevice(NULL);
     }
-    if ((device->caps & (EVDEV_TOUCH))){
+    if ((device->caps & (EVDEV_TOUCH)))
+    {
         initTouchDevice();
     }
 
@@ -868,23 +915,28 @@ WaylandEvdevInputEvent::notifyKeyboardFocus()
     int ret;
 
     memset(all_keys, 0, sizeof(all_keys));
-    wl_list_for_each(device, &m_deviceList, link){
+    wl_list_for_each(device, &m_deviceList, link)
+    {
         memset(evdev_keys, 0, sizeof(evdev_keys));
         ret = ioctl(device->fd, EVIOCGKEY(sizeof(evdev_keys)), evdev_keys);
-        if (ret < 0){
+        if (ret < 0)
+        {
             LOG_WARNING("WaylandEvdevInputEvent", "Failed to get keys for device: " <<
                         device->devnode);
             continue;
         }
-        for (i = 0; i < ARRAY_LENGTH(evdev_keys); ++i){
+        for (i = 0; i < ARRAY_LENGTH(evdev_keys); ++i)
+        {
             all_keys[i] |= evdev_keys[i];
         }
     }
 
     wl_array_init(&keys);
-    for (i = 0; i < KEY_CNT; ++i){
+    for (i = 0; i < KEY_CNT; ++i)
+    {
         set = all_keys[i >> 3] & (1 << (i & 7));
-        if (set){
+        if (set)
+        {
             k = (uint32_t*)wl_array_add(&keys, sizeof(*k));
             *k = i;
         }
@@ -897,15 +949,18 @@ WaylandEvdevInputEvent::notifyKeyboardFocus()
 
 void
 WaylandEvdevInputEvent::notifyKeyboardFocusIn(struct wl_array *keys,
-                                              enum key_state_update updateState)
+                                                enum key_state_update updateState)
 {
     struct wl_seat *wlSeat;
-    uint32_t *k, serial;
+    uint32_t *k;
+    uint32_t serial;
 
-    if ((wlSeat = m_inputDevice->seat()) == NULL){
+    if ((wlSeat = m_inputDevice->seat()) == NULL)
+    {
         return;
     }
-    if (!wlSeat->keyboard){
+    if (!wlSeat->keyboard)
+    {
         return;
     }
     serial = wl_display_next_serial(m_inputDevice->display());
@@ -915,8 +970,10 @@ WaylandEvdevInputEvent::notifyKeyboardFocusIn(struct wl_array *keys,
     struct wl_array *array = &wlSeat->keyboard->keys;
     for (k = (uint32_t*)array->data;
         (const char*)k < (const char*)array->data + array->size;
-        ++k){
-        if (updateState == STATE_UPDATE_AUTOMATIC){
+        ++k)
+    {
+        if (updateState == STATE_UPDATE_AUTOMATIC)
+        {
             updateModifierState(wlSeat, serial, *k, WL_KEYBOARD_KEY_STATE_PRESSED);
         }
     }
@@ -961,7 +1018,7 @@ WaylandEvdevInputEvent::createTouchpad(struct evdev_input_device *device)
 
 void
 WaylandEvdevInputEvent::configureTouchpad(struct touchpad_dispatch *touchpad,
-                                          struct evdev_input_device *device)
+                                            struct evdev_input_device *device)
 {
     struct motion_filter *accel;
 
@@ -977,11 +1034,12 @@ WaylandEvdevInputEvent::configureTouchpad(struct touchpad_dispatch *touchpad,
 
     // Configure pressure
     ioctl(device->fd, EVIOCGBIT(EV_ABS, sizeof(abs_bits)), abs_bits);
-    if (TEST_BIT(abs_bits, ABS_PRESSURE)) {
+    if (TEST_BIT(abs_bits, ABS_PRESSURE))
+    {
         ioctl(device->fd, EVIOCGABS(ABS_PRESSURE), &absinfo);
         configureTouchpadPressure(touchpad,
-                                  absinfo.minimum,
-                                  absinfo.maximum);
+                                absinfo.minimum,
+                                absinfo.maximum);
     }
 
     // Configure acceleration factor
@@ -1025,20 +1083,22 @@ WaylandEvdevInputEvent::handleInputEvent(int fd, uint32_t mask, void *data)
     struct input_event ev[32];
     int len;
     do {
-        if (device->mtdev){
+        if (device->mtdev)
+        {
             len = mtdev_get(device->mtdev, fd, ev,
                 ARRAY_LENGTH(ev)) * sizeof(struct input_event);
         }
-        else {
+        else
+        {
             len = read(fd, &ev, sizeof(ev));
         }
 
-        if (len < 0 || len % sizeof(ev[0]) != 0){
+        if (len < 0 || len % sizeof(ev[0]) != 0)
+        {
             return 1;
         }
 
         WaylandEvdevInputEvent::processEvents(device, ev, len / sizeof(ev[0]));
-
     } while (len > 0);
 
     return 1;
@@ -1046,8 +1106,8 @@ WaylandEvdevInputEvent::handleInputEvent(int fd, uint32_t mask, void *data)
 
 void
 WaylandEvdevInputEvent::processEvents(struct evdev_input_device *device,
-                                      struct input_event *ev,
-                                      int count)
+                                        struct input_event *ev,
+                                        int count)
 {
     struct evdev_dispatch *dispatch = device->dispatch;
     struct input_event *e, *end;
@@ -1057,10 +1117,12 @@ WaylandEvdevInputEvent::processEvents(struct evdev_input_device *device,
 
     e = ev;
     end = e + count;
-    for (; e < end; ++e){
+    for (; e < end; ++e)
+    {
         time = e->time.tv_sec * 1000 + e->time.tv_usec / 1000;
 
-        if (!isMotionEvent(e)){
+        if (!isMotionEvent(e))
+        {
             WaylandEvdevInputEvent::flushMotion(device, time);
         }
 
@@ -1081,40 +1143,46 @@ WaylandEvdevInputEvent::flushMotion(struct evdev_input_device *device,
     if (!inputEvent)
         return;
 
-    if (device->pending_events & EVDEV_RELATIVE_MOTION){
+    if (device->pending_events & EVDEV_RELATIVE_MOTION)
+    {
         struct wl_seat *wlSeat = inputEvent->inputDevice().seat();
-        if (wlSeat){
+        if (wlSeat)
+        {
             // notify_motion
             notifyMotion(device, time,
-                         wlSeat->pointer->x + device->rel.dx,
-                         wlSeat->pointer->y + device->rel.dy);
+                        wlSeat->pointer->x + device->rel.dx,
+                        wlSeat->pointer->y + device->rel.dy);
         }
         device->pending_events &= ~EVDEV_RELATIVE_MOTION;
         device->rel.dx = 0;
         device->rel.dy = 0;
     }
-    if (device->pending_events & EVDEV_ABSOLUTE_MT_DOWN){
+    if (device->pending_events & EVDEV_ABSOLUTE_MT_DOWN)
+    {
         // notify_touch
         notifyTouch(device);
         device->pending_events &= ~EVDEV_ABSOLUTE_MT_DOWN;
         device->pending_events &= ~EVDEV_ABSOLUTE_MT_MOTION;
     }
-    if (device->pending_events & EVDEV_ABSOLUTE_MT_MOTION){
+    if (device->pending_events & EVDEV_ABSOLUTE_MT_MOTION)
+    {
         // notify_touch
         notifyTouch(device);
         device->pending_events &= ~EVDEV_ABSOLUTE_MT_DOWN;
         device->pending_events &= ~EVDEV_ABSOLUTE_MT_MOTION;
     }
-    if (device->pending_events & EVDEV_ABSOLUTE_MT_UP){
+    if (device->pending_events & EVDEV_ABSOLUTE_MT_UP)
+    {
         // notify_touch
         notifyTouch(device);
         device->pending_events &= ~EVDEV_ABSOLUTE_MT_UP;
     }
-    if (device->pending_events & EVDEV_ABSOLUTE_MOTION){
+    if (device->pending_events & EVDEV_ABSOLUTE_MOTION)
+    {
         // notify_motion
         notifyMotion(device, time,
-                     wl_fixed_from_int(device->abs.x),
-                     wl_fixed_from_int(device->abs.y));
+                    wl_fixed_from_int(device->abs.x),
+                    wl_fixed_from_int(device->abs.y));
         device->pending_events &= ~EVDEV_ABSOLUTE_MOTION;
     }
 }
@@ -1129,7 +1197,8 @@ WaylandEvdevInputEvent::fallbackProcess(struct evdev_dispatch *dispatch,
 {
     WL_UNUSED(dispatch);
 
-    switch (e->type){
+    switch (e->type)
+    {
     case EV_REL:
         evdevProcessRelative(device, time, e);
         break;
@@ -1150,9 +1219,10 @@ WaylandEvdevInputEvent::fallbackDestroy(struct evdev_dispatch *dispatch)
 
 void
 WaylandEvdevInputEvent::evdevProcessRelative(struct evdev_input_device *device,
-                                             uint32_t /*time*/, struct input_event *e)
+                                            uint32_t /*time*/, struct input_event *e)
 {
-    switch (e->code){
+    switch (e->code)
+    {
     case REL_X:
         device->rel.dx += wl_fixed_from_int(e->value);
         device->pending_events |= EVDEV_RELATIVE_MOTION;
@@ -1179,9 +1249,12 @@ WaylandEvdevInputEvent::evdevProcessAbsolute(struct evdev_input_device *device,
     int w = inputEvent->m_screenWidth;
     int h = inputEvent->m_screenHeight;
 
-    if (device->isMt){
+    if (device->isMt)
+    {
         processTouch(device, e, w, h);
-    } else {
+    }
+    else
+    {
         processAbsoluteMotion(device, e, w, h);
     }
 }
@@ -1193,7 +1266,8 @@ WaylandEvdevInputEvent::evdevProcessKey(struct evdev_input_device *device,
     if (e->value == 2)
         return;
 
-    switch (e->code){
+    switch (e->code)
+    {
     case BTN_LEFT:
     case BTN_RIGHT:
     case BTN_MIDDLE:
@@ -1228,7 +1302,8 @@ WaylandEvdevInputEvent::touchpadProcess(struct evdev_dispatch *dispatch,
 {
     struct touchpad_dispatch *touchpad = (struct touchpad_dispatch*)dispatch;
 
-    switch (e->type){
+    switch (e->type)
+    {
     case EV_SYN:
         if (e->code == SYN_REPORT)
             touchpad->event_mask |= TOUCHPAD_EVENT_REPORT;
@@ -1251,7 +1326,8 @@ WaylandEvdevInputEvent::touchpadDestroy(struct evdev_dispatch *dispatch)
     struct motion_filter *filter;
     struct motion_filter *next;
 
-    wl_list_for_each_safe(filter, next, &touchpad->motion_filters, link){
+    wl_list_for_each_safe(filter, next, &touchpad->motion_filters, link)
+    {
         filter->interface->destroy(filter);
     }
 
@@ -1265,27 +1341,31 @@ WaylandEvdevInputEvent::touchpadProcessAbsolute(struct touchpad_dispatch *touchp
 {
     WL_UNUSED(device);
 
-    switch (e->code){
+    switch (e->code)
+    {
     case ABS_PRESSURE:
         if (e->value > touchpad->pressure.press)
             touchpad->state = TOUCHPAD_STATE_PRESS;
         else if (e->value > touchpad->pressure.touch_high)
             touchpad->state = TOUCHPAD_STATE_TOUCH;
-        else if (e->value < touchpad->pressure.touch_low){
+        else if (e->value < touchpad->pressure.touch_low)
+        {
             if (touchpad->state > TOUCHPAD_STATE_NONE)
                 touchpad->reset = 1;
             touchpad->state = TOUCHPAD_STATE_NONE;
         }
         break;
     case ABS_X:
-        if (touchpad->state >= TOUCHPAD_STATE_TOUCH){
+        if (touchpad->state >= TOUCHPAD_STATE_TOUCH)
+        {
             touchpad->hw_abs.x = e->value;
             touchpad->event_mask |= TOUCHPAD_EVENT_ABSOLUTE_ANY;
             touchpad->event_mask |= TOUCHPAD_EVENT_ABSOLUTE_X;
         }
         break;
     case ABS_Y:
-        if (touchpad->state >= TOUCHPAD_STATE_TOUCH){
+        if (touchpad->state >= TOUCHPAD_STATE_TOUCH)
+        {
             touchpad->hw_abs.y = e->value;
             touchpad->event_mask |= TOUCHPAD_EVENT_ABSOLUTE_ANY;
             touchpad->event_mask |= TOUCHPAD_EVENT_ABSOLUTE_Y;
@@ -1300,14 +1380,18 @@ WaylandEvdevInputEvent::touchpadProcessKey(struct touchpad_dispatch *touchpad,
                                            struct input_event *e,
                                            uint32_t time)
 {
-    switch (e->code){
+    switch (e->code)
+    {
     case BTN_TOUCH:
-        if (!touchpad->has_pressure){
-            if (!e->value){
+        if (!touchpad->has_pressure)
+        {
+            if (!e->value)
+            {
                 touchpad->state = TOUCHPAD_STATE_NONE;
                 touchpad->reset = 1;
             }
-            else {
+            else
+            {
                 touchpad->state = e->value ? TOUCHPAD_STATE_TOUCH
                                            : TOUCHPAD_STATE_NONE;
             }
@@ -1355,11 +1439,14 @@ WaylandEvdevInputEvent::touchpadUpdateState(struct touchpad_dispatch *touchpad,
                                             uint32_t time)
 {
     int motion_index;
-    int center_x, center_y;
-    double dx, dy;
+    int center_x;
+    int center_y;
+    double dx;
+    double dy;
 
     if (touchpad->reset ||
-        touchpad->last_finger_state != touchpad->finger_state) {
+        touchpad->last_finger_state != touchpad->finger_state)
+    {
         touchpad->reset = 0;
         touchpad->motion_count = 0;
         touchpad->event_mask = TOUCHPAD_EVENT_NONE;
@@ -1386,7 +1473,8 @@ WaylandEvdevInputEvent::touchpadUpdateState(struct touchpad_dispatch *touchpad,
 
     // Avoid noice by moving center only when delta reaches a threshold
     // distance from the old center
-    if (touchpad->motion_count > 0) {
+    if (touchpad->motion_count > 0)
+    {
         center_x = hysteresis(touchpad->hw_abs.x,
                       touchpad->hysteresis.center_x,
                       touchpad->hysteresis.margin_x);
@@ -1394,7 +1482,8 @@ WaylandEvdevInputEvent::touchpadUpdateState(struct touchpad_dispatch *touchpad,
                       touchpad->hysteresis.center_y,
                       touchpad->hysteresis.margin_y);
     }
-    else {
+    else
+    {
         center_x = touchpad->hw_abs.x;
         center_y = touchpad->hw_abs.y;
     }
@@ -1411,7 +1500,8 @@ WaylandEvdevInputEvent::touchpadUpdateState(struct touchpad_dispatch *touchpad,
     if (touchpad->motion_count < 4)
         touchpad->motion_count++;
 
-    if (touchpad->motion_count >= 4) {
+    if (touchpad->motion_count >= 4)
+    {
         touchpadGetDelta(touchpad, &dx, &dy);
 
         filterMotion(touchpad, &dx, &dy, time);
@@ -1440,8 +1530,10 @@ WaylandEvdevInputEvent::notifyButton(struct evdev_input_device *device,
     wlSeat = inputEvent->inputDevice().seat();
     serial = wl_display_next_serial(inputEvent->inputDevice().display());
 
-    if (state == WL_POINTER_BUTTON_STATE_PRESSED){
-        if (wlSeat->pointer->button_count == 0){
+    if (state == WL_POINTER_BUTTON_STATE_PRESSED)
+    {
+        if (wlSeat->pointer->button_count == 0)
+        {
             wlSeat->pointer->grab_button = button;
             wlSeat->pointer->grab_time = time;
             wlSeat->pointer->grab_x = wlSeat->pointer->x;
@@ -1449,7 +1541,8 @@ WaylandEvdevInputEvent::notifyButton(struct evdev_input_device *device,
         }
         ++wlSeat->pointer->button_count;
     }
-    else {
+    else
+    {
         --wlSeat->pointer->button_count;
     }
     wlEvent.x = wl_fixed_to_int(wlSeat->pointer->x);
@@ -1461,7 +1554,8 @@ WaylandEvdevInputEvent::notifyButton(struct evdev_input_device *device,
         state == WL_POINTER_BUTTON_STATE_PRESSED ? INPUT_STATE_PRESSED :
         INPUT_STATE_RELEASED, &wlEvent);
 
-    if (wlSeat->pointer->button_count == 1){
+    if (wlSeat->pointer->button_count == 1)
+    {
         wlSeat->pointer->grab_serial =
             wl_display_get_serial(inputEvent->inputDevice().display());
     }
@@ -1476,9 +1570,11 @@ WaylandEvdevInputEvent::notifyMotion(struct evdev_input_device *device,
 
     WLEvent         wlEvent;
     struct wl_seat *wlSeat = NULL;
-    int             x, y;
+    int             x;
+    int             y;
     //int             old_x, old_y;
-    int             w, h;
+    int             w;
+    int             h;
 
     WaylandEvdevInputEvent *inputEvent = static_cast<WaylandEvdevInputEvent*>(device->master);
     if (!inputEvent)
@@ -1517,21 +1613,25 @@ WaylandEvdevInputEvent::notifyKey(struct evdev_input_device *device,
 
     WLEvent wlEvent;
     struct wl_seat *wlSeat = NULL;
-    uint32_t *k, *end;
+    uint32_t *k;
+    uint32_t *end;
 
     WaylandEvdevInputEvent *inputEvent = static_cast<WaylandEvdevInputEvent*>(device->master);
     if (!inputEvent)
         return;
 
     wlSeat = inputEvent->inputDevice().seat();
-    if (state == WL_KEYBOARD_KEY_STATE_PRESSED){
+    if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
+    {
         wlSeat->keyboard->grab_key = key;
         wlSeat->keyboard->grab_time = time;
     }
 
     end = (uint32_t*)(((unsigned char*)wlSeat->keyboard->keys.data) + wlSeat->keyboard->keys.size);
-    for (k = (uint32_t*)wlSeat->keyboard->keys.data; k < end; ++k){
-        if (*k == key){
+    for (k = (uint32_t*)wlSeat->keyboard->keys.data; k < end; ++k)
+    {
+        if (*k == key)
+        {
             // Ignore server-generated repeats
             if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
                 return;
@@ -1539,7 +1639,8 @@ WaylandEvdevInputEvent::notifyKey(struct evdev_input_device *device,
         }
     }
     wlSeat->keyboard->keys.size = end - (uint32_t*)wlSeat->keyboard->keys.data;
-    if (state == WL_KEYBOARD_KEY_STATE_PRESSED){
+    if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
+    {
         k = (uint32_t*)wl_array_add(&wlSeat->keyboard->keys, sizeof(*k));
         *k = key;
     }
@@ -1562,28 +1663,32 @@ WaylandEvdevInputEvent::notifyTouch(struct evdev_input_device *device)
     if (!inputEvent)
         return;
 
-    if (device->pending_events & EVDEV_ABSOLUTE_MT_DOWN){
+    if (device->pending_events & EVDEV_ABSOLUTE_MT_DOWN)
+    {
         wlEvent.x = (int)wl_fixed_from_int(device->mt.x[device->mt.slot]);
         wlEvent.y = (int)wl_fixed_from_int(device->mt.y[device->mt.slot]);
         wlEvent.touchId = device->mt.slot;
         wlEvent.touchType = WL_TOUCH_DOWN;
         eventState = INPUT_STATE_PRESSED;
-    } else
-    if (device->pending_events & EVDEV_ABSOLUTE_MT_MOTION){
+    }
+    else if (device->pending_events & EVDEV_ABSOLUTE_MT_MOTION)
+    {
         wlEvent.x = (int)wl_fixed_from_int(device->mt.x[device->mt.slot]);
         wlEvent.y = (int)wl_fixed_from_int(device->mt.y[device->mt.slot]);
         wlEvent.touchId = device->mt.slot;
         wlEvent.touchType = WL_TOUCH_MOTION;
         eventState = INPUT_STATE_MOTION;
-    } else
-    if (device->pending_events & EVDEV_ABSOLUTE_MT_UP){
+    }
+    else if (device->pending_events & EVDEV_ABSOLUTE_MT_UP)
+    {
         wlEvent.x = 0;
         wlEvent.y = 0;
         wlEvent.touchId = device->mt.slot;
         wlEvent.touchType = WL_TOUCH_UP;
         eventState = INPUT_STATE_RELEASED;
     }
-    else {
+    else
+    {
         return;
     }
 
@@ -1593,26 +1698,30 @@ WaylandEvdevInputEvent::notifyTouch(struct evdev_input_device *device)
 void
 WaylandEvdevInputEvent::notifyModifiers(struct wl_seat *wlSeat, uint32_t serial)
 {
-    uint32_t mods_depressed, mods_latched, mods_locked, group;
+    uint32_t mods_depressed;
+    uint32_t mods_latched;
+    uint32_t mods_locked;
+    uint32_t group;
     uint32_t mods_lookup;
     int changed = 0;
 
     mods_depressed = xkb_state_serialize_mods(m_xkbState.state, (xkb_state_component)XKB_STATE_DEPRESSED);
-    mods_latched   = xkb_state_serialize_mods(m_xkbState.state, (xkb_state_component)XKB_STATE_LATCHED);
-    mods_locked    = xkb_state_serialize_mods(m_xkbState.state, (xkb_state_component)XKB_STATE_LOCKED);
-    group          = xkb_state_serialize_mods(m_xkbState.state, (xkb_state_component)XKB_STATE_EFFECTIVE);
+    mods_latched = xkb_state_serialize_mods(m_xkbState.state, (xkb_state_component)XKB_STATE_LATCHED);
+    mods_locked = xkb_state_serialize_mods(m_xkbState.state, (xkb_state_component)XKB_STATE_LOCKED);
+    group = xkb_state_serialize_mods(m_xkbState.state, (xkb_state_component)XKB_STATE_EFFECTIVE);
 
     if (mods_depressed != wlSeat->keyboard->modifiers.mods_depressed ||
-        mods_latched   != wlSeat->keyboard->modifiers.mods_latched   ||
-        mods_locked    != wlSeat->keyboard->modifiers.mods_locked    ||
-        group          != wlSeat->keyboard->modifiers.group){
+        mods_latched != wlSeat->keyboard->modifiers.mods_latched ||
+        mods_locked != wlSeat->keyboard->modifiers.mods_locked ||
+        group != wlSeat->keyboard->modifiers.group)
+    {
         changed = 1;
     }
 
     wlSeat->keyboard->modifiers.mods_depressed = mods_depressed;
-    wlSeat->keyboard->modifiers.mods_latched   = mods_latched;
-    wlSeat->keyboard->modifiers.mods_locked    = mods_locked;
-    wlSeat->keyboard->modifiers.group          = group;
+    wlSeat->keyboard->modifiers.mods_latched = mods_latched;
+    wlSeat->keyboard->modifiers.mods_locked = mods_locked;
+    wlSeat->keyboard->modifiers.group = group;
 
     // And update the modifier_state for bindings
     mods_lookup = mods_depressed | mods_latched;
@@ -1622,7 +1731,8 @@ WaylandEvdevInputEvent::notifyModifiers(struct wl_seat *wlSeat, uint32_t serial)
     if (mods_lookup & (1 << m_xkbInfo.super_mod)) m_modifierState |= MODIFIER_SUPER;
     if (mods_lookup & (1 << m_xkbInfo.shift_mod)) m_modifierState |= MODIFIER_SHIFT;
 
-    if (changed){
+    if (changed)
+    {
         m_inputDevice->sendModifiers(serial);
     }
 }
index 0fd1c75..0f850d7 100644 (file)
 #include <iomanip>
 #include "WindowSystems/WaylandEvdevInputEvent.h"
 
-WaylandFbdevWindowSystem::WaylandFbdevWindowSystem(const char* displayname, int width, int height, Scene* pScene, InputManager* pInputManager)
+WaylandFbdevWindowSystem::WaylandFbdevWindowSystem(const char* displayname,
+                                                    int width,
+                                                    int height,
+                                                    Scene* pScene,
+                                                    InputManager* pInputManager)
 : WaylandBaseWindowSystem(displayname, width, height, pScene, pInputManager)
 , m_fdFB(-1)
 {
index 281a42d..33d99e6 100644 (file)
@@ -40,7 +40,8 @@ static struct wl_resource*
 findResourceForClient(struct wl_list *list, struct wl_client *client)
 {
     struct wl_resource *r;
-    wl_list_for_each(r, list, link){
+    wl_list_for_each(r, list, link)
+    {
         if (r->client == client)
             return r;
     }
@@ -58,9 +59,9 @@ WaylandInputDevice::WaylandInputDevice(struct wl_display *display)
 {
     wl_seat_init(&m_wlSeat);
     wl_display_add_global(m_wlDisplay,
-                          &wl_seat_interface,
-                          this,
-                          WaylandInputDevice::bindInputDevice);
+                            &wl_seat_interface,
+                            this,
+                            WaylandInputDevice::bindInputDevice);
 }
 
 WaylandInputDevice::~WaylandInputDevice()
@@ -162,10 +163,12 @@ void
 WaylandInputDevice::destroyResource(struct wl_resource *resource)
 {
     WaylandInputDevice *inputDevice = static_cast<WaylandInputDevice*>(resource->data);
-    if (inputDevice->keyboardDevice()->focus_resource == resource){
+    if (inputDevice->keyboardDevice()->focus_resource == resource)
+    {
         inputDevice->keyboardDevice()->focus_resource = 0;
     }
-    if (inputDevice->pointerDevice()->focus_resource == resource){
+    if (inputDevice->pointerDevice()->focus_resource == resource)
+    {
         inputDevice->pointerDevice()->focus_resource = 0;
     }
 
@@ -299,10 +302,12 @@ WaylandInputDevice::sendKeyPressEvent(struct wl_surface* surface,
                                       uint32_t time, uint32_t code)
 {
     wl_keyboard *keyboard = keyboardDevice();
-    if (!keyboard->focus){
+    if (!keyboard->focus)
+    {
         setKeyboardFocus(surface);
     }
-    if (keyboard->focus_resource){
+    if (keyboard->focus_resource)
+    {
         uint32_t serial = wl_display_next_serial(m_wlDisplay);
         wl_keyboard_send_key(keyboard->focus_resource,
                              serial, time, code, 1);
@@ -314,10 +319,11 @@ WaylandInputDevice::sendKeyReleaseEvent(struct wl_surface* /*surface*/,
                                         uint32_t time, uint32_t code)
 {
     wl_keyboard *keyboard = keyboardDevice();
-    if (keyboard->focus_resource){
+    if (keyboard->focus_resource)
+    {
         uint32_t serial = wl_display_next_serial(m_wlDisplay);
         wl_keyboard_send_key(keyboard->focus_resource,
-                             serial, time, code, 0);
+                            serial, time, code, 0);
     }
 }
 
@@ -325,25 +331,30 @@ void
 WaylandInputDevice::sendTouchPointEvent(struct wl_surface* surface, uint32_t time,
                                         int touchId, int touchState, const Point& touchPos)
 {
-    switch (touchState){
+    switch (touchState)
+    {
     case WL_TOUCH_DOWN:
         ++m_nTp;
-        if (m_nTp == 1){
+        if (m_nTp == 1)
+        {
             setTouchFocus(surface);
         }
-        if (m_wlTouchFocusResource && m_wlTouchFocus){
+        if (m_wlTouchFocusResource && m_wlTouchFocus)
+        {
             wl_touch_send_down(m_wlTouchFocusResource,
-                               0 /*serial*/, time,
-                               &m_wlTouchFocus->resource, touchId,
-                               wl_fixed_from_double(touchPos.x),
-                               wl_fixed_from_double(touchPos.y));
+                                0 /*serial*/, time,
+                                &m_wlTouchFocus->resource, touchId,
+                                wl_fixed_from_double(touchPos.x),
+                                wl_fixed_from_double(touchPos.y));
         }
         break;
     case WL_TOUCH_MOTION:
-        if (!m_wlTouchFocus){
+        if (!m_wlTouchFocus)
+        {
             break;
         }
-        if (m_wlTouchFocusResource){
+        if (m_wlTouchFocusResource)
+        {
             wl_touch_send_motion(m_wlTouchFocusResource,
                                  time, touchId,
                                  wl_fixed_from_double(touchPos.x),
@@ -352,10 +363,12 @@ WaylandInputDevice::sendTouchPointEvent(struct wl_surface* surface, uint32_t tim
         break;
     case WL_TOUCH_UP:
         --m_nTp;
-        if (m_wlTouchFocusResource){
+        if (m_wlTouchFocusResource)
+        {
             wl_touch_send_up(m_wlTouchFocusResource, 0 /*serial*/, time, touchId);
         }
-        if (m_nTp == 0){
+        if (m_nTp == 0)
+        {
             setTouchFocus(NULL);
         }
         break;
@@ -367,7 +380,8 @@ WaylandInputDevice::sendTouchFrameEvent()
 {
     wl_touch *touch = touchDevice();
     wl_resource *resource = touch->focus_resource;
-    if (resource){
+    if (resource)
+    {
         wl_touch_send_frame(resource);
     }
 }
@@ -377,15 +391,16 @@ WaylandInputDevice::sendTouchCancelEvent()
 {
     wl_touch *touch = touchDevice();
     wl_resource *resource = touch->focus_resource;
-    if (resource){
+    if (resource)
+    {
         wl_touch_send_cancel(resource);
     }
 }
 
 void
 WaylandInputDevice::setMouseFocus(struct wl_surface* surface,
-                                  const Point& globalPos,
-                                  const Point& localPos)
+                                    const Point& globalPos,
+                                    const Point& localPos)
 {
     wl_pointer* pointer = pointerDevice();
     pointer->x = wl_fixed_from_double(globalPos.x);
@@ -413,16 +428,19 @@ WaylandInputDevice::setTouchFocus(struct wl_surface* surface)
     if (m_wlTouchFocus == surface)
         return;
 
-    if (surface){
+    if (surface)
+    {
         resource = findResourceForClient(&m_wlSeat.touch->resource_list,
-                                         surface->resource.client);
-        if (!resource){
+                                        surface->resource.client);
+        if (!resource)
+        {
             return;
         }
         m_wlSeat.touch->focus = surface;
         m_wlSeat.touch->focus_resource = resource;
     }
-    else {
+    else
+    {
         m_wlSeat.touch->focus = NULL;
         m_wlSeat.touch->focus_resource = NULL;
     }
@@ -434,8 +452,8 @@ WaylandInputDevice::sendModifiers(uint32_t serial)
     struct wl_keyboard *keyboard = keyboardDevice();
     struct wl_keyboard_grab *grab = keyboard->grab;
     grab->interface->modifiers(grab, serial,
-                               keyboard->modifiers.mods_depressed,
-                               keyboard->modifiers.mods_latched,
-                               keyboard->modifiers.mods_locked,
-                               keyboard->modifiers.group);
+                                keyboard->modifiers.mods_depressed,
+                                keyboard->modifiers.mods_latched,
+                                keyboard->modifiers.mods_locked,
+                                keyboard->modifiers.group);
 }
index 362e392..b3d2601 100644 (file)
@@ -71,12 +71,14 @@ createTmpFileCloexec(char *tmpname)
     int fd;
 #ifdef HAVE_MKOSTEMP
     fd = mkostemp(tmpname, O_CLOEXEC);
-    if (fd >= 0){
+    if (fd >= 0)
+    {
         unlink(tmpname);
     }
 #else
     fd = mkstemp(tmpname);
-    if (fd >= 0){
+    if (fd >= 0)
+    {
         fd = setCloexecOrClose(fd);
         unlink(tmpname);
     }
@@ -124,7 +126,8 @@ WaylandInputEvent::initInputEvent()
 {
     LOG_DEBUG("WaylandInputEvent", "initInputEvent IN");
     m_inputDevice = new WaylandInputDevice(m_windowSystem->getNativeDisplayHandle());
-    if (!m_inputDevice){
+    if (!m_inputDevice)
+    {
         LOG_ERROR("WaylandInputEvent", "Failed to create WaylandInputDevice");
         return;
     }
@@ -139,16 +142,18 @@ WaylandInputEvent::initInputEvent()
 void
 WaylandInputEvent::setupInputEvent()
 {
-    if (!m_xkbContext){
+    if (!m_xkbContext)
+    {
         m_xkbContext = xkb_context_new((enum xkb_context_flags)0);
-        if (!m_xkbContext){
+        if (!m_xkbContext)
+        {
             LOG_ERROR("WaylandInputEvent", "Failed to create XKB context");
             return;
         }
     }
 
-    m_xkbNames.rules  = strdup("evdev");
-    m_xkbNames.model  = strdup("pc105");
+    m_xkbNames.rules = strdup("evdev");
+    m_xkbNames.model = strdup("pc105");
     m_xkbNames.layout = strdup("us");
 }
 
@@ -166,15 +171,19 @@ WaylandInputEvent::initKeyboardDevice(struct xkb_keymap *keymap)
     if (m_inputDevice->hasKeyboard())
         return;
 
-    if (keymap){
+    if (keymap)
+    {
         m_xkbInfo.keymap = xkb_map_ref(keymap);
         createNewKeymap();
-    } else {
+    }
+    else
+    {
         buildGlobalKeymap();
     }
 
     m_xkbState.state = xkb_state_new(m_xkbInfo.keymap);
-    if (!m_xkbState.state){
+    if (!m_xkbState.state)
+    {
         LOG_ERROR("WaylandInputEvent", "Failed to initialize XKB state");
         return;
     }
@@ -199,12 +208,14 @@ WaylandInputEvent::createAnonymousFile(off_t size)
     int fd;
 
     path = getenv("XDG_RUNTIME_DIR");
-    if (!path){
+    if (!path)
+    {
         return -1;
     }
 
     name = (char*)malloc(strlen(path) + sizeof(temp));
-    if (!name){
+    if (!name)
+    {
         return -1;
     }
 
@@ -213,11 +224,13 @@ WaylandInputEvent::createAnonymousFile(off_t size)
     fd = createTmpFileCloexec(name);
 
     free(name);
-    if (fd < 0){
+    if (fd < 0)
+    {
         return -1;
     }
 
-    if (ftruncate(fd, size) < 0){
+    if (ftruncate(fd, size) < 0)
+    {
         close(fd);
         return -1;
     }
@@ -228,27 +241,29 @@ WaylandInputEvent::createAnonymousFile(off_t size)
 void
 WaylandInputEvent::createNewKeymap()
 {
-    m_xkbInfo.shift_mod  = xkb_map_mod_get_index(m_xkbInfo.keymap, XKB_MOD_NAME_SHIFT);
-    m_xkbInfo.caps_mod   = xkb_map_mod_get_index(m_xkbInfo.keymap, XKB_MOD_NAME_CAPS);
-    m_xkbInfo.ctrl_mod   = xkb_map_mod_get_index(m_xkbInfo.keymap, XKB_MOD_NAME_CTRL);
-    m_xkbInfo.alt_mod    = xkb_map_mod_get_index(m_xkbInfo.keymap, XKB_MOD_NAME_ALT);
-    m_xkbInfo.mod2_mod   = xkb_map_mod_get_index(m_xkbInfo.keymap, "Mod2");
-    m_xkbInfo.mod3_mod   = xkb_map_mod_get_index(m_xkbInfo.keymap, "Mod3");
-    m_xkbInfo.super_mod  = xkb_map_mod_get_index(m_xkbInfo.keymap, XKB_MOD_NAME_LOGO);
-    m_xkbInfo.mod5_mod   = xkb_map_mod_get_index(m_xkbInfo.keymap, "Mod5");
-    m_xkbInfo.num_led    = xkb_map_led_get_index(m_xkbInfo.keymap, XKB_LED_NAME_NUM);
-    m_xkbInfo.caps_led   = xkb_map_led_get_index(m_xkbInfo.keymap, XKB_LED_NAME_CAPS);
+    m_xkbInfo.shift_mod = xkb_map_mod_get_index(m_xkbInfo.keymap, XKB_MOD_NAME_SHIFT);
+    m_xkbInfo.caps_mod = xkb_map_mod_get_index(m_xkbInfo.keymap, XKB_MOD_NAME_CAPS);
+    m_xkbInfo.ctrl_mod = xkb_map_mod_get_index(m_xkbInfo.keymap, XKB_MOD_NAME_CTRL);
+    m_xkbInfo.alt_mod = xkb_map_mod_get_index(m_xkbInfo.keymap, XKB_MOD_NAME_ALT);
+    m_xkbInfo.mod2_mod = xkb_map_mod_get_index(m_xkbInfo.keymap, "Mod2");
+    m_xkbInfo.mod3_mod = xkb_map_mod_get_index(m_xkbInfo.keymap, "Mod3");
+    m_xkbInfo.super_mod = xkb_map_mod_get_index(m_xkbInfo.keymap, XKB_MOD_NAME_LOGO);
+    m_xkbInfo.mod5_mod = xkb_map_mod_get_index(m_xkbInfo.keymap, "Mod5");
+    m_xkbInfo.num_led = xkb_map_led_get_index(m_xkbInfo.keymap, XKB_LED_NAME_NUM);
+    m_xkbInfo.caps_led = xkb_map_led_get_index(m_xkbInfo.keymap, XKB_LED_NAME_CAPS);
     m_xkbInfo.scroll_led = xkb_map_led_get_index(m_xkbInfo.keymap, XKB_LED_NAME_SCROLL);
 
     char *keymapStr = xkb_map_get_as_string(m_xkbInfo.keymap);
-    if (keymapStr == NULL){
+    if (keymapStr == NULL)
+    {
         LOG_ERROR("WaylandX11InputEvent", "Failed to get string version of keymap");
         return;
     }
     m_xkbInfo.keymap_size = strlen(keymapStr) + 1;
 
     m_xkbInfo.keymap_fd = createAnonymousFile(m_xkbInfo.keymap_size);
-    if (m_xkbInfo.keymap_fd < 0){
+    if (m_xkbInfo.keymap_fd < 0)
+    {
         LOG_WARNING("WaylandX11InputEvent", "Creating a keymap file for " <<
                     (unsigned long)m_xkbInfo.keymap_size <<
                     " bytes failed");
@@ -261,7 +276,8 @@ WaylandInputEvent::createNewKeymap()
                                         MAP_SHARED,
                                         m_xkbInfo.keymap_fd,
                                         0);
-    if (m_xkbInfo.keymap_area == MAP_FAILED){
+    if (m_xkbInfo.keymap_area == MAP_FAILED)
+    {
         LOG_WARNING("WaylandX11InputEvent", "Failed to mmap() " <<
                     (unsigned long) m_xkbInfo.keymap_size <<
                     " bytes");
@@ -288,13 +304,14 @@ WaylandInputEvent::buildGlobalKeymap()
         return;
 
     m_xkbInfo.keymap = xkb_map_new_from_names(m_xkbContext,
-                                              &m_xkbNames,
-                                              static_cast<xkb_map_compile_flags>(0));
-    if (m_xkbInfo.keymap == NULL){
+                                                &m_xkbNames,
+                                                static_cast<xkb_map_compile_flags>(0));
+    if (m_xkbInfo.keymap == NULL)
+    {
         LOG_ERROR("WaylandInputEvent", "Failed to compile global XKB keymap");
         LOG_ERROR("WaylandInputEvent", "  tried rules: " << m_xkbNames.rules <<
-                                       ", model: "       << m_xkbNames.model <<
-                                       ", layout: "      << m_xkbNames.layout);
+                                        ", model: " << m_xkbNames.model <<
+                                        ", layout: " << m_xkbNames.layout);
         return;
     }
 
index e71cf87..0c46d09 100644 (file)
 #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
 
 static const struct wl_interface *types[] = {
-       NULL,
+    NULL,
 };
 
 static const struct wl_message serverinfo_requests[] = {
-       { "get_connection_id", "", types + 0 },
+    { "get_connection_id", "", types + 0 },
 };
 
 static const struct wl_message serverinfo_events[] = {
-       { "connection_id", "u", types + 0 },
+    { "connection_id", "u", types + 0 },
 };
 
 extern "C" WL_EXPORT const struct wl_interface serverinfo_interface = {
-       "serverinfo", 1,
-       ARRAY_LENGTH(serverinfo_requests), serverinfo_requests,
-       ARRAY_LENGTH(serverinfo_events), serverinfo_events,
+    "serverinfo", 1,
+    ARRAY_LENGTH(serverinfo_requests), serverinfo_requests,
+    ARRAY_LENGTH(serverinfo_events), serverinfo_events,
 };
 
index 7b30ae8..0f94ede 100644 (file)
 
 extern "C"
 {
-    static int
-    x11GetNextEvent(xcb_connection_t *conn, xcb_generic_event_t **event, uint32_t mask)
+static int
+x11GetNextEvent(xcb_connection_t *conn, xcb_generic_event_t **event, uint32_t mask)
+{
+    if (mask & WL_EVENT_READABLE)
+    {
+        *event = xcb_poll_for_event(conn);
+    }
+    else
     {
-        if (mask & WL_EVENT_READABLE){
-            *event = xcb_poll_for_event(conn);
-        } else {
 #ifdef HAVE_XCB_POLL_FOR_QUEUED_EVENT
-            *event = xcb_poll_for_queued_event(conn);
+        *event = xcb_poll_for_queued_event(conn);
 #else
-            *event = xcb_poll_for_event(conn);
+        *event = xcb_poll_for_event(conn);
 #endif
-        }
-        return *event != NULL;
     }
+    return *event != NULL;
+}
 
-    static bool
-    getButtonEvent(xcb_generic_event_t *event, WLEvent *wlEvent, int /*state*/)
+static bool
+getButtonEvent(xcb_generic_event_t *event, WLEvent *wlEvent, int /*state*/)
+{
+    xcb_button_press_event_t *buttonEvent = (xcb_button_press_event_t*)event;
+    switch (buttonEvent->detail)
     {
-        xcb_button_press_event_t *buttonEvent = (xcb_button_press_event_t*)event;
-        switch (buttonEvent->detail){
-        default:
-            wlEvent->button = buttonEvent->detail + BTN_LEFT - 1;
-            break;
-        case 2:
-            wlEvent->button = BTN_MIDDLE;
-            break;
-        case 3:
-            wlEvent->button = BTN_RIGHT;
-            break;
-        case 4:
-        case 5:
-        case 6:
-        case 7:
-            return false;
-        }
-        return true;
+    default:
+        wlEvent->button = buttonEvent->detail + BTN_LEFT - 1;
+        break;
+    case 2:
+        wlEvent->button = BTN_MIDDLE;
+        break;
+    case 3:
+        wlEvent->button = BTN_RIGHT;
+        break;
+    case 4:
+    case 5:
+    case 6:
+    case 7:
+        return false;
     }
+    return true;
+}
 }
 
 /////////////////////////////////////////////////////////////////////////////
@@ -112,20 +116,23 @@ WaylandX11InputEvent::setupInputEvent()
 
     WaylandX11WindowSystem* x11WindowSystem
         = dynamic_cast<WaylandX11WindowSystem*>(m_windowSystem);
-    if (!x11WindowSystem){
+    if (!x11WindowSystem)
+    {
         LOG_ERROR("WaylandX11InputEvent", "Invalid window system");
         return;
     }
 
     m_x11Display = x11WindowSystem->x11Display();
-    if (!m_x11Display){
+    if (!m_x11Display)
+    {
         LOG_ERROR("WaylandX11InputEvent", "ERROR: WindowSystem has not x11 display");
         return;
     }
 
     m_xcbConn = XGetXCBConnection(m_x11Display);
     XSetEventQueueOwner(m_x11Display, XCBOwnsEventQueue);
-    if (xcb_connection_has_error(m_xcbConn)){
+    if (xcb_connection_has_error(m_xcbConn))
+    {
         LOG_ERROR("WaylandX11InputEvent", "ERROR: xcb connection has error.");
         XCloseDisplay(m_x11Display);
         return;
@@ -136,22 +143,26 @@ WaylandX11InputEvent::setupInputEvent()
 
     // Get resources
     {
-        static const struct {
+        static const struct
+        {
             const char *name;
             int offset;
-        } atoms[] = {
-            { "STRING",           F(string)   },
+        }
+        atoms[] = {
+            { "STRING", F(string)   },
             { "_XKB_RULES_NAMES", F(xkbNames) }
         };
         xcb_intern_atom_cookie_t cookies[2];
         xcb_intern_atom_reply_t *reply;
         unsigned int i = 0;
-        for (i = 0; i < ARRAY_LENGTH(atoms); ++i){
+        for (i = 0; i < ARRAY_LENGTH(atoms); ++i)
+        {
             cookies[i] = xcb_intern_atom(m_xcbConn, 0,
                                          strlen(atoms[i].name),
                                          atoms[i].name);
         }
-        for (i = 0; i < ARRAY_LENGTH(atoms); ++i){
+        for (i = 0; i < ARRAY_LENGTH(atoms); ++i)
+        {
             reply = xcb_intern_atom_reply(m_xcbConn, cookies[i], NULL);
             *(xcb_atom_t*)((char *)(&m_atom) + atoms[i].offset) = reply->atom;
             free(reply);
@@ -165,7 +176,8 @@ WaylandX11InputEvent::setupInputEvent()
     setupXkb();
     struct xkb_keymap *keymap = getKeymap();
     initKeyboardDevice(keymap);
-    if (keymap){
+    if (keymap)
+    {
         xkb_map_unref(keymap);
     }
 
@@ -196,7 +208,8 @@ WaylandX11InputEvent::setupXkb()
     xcb_xkb_per_client_flags_reply_t *pcf_reply;
 
     ext = xcb_get_extension_data(m_xcbConn, &xcb_xkb_id);
-    if (!ext){
+    if (!ext)
+    {
         LOG_ERROR("WaylandX11InputEvent", "ERROR: XKB extension not available on "
                                           "host X11 server");
         return;
@@ -212,7 +225,8 @@ WaylandX11InputEvent::setupXkb()
                                    0,
                                    NULL);
     error = xcb_request_check(m_xcbConn, select);
-    if (error){
+    if (error)
+    {
         LOG_ERROR("WaylandX11InputEvent", "ERROR: Failed to select XKB state events");
         return;
     }
@@ -224,7 +238,8 @@ WaylandX11InputEvent::setupXkb()
                                    0, 0, 0);
     pcf_reply = xcb_xkb_per_client_flags_reply(m_xcbConn, pcf, &error);
     free(pcf_reply);
-    if (error){
+    if (error)
+    {
         LOG_ERROR("WaylandX11InputEvent", "ERROR: Failed to set XKB per-client flags, "
                                           "not using detectable repeat");
         return;
@@ -242,8 +257,10 @@ WaylandX11InputEvent::getKeymap()
     xcb_generic_error_t *error;
     struct xkb_rule_names names;
     struct xkb_keymap *ret;
-    char *value_all, *value_part;
-    int length_all, length_part;
+    char* value_all;
+    char* value_part;
+    int length_all;
+    int length_part;
 
     memset(&names, 0x00, sizeof(names));
 
@@ -254,12 +271,13 @@ WaylandX11InputEvent::getKeymap()
                               m_atom.string,
                               0, 1024);
     reply = xcb_get_property_reply(m_xcbConn, cookie, &error);
-    if (reply == NULL){
+    if (reply == NULL)
+    {
         LOG_ERROR("WaylandX11InputEvent", "ERROR: xcb_get_property_reply");
         return NULL;
     }
 
-    value_all  = static_cast<char*>(xcb_get_property_value(reply));
+    value_all = static_cast<char*>(xcb_get_property_value(reply));
     length_all = xcb_get_property_value_length(reply);
     value_part = value_all;
 
@@ -295,27 +313,33 @@ WaylandX11InputEvent::handleInputEvent(int /*fd*/, uint32_t mask, void *data)
     xcb_generic_event_t       *event;
     xcb_motion_notify_event_t *motionNotify;
     xcb_button_press_event_t  *buttonEvent;
-    xcb_key_press_event_t     *keyPress, *keyRelease;
+    xcb_key_press_event_t     *keyPress;
+    xcb_key_press_event_t     *keyRelease;
     InputDevice                deviceType = INPUT_DEVICE_POINTER;
-    InputEventState            state      = INPUT_STATE_MOTION;
+    InputEventState            state = INPUT_STATE_MOTION;
 
     int count = 0;
     xcb_generic_event_t *prev = NULL;
-    while (x11GetNextEvent(ins->connection(), &event, mask)){
-        switch (prev ? prev->response_type & ~0x80 : 0x80){
+    while (x11GetNextEvent(ins->connection(), &event, mask))
+    {
+        switch (prev ? prev->response_type & ~0x80 : 0x80)
+        {
         case XCB_KEY_RELEASE:
             keyRelease = (xcb_key_press_event_t*)prev;
             keyPress   = (xcb_key_press_event_t*)event;
             if ((event->response_type & ~0x80) == XCB_KEY_PRESS &&
                 keyRelease->time == keyPress->time &&
-                keyRelease->detail == keyPress->detail){
+                keyRelease->detail == keyPress->detail)
+            {
                 // Don't deliver the held key release event or
                 // the new key press even.
                 free(event);
                 free(prev);
                 prev = NULL;
                 continue;
-            } else {
+            }
+            else
+            {
                 free(prev);
                 prev = NULL;
                 break;
@@ -331,15 +355,16 @@ WaylandX11InputEvent::handleInputEvent(int /*fd*/, uint32_t mask, void *data)
 
         memset(&wlEvent, 0x00, sizeof(WLEvent));
 
-        switch (event->response_type & ~0x80){
+        switch (event->response_type & ~0x80)
+        {
         case XCB_KEY_PRESS:
             LOG_DEBUG("WaylandX11InputEvent", "[EVENT] XCB_KEY_PRESS");
             keyPress = (xcb_key_press_event_t *)event;
-            wlEvent.keyCode  = keyPress->detail - 8;
+            wlEvent.keyCode = keyPress->detail - 8;
             wlEvent.keyState = WL_KEYBOARD_KEY_STATE_PRESSED;
 
             deviceType = INPUT_DEVICE_KEYBOARD;
-            state      = INPUT_STATE_PRESSED;
+            state = INPUT_STATE_PRESSED;
             break;
         case XCB_KEY_RELEASE:
             LOG_DEBUG("WaylandX11InputEvent", "[EVENT] XCB_KEY_RELEASE");
@@ -348,11 +373,12 @@ WaylandX11InputEvent::handleInputEvent(int /*fd*/, uint32_t mask, void *data)
             wlEvent.keyState = WL_KEYBOARD_KEY_STATE_RELEASED;
 
             deviceType = INPUT_DEVICE_KEYBOARD;
-            state      = INPUT_STATE_RELEASED;
+            state = INPUT_STATE_RELEASED;
             break;
         case XCB_BUTTON_PRESS:
             LOG_DEBUG("WaylandX11InputEvent", "[EVENT] XCB_BUTTON_PRESS");
-            if (!getButtonEvent(event, &wlEvent, 1)){
+            if (!getButtonEvent(event, &wlEvent, 1))
+            {
                 continue; // not supported button event
             }
             buttonEvent = (xcb_button_press_event_t *)event;
@@ -361,11 +387,12 @@ WaylandX11InputEvent::handleInputEvent(int /*fd*/, uint32_t mask, void *data)
             wlEvent.buttonState = WL_POINTER_BUTTON_STATE_PRESSED;
 
             deviceType = INPUT_DEVICE_POINTER;
-            state      = INPUT_STATE_PRESSED;
+            state = INPUT_STATE_PRESSED;
             break;
         case XCB_BUTTON_RELEASE:
             LOG_DEBUG("WaylandX11InputEvent", "[EVENT] XCB_BUTTON_RELEASE");
-            if (!getButtonEvent(event, &wlEvent, 0)){
+            if (!getButtonEvent(event, &wlEvent, 0))
+            {
                 continue; // not suported button event
             }
             buttonEvent = (xcb_button_press_event_t *)event;
@@ -374,7 +401,7 @@ WaylandX11InputEvent::handleInputEvent(int /*fd*/, uint32_t mask, void *data)
             wlEvent.buttonState = WL_POINTER_BUTTON_STATE_RELEASED;
 
             deviceType = INPUT_DEVICE_POINTER;
-            state      = INPUT_STATE_RELEASED;
+            state = INPUT_STATE_RELEASED;
             break;
         case XCB_MOTION_NOTIFY:
             LOG_DEBUG("WaylandX11InputEvent", "[EVENT] XCB_MOTION_NOTIFY");
@@ -383,7 +410,7 @@ WaylandX11InputEvent::handleInputEvent(int /*fd*/, uint32_t mask, void *data)
             wlEvent.y = motionNotify->event_y;
 
             deviceType = INPUT_DEVICE_POINTER;
-            state      = INPUT_STATE_MOTION;
+            state = INPUT_STATE_MOTION;
             break;
         case XCB_EXPOSE:
         case XCB_ENTER_NOTIFY:
@@ -392,30 +419,34 @@ WaylandX11InputEvent::handleInputEvent(int /*fd*/, uint32_t mask, void *data)
         case XCB_FOCUS_OUT:
         default:
             LOG_DEBUG("WaylandX11InputEvent", "[EVENT] Not supported (" <<
-                      (event->response_type & ~0x80) << ")");
-            if (prev != event){
+                                                (event->response_type & ~0x80) << ")");
+            if (prev != event)
+            {
                 free(event);
             }
             continue;
         }
 
         ++count;
-        if (prev != event){
+        if (prev != event)
+        {
             free(event);
         }
     }
 
-    if (count == 0){
+    if (count == 0)
+    {
         goto rtn;
     }
 
-    switch (prev ? prev->response_type & ~0x80 : 0x80){
+    switch (prev ? prev->response_type & ~0x80 : 0x80)
+    {
     case XCB_KEY_RELEASE:
         keyRelease = (xcb_key_press_event_t*)prev;
-        wlEvent.keyCode  = keyRelease->detail - 8;
+        wlEvent.keyCode = keyRelease->detail - 8;
         wlEvent.keyState = WL_KEYBOARD_KEY_STATE_RELEASED;
         deviceType = INPUT_DEVICE_KEYBOARD;
-        state      = INPUT_STATE_RELEASED;
+        state = INPUT_STATE_RELEASED;
         free(prev);
         prev = NULL;
         break;
index 0f681da..9b95952 100644 (file)
@@ -75,9 +75,9 @@ bool WaylandX11WindowSystem::initGraphicSystem()
     //. TODO: should not be here. graphicSystem should support.
     EGLDisplay eglDisplayhandle = ((GLESGraphicsystem*)(graphicSystem))->getEGLDisplay();
     PFNEGLBINDWAYLANDDISPLAYWL eglBindWaylandDisplayWL = (PFNEGLBINDWAYLANDDISPLAYWL)eglGetProcAddress("eglBindWaylandDisplayWL");
-    if( eglBindWaylandDisplayWL != NULL )
+    if (eglBindWaylandDisplayWL != NULL)
     {
-        eglBindWaylandDisplayWL( eglDisplayhandle, m_wlDisplay );
+        eglBindWaylandDisplayWL(eglDisplayhandle, m_wlDisplay);
     }
     else
     {
index 076f731..060ba54 100644 (file)
@@ -39,7 +39,12 @@ int     X11WindowSystem::damage_opcode;
 const char X11WindowSystem::CompositorWindowTitle[] = "LayerManager";
 bool    X11WindowSystem::m_xerror = false;
 
-X11WindowSystem::X11WindowSystem(const char* displayname, int width, int height, Scene* pScene,InputManager* pInputManager,GetVisualInfoFunction func)
+X11WindowSystem::X11WindowSystem(const char* displayname,
+                                int width,
+                                int height,
+                                Scene* pScene,
+                                InputManager* pInputManager,
+                                GetVisualInfoFunction func)
 : BaseWindowSystem(pScene, pInputManager)
 , takeScreenshot(ScreenShotNone)
 , screenShotFile()
@@ -77,8 +82,8 @@ X11WindowSystem::X11WindowSystem(const char* displayname, int width, int height,
 
     // init and take mutex, so windowsystem only does init phase until mutex is released again
     pthread_mutex_init(&run_lock, NULL);
-    pthread_cond_init(&run_condition,NULL);
-    pthread_cond_init(&init_condition,NULL);
+    pthread_cond_init(&run_condition, NULL);
+    pthread_cond_init(&init_condition, NULL);
     pthread_mutex_init(&init_lock, NULL);
 }
 
@@ -96,7 +101,7 @@ XVisualInfo* X11WindowSystem::getDefaultVisual(Display *dpy)
     if (windowVis)
     {
         windowVis->depth = DefaultDepth(dpy, DefaultScreen(dpy));
-        if (!XMatchVisualInfo( dpy, 0, windowVis->depth, TrueColor, windowVis))
+        if (!XMatchVisualInfo(dpy, 0, windowVis->depth, TrueColor, windowVis))
         {
             LOG_ERROR("X11WindowSystem", "Error: Required visual not found\n");
             delete windowVis;
@@ -114,10 +119,10 @@ bool X11WindowSystem::OpenDisplayConnection()
 {
     m_displayEnvironment = getenv("DISPLAY");
 
-    if  (m_displayEnvironment == NULL )
+    if (m_displayEnvironment == NULL)
     {
         m_displayEnvironment = ":0.0";
-        setenv("DISPLAY",m_displayEnvironment,1);
+        setenv("DISPLAY", m_displayEnvironment, 1);
     }
 
     x11Display = XOpenDisplay(m_displayEnvironment);
@@ -132,33 +137,35 @@ bool X11WindowSystem::OpenDisplayConnection()
 
 bool X11WindowSystem::checkForCompositeExtension()
 {
-    if (x11Display == NULL || !XQueryExtension (x11Display, COMPOSITE_NAME, &composite_opcode, &composite_event, &composite_error))
+    if (x11Display == NULL || !XQueryExtension(x11Display, COMPOSITE_NAME, &composite_opcode, &composite_event, &composite_error))
     {
         LOG_ERROR("X11WindowSystem", "No composite extension");
         return false;
     }
-    XCompositeQueryVersion (x11Display, &composite_major, &composite_minor);
+    XCompositeQueryVersion(x11Display, &composite_major, &composite_minor);
     LOG_DEBUG("X11WindowSystem", "Found composite extension: composite opcode: " << composite_opcode);
     LOG_DEBUG("X11WindowSystem", "composite_major: " << composite_major);
     LOG_DEBUG("X11WindowSystem", "composite_minor: " << composite_minor);
     return true;
 }
 
-bool X11WindowSystem::checkForDamageExtension(){
-    if (x11Display == NULL || !XQueryExtension (x11Display, DAMAGE_NAME, &damage_opcode,
+bool X11WindowSystem::checkForDamageExtension()
+{
+    if (x11Display == NULL || !XQueryExtension(x11Display, DAMAGE_NAME, &damage_opcode,
                 &damage_event, &damage_error))
     {
         LOG_ERROR("X11WindowSystem", "No damage extension");
         return false;
     }
-    XDamageQueryVersion (x11Display, &damage_major, &damage_minor);
+    XDamageQueryVersion(x11Display, &damage_major, &damage_minor);
     LOG_DEBUG("X11WindowSystem", "Found damage extension: damage opcode: " << damage_opcode);
     LOG_DEBUG("X11WindowSystem", "damage_major: " << damage_major);
     LOG_DEBUG("X11WindowSystem", "damage_minor: " << damage_minor);
     return true;
 }
 
-void X11WindowSystem::printDebug(){
+void X11WindowSystem::printDebug()
+{
     // print stuff about layerlist
     std::stringstream debugmessage;
     debugmessage << "Layer:  ID |   X  |   Y  |   W  |   H  | Al. \n";
@@ -169,7 +176,7 @@ void X11WindowSystem::printDebug(){
     LayerListConstIterator iter = list.begin();
     LayerListConstIterator iterEnd = list.end();
 
-    for(; iter != iterEnd; ++iter)
+    for (; iter != iterEnd; ++iter)
     {
         Rectangle dest = (*iter)->getDestinationRegion();
         debugmessage << "            " << std::setw(4) << (*iter)->getID() << " " << std::setw(3) << dest.x << " " << std::setw(3) << dest.y << " " << std::setw(3) << dest.width << " " << std::setw(3) << dest.height << " " << std::setw(3) << (*iter)->opacity << "\n";
@@ -181,37 +188,38 @@ void X11WindowSystem::printDebug(){
         SurfaceListIterator surfaceIter = surfaceList.begin();
         SurfaceListIterator surfaceIterEnd = surfaceList.end();
 
-        for(; surfaceIter != surfaceIterEnd ; ++surfaceIter)
+        for (; surfaceIter != surfaceIterEnd; ++surfaceIter)
         {
             Rectangle src = (*surfaceIter)->getSourceRegion();
             Rectangle dest = (*surfaceIter)->getDestinationRegion();
-            debugmessage << "                        " << std::setw(4) << (*surfaceIter)->getID() << " " << std::setprecision(3) << (*surfaceIter)->opacity<< " " << std::setw(3) << src.x << " " << std::setw(3) << src.y << " " << std::setw(3) << src.width << " " << std::setw(3) << src.height << " " << std::setw(3) << dest.x << " " << std::setw(3) << dest.y << " " << std::setw(3) << dest.width << " " << std::setw(3) << dest.height  << "\n";
+            debugmessage << "                        " << std::setw(4) << (*surfaceIter)->getID() << " " << std::setprecision(3) << (*surfaceIter)->opacity << " " << std::setw(3) << src.x << " " << std::setw(3) << src.y << " " << std::setw(3) << src.width << " " << std::setw(3) << src.height << " " << std::setw(3) << dest.x << " " << std::setw(3) << dest.y << " " << std::setw(3) << dest.width << " " << std::setw(3) << dest.height << "\n";
         }
     }
-    LOG_DEBUG("X11WindowSystem",debugmessage.str());
+    LOG_DEBUG("X11WindowSystem", debugmessage.str());
 }
 
-Window * getListOfAllTopLevelWindows (Display *disp, unsigned int *len)
+Window * getListOfAllTopLevelWindows(Display *disp, unsigned int *len)
 {
     LOG_DEBUG("X11WindowSystem", "Getting list of all windows");
     Window *children;
-    Window    root_return, parent_return;
-    Window  root = XDefaultRootWindow(disp);
-    XQueryTree (disp, root, &root_return, &parent_return, &children, len);
+    Window root_return;
+    Window parent_return;
+    Window root = XDefaultRootWindow(disp);
+    XQueryTree(disp, root, &root_return, &parent_return, &children, len);
     return children;
 }
 
 bool X11WindowSystem::isWindowValid(Window w)
 {
     // skip our own two windows
-    return (w!=None && w != CompositorWindow);
+    return (w != None && w != CompositorWindow);
 }
 
 Surface* X11WindowSystem::getSurfaceForWindow(Window w)
 {
     // go though all surfaces
-    const std::map<unsigned int,Surface*> surfaces = m_pScene->getAllSurfaces();
-    for(std::map<unsigned int, Surface*>::const_iterator currentS = surfaces.begin(); currentS != surfaces.end(); ++currentS)
+    const std::map<unsigned int, Surface*> surfaces = m_pScene->getAllSurfaces();
+    for (std::map<unsigned int, Surface*>::const_iterator currentS = surfaces.begin(); currentS != surfaces.end(); ++currentS)
     {
         Surface* currentSurface = (*currentS).second;
         if (!currentSurface)
@@ -220,7 +228,7 @@ Surface* X11WindowSystem::getSurfaceForWindow(Window w)
         }
         if (currentSurface->getNativeContent() == static_cast<int>(w))
         {
-                return currentSurface;
+            return currentSurface;
         }
     }
     LOG_DEBUG("X11WindowSystem", "could not find surface for window " << w);
@@ -231,10 +239,10 @@ void X11WindowSystem::checkForNewSurfaceNativeContent()
 {
     m_pScene->lockScene();
     LayerList layers = m_pScene->getCurrentRenderOrder(0);
-    for(LayerListConstIterator current = layers.begin(); current != layers.end(); current++)
+    for (LayerListConstIterator current = layers.begin(); current != layers.end(); current++)
     {
         SurfaceList surfaces = (*current)->getAllSurfaces();
-        for(SurfaceListConstIterator currentS = surfaces.begin(); currentS != surfaces.end(); currentS++)
+        for (SurfaceListConstIterator currentS = surfaces.begin(); currentS != surfaces.end(); currentS++)
         {
             if ((*currentS)->hasNativeContent())
             {
@@ -257,14 +265,14 @@ void X11WindowSystem::configureSurfaceWindow(Window window)
         UnMapWindow(window);
         MapWindow(window);
         XWindowAttributes att;
-        XGetWindowAttributes (x11Display, window, &att);
+        XGetWindowAttributes(x11Display, window, &att);
         int winWidth = att.width;
         int winHeight = att.height;
 
         Surface* surface = getSurfaceForWindow(window);
         if (!surface)
         {
-             LOG_WARNING("X11WindowSystem", "Could not find surface for window " << window);
+            LOG_WARNING("X11WindowSystem", "Could not find surface for window " << window);
             return;
         }
         if (!surface->platform)
@@ -284,15 +292,15 @@ void X11WindowSystem::configureSurfaceWindow(Window window)
 
 void X11WindowSystem::MapWindow(Window window)
 {
-    LOG_DEBUG("X11WindowSystem","Map window begin");
+    LOG_DEBUG("X11WindowSystem", "Map window begin");
     if (isWindowValid(window))
     {
         XWindowAttributes att;
-        XGetWindowAttributes (x11Display, window, &att);
+        XGetWindowAttributes(x11Display, window, &att);
 /*      LOG_DEBUG("X11WindowSystem", "XCompositeRedirectWindow()");
         XCompositeRedirectWindow(x11Display, window, CompositeRedirectManual);
         XSync(x11Display, 0);*/
-        if (att.map_state == IsViewable && att.override_redirect==0)
+        if (att.map_state == IsViewable && att.override_redirect == 0)
         {
             LOG_DEBUG("X11WindowSystem", "Mapping surface to window " << window);
             Surface* surface = getSurfaceForWindow(window);
@@ -315,7 +323,6 @@ void X11WindowSystem::MapWindow(Window window)
             }
             x11surf->isMapped = true;
 
-
             LOG_DEBUG("X11WindowSystem", "getting pixmap for window");
             LOG_DEBUG("X11WindowSystem", "window width: " << att.width);
             LOG_DEBUG("X11WindowSystem", "window height: " << att.height);
@@ -342,7 +349,7 @@ void X11WindowSystem::MapWindow(Window window)
             LOG_DEBUG("X11WindowSystem", "Mapping successfull");
         }
     }
-    LOG_DEBUG("X11WindowSystem","Map window end");
+    LOG_DEBUG("X11WindowSystem", "Map window end");
 }
 
 void X11WindowSystem::UnMapWindow(Window window)
@@ -351,7 +358,7 @@ void X11WindowSystem::UnMapWindow(Window window)
     if (isWindowValid(window))
     {
         LOG_DEBUG("X11WindowSystem", "Unmapping surface from window " << window);
-        Surface* surface = getSurfaceForWindow(window);        
+        Surface* surface = getSurfaceForWindow(window);
         if (!surface)
         {
             LOG_WARNING("X11WindowSystem", "Could not unmap window " << window);
@@ -372,7 +379,6 @@ void X11WindowSystem::UnMapWindow(Window window)
         }
         x11surf->isMapped = false;
 
-
         LOG_DEBUG("X11WindowSystem", "Destroying ClientBuffer");
         graphicSystem->getTextureBinder()->destroyClientBuffer(surface);
         XSync(x11Display, 0);
@@ -396,7 +402,7 @@ void X11WindowSystem::NewWindow(Surface* surface, Window window)
         LOG_DEBUG("X11WindowSystem", "Creating Surface for new window " << window);
         // get the windows attributes
         XWindowAttributes att;
-        int status = XGetWindowAttributes (x11Display, window, &att);
+        int status = XGetWindowAttributes(x11Display, window, &att);
         LOG_DEBUG("X11WindowSystem", "Got window attrbutes");
         char* name;
         status = XFetchName(x11Display, window, &name);
@@ -405,10 +411,10 @@ void X11WindowSystem::NewWindow(Surface* surface, Window window)
         {
             LOG_DEBUG("X11WindowSystem", "Found window: " << window << " " << name);
             char GuiTitle[]  = "Layermanager Remote GUI\0";
-            if (strcmp(name,GuiTitle)==0)
+            if (strcmp(name, GuiTitle) == 0)
             {
                 LOG_DEBUG("X11WindowSystem", "Found gui window: repositioning it");
-                XCompositeUnredirectWindow(x11Display,window,CompositeRedirectManual);
+                XCompositeUnredirectWindow(x11Display, window, CompositeRedirectManual);
                 XMoveWindow(x11Display, window, 50, 500);
                 XMapRaised(x11Display, window);
             }
@@ -420,12 +426,12 @@ void X11WindowSystem::NewWindow(Surface* surface, Window window)
 
         if (att.c_class == InputOutput)
         {
-            LOG_DEBUG("X11WindowSystem","Creating New Damage for window - " << window);
-            XDamageCreate(x11Display,window,XDamageReportNonEmpty);
+            LOG_DEBUG("X11WindowSystem", "Creating New Damage for window - " << window);
+            XDamageCreate(x11Display, window, XDamageReportNonEmpty);
         }
 
         XFree(name);
-        XLowerWindow(x11Display,window);
+        XLowerWindow(x11Display, window);
 
         surface->setNativeContent(window);
         XPlatformSurface * platformSurface = (XPlatformSurface*)graphicSystem->getTextureBinder()->createPlatformSurface(surface);
@@ -456,7 +462,7 @@ void X11WindowSystem::DestroyWindow(Window window)
     if (isWindowValid(window))
     {
         LOG_DEBUG("X11WindowSystem", "Destroying Surface for window " << window);
-        Surface* surface = getSurfaceForWindow(window);        
+        Surface* surface = getSurfaceForWindow(window);
         if (!surface)
         {
             LOG_WARNING("X11WindowSystem", "Could not find surface for window " << window);
@@ -479,8 +485,8 @@ bool X11WindowSystem::CreatePixmapsForAllWindows()
     bool result = true;
     LOG_DEBUG("X11WindowSystem", "redirecting all windows");
     Window root = RootWindow(x11Display, DefaultScreen(x11Display));
-    XCompositeRedirectSubwindows(x11Display,root,CompositeRedirectManual);
-    XSync(x11Display,0);
+    XCompositeRedirectSubwindows(x11Display, root, CompositeRedirectManual);
+    XSync(x11Display, 0);
     return result;
 }
 
@@ -496,7 +502,7 @@ bool X11WindowSystem::CreateCompositorWindow()
     XSetWindowAttributes attr;
     // draw a black background the full size of the resolution
     attr.override_redirect = True;
-    attr.event_mask =     ExposureMask
+    attr.event_mask = ExposureMask
                         | StructureNotifyMask
                         | ButtonPressMask
                         | ButtonReleaseMask
@@ -513,8 +519,8 @@ bool X11WindowSystem::CreateCompositorWindow()
     attr.colormap = XCreateColormap(x11Display, root, windowVis->visual, AllocNone);
     attr.override_redirect = True;
 
-    Window compManager = XGetSelectionOwner(x11Display,XInternAtom(x11Display,"_NET_WM_CM_S0",0));
-    if ( None != compManager )
+    Window compManager = XGetSelectionOwner(x11Display, XInternAtom(x11Display, "_NET_WM_CM_S0", 0));
+    if (None != compManager)
     {
         LOG_ERROR("X11WindowSystem", "Could not create compositor window, annother compisite manager is already running");
         return false;
@@ -531,7 +537,7 @@ bool X11WindowSystem::CreateCompositorWindow()
     }
 
     LOG_DEBUG("X11WindowSystem", "Created the Compositor Window");
-    XSelectInput (x11Display, root,
+    XSelectInput(x11Display, root,
             SubstructureNotifyMask|
             ExposureMask|
             StructureNotifyMask|
@@ -539,7 +545,7 @@ bool X11WindowSystem::CreateCompositorWindow()
 
     LOG_DEBUG("X11WindowSystem", "Created the window");
     XSizeHints sizehints;
-    sizehints.width  = windowWidth;
+    sizehints.width = windowWidth;
     sizehints.height = windowHeight;
     sizehints.flags = USSize;
     XSetNormalHints(x11Display, CompositorWindow, &sizehints);
@@ -557,17 +563,17 @@ static struct timeval tv0;
 static int Frame = 0;
 
 
-void X11WindowSystem::calculateSurfaceFps(Surface *currentSurface, float time ) 
+void X11WindowSystem::calculateSurfaceFps(Surface *currentSurface, float time)
 {
-        char floatStringBuffer[256];
-        float surfaceUpdateFps = ((float)(currentSurface->updateCounter)) / time ;
-        float surfaceDrawFps = ((float)(currentSurface->drawCounter)) / time ;
-        sprintf(floatStringBuffer, "0x%08x update fps: %3.2f", currentSurface->getID(),surfaceUpdateFps);
-        currentSurface->updateCounter = 0;      
-        LOG_INFO("X11WindowSystem", "Surface " << floatStringBuffer);        
-        sprintf(floatStringBuffer, "0x%08x draw fps: %3.2f", currentSurface->getID(),surfaceDrawFps);
-        currentSurface->drawCounter = 0;        
-        LOG_INFO("X11WindowSystem", "Surface " << floatStringBuffer);
+    char floatStringBuffer[256];
+    float surfaceUpdateFps = ((float)(currentSurface->updateCounter)) / time;
+    float surfaceDrawFps = ((float)(currentSurface->drawCounter)) / time;
+    sprintf(floatStringBuffer, "0x%08x update fps: %3.2f", currentSurface->getID(), surfaceUpdateFps);
+    currentSurface->updateCounter = 0;
+    LOG_INFO("X11WindowSystem", "Surface " << floatStringBuffer);
+    sprintf(floatStringBuffer, "0x%08x draw fps: %3.2f", currentSurface->getID(), surfaceDrawFps);
+    currentSurface->drawCounter = 0;
+    LOG_INFO("X11WindowSystem", "Surface " << floatStringBuffer);
 }
 
 void X11WindowSystem::calculateFps()
@@ -584,14 +590,14 @@ void X11WindowSystem::calculateFps()
         FPS = ((float)(Frame)) / timeSinceLastCalc;
         char floatStringBuffer[256];
         sprintf(floatStringBuffer, "Overall fps: %f", FPS);
-        for(std::list<Layer*>::const_iterator current = layers.begin(); current != layers.end(); current++)
+        for (std::list<Layer*>::const_iterator current = layers.begin(); current != layers.end(); current++)
         {
             SurfaceList surfaceList = (*current)->getAllSurfaces();
             SurfaceListIterator surfaceIter = surfaceList.begin();
             SurfaceListIterator surfaceIterEnd = surfaceList.end();
-            for(; surfaceIter != surfaceIterEnd ; ++surfaceIter)
+            for (; surfaceIter != surfaceIterEnd; ++surfaceIter)
             {
-                calculateSurfaceFps((*surfaceIter),timeSinceLastCalc);
+                calculateSurfaceFps((*surfaceIter), timeSinceLastCalc);
             }
         }
         LOG_INFO("X11WindowSystem", floatStringBuffer);
@@ -606,7 +612,7 @@ void X11WindowSystem::RedrawAllLayers(bool clear, bool swap)
     LayerList swLayers;
 
     // Refresh HW Layers, find SW Layers
-    for(LayerListConstIterator current = layers.begin(); current != layers.end(); current++)
+    for (LayerListConstIterator current = layers.begin(); current != layers.end(); current++)
     {
         if ((*current)->getLayerType() == Hardware)
         {
@@ -668,7 +674,7 @@ void X11WindowSystem::Screenshot()
         LOG_DEBUG("X11WindowSystem", "Taking screenshot");
         RedrawAllLayers(true, false);  // Do clear, Don't swap
     }
-    else if(takeScreenshot == ScreenshotOfLayer)
+    else if (takeScreenshot == ScreenshotOfLayer)
     {
         LOG_DEBUG("X11WindowSystem", "Taking screenshot of layer");
         Layer* layer = m_pScene->getLayer(screenShotLayerID);
@@ -678,7 +684,7 @@ void X11WindowSystem::Screenshot()
             graphicSystem->renderSWLayer(layer, true); // Do clear
         }
     }
-    else if(takeScreenshot == ScreenshotOfSurface)
+    else if (takeScreenshot == ScreenshotOfSurface)
     {
         LOG_DEBUG("X11WindowSystem", "Taking screenshot of surface");
         Layer* layer = m_pScene->getLayer(screenShotLayerID);
@@ -701,7 +707,7 @@ void X11WindowSystem::Screenshot()
 }
 
 int
-X11WindowSystem::error (Display *dpy, XErrorEvent *ev)
+X11WindowSystem::error(Display *dpy, XErrorEvent *ev)
 {
     const char* name = NULL;
     static char buffer[256];
@@ -714,10 +720,10 @@ X11WindowSystem::error (Display *dpy, XErrorEvent *ev)
     if (!name)
     {
         buffer[0] = '\0';
-        XGetErrorText (dpy, ev->error_code, buffer, sizeof (buffer));
+        XGetErrorText(dpy, ev->error_code, buffer, sizeof(buffer));
         name = buffer;
     }
-    name = (strlen (name) > 0) ? name : "unknown";
+    name = (strlen(name) > 0) ? name : "unknown";
     LOG_ERROR("X11WindowSystem", "X Error: " << (int)ev->error_code << " " << name << " request : " << (int)ev->request_code << " minor: " <<  (int)ev->minor_code << " serial: " << (int)ev->serial);
     m_xerror = true;
     return 0;
@@ -731,13 +737,13 @@ bool X11WindowSystem::initXServer()
     //setDisplayMode();
     if (!CreateCompositorWindow())
     {
-        LOG_ERROR("X11WindowSystem", "Compositor Window creation failed " );
+        LOG_ERROR("X11WindowSystem", "Compositor Window creation failed ");
         return false;
     }
 
     LOG_DEBUG("X11WindowSystem", "Compositor Window ID: " << CompositorWindow);
 
-    if ( CreatePixmapsForAllWindows() )
+    if (CreatePixmapsForAllWindows())
     {
             //unredirect our window
 #ifdef FULLSCREEN
@@ -745,7 +751,9 @@ bool X11WindowSystem::initXServer()
 #endif
         XCompositeUnredirectWindow(x11Display, CompositorWindow, CompositeRedirectManual);
         LOG_DEBUG("X11WindowSystem", "Initialised XServer connection complete");
-    } else {
+    }
+    else
+    {
         LOG_ERROR("X11WindowSystem", "Initialised XServer connection failed");
         result = false;
     }
@@ -759,7 +767,7 @@ bool X11WindowSystem::initXServer()
  */
 void * X11eventLoopCallback(void *ptr)
 {
-    X11WindowSystem *windowsys = static_cast<X11WindowSystem*>( (X11WindowSystem*) ptr);
+    X11WindowSystem *windowsys = static_cast<X11WindowSystem*>((X11WindowSystem*) ptr);
     return windowsys->EventLoop();
 }
 
@@ -776,19 +784,19 @@ void* X11WindowSystem::EventLoop()
     // init own stuff
     LOG_DEBUG("X11WindowSystem", "open display connection");
     status &= this->OpenDisplayConnection();
-    if ( status == false ) goto init_complete;
+    if (status == false) goto init_complete;
     LOG_DEBUG("X11WindowSystem", "check for composite extension");
     status &= this->checkForCompositeExtension();
-    if ( status == false ) goto init_complete;
+    if (status == false) goto init_complete;
     LOG_DEBUG("X11WindowSystem", "check for damage extension");
     status &= this->checkForDamageExtension();
-    if ( status == false ) goto init_complete;
+    if (status == false) goto init_complete;
     LOG_DEBUG("X11WindowSystem", "init xserver");
     status &= this->initXServer();
-    if ( status == false ) goto init_complete;
+    if (status == false) goto init_complete;
     LOG_INFO("X11WindowSystem", "XServer initialisation completed");
     LOG_DEBUG("X11WindowSystem", "Graphicsystem initialisation");
-    status &= this->graphicSystem->init(this->x11Display,this->CompositorWindow);
+    status &= this->graphicSystem->init(this->x11Display, this->CompositorWindow);
     LOG_DEBUG("X11WindowSystem", "Graphicsystem initialisation complete");
 init_complete:
     this->m_success = status;
@@ -796,7 +804,7 @@ init_complete:
     pthread_mutex_unlock(&this->init_lock);
     // Done with init, wait for lock to actually run (ie start/stop method called)
     LOG_DEBUG("X11WindowSystem", "Waiting for startup");
-    pthread_cond_wait(&this->run_condition,&this->run_lock);
+    pthread_cond_wait(&this->run_condition, &this->run_lock);
     pthread_mutex_unlock(&this->run_lock);
     LOG_DEBUG("X11WindowSystem", "Starting Event loop");
     Layer* defaultLayer = 0;
@@ -807,8 +815,8 @@ init_complete:
     {
         defaultLayer = this->m_pScene->createLayer(0, 0);
         defaultLayer->setOpacity(1.0);
-        defaultLayer->setDestinationRegion(Rectangle(0,0,this->resolutionWidth,this->resolutionHeight));
-        defaultLayer->setSourceRegion(Rectangle(0,0,this->resolutionWidth,this->resolutionHeight));
+        defaultLayer->setDestinationRegion(Rectangle(0, 0, this->resolutionWidth, this->resolutionHeight));
+        defaultLayer->setSourceRegion(Rectangle(0, 0, this->resolutionWidth, this->resolutionHeight));
         this->m_pScene->getCurrentRenderOrder(0).push_back(defaultLayer);
     }
     LOG_INFO("X11WindowSystem", "Enter render loop");
@@ -820,13 +828,13 @@ init_complete:
 
     while (this->m_running)
     {
-            XEvent event;
-            // blocking wait for event
-            XNextEvent(this->x11Display, &event);
-            this->m_pScene->lockScene();
-            switch (event.type)
-            {
-            case CreateNotify:
+        XEvent event;
+        // blocking wait for event
+        XNextEvent(this->x11Display, &event);
+        this->m_pScene->lockScene();
+        switch (event.type)
+        {
+        case CreateNotify:
             {
                 if (this->debugMode)
                 {
@@ -838,86 +846,87 @@ init_complete:
                 }
                 break;
             }
-            case ConfigureNotify:
-                LOG_DEBUG("X11WindowSystem", "Configure notify Event");
-                this->configureSurfaceWindow( event.xconfigure.window);
-                checkRedraw = true;
-                break;
-
-            case DestroyNotify:
-                LOG_DEBUG("X11WindowSystem", "Destroy  Event");
-                this->DestroyWindow(event.xdestroywindow.window);
-                checkRedraw = true;
-                break;
-            case Expose:
-                LOG_DEBUG("X11WindowSystem", "Expose Event");
-                checkRedraw = true;
-                break;
-            case MapNotify:
-                LOG_DEBUG("X11WindowSystem", "Map Event");
-                this->MapWindow(event.xmap.window);
-                checkRedraw = true;
-                break;
-            case UnmapNotify:
-                LOG_DEBUG("X11WindowSystem", "Unmap Event");
-                this->UnMapWindow(event.xunmap.window);
-                checkRedraw = true;
-                break;
-            case ReparentNotify:
-                LOG_DEBUG("X11WindowSystem", "Reparent Event");
-                //           if (event.xreparent.parent == root)
-                //               renderer->NewWindow(event.xreparent.window);
-                //           else
-                //               renderer->DestroyWindow(event.xreparent.window);
-                break;
+        case ConfigureNotify:
+            LOG_DEBUG("X11WindowSystem", "Configure notify Event");
+            this->configureSurfaceWindow(event.xconfigure.window);
+            checkRedraw = true;
+            break;
 
-            // Keyboard
-            case KeyPress:
-                ManageXInputEvent(INPUT_DEVICE_KEYBOARD, INPUT_STATE_PRESSED, &event);
-                break;
-            case KeyRelease:
-                 ManageXInputEvent(INPUT_DEVICE_KEYBOARD, INPUT_STATE_RELEASED, &event);
-                break;
+        case DestroyNotify:
+            LOG_DEBUG("X11WindowSystem", "Destroy  Event");
+            this->DestroyWindow(event.xdestroywindow.window);
+            checkRedraw = true;
+            break;
+        case Expose:
+            LOG_DEBUG("X11WindowSystem", "Expose Event");
+            checkRedraw = true;
+            break;
+        case MapNotify:
+            LOG_DEBUG("X11WindowSystem", "Map Event");
+            this->MapWindow(event.xmap.window);
+            checkRedraw = true;
+            break;
+        case UnmapNotify:
+            LOG_DEBUG("X11WindowSystem", "Unmap Event");
+            this->UnMapWindow(event.xunmap.window);
+            checkRedraw = true;
+            break;
+        case ReparentNotify:
+            LOG_DEBUG("X11WindowSystem", "Reparent Event");
+            //           if (event.xreparent.parent == root)
+            //               renderer->NewWindow(event.xreparent.window);
+            //           else
+            //               renderer->DestroyWindow(event.xreparent.window);
+            break;
 
-            // Pointer
-            case ButtonPress:
-                ManageXInputEvent(INPUT_DEVICE_POINTER, INPUT_STATE_PRESSED, &event);
-                break;
-            case ButtonRelease:
-                ManageXInputEvent(INPUT_DEVICE_POINTER, INPUT_STATE_RELEASED, &event);
-                break;
-            case MotionNotify:
-                ManageXInputEvent(INPUT_DEVICE_POINTER, INPUT_STATE_MOTION, &event);
-                break;
+        // Keyboard
+        case KeyPress:
+            ManageXInputEvent(INPUT_DEVICE_KEYBOARD, INPUT_STATE_PRESSED, &event);
+            break;
+        case KeyRelease:
+            ManageXInputEvent(INPUT_DEVICE_KEYBOARD, INPUT_STATE_RELEASED, &event);
+            break;
 
-            // Touch
-            // TODO. See @ref<X11WindowSystem-MultiTouch> at the end of this file
+        // Pointer
+        case ButtonPress:
+            ManageXInputEvent(INPUT_DEVICE_POINTER, INPUT_STATE_PRESSED, &event);
+            break;
+        case ButtonRelease:
+            ManageXInputEvent(INPUT_DEVICE_POINTER, INPUT_STATE_RELEASED, &event);
+            break;
+        case MotionNotify:
+            ManageXInputEvent(INPUT_DEVICE_POINTER, INPUT_STATE_MOTION, &event);
+            break;
 
+        // Touch
+        // TODO. See @ref<X11WindowSystem-MultiTouch> at the end of this file
 
-            default:
-                if (event.type == this->damage_event + XDamageNotify)
+        default:
+            if (event.type == this->damage_event + XDamageNotify)
+            {
+                XDamageSubtract(this->x11Display, ((XDamageNotifyEvent*)(&event))->damage, None, None);
+                Surface* currentSurface = this->getSurfaceForWindow(((XDamageNotifyEvent*)(&event))->drawable);
+                if (currentSurface == NULL)
+                {
+                    LOG_WARNING("X11WindowSystem", "Surface empty during damage notification");
+                    break;
+                }
+                else
                 {
-                    XDamageSubtract(this->x11Display, ((XDamageNotifyEvent*)(&event))->damage, None, None);
-                    Surface* currentSurface = this->getSurfaceForWindow(((XDamageNotifyEvent*)(&event))->drawable);
-                    if (currentSurface==NULL)
+                    if (currentSurface->platform != NULL)
                     {
-                        LOG_WARNING("X11WindowSystem", "Surface empty during damage notification");
-                        break;
-                    } else {
-                        if (currentSurface->platform != NULL) 
-                        {
-                            /* Enable Rendering for Surface, after damage Notification was send successfully */
-                            /* This will ensure, that the content is not dirty */
-                            ((XPlatformSurface *)(currentSurface->platform))->enableRendering();
-                        }
+                        /* Enable Rendering for Surface, after damage Notification was send successfully */
+                        /* This will ensure, that the content is not dirty */
+                        ((XPlatformSurface *)(currentSurface->platform))->enableRendering();
                     }
-                    currentSurface->damaged = true;
-                    currentSurface->updateCounter++;
-                    checkRedraw = true;
                 }
-                break;
+                currentSurface->damaged = true;
+                currentSurface->updateCounter++;
+                checkRedraw = true;
             }
-            this->m_pScene->unlockScene();
+            break;
+        }
+        this->m_pScene->unlockScene();
 
         if (this->m_systemState == REDRAW_STATE)
         {
@@ -934,7 +943,6 @@ init_complete:
                 this->checkForNewSurfaceNativeContent();
                 checkRedraw = true;
             }
-
         }
         else if (this->m_systemState == WAKEUP_STATE)
         {
@@ -960,12 +968,12 @@ init_complete:
 
 
 void X11WindowSystem::ManageXInputEvent(InputDevice type, InputEventState state, XEvent *pevent)
- {
+{
     Surface * surf;
 
     switch (type)
     {
-        case INPUT_DEVICE_KEYBOARD:
+    case INPUT_DEVICE_KEYBOARD:
         {
             surf = m_pInputManager->reportKeyboardEvent(state, ((XKeyEvent *) pevent)->keycode);
             if (surf != NULL)
@@ -976,7 +984,7 @@ void X11WindowSystem::ManageXInputEvent(InputDevice type, InputEventState state,
         }
         break;
 
-        case INPUT_DEVICE_POINTER:
+    case INPUT_DEVICE_POINTER:
         {
             Point p = {state, ((XButtonEvent*)pevent)->x, ((XButtonEvent*)pevent)->y};
             surf = m_pInputManager->reportPointerEvent(p);
@@ -990,25 +998,24 @@ void X11WindowSystem::ManageXInputEvent(InputDevice type, InputEventState state,
         }
         break;
 
-        case INPUT_DEVICE_TOUCH:
-            /* TODO */
-            break;
-
+    case INPUT_DEVICE_TOUCH:
+        /* TODO */
+        break;
 
-        default:
-        case INPUT_DEVICE_ALL:
-            break;
+    default:
+    case INPUT_DEVICE_ALL:
+        break;
     }
 }
 
 
 static Display* displaySignal = NULL;
 
-void X11WindowSystem::wakeUpRendererThread() 
+void X11WindowSystem::wakeUpRendererThread()
 {
     // send dummy expose event, to wake up blocking x11 event loop (XNextEvent)
     LOG_DEBUG("X11WindowSystem", "Sending dummy event to wake up renderer thread");
-    if (NULL == displaySignal )
+    if (NULL == displaySignal)
     {
         displaySignal = XOpenDisplay(m_displayEnvironment);
     }
@@ -1027,13 +1034,14 @@ void X11WindowSystem::signalRedrawEvent()
     this->wakeUpRendererThread();
 }
 
-void X11WindowSystem::cleanup(){
+void X11WindowSystem::cleanup()
+{
     LOG_DEBUG("X11WindowSystem", "Cleanup");
     if (None != CompositorWindow)
     {
         Window root = RootWindow(x11Display, DefaultScreen(x11Display));
-        XCompositeUnredirectSubwindows(x11Display,root,CompositeRedirectManual);
-        XDestroyWindow(x11Display,CompositorWindow);
+        XCompositeUnredirectSubwindows(x11Display, root, CompositeRedirectManual);
+        XDestroyWindow(x11Display, CompositorWindow);
     }
 
     if (windowVis)
@@ -1041,7 +1049,7 @@ void X11WindowSystem::cleanup(){
         delete windowVis;
     }
 
-    if ( NULL  != displaySignal )
+    if (NULL != displaySignal)
     {
         XCloseDisplay(displaySignal);
     }
@@ -1052,30 +1060,30 @@ void X11WindowSystem::cleanup(){
     pthread_mutex_unlock(&this->run_lock);
 }
 
-bool X11WindowSystem::init(BaseGraphicSystem<Display*,Window>* base)
+bool X11WindowSystem::init(BaseGraphicSystem<Display*, Window>* base)
 {
     XInitThreads();
     X11WindowSystem *renderer = this;
     graphicSystem = base;
-    LOG_INFO("X11WindowSystem","Initialization");    
+    LOG_INFO("X11WindowSystem", "Initialization");
     pthread_mutex_lock(&init_lock);
-    int status = pthread_create( &renderThread, NULL, X11eventLoopCallback, (void*) renderer);
-    if (0 != status )
+    int status = pthread_create(&renderThread, NULL, X11eventLoopCallback, (void*) renderer);
+    if (0 != status)
     {
         pthread_mutex_unlock(&init_lock);
         return false;
     }
     mThreadId = renderThread;
-    
-    pthread_cond_wait(&init_condition,&init_lock);
+
+    pthread_cond_wait(&init_condition, &init_lock);
 /*  while (!m_initialized)
     {
         usleep(1000); // TODO
         LOG_DEBUG("X11WindowSystem","Waiting start complete " << m_initialized);
-    } 
+    }
 */
     pthread_mutex_unlock(&init_lock);
-    LOG_INFO("X11WindowSystem","Initialization complete success :" << m_success);
+    LOG_INFO("X11WindowSystem", "Initialization complete success :" << m_success);
     return m_success;
 }
 
@@ -1085,12 +1093,14 @@ bool X11WindowSystem::start()
     pthread_mutex_lock(&this->run_lock);
     LOG_DEBUG("X11WindowSystem", "Startup");
     // let thread actually run
-    if ( m_xerror == false )
+    if (m_xerror == false)
     {
         this->m_running = true;
         pthread_cond_signal(&this->run_condition);
         pthread_mutex_unlock(&this->run_lock);
-    } else {
+    }
+    else
+    {
         this->m_running = false;
         pthread_cond_signal(&this->run_condition);
         pthread_mutex_unlock(&this->run_lock);
@@ -1101,37 +1111,37 @@ bool X11WindowSystem::start()
 
 void X11WindowSystem::stop()
 {
-    LOG_INFO("X11WindowSystem","Stopping..");
+    LOG_INFO("X11WindowSystem", "Stopping..");
     pthread_mutex_lock(&this->run_lock);
     this->m_running = false;
     // needed if start was never called, we wake up thread, so it can immediatly finish
     this->signalRedrawEvent();
     pthread_cond_signal(&this->run_condition);
     pthread_mutex_unlock(&this->run_lock);
-    pthread_join(renderThread,NULL);
+    pthread_join(renderThread, NULL);
 }
 
 void X11WindowSystem::allocatePlatformSurface(Surface* surface)
 {
-    LOG_DEBUG("X11WindowSystem","allocatePlatformSurface begin");
+    LOG_DEBUG("X11WindowSystem", "allocatePlatformSurface begin");
     XPlatformSurface* nativeSurface = (XPlatformSurface*)surface->platform;
     if (!nativeSurface)
     {
-        LOG_DEBUG("X11WindowSystem","creating native surface for new window");
+        LOG_DEBUG("X11WindowSystem", "creating native surface for new window");
         // this surface does not have a native platform surface attached yet!
         NewWindow(surface, surface->getNativeContent());
         MapWindow(surface->getNativeContent());
     }
-    LOG_DEBUG("X11WindowSystem","allocatePlatformSurface end");
+    LOG_DEBUG("X11WindowSystem", "allocatePlatformSurface end");
 }
 
 void X11WindowSystem::deallocatePlatformSurface(Surface* surface)
 {
-    LOG_DEBUG("X11WindowSystem","deallocatePlatformSurface begin");
+    LOG_DEBUG("X11WindowSystem", "deallocatePlatformSurface begin");
     XPlatformSurface* nativeSurface = (XPlatformSurface*)surface->platform;
     if (nativeSurface)
     {
-        LOG_DEBUG("X11WindowSystem","destroyingnative surface");
+        LOG_DEBUG("X11WindowSystem", "destroyingnative surface");
         graphicSystem->getTextureBinder()->destroyClientBuffer(surface);
 
         if (nativeSurface->pixmap)
@@ -1143,7 +1153,7 @@ void X11WindowSystem::deallocatePlatformSurface(Surface* surface)
         delete surface->platform;
         surface->platform = NULL;
     }
-    LOG_DEBUG("X11WindowSystem","deallocatePlatformSurface end");
+    LOG_DEBUG("X11WindowSystem", "deallocatePlatformSurface end");
 }
 
 void X11WindowSystem::doScreenShot(std::string fileName)
@@ -1180,7 +1190,8 @@ void X11WindowSystem::doScreenShotOfSurface(std::string fileName, const uint id,
  *         -> Via cmake ==> ?
  *         -> At runtime ==> http://who-t.blogspot.fr/2011/12/multitouch-in-x-getting-events.html
  *     - Register for XIDirectTouch. (No plan (yet?) to support XIDependentTouch)
- *     - Call m_pInputManager->reportTouchEvent() from ManageXInputEvent() to translate screen wide touch coordinates into surface wide coordinates
+ *     - Call m_pInputManager->reportTouchEvent() from ManageXInputEvent() to translate screen wide touch coordinates
+ *      into surface wide coordinates
  *     - Forward the event to the native handle of the surface returned by m_pInputManager->reportTouchEvent()
  *
  *   Further reading:
index 74b55e5..7b8b118 100644 (file)
@@ -49,12 +49,12 @@ bool X11GLXRenderer::start(int width, int height, const char* displayname)
     screenList.push_back(lmScreen);
 
     // create X11 windows, register as composite manager etc
-    m_pWindowSystem  = new X11WindowSystem(displayname, width, height, m_pScene, m_pInputManager, GLXGraphicsystem::GetMatchingVisual);
+    m_pWindowSystem = new X11WindowSystem(displayname, width, height, m_pScene, m_pInputManager, GLXGraphicsystem::GetMatchingVisual);
     m_pGraphicSystem = new GLXGraphicsystem(width, height);
     m_pGraphicSystem->setBaseWindowSystem(m_pWindowSystem);
 
     LOG_DEBUG("X11GLXRenderer", "init windowsystem");
-    if ( m_pWindowSystem->init(m_pGraphicSystem ) )
+    if (m_pWindowSystem->init(m_pGraphicSystem))
     {
         Display* x11Display = m_pWindowSystem->getNativeDisplayHandle();
         if (x11Display)
@@ -75,7 +75,7 @@ bool X11GLXRenderer::start(int width, int height, const char* displayname)
                     binder = new X11CopyGLX(x11Display);
                 }
 #endif // WITH_FORCE_COPY
-                if ( binder != NULL )
+                if (binder != NULL)
                 {
                     m_pGraphicSystem->setTextureBinder(binder);
                     result = m_pWindowSystem->start();
@@ -101,13 +101,14 @@ void X11GLXRenderer::doScreenShot(std::string fileToSave)
     m_pWindowSystem->doScreenShot(fileToSave);
 }
 
-void X11GLXRenderer::doScreenShotOfLayer(std::string fileToSave,uint id)
+void X11GLXRenderer::doScreenShotOfLayer(std::string fileToSave, uint id)
 {
-    m_pWindowSystem->doScreenShotOfLayer(fileToSave,id);
+    m_pWindowSystem->doScreenShotOfLayer(fileToSave, id);
 }
 
-void X11GLXRenderer::doScreenShotOfSurface(std::string fileToSave, uint id, uint layer_id){
-    m_pWindowSystem->doScreenShotOfSurface(fileToSave,id,layer_id);
+void X11GLXRenderer::doScreenShotOfSurface(std::string fileToSave, uint id, uint layer_id)
+{
+    m_pWindowSystem->doScreenShotOfSurface(fileToSave, id, layer_id);
 }
 
 uint X11GLXRenderer::getNumberOfHardwareLayers(uint screenID)
@@ -164,4 +165,4 @@ bool X11GLXRenderer::setOptimizationMode(OptimizationType id, OptimizationModeTy
     return m_pGraphicSystem->setOptimizationMode(id, (unsigned int)mode);
 }
 
-DECLARE_LAYERMANAGEMENT_PLUGIN(X11GLXRenderer)
\ No newline at end of file
+DECLARE_LAYERMANAGEMENT_PLUGIN(X11GLXRenderer)
index 73ba254..ff51e85 100644 (file)
@@ -17,8 +17,8 @@
 *
 ****************************************************************************/
 
-#ifndef DEBUGRENDERER_H_
-#define DEBUGRENDERER_H_
+#ifndef TEXTRENDERER_H_
+#define TEXTRENDERER_H_
 
 #include "LayerList.h"
 #include "BaseRenderer.h"
@@ -53,4 +53,4 @@ private:
     OptimizationModeType m_optimizationMode;
 };
 
-#endif /* DEBUGRENDERER_H_ */
+#endif /* TEXTRENDERER_H_ */
index 44b813b..4bf3ce6 100644 (file)
@@ -42,9 +42,9 @@ bool TextRenderer::start(int width, int height, const char* displayname)
     screenList.push_back(lmScreen);
 
     LOG_DEBUG("TextRenderer", "start("
-              << "width=" << width
-              << ", height=" << height
-              << ", displayname=" << displayname << ")");
+                << "width=" << width
+                << ", height=" << height
+                << ", displayname=" << displayname << ")");
     return true;
 }
 
@@ -61,24 +61,24 @@ TextRenderer::~TextRenderer()
 void TextRenderer::doScreenShot(std::string fileToSave)
 {
     LOG_DEBUG("TextRenderer", "doScreenShot("
-              << "fileToSave=" << fileToSave << ")");
+                << "fileToSave=" << fileToSave << ")");
     std::fstream file(fileToSave.c_str());
 }
 
-void TextRenderer::doScreenShotOfLayer(std::string fileToSave,uint id)
+void TextRenderer::doScreenShotOfLayer(std::string fileToSave, uint id)
 {
     LOG_DEBUG("TextRenderer", "doScreenShotOfLayer("
-              << "fileToSave=" << fileToSave
-              << ", id=" << id << ")");
+                << "fileToSave=" << fileToSave
+                << ", id=" << id << ")");
     std::fstream file(fileToSave.c_str());
 }
 
 void TextRenderer::doScreenShotOfSurface(std::string fileToSave, uint id, uint layer_id)
 {
     LOG_DEBUG("TextRenderer", "doScreenShotOfSurface("
-              << "fileToSave=" << fileToSave
-              << ", id=" << id
-              << ", layer_id=" << layer_id << ")");
+                << "fileToSave=" << fileToSave
+                << ", id=" << id
+                << ", layer_id=" << layer_id << ")");
     std::fstream file(fileToSave.c_str());
 }
 
@@ -126,8 +126,8 @@ void TextRenderer::forceCompositionWindowSystem()
 bool TextRenderer::setOptimizationMode(OptimizationType id, OptimizationModeType mode)
 {
     LOG_DEBUG("TextRenderer", "setOptimizationMode("
-              << "id=" << id
-              << ", mode=" << mode << ")");
+                << "id=" << id
+                << ", mode=" << mode << ")");
     m_optimizationMode = mode;
     return true;
 }
@@ -136,7 +136,7 @@ bool TextRenderer::getOptimizationMode(OptimizationType id, OptimizationModeType
 {
     (void)mode;
     LOG_DEBUG("TextRenderer", "getOptimizationMode("
-              << "id=" << id << ")");
+                << "id=" << id << ")");
     *mode = m_optimizationMode;
     return true;
 }
index 9653b3a..4fe36da 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- * 
+ *
  * Copyright 2010-2012 BMW Car IT GmbH
  * Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
  * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
index fa4bcec..8b8ee47 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- * 
+ *
  * Copyright 2010-2012 BMW Car IT GmbH
  * Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
  *
index 45b017d..4c02715 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- * 
+ *
  * Copyright 2010-2012 BMW Car IT GmbH
  * Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
  * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
index 4b5f922..abfbd3a 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- * 
+ *
  * Copyright 2010, 2011 BMW Car IT GmbH
  * Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
  *
@@ -43,4 +43,4 @@ GLESGraphicsystem* WaylandFbdevGLESRenderer::getGraphicSystem(PfnShaderProgramCr
     return new GLESGraphicsystem(m_width, m_height, shaderProgram);
 }
 
-DECLARE_LAYERMANAGEMENT_PLUGIN(WaylandFbdevGLESRenderer)
\ No newline at end of file
+DECLARE_LAYERMANAGEMENT_PLUGIN(WaylandFbdevGLESRenderer)
index 43c4702..a516212 100644 (file)
@@ -1,6 +1,6 @@
 /***************************************************************************
 *
-* Copyright 2010, 2011 BMW Car IT GmbH 
+* Copyright 2010, 2011 BMW Car IT GmbH
 * Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
 * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
 *
index 6dab2d8..add9ce9 100644 (file)
@@ -1,6 +1,6 @@
 /***************************************************************************
 *
-* Copyright 2010, 2011 BMW Car IT GmbH 
+* Copyright 2010, 2011 BMW Car IT GmbH
 * Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
 *
 *
@@ -50,10 +50,10 @@ bool WaylandGLESRenderer::start(int width, int height, const char* displayname)
 
     // create Wayland windows, register as composite manager etc
     m_pWindowSystem = getWindowSystem(displayname);
-    if( m_pWindowSystem == NULL )
+    if (m_pWindowSystem == NULL)
     {
-    LOG_ERROR("WaylandGLESRenderer", "Window system is not specified. Consider to specify WITH_WAYLAND_X11 or WITH_WAYLAND_FBDEV");
-    goto fail; // TODO bad style
+        LOG_ERROR("WaylandGLESRenderer", "Window system is not specified. Consider to specify WITH_WAYLAND_X11 or WITH_WAYLAND_FBDEV");
+        goto fail; // TODO bad style
     }
 
     m_pGraphicSystem = getGraphicSystem(ShaderProgramGLES::createProgram);
@@ -88,7 +88,7 @@ bool WaylandGLESRenderer::start(int width, int height, const char* displayname)
     }
     return true;
 
-    fail: // TODO bad style
+fail: // TODO bad style
 
     LOG_ERROR("WaylandGLESRenderer", "Initialization failed !");
     return false;
@@ -97,7 +97,7 @@ bool WaylandGLESRenderer::start(int width, int height, const char* displayname)
 void WaylandGLESRenderer::stop()
 {
     m_pWindowSystem->stop();
-    if(m_binder)
+    if (m_binder)
     {
         delete m_binder;
     }
@@ -110,12 +110,12 @@ void WaylandGLESRenderer::doScreenShot(std::string fileToSave)
 
 void WaylandGLESRenderer::doScreenShotOfLayer(std::string fileToSave, uint id)
 {
-    m_pWindowSystem->doScreenShotOfLayer(fileToSave,id);
+    m_pWindowSystem->doScreenShotOfLayer(fileToSave, id);
 }
 
 void WaylandGLESRenderer::doScreenShotOfSurface(std::string fileToSave, uint id, uint layer_id)
 {
-    m_pWindowSystem->doScreenShotOfSurface(fileToSave,id,layer_id);
+    m_pWindowSystem->doScreenShotOfSurface(fileToSave, id, layer_id);
 }
 
 uint WaylandGLESRenderer::getNumberOfHardwareLayers(uint screenID)
@@ -169,14 +169,14 @@ HealthCondition WaylandGLESRenderer::pluginGetHealth()
     return BaseRenderer::pluginGetHealth();
 }
 
-Shader* WaylandGLESRenderer::createShader(const string* vertexName, const string* fragmentName)  
+Shader* WaylandGLESRenderer::createShader(const string* vertexName, const string* fragmentName)
 {
     Shader *result = NULL;
     m_pWindowSystem->setSystemState(WAKEUP_STATE);
     m_pWindowSystem->wakeUpRendererThread();
     m_pGraphicSystem->activateGraphicContext();
-    result = Shader::createShader(*vertexName,*fragmentName);
+    result = Shader::createShader(*vertexName, *fragmentName);
     m_pGraphicSystem->releaseGraphicContext();
     m_pWindowSystem->setSystemState(IDLE_STATE);
     return result;
-}
\ No newline at end of file
+}
index 4536260..2c2c829 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- * 
+ *
  * Copyright 2010-2012 BMW Car IT GmbH
  * Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
  * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
index 9b0f958..ee13124 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- * 
+ *
  * Copyright 2010, 2011 BMW Car IT GmbH
  * Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
  *
@@ -43,4 +43,4 @@ GLESGraphicsystem* WaylandX11GLESRenderer::getGraphicSystem(PfnShaderProgramCrea
     return new GLESGraphicsystem(m_width, m_height, shaderProgram);
 }
 
-DECLARE_LAYERMANAGEMENT_PLUGIN(WaylandX11GLESRenderer)
\ No newline at end of file
+DECLARE_LAYERMANAGEMENT_PLUGIN(WaylandX11GLESRenderer)
index 6211815..8b0b24f 100644 (file)
@@ -51,7 +51,7 @@ public:
      */
     virtual void use(void) const;
 
-    virtual int getUniformLocation(const char* name) 
+    virtual int getUniformLocation(const char* name)
     {
         return glGetUniformLocation(m_progHandle, name);
     }
index f23b759..8b7310a 100644 (file)
 ShaderProgram* ShaderProgramGLES::createProgram(const std::string& vertName, const std::string& fragName)
 {
     GLuint progHandle;
-    ShaderProgramGLES* program = 0;
+    ShaderProgramGLES* program=0;
     char defaultShaderDir[1024];
     char fragmentShaderLocation[1024];
     char vertexShaderLocation[1024];
-    int multitex = 1;
-    
-    const char* pluginLookupPath = getenv("LM_PLUGIN_PATH");
-    if  (pluginLookupPath != NULL ) 
+    int multitex=1;
+
+    const char* pluginLookupPath=getenv("LM_PLUGIN_PATH");
+    if (pluginLookupPath!=NULL)
     {
-        strncpy(defaultShaderDir, pluginLookupPath, sizeof(defaultShaderDir) - 1);
+        strncpy(defaultShaderDir, pluginLookupPath, sizeof(defaultShaderDir)-1);
     }
     else
     {
         strncpy(defaultShaderDir, CMAKE_INSTALL_PREFIX"/lib/layermanager", sizeof(defaultShaderDir));
     }
-    strcat(defaultShaderDir,"/renderer");
+    strcat(defaultShaderDir, "/renderer");
 
     if (vertName=="default")
     {
-        multitex = 1;
-        strcpy(vertexShaderLocation,defaultShaderDir);
-        strcat(vertexShaderLocation,"/renderer_vert.glslv");
+        multitex=1;
+        strcpy(vertexShaderLocation, defaultShaderDir);
+        strcat(vertexShaderLocation, "/renderer_vert.glslv");
     }
     else if (vertName=="default_2surf")
     {
-        multitex = 2;
-        strcpy(vertexShaderLocation,defaultShaderDir);
-        strcat(vertexShaderLocation,"/renderer_vert_2surf.glslv");
+        multitex=2;
+        strcpy(vertexShaderLocation, defaultShaderDir);
+        strcat(vertexShaderLocation, "/renderer_vert_2surf.glslv");
     }
     else if (vertName=="default_3surf")
     {
-        multitex = 3;
-        strcpy(vertexShaderLocation,defaultShaderDir);
-        strcat(vertexShaderLocation,"/renderer_vert_3surf.glslv");
+        multitex=3;
+        strcpy(vertexShaderLocation, defaultShaderDir);
+        strcat(vertexShaderLocation, "/renderer_vert_3surf.glslv");
     }
     else if (vertName=="default_4surf")
     {
-        multitex = 4;
-        strcpy(vertexShaderLocation,defaultShaderDir);
-        strcat(vertexShaderLocation,"/renderer_vert_4surf.glslv");
+        multitex=4;
+        strcpy(vertexShaderLocation, defaultShaderDir);
+        strcat(vertexShaderLocation, "/renderer_vert_4surf.glslv");
     }
     else
     {
@@ -76,94 +76,94 @@ ShaderProgram* ShaderProgramGLES::createProgram(const std::string& vertName, con
 
     if (fragName=="default_clear")
     {
-        strcpy(fragmentShaderLocation,defaultShaderDir);
-        strcat(fragmentShaderLocation,"/renderer_frag_clear.glslf");
+        strcpy(fragmentShaderLocation, defaultShaderDir);
+        strcat(fragmentShaderLocation, "/renderer_frag_clear.glslf");
     }
     else if (fragName=="default")
     {
-        strcpy(fragmentShaderLocation,defaultShaderDir);
-        strcat(fragmentShaderLocation,"/renderer_frag.glslf");
+        strcpy(fragmentShaderLocation, defaultShaderDir);
+        strcat(fragmentShaderLocation, "/renderer_frag.glslf");
     }
     else if (fragName=="default_no_blend")
     {
-        strcpy(fragmentShaderLocation,defaultShaderDir);
-        strcat(fragmentShaderLocation,"/renderer_frag_no_blend.glslf");
+        strcpy(fragmentShaderLocation, defaultShaderDir);
+        strcat(fragmentShaderLocation, "/renderer_frag_no_blend.glslf");
     }
     else if (fragName=="default_no_uniform_alpha")
     {
-        strcpy(fragmentShaderLocation,defaultShaderDir);
-        strcat(fragmentShaderLocation,"/renderer_frag_no_ualpha.glslf");
-        progHandle = RenderUtilLoadShaderSources(vertexShaderLocation,fragmentShaderLocation, GL_TRUE);
+        strcpy(fragmentShaderLocation, defaultShaderDir);
+        strcat(fragmentShaderLocation, "/renderer_frag_no_ualpha.glslf");
+        progHandle=RenderUtilLoadShaderSources(vertexShaderLocation, fragmentShaderLocation, GL_TRUE);
     }
-    else if (vertName=="default" && fragName=="default_add_uniform_chromakey")
+    else if (vertName=="default"&&fragName=="default_add_uniform_chromakey")
     {
-        strcpy(vertexShaderLocation,defaultShaderDir);
-        strcpy(fragmentShaderLocation,defaultShaderDir);
-        strcat(vertexShaderLocation,"/renderer_vert.glslv");
-        strcat(fragmentShaderLocation,"/renderer_frag_add_uchromakey.glslf");
+        strcpy(vertexShaderLocation, defaultShaderDir);
+        strcpy(fragmentShaderLocation, defaultShaderDir);
+        strcat(vertexShaderLocation, "/renderer_vert.glslv");
+        strcat(fragmentShaderLocation, "/renderer_frag_add_uchromakey.glslf");
     }
     else if (fragName=="default_no_blend_no_uniform_alpha")
     {
-        strcpy(fragmentShaderLocation,defaultShaderDir);
-        strcat(fragmentShaderLocation,"/renderer_frag_no_blend_no_ualpha.glslf");
+        strcpy(fragmentShaderLocation, defaultShaderDir);
+        strcat(fragmentShaderLocation, "/renderer_frag_no_blend_no_ualpha.glslf");
     }
     else if (fragName=="default_2surf")
     {
-        strcpy(fragmentShaderLocation,defaultShaderDir);
-        strcat(fragmentShaderLocation,"/renderer_frag_2surf.glslf");
+        strcpy(fragmentShaderLocation, defaultShaderDir);
+        strcat(fragmentShaderLocation, "/renderer_frag_2surf.glslf");
     }
     else if (fragName=="default_2surf_no_blend")
     {
-        strcpy(fragmentShaderLocation,defaultShaderDir);
-        strcat(fragmentShaderLocation,"/renderer_frag_2surf_no_blend.glslf");
+        strcpy(fragmentShaderLocation, defaultShaderDir);
+        strcat(fragmentShaderLocation, "/renderer_frag_2surf_no_blend.glslf");
     }
     else if (fragName=="default_2surf_no_uniform_alpha")
     {
-        strcpy(fragmentShaderLocation,defaultShaderDir);
-        strcat(fragmentShaderLocation,"/renderer_frag_2surf_no_ualpha.glslf");
+        strcpy(fragmentShaderLocation, defaultShaderDir);
+        strcat(fragmentShaderLocation, "/renderer_frag_2surf_no_ualpha.glslf");
     }
     else if (fragName=="default_2surf_no_blend_no_uniform_alpha")
     {
-        strcpy(fragmentShaderLocation,defaultShaderDir);
-        strcat(fragmentShaderLocation,"/renderer_frag_2surf_no_blend_no_ualpha.glslf");
+        strcpy(fragmentShaderLocation, defaultShaderDir);
+        strcat(fragmentShaderLocation, "/renderer_frag_2surf_no_blend_no_ualpha.glslf");
     }
     else if (fragName=="default_2surf_no_uniform_alpha_0")
     {
-        strcpy(fragmentShaderLocation,defaultShaderDir);
-        strcat(fragmentShaderLocation,"/renderer_frag_2surf_no_ualpha_0.glslf");
+        strcpy(fragmentShaderLocation, defaultShaderDir);
+        strcat(fragmentShaderLocation, "/renderer_frag_2surf_no_ualpha_0.glslf");
     }
     else if (fragName=="default_2surf_no_blend_no_uniform_alpha_0")
     {
-        strcpy(fragmentShaderLocation,defaultShaderDir);
-        strcat(fragmentShaderLocation,"/renderer_frag_2surf_no_blend_no_ualpha_0.glslf");
+        strcpy(fragmentShaderLocation, defaultShaderDir);
+        strcat(fragmentShaderLocation, "/renderer_frag_2surf_no_blend_no_ualpha_0.glslf");
     }
     else if (fragName=="default_2surf_no_uniform_alpha_1")
     {
-        strcpy(fragmentShaderLocation,defaultShaderDir);
-        strcat(fragmentShaderLocation,"/renderer_frag_2surf_no_ualpha_1.glslf");
+        strcpy(fragmentShaderLocation, defaultShaderDir);
+        strcat(fragmentShaderLocation, "/renderer_frag_2surf_no_ualpha_1.glslf");
     }
     else if (fragName=="default_2surf_no_blend_no_uniform_alpha_1")
     {
-        strcpy(fragmentShaderLocation,defaultShaderDir);
-        strcat(fragmentShaderLocation,"/renderer_frag_2surf_no_blend_no_ualpha_1.glslf");
+        strcpy(fragmentShaderLocation, defaultShaderDir);
+        strcat(fragmentShaderLocation, "/renderer_frag_2surf_no_blend_no_ualpha_1.glslf");
     }
     else
     {
         strcpy(fragmentShaderLocation, fragName.c_str());
     }
 
-    progHandle = RenderUtilLoadShaderSources(vertexShaderLocation,fragmentShaderLocation, GL_TRUE);
+    progHandle=RenderUtilLoadShaderSources(vertexShaderLocation, fragmentShaderLocation, GL_TRUE);
 
-    if (progHandle != 0)
+    if (progHandle!=0)
     {
         // bind attrib locations for vertex positions and texture coordinates
         glBindAttribLocation(progHandle, 0, "aPosition");
 
         // each texture has its own texCoord attribute
-        for (int i = 1; i <= multitex; i++)
+        for (int i=1; i<=multitex; i++)
         {
             char attribName[15];
-            if (i == 1)
+            if (i==1)
             {
                 sprintf(attribName, "aTexCoords");
             }
@@ -177,7 +177,7 @@ ShaderProgram* ShaderProgramGLES::createProgram(const std::string& vertName, con
         // re-link the program as we have changed the attrib bindings
         glLinkProgram(progHandle);
 
-        program = new ShaderProgramGLES(vertName, fragName, progHandle);
+        program=new ShaderProgramGLES(vertName, fragName, progHandle);
     }
     else
     {
index ea1ba7d..0f546ff 100644 (file)
@@ -53,7 +53,7 @@ bool X11GLESRenderer::start(int width, int height, const char* displayname)
 
     // create X11 windows, register as composite manager etc
     m_pWindowSystem = new X11WindowSystem(displayname, width, height, m_pScene, m_pInputManager);
-    m_pGraphicSystem = new GLESGraphicsystem(width,height, ShaderProgramGLES::createProgram);
+    m_pGraphicSystem = new GLESGraphicsystem(width, height, ShaderProgramGLES::createProgram);
 
     if (!m_pWindowSystem->init(m_pGraphicSystem))
     {
@@ -93,7 +93,7 @@ bool X11GLESRenderer::start(int width, int height, const char* displayname)
     }
     return true;
 
-    fail: // TODO bad style
+fail: // TODO bad style
 
     LOG_ERROR("X11GLESRenderer", "Initialization failed !");
     return false;
@@ -108,7 +108,6 @@ void X11GLESRenderer::stop()
     {
         delete m_binder;
     }
-    
 }
 
 void X11GLESRenderer::doScreenShot(std::string fileToSave)
@@ -118,12 +117,12 @@ void X11GLESRenderer::doScreenShot(std::string fileToSave)
 
 void X11GLESRenderer::doScreenShotOfLayer(std::string fileToSave, uint id)
 {
-    m_pWindowSystem->doScreenShotOfLayer(fileToSave,id);
+    m_pWindowSystem->doScreenShotOfLayer(fileToSave, id);
 }
 
 void X11GLESRenderer::doScreenShotOfSurface(std::string fileToSave, uint id, uint layer_id)
 {
-    m_pWindowSystem->doScreenShotOfSurface(fileToSave,id,layer_id);
+    m_pWindowSystem->doScreenShotOfSurface(fileToSave, id, layer_id);
 }
 
 uint X11GLESRenderer::getNumberOfHardwareLayers(uint screenID)
@@ -195,7 +194,7 @@ Shader* X11GLESRenderer::createShader(const string* vertexName, const string* fr
     m_pScene->unlockScene();
     while (m_pWindowSystem->getSystemState() != IDLE_STATE);
     m_pGraphicSystem->activateGraphicContext();
-    result = Shader::createShader(*vertexName,*fragmentName);
+    result = Shader::createShader(*vertexName, *fragmentName);
     m_pGraphicSystem->releaseGraphicContext();
     m_pWindowSystem->setSystemState(WAKEUP_STATE);
     m_pScene->lockScene();
index 21530b7..b8b8ae9 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _LAYERSCENE_H_
-#define _LAYERSCENE_H_
+#ifndef _EXAMPLEAPPIDS_H_
+#define _EXAMPLEAPPIDS_H_
 
 typedef enum e_layers
 {
@@ -45,4 +45,4 @@ typedef enum e_surfaces
     SURFACE_EXAMPLE_VIDEO_APPLICATION = 40
 } sceneSurfaces;
 
-#endif /* _LAYERSCENE_H_ */
+#endif /* _EXAMPLEAPPIDS_H_ */
index 111f52c..3878c61 100644 (file)
@@ -16,9 +16,9 @@
  * limitations under the License.
  *
  ****************************************************************************/
-#ifndef _LAYERSCENE_PROVIDER_H_
-#define _LAYERSCENE_PROVIDER_H_
+
+#ifndef _EXAMPLESCENEPROVIDER_H_
+#define _EXAMPLESCENEPROVIDER_H_
 
 #include "ISceneProvider.h"
 #include "PluginBase.h"
@@ -32,7 +32,7 @@ class Configuration;
 class ExampleSceneProvider : public ISceneProvider, public PluginBase
 {
 public:
-    
+
     ExampleSceneProvider(ICommandExecutor& executor, Configuration& config);
     virtual ~ExampleSceneProvider() {}
 
@@ -41,10 +41,10 @@ public:
 
     //from PluginBase
     virtual t_ilm_const_string pluginGetName() const;
-    
+
 protected:
     ICommandExecutor& mExecutor;
     Configuration& mConfiguration;
 };
 
-#endif /* _LAYERSCENE_PROVIDER_H_ */
+#endif /* _EXAMPLESCENEPROVIDER_H_ */
index b3c2a5d..cf548e3 100644 (file)
@@ -41,14 +41,14 @@ ExampleSceneProvider::ExampleSceneProvider(ICommandExecutor& executor, Configura
 {
 }
 
-typedef struct t_layerScene 
+typedef struct t_layerScene
 {
     unsigned int layer;
     bool visibility;
     float opacity;
 } layerScene;
 
-typedef struct t_surfaceScene 
+typedef struct t_surfaceScene
 {
     unsigned int surface;
     bool visibility;
@@ -56,28 +56,28 @@ typedef struct t_surfaceScene
 } surfaceScene;
 
 
-static layerScene gInitialLayerScene[] = 
+static layerScene gInitialLayerScene[] =
 {
     { LAYER_EXAMPLE_VIDEO_APPLICATIONS, true, 1.0 },
     { LAYER_EXAMPLE_GLES_APPLICATIONS, true, 1.0 },
     { LAYER_EXAMPLE_X_APPLICATIONS, true, 1.0 }
 };
 
-static surfaceScene gInitialSurfaceScene[] = 
+static surfaceScene gInitialSurfaceScene[] =
 {
-    { SURFACE_EXAMPLE_EGLX11_APPLICATION,false,1.0 },
-    { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_1,false,1.0 },
-    { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_2,false,1.0 },
-    { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_3,false,1.0 },
-    { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_4,false,1.0 },
-    { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_5,false,1.0 },
-    { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_6,false,1.0 },
-    { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_7,false,1.0 },
-    { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_8,false,1.0 },
-    { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_9,false,1.0 },
-    { SURFACE_EXAMPLE_GLXX11_APPLICATION,false,1.0 },
-    { SURFACE_EXAMPLE_EGLRAW_APPLICATION,false,1.0 },
-    { SURFACE_EXAMPLE_VIDEO_APPLICATION,false,1.0 }
+    { SURFACE_EXAMPLE_EGLX11_APPLICATION, false, 1.0 },
+    { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_1, false, 1.0 },
+    { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_2, false, 1.0 },
+    { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_3, false, 1.0 },
+    { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_4, false, 1.0 },
+    { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_5, false, 1.0 },
+    { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_6, false, 1.0 },
+    { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_7, false, 1.0 },
+    { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_8, false, 1.0 },
+    { SURFACE_EXAMPLE_GDTESTENV_APPLICATION_9, false, 1.0 },
+    { SURFACE_EXAMPLE_GLXX11_APPLICATION, false, 1.0 },
+    { SURFACE_EXAMPLE_EGLRAW_APPLICATION, false, 1.0 },
+    { SURFACE_EXAMPLE_VIDEO_APPLICATION, false, 1.0 }
 };
 
 
@@ -86,38 +86,58 @@ bool ExampleSceneProvider::delegateScene()
     bool result = true;
     pid_t layermanagerPid = getpid();
     int i = 0;
-    int numberOfLayers = sizeof(gInitialLayerScene) / sizeof (layerScene);
-    int numberOfSurfaces = sizeof(gInitialSurfaceScene) / sizeof (surfaceScene);
+    int numberOfLayers = sizeof(gInitialLayerScene) / sizeof(layerScene);
+    int numberOfSurfaces = sizeof(gInitialSurfaceScene) / sizeof(surfaceScene);
     unsigned int *renderOrder = new unsigned int [numberOfLayers];
     unsigned int* screenResolution = mExecutor.getScreenResolution(0);
-    if ( numberOfLayers > 0 ) 
+    if (numberOfLayers > 0)
     {
         /* setup inital layer scenery */
-        for (i = 0;i<numberOfLayers;i++)
+        for (i = 0; i<numberOfLayers; i++)
         {
-            result &= mExecutor.execute(new LayerCreateCommand(layermanagerPid, screenResolution[0], screenResolution[1], &(gInitialLayerScene[i].layer)));
-            result &= mExecutor.execute(new LayerSetSourceRectangleCommand(layermanagerPid, gInitialLayerScene[i].layer, 0, 0, screenResolution[0], screenResolution[1]));
-            result &= mExecutor.execute(new LayerSetDestinationRectangleCommand(layermanagerPid, gInitialLayerScene[i].layer, 0, 0, screenResolution[0], screenResolution[1]));
-            result &= mExecutor.execute(new LayerSetOpacityCommand(layermanagerPid, gInitialLayerScene[i].layer, gInitialLayerScene[i].opacity) );
-            result &= mExecutor.execute(new LayerSetVisibilityCommand(layermanagerPid, gInitialLayerScene[i].layer, gInitialLayerScene[i].visibility) );
+            result &= mExecutor.execute(new LayerCreateCommand(layermanagerPid,
+                                                               screenResolution[0],
+                                                               screenResolution[1],
+                                                               &(gInitialLayerScene[i].layer)));
+            result &= mExecutor.execute(new LayerSetSourceRectangleCommand(layermanagerPid,
+                                                                           gInitialLayerScene[i].layer,
+                                                                           0, 0,
+                                                                           screenResolution[0],
+                                                                           screenResolution[1]));
+            result &= mExecutor.execute(new LayerSetDestinationRectangleCommand(layermanagerPid,
+                                                                                gInitialLayerScene[i].layer,
+                                                                                0, 0,
+                                                                                screenResolution[0],
+                                                                                screenResolution[1]));
+            result &= mExecutor.execute(new LayerSetOpacityCommand(layermanagerPid,
+                                                                   gInitialLayerScene[i].layer,
+                                                                   gInitialLayerScene[i].opacity));
+            result &= mExecutor.execute(new LayerSetVisibilityCommand(layermanagerPid,
+                                                                      gInitialLayerScene[i].layer,
+                                                                      gInitialLayerScene[i].visibility));
             result &= mExecutor.execute(new CommitCommand(layermanagerPid));
             renderOrder[i]=gInitialLayerScene[i].layer;
-        }        
+        }
         /* Finally set the first executed renderorder */
         result &= mExecutor.execute(new ScreenSetRenderOrderCommand(layermanagerPid, 0, renderOrder, numberOfLayers));
         result &= mExecutor.execute(new CommitCommand(layermanagerPid));
     }
-    
-    if ( numberOfSurfaces > 0 ) 
+
+    if (numberOfSurfaces > 0)
     {
         /* setup inital surface scenery */
-        for (i = 0;i<numberOfSurfaces;i++)
+        for (i = 0; i<numberOfSurfaces; i++)
         {
-            result &= mExecutor.execute(new SurfaceCreateCommand(layermanagerPid, &(gInitialSurfaceScene[i].surface)));
-            result &= mExecutor.execute(new SurfaceSetOpacityCommand(layermanagerPid, gInitialSurfaceScene[i].surface, gInitialSurfaceScene[i].opacity));
-            result &= mExecutor.execute(new SurfaceSetVisibilityCommand(layermanagerPid, gInitialSurfaceScene[i].surface, gInitialSurfaceScene[i].visibility));
+            result &= mExecutor.execute(new SurfaceCreateCommand(layermanagerPid,
+                                                                 &(gInitialSurfaceScene[i].surface)));
+            result &= mExecutor.execute(new SurfaceSetOpacityCommand(layermanagerPid,
+                                                                     gInitialSurfaceScene[i].surface,
+                                                                     gInitialSurfaceScene[i].opacity));
+            result &= mExecutor.execute(new SurfaceSetVisibilityCommand(layermanagerPid,
+                                                                        gInitialSurfaceScene[i].surface,
+                                                                        gInitialSurfaceScene[i].visibility));
             result &= mExecutor.execute(new CommitCommand(layermanagerPid));
-        }        
+        }
         /* Finally set the first executed renderorder */
     }
     return result;
index c53163d..44eff6c 100644 (file)
@@ -27,7 +27,8 @@ int main(int argc, char **argv)
 {
     // monitor startup performance
     unsigned int startupTimeInMs = 0;
-    timeval start, end;
+    timeval start;
+    timeval end;
     gettimeofday(&start, 0);
 
     // collect all configuration settings
@@ -39,7 +40,7 @@ int main(int argc, char **argv)
     Log::dltLogLevel = (LOG_MODES)configuration.getLogLevelTrace();
 
     LOG_INFO("LayerManagerService", "Starting Layermanager (version: " << ILM_VERSION << ")");
-    
+
     // log configuration options
     configuration.logAllSettings();
 
index 11f93a1..e0c606f 100644 (file)
@@ -35,8 +35,8 @@
 * 3. This notice may not be removed or altered from any source distribution.
 ****************************************************************************/
 
-#ifndef _ILM_MATRIX_H_
-#define _ILM_MATRIX_H_
+#ifndef _ILMMATRIX_H_
+#define _ILMMATRIX_H_
 
 #define MAT00     0
 #define MAT01     1
@@ -104,4 +104,4 @@ void IlmMatrixRotateZ(IlmMatrix &mOut, const float angle);
 void IlmMatrixProjection(IlmMatrix &mOut, const float fov, const float near, const float far, const float aspectRatio);
 
 
-#endif /* _ILMMATRIX_H*/
+#endif /* _ILMMATRIX_H_*/
index 5c2afc5..ff0e959 100644 (file)
@@ -34,22 +34,22 @@ t_ilm_bool initServiceMode();
  create new messages
 =============================================================================
 */
-t_ilm_message createMessage      (t_ilm_const_string);
-t_ilm_message createResponse     (t_ilm_message);
+t_ilm_message createMessage(t_ilm_const_string);
+t_ilm_message createResponse(t_ilm_message);
 t_ilm_message createErrorResponse(t_ilm_message);
-t_ilm_message createNotification (t_ilm_const_string);
+t_ilm_message createNotification(t_ilm_const_string);
 
 /*
 =============================================================================
  add content to message
 =============================================================================
 */
-t_ilm_bool appendBool     (t_ilm_message, const t_ilm_bool);
-t_ilm_bool appendDouble   (t_ilm_message, const double);
-t_ilm_bool appendString   (t_ilm_message, const char*);
-t_ilm_bool appendInt      (t_ilm_message, const int);
-t_ilm_bool appendIntArray (t_ilm_message, const int*, int);
-t_ilm_bool appendUint     (t_ilm_message, const unsigned int);
+t_ilm_bool appendBool(t_ilm_message, const t_ilm_bool);
+t_ilm_bool appendDouble(t_ilm_message, const double);
+t_ilm_bool appendString(t_ilm_message, const char*);
+t_ilm_bool appendInt(t_ilm_message, const int);
+t_ilm_bool appendIntArray(t_ilm_message, const int*, int);
+t_ilm_bool appendUint(t_ilm_message, const unsigned int);
 t_ilm_bool appendUintArray(t_ilm_message, const unsigned int*, int);
 
 /*
@@ -72,9 +72,9 @@ t_ilm_message receive(t_ilm_int); /* timeout in ms*/
  get message information
 =============================================================================
 */
-t_ilm_const_string  getMessageName (t_ilm_message);
-t_ilm_message_type  getMessageType (t_ilm_message);
-t_ilm_const_string  getSenderName  (t_ilm_message);
+t_ilm_const_string getMessageName(t_ilm_message);
+t_ilm_message_type getMessageType(t_ilm_message);
+t_ilm_const_string getSenderName(t_ilm_message);
 t_ilm_client_handle getSenderHandle(t_ilm_message);
 
 /*
@@ -82,12 +82,12 @@ t_ilm_client_handle getSenderHandle(t_ilm_message);
  get content of message
 =============================================================================
 */
-t_ilm_bool getBool     (t_ilm_message, t_ilm_bool*);
-t_ilm_bool getDouble   (t_ilm_message, double*);
-t_ilm_bool getString   (t_ilm_message, char*);
-t_ilm_bool getInt      (t_ilm_message, int*);
-t_ilm_bool getIntArray (t_ilm_message, int**, int*);
-t_ilm_bool getUint     (t_ilm_message, unsigned int*);
+t_ilm_bool getBool(t_ilm_message, t_ilm_bool*);
+t_ilm_bool getDouble(t_ilm_message, double*);
+t_ilm_bool getString(t_ilm_message, char*);
+t_ilm_bool getInt(t_ilm_message, int*);
+t_ilm_bool getIntArray(t_ilm_message, int**, int*);
+t_ilm_bool getUint(t_ilm_message, unsigned int*);
 t_ilm_bool getUintArray(t_ilm_message, unsigned int**, int*);
 
 /*
index df3f13d..3d96d30 100644 (file)
@@ -41,7 +41,8 @@
 #include <fstream>
 #include <pthread.h>
 #include <map>
-typedef enum {
+typedef enum
+{
     LOG_DISABLED = 0,
     LOG_ERROR = 1,
     LOG_INFO = 2,
@@ -62,44 +63,47 @@ typedef void (*diagnosticInjectionCallback)(unsigned int module_id, void *data,
 class Log
 {
 public:
-    
+
     typedef struct diagnosticCallbackData_t
     {
         unsigned int module_id;
         void *userdata;
         diagnosticInjectionCallback diagFunc;
     } diagnosticCallbackData;
-    
+
     typedef std::map<unsigned int, diagnosticCallbackData*> DiagnosticCallbackMap;
-    
+
     virtual ~Log();
     static LOG_MODES fileLogLevel;
     static LOG_MODES consoleLogLevel;
     static LOG_MODES dltLogLevel;
     static Log* getInstance();
-    static DiagnosticCallbackMap* getDiagnosticCallbackMap(){return getInstance()->m_diagnosticCallbackMap;};
-    void warning (LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output);
-    void info (LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output);
-    void error (LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output);
-    void debug (LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output);
+    static DiagnosticCallbackMap* getDiagnosticCallbackMap()
+    {
+        return getInstance()->m_diagnosticCallbackMap;
+    }
+    void warning(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output);
+    void info(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output);
+    void error(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output);
+    void debug(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output);
     void log(LogContext logContext, LOG_MODES logMode, const std::string& moduleName, const std::basic_string<char>& output);
-    void registerDiagnosticInjectionCallback( unsigned int module_id, diagnosticInjectionCallback diagFunc, void* userdata );
-    void unregisterDiagnosticInjectionCallback( unsigned int module_id );
+    void registerDiagnosticInjectionCallback(unsigned int module_id, diagnosticInjectionCallback diagFunc, void* userdata);
+    void unregisterDiagnosticInjectionCallback(unsigned int module_id);
     LogContext getLogContext();
     static void closeInstance();
 private:
     Log();
     void LogToFile(std::string logMode, const std::string& moduleName, const std::basic_string<char>& output);
-    void LogToConsole(std::string logMode, const std::string& moduleName,const std::basic_string<char>& output);
-    void LogToDltDaemon(LogContext logContext, LOG_MODES logMode,const std::string& moduleName,const std::basic_string<char>& output);
+    void LogToConsole(std::string logMode, const std::string& moduleName, const std::basic_string<char>& output);
+    void LogToDltDaemon(LogContext logContext, LOG_MODES logMode, const std::string& moduleName, const std::basic_string<char>& output);
 
 private:
     std::ofstream* m_fileStream;
     pthread_mutex_t m_LogBufferMutex;
     LogContext m_logContext;
     static DiagnosticCallbackMap* m_diagnosticCallbackMap;
-    
-    static Log* m_instance;    
+
+    static Log* m_instance;
 };
 
 //#define LOG_ERROR(logcontext,module, message)
index ea3c2d8..aca6166 100644 (file)
@@ -45,82 +45,82 @@ typedef std::ios_base& (*ios_base_manip)(std::ios_base&);
 class LogMessageBuffer
 {
 public:
-   /**
-    *  Creates a new instance.
-    */
-   LogMessageBuffer();
-   /**
-    *  Destructor.
-    */
-   ~LogMessageBuffer();
+    /**
+     *  Creates a new instance.
+     */
+    LogMessageBuffer();
+    /**
+     *  Destructor.
+     */
+    ~LogMessageBuffer();
 
-   LogMessageBuffer& operator<<(const std::basic_string<char>& msg);
+    LogMessageBuffer& operator<<(const std::basic_string<char>& msg);
 
-   LogMessageBuffer& operator<<(const char* msg);
+    LogMessageBuffer& operator<<(const char* msg);
 
-   LogMessageBuffer& operator<<(char* msg);
+    LogMessageBuffer& operator<<(char* msg);
 
-   LogMessageBuffer& operator<<(const char msg);
+    LogMessageBuffer& operator<<(const char msg);
 
-   std::ostream& operator<<(ios_base_manip manip);
+    std::ostream& operator<<(ios_base_manip manip);
 
-   std::ostream& operator<<(bool val);
+    std::ostream& operator<<(bool val);
 
-   std::ostream& operator<<(short val);
+    std::ostream& operator<<(short val);
 
-   std::ostream& operator<<(int val);
+    std::ostream& operator<<(int val);
 
-   std::ostream& operator<<(unsigned int val);
+    std::ostream& operator<<(unsigned int val);
 
-   std::ostream& operator<<(long val);
+    std::ostream& operator<<(long val);
 
-   std::ostream& operator<<(unsigned long val);
+    std::ostream& operator<<(unsigned long val);
 
-   std::ostream& operator<<(float val);
+    std::ostream& operator<<(float val);
 
-   std::ostream& operator<<(double val);
+    std::ostream& operator<<(double val);
 
-   std::ostream& operator<<(long double val);
+    std::ostream& operator<<(long double val);
 
-   std::ostream& operator<<(void* val);
+    std::ostream& operator<<(void* val);
 
-   /**
-    *  Cast to ostream.
-    */
-   operator std::basic_ostream<char>&();
+    /**
+     *  Cast to ostream.
+     */
+    operator std::basic_ostream<char>&();
 
-   const std::basic_string<char>& str(std::basic_ostream<char>& os);
+    const std::basic_string<char>& str(std::basic_ostream<char>& os);
 
-   const std::basic_string<char>& str() const;
+    const std::basic_string<char>& str() const;
 
-   bool hasStream() const;
+    bool hasStream() const;
 
 private:
-   /**
-    * No default copy constructor.
-    */
-   LogMessageBuffer(const LogMessageBuffer&);
-
-   /**
-    *  No assignment operator.
-    */
-   LogMessageBuffer& operator=(const LogMessageBuffer&);
-
-   /**
-    * Encapsulated std::string.
-    */
-   std::basic_string<char> buf;
-
-   /**
-    *  Encapsulated stream, created on demand.
-    */
-   std::basic_ostringstream<char>* stream;
+    /**
+     * No default copy constructor.
+     */
+    LogMessageBuffer(const LogMessageBuffer&);
+
+    /**
+     *  No assignment operator.
+     */
+    LogMessageBuffer& operator=(const LogMessageBuffer&);
+
+    /**
+     * Encapsulated std::string.
+     */
+    std::basic_string<char> buf;
+
+    /**
+     *  Encapsulated stream, created on demand.
+     */
+    std::basic_ostringstream<char>* stream;
 };
 
 template<class V>
 std::basic_ostream<char>& operator<<(LogMessageBuffer& os, const V& val)
 {
-   return ((std::basic_ostream<char>&) os) << val;
+    return ((std::basic_ostream<char>&) os) << val;
 }
 
 #endif /* _LOGMESSAGEBUFFER_H_ */
index b775da9..77cc7b5 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- * 
+ *
  * Copyright 2010,2011 BMW Car IT GmbH
  *
  *
@@ -28,22 +28,22 @@ class ThreadBase
 public:
     ThreadBase();
     virtual ~ThreadBase();
-    
+
     t_ilm_bool threadCreate();
     t_ilm_bool threadInit();
     t_ilm_bool threadStart();
     t_ilm_bool threadStop();
-    
+
     pthread_t threadGetId() const;
     t_ilm_bool threadIsRunning();
-    
+
     // override in inheriting class if required
     virtual t_ilm_bool threadInitInThreadContext();
     virtual t_ilm_bool threadDestroyInThreadContext();
-    
+
     // implement in inheriting class
     virtual t_ilm_bool threadMainLoop() = 0;
-    
+
 private:
     static unsigned int mGlobalThreadCount;
     pthread_t mThreadId;
index fcc1d5d..e0910ab 100644 (file)
@@ -49,18 +49,18 @@ typedef struct headerStruct
 
 void writeBitmap(std::string FileName, char* imagedataRGB, int width, int height)
 {
-    LOG_DEBUG("Bitmap","writing Bitmap to file:" <<FileName);
+    LOG_DEBUG("Bitmap", "writing Bitmap to file:" << FileName);
 
     BMPHeader bmpHeader;
     InfoHeader header;
-    int imagebytes=width*height*3;
+    int imagebytes = width*height*3;
     char firstbytes[2];
-    firstbytes[0]='B';
-    firstbytes[1]='M';
-    bmpHeader.size = 2+sizeof(BMPHeader)+sizeof(header)+imagebytes;
+    firstbytes[0] = 'B';
+    firstbytes[1] = 'M';
+    bmpHeader.size = 2 + sizeof(BMPHeader) + sizeof(header) + imagebytes;
     bmpHeader.a = 0;
     bmpHeader.b = 0;
-    bmpHeader.offset = 2+sizeof(BMPHeader)+sizeof(header);
+    bmpHeader.offset = 2 + sizeof(BMPHeader) + sizeof(header);
     header.headersize = sizeof(header);
     header.width = width;
     header.height = height;
@@ -75,17 +75,17 @@ void writeBitmap(std::string FileName, char* imagedataRGB, int width, int height
 
     // make sure parent directory exists
     std::size_t currentPos = 0;
-    std::size_t lastPos = FileName.find_first_of("/",currentPos);
+    std::size_t lastPos = FileName.find_first_of("/", currentPos);
     while (lastPos != std::string::npos)
     {
-        std::string directory = FileName.substr(0,lastPos);
-        LOG_DEBUG("Bitmap","Creating directory " << directory);
-        mkdir(directory.c_str(),0755);
+        std::string directory = FileName.substr(0, lastPos);
+        LOG_DEBUG("Bitmap", "Creating directory " << directory);
+        mkdir(directory.c_str(), 0755);
         currentPos = lastPos;
-        lastPos = FileName.find_first_of("/",currentPos+1);
+        lastPos = FileName.find_first_of("/", currentPos + 1);
     }
 
-    FILE* file = fopen(FileName.c_str(),"wb");
+    FILE* file = fopen(FileName.c_str(), "wb");
 
     if (file)
     {
index ad01d62..5e50b6c 100644 (file)
 
 void IlmMatrixIdentity(IlmMatrix &mOut)
 {
-    mOut.f[0] = 1.0f;    mOut.f[4] = 0.0f;    mOut.f[8]  = 0.0f;    mOut.f[12] = 0.0f;
-    mOut.f[1] = 0.0f;    mOut.f[5] = 1.0f;    mOut.f[9]  = 0.0f;    mOut.f[13] = 0.0f;
-    mOut.f[2] = 0.0f;    mOut.f[6] = 0.0f;    mOut.f[10] = 1.0f;    mOut.f[14] = 0.0f;
-    mOut.f[3] = 0.0f;    mOut.f[7] = 0.0f;    mOut.f[11] = 0.0f;    mOut.f[15] = 1.0f;
+    mOut.f[0] = 1.0f;
+    mOut.f[1] = 0.0f;
+    mOut.f[2] = 0.0f;
+    mOut.f[3] = 0.0f;
+
+    mOut.f[4] = 0.0f;
+    mOut.f[5] = 1.0f;
+    mOut.f[6] = 0.0f;
+    mOut.f[7] = 0.0f;
+
+    mOut.f[8] = 0.0f;
+    mOut.f[9] = 0.0f;
+    mOut.f[10] = 1.0f;
+    mOut.f[11] = 0.0f;
+
+    mOut.f[12] = 0.0f;
+    mOut.f[13] = 0.0f;
+    mOut.f[14] = 0.0f;
+    mOut.f[15] = 1.0f;
 }
 
 void IlmMatrixMultiply(IlmMatrix &mOut, const IlmMatrix &mA, const IlmMatrix &mB)
@@ -79,18 +94,48 @@ void IlmMatrixMultiply(IlmMatrix &mOut, const IlmMatrix &mA, const IlmMatrix &mB
 
 void IlmMatrixTranslation(IlmMatrix &mOut, const float X, const float Y, const float Z)
 {
-    mOut.f[0] = 1.0f;    mOut.f[4] = 0.0f;    mOut.f[8]  = 0.0f;    mOut.f[12] = X;
-    mOut.f[1] = 0.0f;    mOut.f[5] = 1.0f;    mOut.f[9]  = 0.0f;    mOut.f[13] = Y;
-    mOut.f[2] = 0.0f;    mOut.f[6] = 0.0f;    mOut.f[10] = 1.0f;    mOut.f[14] = Z;
-    mOut.f[3] = 0.0f;    mOut.f[7] = 0.0f;    mOut.f[11] = 0.0f;    mOut.f[15] = 1.0f;
+    mOut.f[0] = 1.0f;
+    mOut.f[1] = 0.0f;
+    mOut.f[2] = 0.0f;
+    mOut.f[3] = 0.0f;
+
+    mOut.f[4] = 0.0f;
+    mOut.f[5] = 1.0f;
+    mOut.f[6] = 0.0f;
+    mOut.f[7] = 0.0f;
+
+    mOut.f[8] = 0.0f;
+    mOut.f[9] = 0.0f;
+    mOut.f[10] = 1.0f;
+    mOut.f[11] = 0.0f;
+
+    mOut.f[12] = X;
+    mOut.f[13] = Y;
+    mOut.f[14] = Z;
+    mOut.f[15] = 1.0f;
 }
 
 void IlmMatrixScaling(IlmMatrix &mOut, const float X, const float Y, const float Z)
 {
-    mOut.f[0] = X;       mOut.f[4] = 0.0f;    mOut.f[8]  = 0.0f;    mOut.f[12] = 0.0f;
-    mOut.f[1] = 0.0f;    mOut.f[5] = Y;       mOut.f[9]  = 0.0f;    mOut.f[13] = 0.0f;
-    mOut.f[2] = 0.0f;    mOut.f[6] = 0.0f;    mOut.f[10] = Z;       mOut.f[14] = 0.0f;
-    mOut.f[3] = 0.0f;    mOut.f[7] = 0.0f;    mOut.f[11] = 0.0f;    mOut.f[15] = 1.0f;
+    mOut.f[0] = X;
+    mOut.f[1] = 0.0f;
+    mOut.f[2] = 0.0f;
+    mOut.f[3] = 0.0f;
+
+    mOut.f[4] = 0.0f;
+    mOut.f[5] = Y;
+    mOut.f[6] = 0.0f;
+    mOut.f[7] = 0.0f;
+
+    mOut.f[8] = 0.0f;
+    mOut.f[9] = 0.0f;
+    mOut.f[10] = Z;
+    mOut.f[11] = 0.0f;
+
+    mOut.f[12] = 0.0f;
+    mOut.f[13] = 0.0f;
+    mOut.f[14] = 0.0f;
+    mOut.f[15] = 1.0f;
 }
 
 void IlmMatrixRotateX(IlmMatrix &mOut, const float angle)
@@ -100,10 +145,25 @@ void IlmMatrixRotateX(IlmMatrix &mOut, const float angle)
     float fSine = (float)sin(degToRad(angle));
 
     // Create the trigonometric matrix corresponding to X Rotation
-    mOut.f[0] = 1.0f;    mOut.f[4] = 0.0f;      mOut.f[8]  = 0.0f;      mOut.f[12] = 0.0f;
-    mOut.f[1] = 0.0f;    mOut.f[5] = fCosine;   mOut.f[9]  = fSine;     mOut.f[13] = 0.0f;
-    mOut.f[2] = 0.0f;    mOut.f[6] = -fSine;    mOut.f[10] = fCosine;   mOut.f[14] = 0.0f;
-    mOut.f[3] = 0.0f;    mOut.f[7] = 0.0f;      mOut.f[11] = 0.0f;      mOut.f[15] = 1.0f;
+    mOut.f[0] = 1.0f;
+    mOut.f[1] = 0.0f;
+    mOut.f[2] = 0.0f;
+    mOut.f[3] = 0.0f;
+
+    mOut.f[4] = 0.0f;
+    mOut.f[5] = fCosine;
+    mOut.f[6] = -fSine;
+    mOut.f[7] = 0.0f;
+
+    mOut.f[8] = 0.0f;
+    mOut.f[9] = fSine;
+    mOut.f[10] = fCosine;
+    mOut.f[11] = 0.0f;
+
+    mOut.f[12] = 0.0f;
+    mOut.f[13] = 0.0f;
+    mOut.f[14] = 0.0f;
+    mOut.f[15] = 1.0f;
 }
 
 void IlmMatrixRotateY(IlmMatrix &mOut, const float angle)
@@ -113,10 +173,25 @@ void IlmMatrixRotateY(IlmMatrix &mOut, const float angle)
     float fSine = (float)sin(degToRad(angle));
 
     // Create the trigonometric matrix corresponding to Y Rotation
-    mOut.f[0] = fCosine;   mOut.f[4] = 0.0f;    mOut.f[8]  = -fSine;    mOut.f[12] = 0.0f;
-    mOut.f[1] = 0.0f;      mOut.f[5] = 1.0f;    mOut.f[9]  = 0.0f;      mOut.f[13] = 0.0f;
-    mOut.f[2] = fSine;     mOut.f[6] = 0.0f;    mOut.f[10] = fCosine;   mOut.f[14] = 0.0f;
-    mOut.f[3] = 0.0f;      mOut.f[7] = 0.0f;    mOut.f[11] = 0.0f;      mOut.f[15] = 1.0f;
+    mOut.f[0] = fCosine;
+    mOut.f[1] = 0.0f;
+    mOut.f[2] = fSine;
+    mOut.f[3] = 0.0f;
+
+    mOut.f[4] = 0.0f;
+    mOut.f[5] = 1.0f;
+    mOut.f[6] = 0.0f;
+    mOut.f[7] = 0.0f;
+
+    mOut.f[8]  = -fSine;
+    mOut.f[9]  = 0.0f;
+    mOut.f[10] = fCosine;
+    mOut.f[11] = 0.0f;
+
+    mOut.f[12] = 0.0f;
+    mOut.f[13] = 0.0f;
+    mOut.f[14] = 0.0f;
+    mOut.f[15] = 1.0f;
 }
 
 void IlmMatrixRotateZ(IlmMatrix &mOut, const float angle)
@@ -126,42 +201,57 @@ void IlmMatrixRotateZ(IlmMatrix &mOut, const float angle)
     float fSine = (float)sin(degToRad(angle));
 
     // Create the trigonometric matrix corresponding to Z Rotation
-    mOut.f[0] = fCosine;   mOut.f[4] = fSine;    mOut.f[8]  = 0.0f;    mOut.f[12] = 0.0f;
-    mOut.f[1] = -fSine;    mOut.f[5] = fCosine;  mOut.f[9]  = 0.0f;    mOut.f[13] = 0.0f;
-    mOut.f[2] = 0.0f;      mOut.f[6] = 0.0f;     mOut.f[10] = 1.0f;    mOut.f[14] = 0.0f;
-    mOut.f[3] = 0.0f;      mOut.f[7] = 0.0f;     mOut.f[11] = 0.0f;    mOut.f[15] = 1.0f;
+    mOut.f[0] = fCosine;
+    mOut.f[1] = -fSine;
+    mOut.f[2] = 0.0f;
+    mOut.f[3] = 0.0f;
+
+    mOut.f[4] = fSine;
+    mOut.f[5] = fCosine;
+    mOut.f[6] = 0.0f;
+    mOut.f[7] = 0.0f;
+
+    mOut.f[8]  = 0.0f;
+    mOut.f[9]  = 0.0f;
+    mOut.f[10] = 1.0f;
+    mOut.f[11] = 0.0f;
+
+    mOut.f[12] = 0.0f;
+    mOut.f[13] = 0.0f;
+    mOut.f[14] = 0.0f;
+    mOut.f[15] = 1.0f;
 }
 
 void IlmMatrixProjection(IlmMatrix &mOut, const float fov, const float near, const float far, const float aspect)
 {
-       // Precompute borders for projection
-       float range = near * tan(degToRad(fov) / 2.0);
-       float left = -range * aspect;
-       float right = range * aspect;
-       float bottom = -range;
-       float top = range;
-
-       // Column 1
-       mOut.f[0] = 2 * near / (right - left);
-       mOut.f[1] = 0.0;
-       mOut.f[2] = 0.0;
-       mOut.f[3] = 0.0;
-
-       // Column 2
-       mOut.f[4] = 0.0;
-       mOut.f[5] = 2 * near / (top - bottom);
-       mOut.f[6] = 0.0;
-       mOut.f[7] = 0.0;
-
-       // Column 3
-       mOut.f[8] = 0.0;
-       mOut.f[9] = 0.0;
-       mOut.f[10] = -(far + near) / (far - near);
-       mOut.f[11] = -1;
-
-       // Column 4
-       mOut.f[12] = 0.0;
-       mOut.f[13] = 0.0;
-       mOut.f[14] = -(2 * far * near) / (far - near);
-       mOut.f[15] = 0.0;
+    // Precompute borders for projection
+    float range = near * tan(degToRad(fov) / 2.0);
+    float left = -range * aspect;
+    float right = range * aspect;
+    float bottom = -range;
+    float top = range;
+
+    // Column 1
+    mOut.f[0] = 2 * near / (right - left);
+    mOut.f[1] = 0.0;
+    mOut.f[2] = 0.0;
+    mOut.f[3] = 0.0;
+
+    // Column 2
+    mOut.f[4] = 0.0;
+    mOut.f[5] = 2 * near / (top - bottom);
+    mOut.f[6] = 0.0;
+    mOut.f[7] = 0.0;
+
+    // Column 3
+    mOut.f[8] = 0.0;
+    mOut.f[9] = 0.0;
+    mOut.f[10] = -(far + near) / (far - near);
+    mOut.f[11] = -1;
+
+    // Column 4
+    mOut.f[12] = 0.0;
+    mOut.f[13] = 0.0;
+    mOut.f[14] = -(2 * far * near) / (far - near);
+    mOut.f[15] = 0.0;
 }
index c4ac9ac..c5bf8dd 100644 (file)
@@ -49,53 +49,52 @@ t_ilm_bool loadSymbolTable(struct IpcModule* ipcModule, char* path, char* file)
 
     struct ApiFunction ApiFunctionTable[] =
     {
-        { "initClientMode",      (void**)&ipcModule->initClientMode },
-        { "initServiceMode",     (void**)&ipcModule->initServiceMode },
+        { "initClientMode", (void**)&ipcModule->initClientMode },
+        { "initServiceMode", (void**)&ipcModule->initServiceMode },
 
-        { "createMessage",       (void**)&ipcModule->createMessage },
-        { "createResponse",      (void**)&ipcModule->createResponse },
+        { "createMessage", (void**)&ipcModule->createMessage },
+        { "createResponse", (void**)&ipcModule->createResponse },
         { "createErrorResponse", (void**)&ipcModule->createErrorResponse },
-        { "createNotification",  (void**)&ipcModule->createNotification },
+        { "createNotification", (void**)&ipcModule->createNotification },
 
-        { "appendBool",          (void**)&ipcModule->appendBool },
-        { "appendDouble",        (void**)&ipcModule->appendDouble },
-        { "appendString",        (void**)&ipcModule->appendString },
-        { "appendInt",           (void**)&ipcModule->appendInt },
-        { "appendIntArray",      (void**)&ipcModule->appendIntArray },
-        { "appendUint",          (void**)&ipcModule->appendUint },
-        { "appendUintArray",     (void**)&ipcModule->appendUintArray },
+        { "appendBool", (void**)&ipcModule->appendBool },
+        { "appendDouble", (void**)&ipcModule->appendDouble },
+        { "appendString", (void**)&ipcModule->appendString },
+        { "appendInt", (void**)&ipcModule->appendInt },
+        { "appendIntArray", (void**)&ipcModule->appendIntArray },
+        { "appendUint", (void**)&ipcModule->appendUint },
+        { "appendUintArray", (void**)&ipcModule->appendUintArray },
 
-        { "sendToClients",       (void**)&ipcModule->sendToClients },
-        { "sendToService",       (void**)&ipcModule->sendToService },
+        { "sendToClients", (void**)&ipcModule->sendToClients },
+        { "sendToService", (void**)&ipcModule->sendToService },
 
-        { "receive",             (void**)&ipcModule->receive },
+        { "receive", (void**)&ipcModule->receive },
 
-        { "getMessageName",      (void**)&ipcModule->getMessageName },
-        { "getMessageType",      (void**)&ipcModule->getMessageType },
-        { "getSenderName",       (void**)&ipcModule->getSenderName },
-        { "getSenderHandle",     (void**)&ipcModule->getSenderHandle },
+        { "getMessageName", (void**)&ipcModule->getMessageName },
+        { "getMessageType", (void**)&ipcModule->getMessageType },
+        { "getSenderName", (void**)&ipcModule->getSenderName },
+        { "getSenderHandle", (void**)&ipcModule->getSenderHandle },
 
-        { "getBool",             (void**)&ipcModule->getBool },
-        { "getDouble",           (void**)&ipcModule->getDouble },
-        { "getString",           (void**)&ipcModule->getString },
-        { "getInt",              (void**)&ipcModule->getInt },
-        { "getIntArray",         (void**)&ipcModule->getIntArray },
-        { "getUint",             (void**)&ipcModule->getUint },
-        { "getUintArray",        (void**)&ipcModule->getUintArray },
+        { "getBool", (void**)&ipcModule->getBool },
+        { "getDouble", (void**)&ipcModule->getDouble },
+        { "getString", (void**)&ipcModule->getString },
+        { "getInt", (void**)&ipcModule->getInt },
+        { "getIntArray", (void**)&ipcModule->getIntArray },
+        { "getUint", (void**)&ipcModule->getUint },
+        { "getUintArray", (void**)&ipcModule->getUintArray },
 
-        { "destroyMessage",      (void**)&ipcModule->destroyMessage },
+        { "destroyMessage", (void**)&ipcModule->destroyMessage },
 
-        { "destroy",             (void**)&ipcModule->destroy }
+        { "destroy", (void**)&ipcModule->destroy }
     };
 
-    const unsigned int apiFunctionCount = sizeof (ApiFunctionTable) / sizeof(struct ApiFunction);
+    const unsigned int apiFunctionCount = sizeof(ApiFunctionTable) / sizeof(struct ApiFunction);
     unsigned int symbolCount = 0;
     t_ilm_bool returnValue = ILM_FALSE;
     void* pluginLibHandle = 0;
     char fullFilePath[1024];
     fullFilePath[0] = '\0';
 
-
     snprintf(fullFilePath, sizeof(fullFilePath), "%s/%s", path, file);
 
     pluginLibHandle = dlopen(fullFilePath, RTLD_LAZY);
@@ -111,11 +110,11 @@ t_ilm_bool loadSymbolTable(struct IpcModule* ipcModule, char* path, char* file)
             if (*func->funcPtr)
             {
                 symbolCount++;
-                 /*printf("[ OK ] symbol %s\n", func->name);*/
+                /*printf("[ OK ] symbol %s\n", func->name);*/
             }
             else
             {
-                 /*printf("[FAIL] symbol %s\n", func->name);*/
+                /*printf("[FAIL] symbol %s\n", func->name);*/
             }
         }
     }
@@ -138,10 +137,10 @@ t_ilm_bool loadSymbolTable(struct IpcModule* ipcModule, char* path, char* file)
         }
     }
 
-     /*
-      Note: will break plugin. must be done during shutdown,
-      but currently there is no unloadIpcModule
-     dlclose(pluginLibHandle);
+    /*
+     * Note: will break plugin. must be done during shutdown,
+     * but currently there is no unloadIpcModule
+     dlclose(pluginLibHandle);
      */
 
     return returnValue;
@@ -153,14 +152,13 @@ t_ilm_bool loadIpcModule(struct IpcModule* communicator)
     char path[1024];
     DIR *directory;
 
-     /* find communicator client plugin*/
+    /* find communicator client plugin*/
     char* pluginLookupPath = getenv("LM_PLUGIN_PATH");
-    if  (pluginLookupPath)
+    if (pluginLookupPath)
     {
-       gDefaultPluginLookupPath = pluginLookupPath;
+        gDefaultPluginLookupPath = pluginLookupPath;
     }
 
-
     snprintf(path, sizeof(path), "%s/%s", gDefaultPluginLookupPath,
                                           gCommunicatorPluginDirectory);
 
@@ -168,7 +166,7 @@ t_ilm_bool loadIpcModule(struct IpcModule* communicator)
     directory = opendir(path);
     if (directory)
     {
-         /* iterate content of directory*/
+        /* iterate content of directory*/
         struct dirent *itemInDirectory = 0;
         while ((itemInDirectory = readdir(directory)) && !result)
         {
index 1575559..21d3036 100644 (file)
@@ -48,7 +48,7 @@ LOG_MODES Log::fileLogLevel = LOG_DISABLED;
 LOG_MODES Log::consoleLogLevel = LOG_INFO;
 #ifdef WITH_DLT
 LOG_MODES Log::dltLogLevel = LOG_DEBUG;
-#else 
+#else
 LOG_MODES Log::dltLogLevel = LOG_DISABLED;
 #endif
 
@@ -60,23 +60,20 @@ Log::Log()
     pthread_mutex_init(&m_LogBufferMutex, NULL);
     Log::m_diagnosticCallbackMap = new Log::DiagnosticCallbackMap;
 #ifdef WITH_DLT
-    m_logContext = new DltContext;    
-    DLT_REGISTER_APP("LMSA","LayerManagerService");
-    DLT_REGISTER_CONTEXT(*((DltContext*)m_logContext),"LMSC","LayerManagerService");
+    m_logContext = new DltContext;
+    DLT_REGISTER_APP("LMSA", "LayerManagerService");
+    DLT_REGISTER_CONTEXT(*((DltContext*)m_logContext), "LMSC", "LayerManagerService");
     DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_DEFAULT);
 #else
     m_logContext = NULL;
 #endif
-
-
 }
 
 Log* Log::getInstance()
 {
-    if ( m_instance == NULL ) 
+    if (m_instance == NULL)
     {
         m_instance = new Log();
-        
     }
     return m_instance;
 }
@@ -95,7 +92,7 @@ Log::~Log()
     Log::m_instance = NULL;
 #ifdef WITH_DLT
     DLT_UNREGISTER_CONTEXT(*((DltContext*)m_logContext));
-    delete ((DltContext*)m_logContext);
+    delete((DltContext*)m_logContext);
     DLT_UNREGISTER_APP();
 #endif
     delete m_diagnosticCallbackMap;
@@ -103,55 +100,55 @@ Log::~Log()
     m_logContext = NULL;
 }
 
-void Log::warning (LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output)
+void Log::warning(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output)
 {
-    log(logContext,LOG_WARNING, moduleName, output);
+    log(logContext, LOG_WARNING, moduleName, output);
 }
 
-void Log::info (LogContext logContext,const std::string& moduleName, const std::basic_string<char>& output)
+void Log::info(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output)
 {
     log(logContext, LOG_INFO, moduleName, output);
 }
 
-void Log::error (LogContext logContext,const std::string& moduleName, const std::basic_string<char>& output)
+void Log::error(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output)
 {
     log(logContext, LOG_ERROR, moduleName, output);
 }
 
-void Log::debug (LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output)
+void Log::debug(LogContext logContext, const std::string& moduleName, const std::basic_string<char>& output)
 {
-    log(logContext,  LOG_DEBUG, moduleName, output);
+    log(logContext, LOG_DEBUG, moduleName, output);
 }
 
 void Log::log(LogContext logContext, LOG_MODES logMode, const std::string& moduleName, const std::basic_string<char>& output)
 {
     (void)logContext;
 
-    std::string logString[LOG_MAX_LEVEL] = {"","ERROR","INFO","WARNING","DEBUG"};
+    std::string logString[LOG_MAX_LEVEL] = {"", "ERROR", "INFO", "WARNING", "DEBUG"};
     std::string logOutLevelString = logString[LOG_INFO];
     pthread_mutex_lock(&m_LogBufferMutex);
-    if ( logMode < LOG_MAX_LEVEL ) 
+    if (logMode < LOG_MAX_LEVEL)
     {
         logOutLevelString = logString[logMode];
     }
-    if ( consoleLogLevel >= logMode ) 
-    { 
+    if (consoleLogLevel >= logMode)
+    {
         LogToConsole(logOutLevelString, moduleName, output);
     }
-    if ( fileLogLevel >= logMode ) 
+    if (fileLogLevel >= logMode)
     {
         LogToFile(logOutLevelString, moduleName, output);
-    }   
+    }
 #ifdef WITH_DLT
-    if ( dltLogLevel >= logMode ) 
+    if (dltLogLevel >= logMode)
     {
         LogToDltDaemon(logContext, logMode, moduleName, output);
-    }   
-#endif    
+    }
+#endif
     pthread_mutex_unlock(&m_LogBufferMutex);
 }
 
-void Log::LogToFile(std::string logMode, const std::string& moduleName,const std::basic_string<char>& output)
+void Log::LogToFile(std::string logMode, const std::string& moduleName, const std::basic_string<char>& output)
 {
     static unsigned int maxLengthModuleName = 0;
     static unsigned int maxLengthLogModeName = 0;
@@ -167,8 +164,8 @@ void Log::LogToFile(std::string logMode, const std::string& moduleName,const std
     }
 
     *m_fileStream << std::setw(maxLengthModuleName)  << std::left << moduleName << " | "
-              << std::setw(maxLengthLogModeName) << std::left << logMode    << " | "
-              << output << std::endl;
+                << std::setw(maxLengthLogModeName) << std::left << logMode << " | "
+                << output << std::endl;
 }
 
 void Log::LogToConsole(std::string logMode, const std::string& moduleName, const std::basic_string<char>& output)
@@ -187,20 +184,21 @@ void Log::LogToConsole(std::string logMode, const std::string& moduleName, const
     }
 
     std::cout << std::setw(maxLengthModuleName)  << std::left << moduleName << " | "
-              << std::setw(maxLengthLogModeName) << std::left << logMode    << " | "
-              << output << std::endl;
+                << std::setw(maxLengthLogModeName) << std::left << logMode << " | "
+                << output << std::endl;
 }
 
 LogContext Log::getLogContext()
 {
     return m_logContext;
 }
+
 #ifdef WITH_DLT
 int dlt_injection_callback(unsigned int module_id, void *data, unsigned int length)
 {
-    LOG_DEBUG("LOG","Injection for service " << module_id << " called");
+    LOG_DEBUG("LOG", "Injection for service " << module_id << " called");
     Log::diagnosticCallbackData *cbData = (*Log::getDiagnosticCallbackMap())[module_id];
-    if ( NULL != cbData) 
+    if (cbData)
     {
         cbData->diagFunc(module_id, data, length, cbData->userdata);
     }
@@ -208,27 +206,24 @@ int dlt_injection_callback(unsigned int module_id, void *data, unsigned int leng
 }
 #endif
 
-
-void Log::registerDiagnosticInjectionCallback( unsigned int module_id, diagnosticInjectionCallback diagFunc, void* userdata )
+void Log::registerDiagnosticInjectionCallback(unsigned int module_id, diagnosticInjectionCallback diagFunc, void* userdata)
 {
     Log::diagnosticCallbackData *cbData = new Log::diagnosticCallbackData;
     cbData->module_id = module_id;
     cbData->userdata = userdata;
     cbData->diagFunc = diagFunc;
-    (*m_diagnosticCallbackMap)[module_id]=cbData;
-#ifdef WITH_DLT    
+    (*m_diagnosticCallbackMap)[module_id] = cbData;
+#ifdef WITH_DLT
     DLT_REGISTER_INJECTION_CALLBACK(*(DltContext*)m_logContext, module_id, dlt_injection_callback);
 #endif
 }
-    
-void Log::unregisterDiagnosticInjectionCallback( unsigned int module_id )
+
+void Log::unregisterDiagnosticInjectionCallback(unsigned int module_id)
 {
     m_diagnosticCallbackMap->erase(module_id);
 }
 
-
-
-#ifdef WITH_DLT    
+#ifdef WITH_DLT
 
 // DLT macros will fail using -pedantic with
 // warning: ISO C++ forbids braced-groups within expressions
@@ -236,7 +231,6 @@ void Log::unregisterDiagnosticInjectionCallback( unsigned int module_id )
 
 void Log::LogToDltDaemon(LogContext logContext, LOG_MODES logMode, const std::string& moduleName, const std::basic_string<char>& output)
 {
-    
     std::stringstream oss;
     std::string dltString;
     static unsigned int maxLengthModuleName = 0;
@@ -246,17 +240,30 @@ void Log::LogToDltDaemon(LogContext logContext, LOG_MODES logMode, const std::st
         maxLengthModuleName = moduleName.length();
     }
     oss << std::setw(maxLengthModuleName)  << std::left << moduleName << " | "
-     << output << std::endl;
-    dltString = oss.str();                         
-    switch ( logMode ) 
+        << output << std::endl;
+    dltString = oss.str();
+
+    switch (logMode)
     {
-        case LOG_INFO : DLT_LOG(*((DltContext*)logContext),DLT_LOG_INFO,DLT_STRING(dltString.c_str())); break;
-        case LOG_ERROR : DLT_LOG(*((DltContext*)logContext),DLT_LOG_ERROR,DLT_STRING(dltString.c_str())); break;
-        case LOG_DEBUG : DLT_LOG(*((DltContext*)logContext),DLT_LOG_DEBUG,DLT_STRING(dltString.c_str())); break;
-        case LOG_WARNING : DLT_LOG(*((DltContext*)logContext),DLT_LOG_WARN,DLT_STRING(dltString.c_str())); break;
-        default:
-            DLT_LOG(*((DltContext*)logContext),DLT_LOG_INFO,DLT_STRING(dltString.c_str()));
+    case LOG_INFO:
+        DLT_LOG(*((DltContext*)logContext), DLT_LOG_INFO, DLT_STRING(dltString.c_str()));
+        break;
+
+    case LOG_ERROR:
+        DLT_LOG(*((DltContext*)logContext), DLT_LOG_ERROR, DLT_STRING(dltString.c_str()));
+        break;
+
+    case LOG_DEBUG:
+        DLT_LOG(*((DltContext*)logContext), DLT_LOG_DEBUG, DLT_STRING(dltString.c_str()));
+        break;
+
+    case LOG_WARNING:
+        DLT_LOG(*((DltContext*)logContext), DLT_LOG_WARN, DLT_STRING(dltString.c_str()));
+        break;
+
+    default:
+        DLT_LOG(*((DltContext*)logContext), DLT_LOG_INFO, DLT_STRING(dltString.c_str()));
     }
 }
-#endif              
+#endif
 
index 17cdecb..e19a05f 100644 (file)
@@ -44,7 +44,7 @@ LogMessageBuffer::LogMessageBuffer()
 
 LogMessageBuffer::~LogMessageBuffer()
 {
-    if (stream) 
+    if (stream)
     {
         delete stream;
     }
index deed952..202fd28 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- * 
+ *
  * Copyright 2010,2011 BMW Car IT GmbH
  *
  *
@@ -48,7 +48,7 @@ static void threadBaseMainLoopCleanup(void* arg)
     ((ThreadArgument*)arg)->obj->threadDestroyInThreadContext();
     pthread_mutex_unlock(((ThreadArgument*)arg)->runLock);
     *(((ThreadArgument*)arg)->running) = ILM_FALSE;
-    delete (ThreadArgument*)arg;
+    delete((ThreadArgument*)arg);
 }
 
 //===========================================================================
@@ -61,40 +61,40 @@ static void* threadBaseMainLoop(void* arg)
         LOG_ERROR("ThreadBase", "invalid thread argument (arg)");
         return NULL;
     }
-    
+
     if (!((ThreadArgument*)arg)->obj)
     {
         LOG_ERROR("ThreadBase", "invalid thread argument (obj)");
         return NULL;
     }
-    
+
     if (!((ThreadArgument*)arg)->running)
     {
         LOG_ERROR("ThreadBase", "invalid thread argument (running)");
         return NULL;
     }
-    
+
     // register cleanup function
     pthread_cleanup_push(threadBaseMainLoopCleanup, arg);
-    
+
     // init in thread context
     *(((ThreadArgument*)arg)->running) = ((ThreadArgument*)arg)->obj->threadInitInThreadContext();
-    
+
     // indicate initialization complete
     pthread_mutex_unlock(((ThreadArgument*)arg)->initLock);
-    
+
     // wait for start permit
     pthread_mutex_lock(((ThreadArgument*)arg)->runLock);
-    
+
     // run thread
     while (*(((ThreadArgument*)arg)->running))
     {
         *(((ThreadArgument*)arg)->running) = ((ThreadArgument*)arg)->obj->threadMainLoop();
     }
-    
+
     // execute cleanup handlers
     pthread_cleanup_pop(1);
-    
+
     return NULL;
 }
 
@@ -107,7 +107,7 @@ ThreadBase::ThreadBase()
 {
     pthread_mutex_init(&mRunLock, NULL);
     pthread_mutex_lock(&mRunLock);
-    
+
     pthread_mutex_init(&mInitLock, NULL);
     pthread_mutex_lock(&mInitLock);
 }
@@ -116,7 +116,7 @@ ThreadBase::~ThreadBase()
 {
     pthread_mutex_unlock(&mInitLock);
     pthread_mutex_destroy(&mInitLock);
-    
+
     pthread_mutex_unlock(&mRunLock);
     pthread_mutex_destroy(&mRunLock);
 }
@@ -128,7 +128,7 @@ pthread_t ThreadBase::threadGetId() const
 
 t_ilm_bool ThreadBase::threadIsRunning()
 {
-    if(0 == pthread_mutex_trylock(&mRunLock))
+    if (0 == pthread_mutex_trylock(&mRunLock))
     {
         pthread_mutex_unlock(&mRunLock);
         mRunning = ILM_FALSE;
@@ -146,17 +146,17 @@ t_ilm_bool ThreadBase::threadCreate()
     pthread_attr_init(&notificationThreadAttributes);
     pthread_attr_setdetachstate(&notificationThreadAttributes,
                                 PTHREAD_CREATE_JOINABLE);
-    
+
     ThreadArgument* arg = new ThreadArgument();
     arg->obj = this;
     arg->runLock = &mRunLock;
     arg->initLock = &mInitLock;
     arg->running = &mRunning;
-    
+
     int ret = pthread_create(&mThreadId,
-                             &notificationThreadAttributes,
-                             threadBaseMainLoop,
-                             (void*)arg);
+                                &notificationThreadAttributes,
+                                threadBaseMainLoop,
+                                (void*)arg);
     if (0 != ret)
     {
         LOG_ERROR("ThreadBase", "Failed to start thread.");
@@ -167,7 +167,7 @@ t_ilm_bool ThreadBase::threadCreate()
         LOG_DEBUG("ThreadBase", "Started thread (now " << mGlobalThreadCount << ")");
         mRunning = ILM_TRUE;
     }
-    
+
     return threadIsRunning();
 }
 
@@ -184,9 +184,9 @@ t_ilm_bool ThreadBase::threadStart()
 t_ilm_bool ThreadBase::threadStop()
 {
     t_ilm_bool result = ILM_TRUE;
-    
+
     mRunning = threadIsRunning();
-    
+
     if (mRunning)
     {
         LOG_INFO("ThreadBase", "pthread_cancel");
@@ -205,13 +205,13 @@ t_ilm_bool ThreadBase::threadStop()
             }
         }
     }
-    
+
     if (result)
     {
         --mGlobalThreadCount;
         LOG_DEBUG("ThreadBase", "Stopped thread (now " << mGlobalThreadCount << ")");
     }
-    
+
     return result;
 }