From e33459ec09cbcffad316f0a3edb2f0aa85174c82 Mon Sep 17 00:00:00 2001 From: Rahul Singhal Date: Tue, 13 Mar 2012 16:56:19 +0530 Subject: [PATCH] X11WindowSystem: Bug fixes in map/unmap window functions 1. Force surface update when its associated window is mapped/unmapped. This prevent the surface from showing stale frame. 2. Only unmap a X platform surface if is currently mapped --- .../Graphic/src/WindowSystems/X11WindowSystem.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp b/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp index 395ad4e..664de60 100644 --- a/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp +++ b/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp @@ -280,7 +280,7 @@ void X11WindowSystem::MapWindow(Window window) XPlatformSurface* x11surf = (XPlatformSurface*)surface->platform; if (x11surf->isMapped) { - LOG_WARNING("X11WindowSystem", "Platform surface already in use "); + LOG_WARNING("X11WindowSystem", "Platform surface already mapped"); return; } x11surf->isMapped = true; @@ -302,6 +302,7 @@ void X11WindowSystem::MapWindow(Window window) surface->OriginalSourceHeight = winHeight; surface->OriginalSourceWidth = winWidth; + surface->renderPropertyChanged = true; graphicSystem->getTextureBinder()->createClientBuffer(surface); XSync(x11Display, 0); @@ -330,8 +331,13 @@ void X11WindowSystem::UnMapWindow(Window window) LOG_WARNING("X11WindowSystem", "Platform surface not available for window " << window); return; } - XPlatformSurface* x11surf = (XPlatformSurface*)surface->platform; + XPlatformSurface* x11surf = (XPlatformSurface*)surface->platform; LOG_DEBUG("X11WindowSystem", "Unmapping surface " << surface->getID()); + if (!x11surf->isMapped) + { + LOG_WARNING("X11WindowSystem", "Platform surface already unmapped"); + return; + } x11surf->isMapped = false; @@ -345,6 +351,8 @@ void X11WindowSystem::UnMapWindow(Window window) int result = XFreePixmap(x11Display, x11surf->pixmap); LOG_DEBUG("X11WindowSystem", "XFreePixmap() returned " << result); } + + surface->renderPropertyChanged = true; } LOG_DEBUG("X11WindowSystem", "Unmap finished"); } @@ -421,8 +429,7 @@ void X11WindowSystem::DestroyWindow(Window window) LOG_DEBUG("X11WindowSystem", "Remove Native Content from Surface " << surface->getID()); surface->removeNativeContent(); delete surface->platform; - surface->platform = NULL; - surface->renderPropertyChanged = true; + surface->platform = NULL; } } -- 2.7.4