From 46dd8d5c76cf7845f80a40529d29479341f47efc Mon Sep 17 00:00:00 2001 From: Michael Schuldt Date: Tue, 26 Mar 2013 03:16:41 -0700 Subject: [PATCH] X11WindowSystem: improved surface resize handling Signed-off-by: Michael Schuldt --- .../Graphic/src/WindowSystems/X11WindowSystem.cpp | 28 +++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp b/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp index 88a53b0..72feff4 100644 --- a/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp +++ b/LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp @@ -21,6 +21,7 @@ #include "config.h" #include "Log.h" #include "Layer.h" +#include "Rectangle.h" #include #include #include @@ -263,8 +264,6 @@ void X11WindowSystem::configureSurfaceWindow(Window window) if (isWindowValid(window)) { LOG_DEBUG("X11WindowSystem", "Updating window " << window); - UnMapWindow(window); - MapWindow(window); XWindowAttributes att; XGetWindowAttributes(x11Display, window, &att); int winWidth = att.width; @@ -284,11 +283,28 @@ void X11WindowSystem::configureSurfaceWindow(Window window) LOG_DEBUG("X11WindowSystem", "Updating surface " << surface->getID()); - surface->OriginalSourceHeight = winHeight; - surface->OriginalSourceWidth = winWidth; + if (surface->OriginalSourceHeight != winHeight || surface->OriginalSourceWidth != winWidth) + { + surface->OriginalSourceHeight = winHeight; + surface->OriginalSourceWidth = winWidth; + + surface->damaged = false; // Waiting for damage event to get updated content + surface->m_surfaceResized = true /*surface->synchronized*/; + + Rectangle newDestination = surface->getDestinationRegion(); + newDestination.width = surface->OriginalSourceWidth; + newDestination.height = surface->OriginalSourceHeight; + surface->setDestinationRegion(newDestination); + + Rectangle newSource = surface->getSourceRegion(); + newSource.width = surface->OriginalSourceWidth; + newSource.height = surface->OriginalSourceHeight; + surface->setSourceRegion(newSource); + } + + UnMapWindow(window); + MapWindow(window); - surface->damaged = false; // Waiting for damage event to get updated content - surface->m_surfaceResized = true /*surface->synchronized*/; LOG_DEBUG("X11WindowSystem", "Done Updating window " << window); } } -- 2.7.4