From a11edb74930476a3ec7ddf9fd4ce0d03b428dfa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 23 Mar 2011 15:49:01 -0400 Subject: [PATCH] Suppress exposures and implicit painting for some requests This is hand-crafted to avoid flickering when mcompositor flips the compsiting on and off. --- Xext/shape.c | 12 +++++++++--- composite/compext.c | 7 ++++++- dix/window.c | 20 ++++++++++++++++++++ include/window.h | 4 ++++ mi/miexpose.c | 14 +++++++++----- 5 files changed, 48 insertions(+), 9 deletions(-) diff --git a/Xext/shape.c b/Xext/shape.c index 115fc07..39f4e2d 100644 --- a/Xext/shape.c +++ b/Xext/shape.c @@ -300,9 +300,15 @@ ProcShapeRectangles (ClientPtr client) return BadValue; } - return RegionOperate (client, pWin, (int)stuff->destKind, - destRgn, srcRgn, (int)stuff->op, - stuff->xOff, stuff->yOff, createDefault); + PushSuppressExposure(); + + rc = RegionOperate (client, pWin, (int)stuff->destKind, + destRgn, srcRgn, (int)stuff->op, + stuff->xOff, stuff->yOff, createDefault); + + PopSuppressExposure(); + + return rc; } #ifdef PANORAMIX diff --git a/composite/compext.c b/composite/compext.c index fbd36b5..8bf57cd 100644 --- a/composite/compext.c +++ b/composite/compext.c @@ -151,12 +151,17 @@ ProcCompositeRedirectWindow (ClientPtr client) { WindowPtr pWin; REQUEST(xCompositeRedirectWindowReq); + int rc; REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq); VERIFY_WINDOW(pWin, stuff->window, client, DixSetAttrAccess|DixManageAccess|DixBlendAccess); - return compRedirectWindow (client, pWin, stuff->update); + PushSuppressExposure(); + rc = compRedirectWindow (client, pWin, stuff->update); + PopSuppressExposure(); + + return rc; } static int diff --git a/dix/window.c b/dix/window.c index 9be7064..0ab45ef 100644 --- a/dix/window.c +++ b/dix/window.c @@ -3684,3 +3684,23 @@ WindowParentHasDeviceCursor(WindowPtr pWin, } return FALSE; } + +static int suppress_count; + +Bool +SuppressExposures(void) +{ + return suppress_count > 0; +} + +void +PushSuppressExposure(void) +{ + suppress_count++; +} + +void +PopSuppressExposure(void) +{ + suppress_count--; +} diff --git a/include/window.h b/include/window.h index 6fb2f8c..04ca025 100644 --- a/include/window.h +++ b/include/window.h @@ -266,4 +266,8 @@ extern _X_EXPORT void DisableMapUnmapEvents( extern _X_EXPORT void EnableMapUnmapEvents( WindowPtr /* pWin */ ); +extern _X_EXPORT Bool SuppressExposures(void); +extern _X_EXPORT void PushSuppressExposure(void); +extern _X_EXPORT void PopSuppressExposure(void); + #endif /* WINDOW_H */ diff --git a/mi/miexpose.c b/mi/miexpose.c index 94258b8..333e03b 100644 --- a/mi/miexpose.c +++ b/mi/miexpose.c @@ -497,11 +497,15 @@ miWindowExposures( WindowPtr pWin, RegionPtr prgn, RegionPtr other_exposed) /* miPaintWindow doesn't clip, so we have to */ RegionIntersect(prgn, prgn, &pWin->clipList); } - if (prgn && !RegionNil(prgn)) - miPaintWindow(pWin, prgn, PW_BACKGROUND); - if (clientInterested && exposures && !RegionNil(exposures)) - miSendExposures(pWin, exposures, - pWin->drawable.x, pWin->drawable.y); + + if (!SuppressExposures()) { + if (prgn && !RegionNil(prgn)) + miPaintWindow(pWin, prgn, PW_BACKGROUND); + if (clientInterested && exposures && !RegionNil(exposures)) + miSendExposures(pWin, exposures, + pWin->drawable.x, pWin->drawable.y); + } + if (exposures == &expRec) { RegionUninit(exposures); -- 1.7.4.1