Graphic: Fix: changing display notification between threads
authorMichael Schuldt <michael.schuldt@bmw.de>
Thu, 12 Apr 2012 07:33:30 +0000 (09:33 +0200)
committerMichael Schuldt <michael.schuldt@bmw.de>
Thu, 12 Apr 2012 07:33:30 +0000 (09:33 +0200)
- If the LayerManager will work on another display as zero, there was
  a bug during signal redraw event.
- Now the global display environment variable is taken too.

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

index 86e08b5..40affd9 100644 (file)
@@ -79,6 +79,7 @@ private:
     bool m_initialized;
     bool m_success;
     X11WindowSystemStates m_systemState;
+    char* m_displayEnvironment;
 
 protected:
     Display* x11Display;
index b285ac6..79664c0 100644 (file)
@@ -50,6 +50,7 @@ X11WindowSystem::X11WindowSystem(const char* displayname, int width, int height,
 , m_initialized(false)
 , m_success(false)
 , m_systemState(IDLE_STATE)
+, m_displayEnvironment(NULL)
 , windowWidth(width)
 , windowHeight(height)
 {
@@ -86,15 +87,15 @@ XVisualInfo* X11WindowSystem::getDefaultVisual(Display *dpy)
 
 bool X11WindowSystem::OpenDisplayConnection()
 {
-    const char* displayEnvironment = getenv("DISPLAY");
+    m_displayEnvironment = getenv("DISPLAY");
 
-    if  (displayEnvironment == NULL )
+    if  (m_displayEnvironment == NULL )
     {
-        displayEnvironment = ":0.0";
-        setenv("DISPLAY",displayEnvironment,1);
+        m_displayEnvironment = ":0.0";
+        setenv("DISPLAY",m_displayEnvironment,1);
     }
 
-    x11Display = XOpenDisplay(displayEnvironment);
+    x11Display = XOpenDisplay(m_displayEnvironment);
     if (!x11Display)
     {
         LOG_ERROR("X11WindowSystem", "Couldn't open default display!");
@@ -944,7 +945,7 @@ void X11WindowSystem::wakeUpRendererThread()
     LOG_DEBUG("X11WindowSystem", "Sending dummy event to wake up renderer thread");
     if (NULL == displaySignal )
     {
-        displaySignal = XOpenDisplay(":0");
+        displaySignal = XOpenDisplay(m_displayEnvironment);
     }
     XExposeEvent ev = { Expose, 0, 1, displaySignal, CompositorWindow, 0, 0, 100, 100, 0 };
     XLockDisplay(displaySignal);