X11WindowSystem: Slight changes in inheritance behaviour
authorMichael Schuldt <michael.schuldt@bmw.de>
Thu, 30 Aug 2012 09:00:41 +0000 (11:00 +0200)
committerMichael Schuldt <michael.schuldt@bmw.de>
Thu, 30 Aug 2012 09:00:41 +0000 (11:00 +0200)
- All WindowSystems which are derived from the X11WindowSystem
  can now overwrite the calculateSurfaceFps and calculateFps Method.

LayerManagerPlugins/Renderers/Graphic/include/WindowSystems/X11WindowSystem.h
LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp

index 25d599c..fb52963 100644 (file)
@@ -92,6 +92,7 @@ protected:
     //    Window background;
     Window CompositorWindow;
     XVisualInfo* windowVis;
+    float m_fpsinterval;    
     pthread_mutex_t run_lock;
     pthread_mutex_t init_lock;
     pthread_cond_t init_condition;
@@ -100,7 +101,8 @@ protected:
     virtual bool initXServer();
     virtual void RedrawAllLayers(bool clear, bool swap);
     virtual void renderHWLayer(Layer* layer);
-
+    virtual void calculateFps();
+    virtual void calculateSurfaceFps(Surface *currentSurface, float time) ;
 private:
     void cleanup();
     void Screenshot();
@@ -122,13 +124,11 @@ private:
     bool CreatePixmapsForAllWindows();
     bool CreateCompositorWindow();
     void UnredirectSpecialWIndows(Window w);
-    void calculateFps();
-    void calculateSurfaceFps(Surface *currentSurface, float time) ;
+
     void printDebug();
     void* EventLoop();
     static int error(Display *dpy, XErrorEvent *ev);
     void ManageXInputEvent(InputDevice type, InputEventState state, XEvent *pevent);
-
     static bool m_xerror;
 
 
index ea364dc..1d3fbe8 100644 (file)
@@ -69,6 +69,7 @@ X11WindowSystem::X11WindowSystem(const char* displayname, int width, int height,
 , windowHeight(height)
 , CompositorWindow(0)
 , windowVis(0)
+, m_fpsinterval(10.0f)
 , run_lock()
 , graphicSystem(0)
 {
@@ -578,7 +579,7 @@ void X11WindowSystem::calculateFps()
     gettimeofday(&tv, NULL);
     timeSinceLastCalc = (float)(tv.tv_sec-tv0.tv_sec) + 0.000001*((float)(tv.tv_usec-tv0.tv_usec));
 
-    if (timeSinceLastCalc > 10.0f)
+    if (timeSinceLastCalc > m_fpsinterval)
     {
         FPS = ((float)(Frame)) / timeSinceLastCalc;
         char floatStringBuffer[256];