Skip to content

Commit

Permalink
dix: Drop the third argument from WindowExposuresProcPtr
Browse files Browse the repository at this point in the history
 Backport from X.org:

    dix: Drop the third argument from WindowExposuresProcPtr

    A careful read shows that it was always NULL.  It hasn't always been; as
    the DDX spec indicates, it was the "occluded region that has backing
    store", but since that backing store code is long gone, we can nuke it.

    mi{,Overlay}WindowExposures get slightly simpler here, and will get even
    simpler in just a moment.

    Reviewed-by: Julien Cristau <[email protected]>
    Signed-off-by: Adam Jackson <[email protected]>

    Backported to NX by: Mike Gabriel <[email protected]>
  • Loading branch information
nwnk authored and sunweaver committed Nov 21, 2017
1 parent 12eed42 commit 6de6173
Show file tree
Hide file tree
Showing 14 changed files with 51 additions and 91 deletions.
2 changes: 1 addition & 1 deletion nx-X11/programs/Xserver/dix/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -2760,7 +2760,7 @@ MapWindow(register WindowPtr pWin, ClientPtr client)
(*pScreen->PostValidateTree)(NullWindow, pWin, VTMap);
RegionNull(&temp);
RegionCopy(&temp, &pWin->clipList);
(*pScreen->WindowExposures) (pWin, &temp, NullRegion);
(*pScreen->WindowExposures) (pWin, &temp);
RegionUninit(&temp);
}

Expand Down
5 changes: 2 additions & 3 deletions nx-X11/programs/Xserver/fb/fboverlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,12 @@ fbOverlayCopyWindow(WindowPtr pWin,

void
fbOverlayWindowExposures (WindowPtr pWin,
RegionPtr prgn,
RegionPtr other_exposed)
RegionPtr prgn)
{
fbOverlayUpdateLayerRegion (pWin->drawable.pScreen,
fbOverlayWindowLayer (pWin),
prgn);
miWindowExposures(pWin, prgn, other_exposed);
miWindowExposures(pWin, prgn);
}

void
Expand Down
3 changes: 1 addition & 2 deletions nx-X11/programs/Xserver/fb/fboverlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ fbOverlayCopyWindow(WindowPtr pWin,

void
fbOverlayWindowExposures (WindowPtr pWin,
RegionPtr prgn,
RegionPtr other_exposed);
RegionPtr prgn);

void
fbOverlayPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what);
Expand Down
4 changes: 2 additions & 2 deletions nx-X11/programs/Xserver/hw/nxagent/Drawable.c
Original file line number Diff line number Diff line change
Expand Up @@ -3120,7 +3120,7 @@ void nxagentSendBackgroundExpose(WindowPtr pWin, PixmapPtr pBackground, RegionPt

RegionTranslate(&expose, pWin -> drawable.x, pWin -> drawable.y);

miWindowExposures(pWin, &expose, &expose);
miWindowExposures(pWin, &expose);

nxagentSendBackgroundExposeEnd:

Expand Down Expand Up @@ -3230,7 +3230,7 @@ int nxagentClipAndSendClearExpose(WindowPtr pWin, void * ptr)

RegionSubtract(remoteExposeRgn, remoteExposeRgn, exposeRgn);

miWindowExposures(pWin, exposeRgn, exposeRgn);
miWindowExposures(pWin, exposeRgn);
}

RegionDestroy(exposeRgn);
Expand Down
18 changes: 15 additions & 3 deletions nx-X11/programs/Xserver/hw/nxagent/Events.c
Original file line number Diff line number Diff line change
Expand Up @@ -2483,7 +2483,7 @@ FIXME: This can be maybe optimized by consuming the

if (index == -1)
{
miWindowExposures(pWin, &sum, NullRegion);
miWindowExposures(pWin, &sum);
}
else
{
Expand Down Expand Up @@ -2545,6 +2545,10 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X)

pWin = nxagentWindowPtr(X -> xgraphicsexpose.drawable);

if (pWin == 0) {
return 1;
}

/*
* Rectangle affected by GraphicsExpose
* event.
Expand All @@ -2563,6 +2567,14 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X)
* must be relative to the screen.
*/

// #ifdef TEST
fprintf(stderr, "nxagentHandleGraphicsExposeEvent: graphics expose event with expose region rectangle "
"x1 [%d], y1 [%d] and x2 [%d] y2 [%d]. and drawable [%ld] with x [%d] and y[%d].\n",
rect.x1, rect.y1, rect.x2, rect.y2,
X -> xgraphicsexpose.drawable,
pWin -> drawable.x, pWin -> drawable.y);
// #endif

RegionTranslate(exposeRegion, pWin -> drawable.x, pWin -> drawable.y);

RegionUnion(nxagentRemoteExposeRegion, nxagentRemoteExposeRegion, exposeRegion);
Expand Down Expand Up @@ -4036,7 +4048,7 @@ void nxagentSynchronizeExpose(void)
RegionNumRects(nxagentExposeQueueHead.remoteRegion));
#endif

miWindowExposures(pWin, nxagentExposeQueueHead.remoteRegion, NullRegion);
miWindowExposures(pWin, nxagentExposeQueueHead.remoteRegion);
}
}
}
Expand Down Expand Up @@ -4271,7 +4283,7 @@ int nxagentClipAndSendExpose(WindowPtr pWin, void * ptr)

RegionSubtract(remoteExposeRgn, remoteExposeRgn, exposeRgn);

miWindowExposures(pWin, exposeRgn, NullRegion);
miWindowExposures(pWin, exposeRgn);
}

RegionDestroy(exposeRgn);
Expand Down
21 changes: 4 additions & 17 deletions nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,16 +353,15 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
}

void
miWindowExposures(pWin, prgn, other_exposed)
miWindowExposures(pWin, prgn)
WindowPtr pWin;
register RegionPtr prgn, other_exposed;
register RegionPtr prgn;
{

int total;

RegionPtr exposures = prgn;
if ((prgn && !RegionNil(prgn)) ||
(exposures && !RegionNil(exposures)) || other_exposed)
if ((prgn && !RegionNil(prgn)) || (exposures && !RegionNil(exposures)))
{
RegionRec expRec;
int clientInterested;
Expand All @@ -371,18 +370,6 @@ miWindowExposures(pWin, prgn, other_exposed)
* Restore from backing-store FIRST.
*/
clientInterested = (pWin->eventMask|wOtherEventMasks(pWin)) & ExposureMask;
if (other_exposed)
{
if (exposures)
{
RegionUnion(other_exposed,
exposures,
other_exposed);
if (exposures != prgn)
RegionDestroy(exposures);
}
exposures = other_exposed;
}

/*
* If the number of rectangles is greater
Expand Down Expand Up @@ -424,7 +411,7 @@ miWindowExposures(pWin, prgn, other_exposed)
{
RegionUninit(exposures);
}
else if (exposures && exposures != prgn && exposures != other_exposed)
else if (exposures && exposures != prgn)
RegionDestroy(exposures);
if (prgn)
RegionEmpty(prgn);
Expand Down
2 changes: 1 addition & 1 deletion nx-X11/programs/Xserver/hw/nxagent/NXwindow.c
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ MapWindow(register WindowPtr pWin, ClientPtr client)
(*pScreen->PostValidateTree)(NullWindow, pWin, VTMap);
RegionNull(&temp);
RegionCopy(&temp, &pWin->clipList);
(*pScreen->WindowExposures) (pWin, &temp, NullRegion);
(*pScreen->WindowExposures) (pWin, &temp);
RegionUninit(&temp);
}

Expand Down
23 changes: 8 additions & 15 deletions nx-X11/programs/Xserver/hw/nxagent/Window.c
Original file line number Diff line number Diff line change
Expand Up @@ -2110,7 +2110,7 @@ void nxagentClipNotify(WindowPtr pWin, int dx, int dy)
#endif /* NXAGENT_SHAPE */
}

void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed)
void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn)
{
/*
* The problem: we want to synthetize the expose events internally, so
Expand Down Expand Up @@ -2202,11 +2202,6 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo
RegionUnion(&temp, &temp, pRgn);
}

if (other_exposed != NULL)
{
RegionUnion(&temp, &temp, other_exposed);
}

if (RegionNil(&temp) == 0)
{
RegionTranslate(&temp,
Expand Down Expand Up @@ -2281,12 +2276,11 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo
fprintf(stderr, "nxagentWindowExposures: WARNING! Reached maximum size of collect exposures vector.\n");
#endif

if ((pRgn != NULL && RegionNotEmpty(pRgn) != 0) ||
(other_exposed != NULL && RegionNotEmpty(other_exposed) != 0))
if (pRgn != NULL && RegionNotEmpty(pRgn) != 0)
{
nxagentUnmarkExposedRegion(pWin, pRgn, other_exposed);
nxagentUnmarkExposedRegion(pWin, pRgn, NullRegion);

miWindowExposures(pWin, pRgn, other_exposed);
miWindowExposures(pWin, pRgn);
}

return;
Expand All @@ -2296,12 +2290,11 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo
RegionUninit(&temp);
}

if ((pRgn != NULL && RegionNotEmpty(pRgn) != 0) ||
(other_exposed != NULL && RegionNotEmpty(other_exposed) != 0))
if (pRgn != NULL && RegionNotEmpty(pRgn) != 0)
{
nxagentUnmarkExposedRegion(pWin, pRgn, other_exposed);
nxagentUnmarkExposedRegion(pWin, pRgn, NullRegion);

miWindowExposures(pWin, pRgn, other_exposed);
miWindowExposures(pWin, pRgn);
}

return;
Expand Down Expand Up @@ -2489,7 +2482,7 @@ static int nxagentForceExposure(WindowPtr pWin, void * ptr)

if (exposedRgn != NULL && RegionNotEmpty(exposedRgn) != 0)
{
miWindowExposures(pWin, exposedRgn, NullRegion);
miWindowExposures(pWin, exposedRgn);
}

RegionDestroy(exposedRgn);
Expand Down
2 changes: 1 addition & 1 deletion nx-X11/programs/Xserver/hw/nxagent/Windows.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ Bool nxagentUnrealizeWindow(WindowPtr pWin);

Bool nxagentCheckIllegalRootMonitoring(WindowPtr pWin, Mask mask);

void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed);
void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn);

void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what);

Expand Down
3 changes: 1 addition & 2 deletions nx-X11/programs/Xserver/include/scrnintstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ typedef void (* PostValidateTreeProcPtr)(

typedef void (* WindowExposuresProcPtr)(
WindowPtr /*pWindow*/,
RegionPtr /*prgn*/,
RegionPtr /*other_exposed*/);
RegionPtr /*prgn*/);

typedef void (* PaintWindowProcPtr)(
WindowPtr /*pWindow*/,
Expand Down
3 changes: 1 addition & 2 deletions nx-X11/programs/Xserver/mi/mi.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,7 @@ extern void miSendExposures(

extern void miWindowExposures(
WindowPtr /*pWin*/,
RegionPtr /*prgn*/,
RegionPtr /*other_exposed*/
RegionPtr /*prgn*/
);

extern void miPaintWindow(
Expand Down
21 changes: 4 additions & 17 deletions nx-X11/programs/Xserver/mi/miexpose.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,12 @@ miSendExposures(pWin, pRgn, dx, dy)

#ifndef NXAGENT_SERVER
void
miWindowExposures(pWin, prgn, other_exposed)
miWindowExposures(pWin, prgn)
WindowPtr pWin;
register RegionPtr prgn, other_exposed;
register RegionPtr prgn;
{
RegionPtr exposures = prgn;
if ((prgn && !RegionNil(prgn)) ||
(exposures && !RegionNil(exposures)) || other_exposed)
if ((prgn && !RegionNil(prgn)) || (exposures && !RegionNil(exposures)))
{
RegionRec expRec;
int clientInterested;
Expand All @@ -480,18 +479,6 @@ miWindowExposures(pWin, prgn, other_exposed)
* Restore from backing-store FIRST.
*/
clientInterested = (pWin->eventMask|wOtherEventMasks(pWin)) & ExposureMask;
if (other_exposed)
{
if (exposures)
{
RegionUnion(other_exposed,
exposures,
other_exposed);
if (exposures != prgn)
RegionDestroy(exposures);
}
exposures = other_exposed;
}
if (clientInterested && exposures && (RegionNumRects(exposures) > RECTLIMIT))
{
/*
Expand Down Expand Up @@ -524,7 +511,7 @@ miWindowExposures(pWin, prgn, other_exposed)
{
RegionUninit(exposures);
}
else if (exposures && exposures != prgn && exposures != other_exposed)
else if (exposures && exposures != prgn)
RegionDestroy(exposures);
if (prgn)
RegionEmpty(prgn);
Expand Down
28 changes: 8 additions & 20 deletions nx-X11/programs/Xserver/mi/mioverlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static void miOverlayMarkUnrealizedWindow(WindowPtr, WindowPtr, Bool);
static int miOverlayValidateTree(WindowPtr, WindowPtr, VTKind);
static void miOverlayHandleExposures(WindowPtr);
static void miOverlayMoveWindow(WindowPtr, int, int, WindowPtr, VTKind);
static void miOverlayWindowExposures(WindowPtr, RegionPtr, RegionPtr);
static void miOverlayWindowExposures(WindowPtr, RegionPtr);
static void miOverlayResizeWindow(WindowPtr, int, int, unsigned int,
unsigned int, WindowPtr);
static void miOverlayClearToBackground(WindowPtr, int, int, int, int, Bool);
Expand Down Expand Up @@ -849,7 +849,7 @@ miOverlayHandleExposures(WindowPtr pWin)
miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
WindowPtr pChild;
ValidatePtr val;
void (* WindowExposures)(WindowPtr, RegionPtr, RegionPtr);
void (* WindowExposures)(WindowPtr, RegionPtr);

WindowExposures = pWin->drawable.pScreen->WindowExposures;
if(pPriv->underlayMarked) {
Expand All @@ -870,7 +870,7 @@ miOverlayHandleExposures(WindowPtr pWin)
pTree->pWin, &mival->borderExposed, PW_BORDER);
RegionUninit(&mival->borderExposed);

(*WindowExposures)(pTree->pWin,&mival->exposed,NullRegion);
(*WindowExposures)(pTree->pWin,&mival->exposed);
RegionUninit(&mival->exposed);
}
free(mival);
Expand Down Expand Up @@ -907,7 +907,7 @@ miOverlayHandleExposures(WindowPtr pWin)
(*pChild->drawable.pScreen->PaintWindowBorder)(pChild,
&val->after.borderExposed,
PW_BORDER);
(*WindowExposures)(pChild, &val->after.exposed, NullRegion);
(*WindowExposures)(pChild, &val->after.exposed);
}
RegionUninit(&val->after.borderExposed);
RegionUninit(&val->after.exposed);
Expand Down Expand Up @@ -1019,28 +1019,19 @@ miOverlayMoveWindow(
static void
miOverlayWindowExposures(
WindowPtr pWin,
register RegionPtr prgn,
RegionPtr other_exposed
register RegionPtr prgn
){
RegionPtr exposures = prgn;
ScreenPtr pScreen = pWin->drawable.pScreen;

if ((prgn && !RegionNil(prgn)) ||
(exposures && !RegionNil(exposures)) || other_exposed)
(exposures && !RegionNil(exposures)))
{
RegionRec expRec;
int clientInterested;

clientInterested = (pWin->eventMask|wOtherEventMasks(pWin)) &
ExposureMask;
if (other_exposed) {
if (exposures) {
RegionUnion(other_exposed, exposures, other_exposed);
if (exposures != prgn)
RegionDestroy(exposures);
}
exposures = other_exposed;
}
if (clientInterested && exposures &&
(RegionNumRects(exposures) > RECTLIMIT))
{
Expand Down Expand Up @@ -1075,7 +1066,7 @@ miOverlayWindowExposures(
if (exposures == &expRec) {
RegionUninit(exposures);
}
else if (exposures && exposures != prgn && exposures != other_exposed)
else if (exposures && exposures != prgn)
RegionDestroy(exposures);
if (prgn)
RegionEmpty(prgn);
Expand Down Expand Up @@ -1706,7 +1697,6 @@ miOverlayClearToBackground(
miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
BoxRec box;
RegionRec reg;
RegionPtr pBSReg = NullRegion;
ScreenPtr pScreen = pWin->drawable.pScreen;
miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
RegionPtr clipList;
Expand Down Expand Up @@ -1744,12 +1734,10 @@ miOverlayClearToBackground(

RegionIntersect(&reg, &reg, clipList);
if (generateExposures)
(*pScreen->WindowExposures)(pWin, &reg, pBSReg);
(*pScreen->WindowExposures)(pWin, &reg);
else if (pWin->backgroundState != None)
(*pScreen->PaintWindowBackground)(pWin, &reg, PW_BACKGROUND);
RegionUninit(&reg);
if (pBSReg)
RegionDestroy(pBSReg);
}


Expand Down
Loading

0 comments on commit 6de6173

Please sign in to comment.