diff options
author | marha <marha@users.sourceforge.net> | 2012-03-26 14:23:28 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-03-26 14:23:28 +0200 |
commit | 76bcc36ed305418a3ddc5752d287ede894243e1b (patch) | |
tree | bacb320c825768471ce56f058f17ce863d592376 /xorg-server/damageext | |
parent | 7d894e32566b710952c44cbc71939ad1d9e2fa8d (diff) | |
parent | 0f834b91a4768673833ab4917e87d86c237bb1a6 (diff) | |
download | vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.gz vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.bz2 vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
pixman/pixman/pixman-mmx.c
xorg-server/Xext/shm.c
xorg-server/Xext/syncsrv.h
xorg-server/Xext/xvmain.c
xorg-server/Xi/exevents.c
xorg-server/Xi/opendev.c
xorg-server/composite/compalloc.c
xorg-server/composite/compoverlay.c
xorg-server/dix/colormap.c
xorg-server/dix/devices.c
xorg-server/dix/dispatch.c
xorg-server/dix/dixfonts.c
xorg-server/dix/eventconvert.c
xorg-server/dix/events.c
xorg-server/dix/gc.c
xorg-server/dix/getevents.c
xorg-server/dix/main.c
xorg-server/dix/privates.c
xorg-server/dix/registry.c
xorg-server/dix/resource.c
xorg-server/exa/exa_accel.c
xorg-server/exa/exa_migration_classic.c
xorg-server/exa/exa_unaccel.c
xorg-server/fb/fb.h
xorg-server/fb/fbcopy.c
xorg-server/fb/fbpixmap.c
xorg-server/glx/dispatch.h
xorg-server/glx/glapi.h
xorg-server/glx/glapi_gentable.c
xorg-server/glx/glapitable.h
xorg-server/glx/glprocs.h
xorg-server/glx/glxcmds.c
xorg-server/glx/glxcmdsswap.c
xorg-server/glx/glxdricommon.c
xorg-server/glx/glxdriswrast.c
xorg-server/glx/glxext.c
xorg-server/glx/indirect_dispatch.c
xorg-server/glx/indirect_dispatch.h
xorg-server/glx/indirect_dispatch_swap.c
xorg-server/glx/indirect_size.h
xorg-server/glx/indirect_size_get.h
xorg-server/glx/indirect_table.c
xorg-server/glx/indirect_util.c
xorg-server/glx/rensize.c
xorg-server/glx/single2swap.c
xorg-server/glx/singlepix.c
xorg-server/glx/singlepixswap.c
xorg-server/glx/singlesize.c
xorg-server/hw/dmx/dmxinit.c
xorg-server/hw/kdrive/ephyr/ephyr.c
xorg-server/hw/kdrive/ephyr/hostx.c
xorg-server/hw/kdrive/ephyr/hostx.h
xorg-server/hw/kdrive/src/kinput.c
xorg-server/hw/xfree86/common/compiler.h
xorg-server/hw/xwin/InitInput.c
xorg-server/hw/xwin/InitOutput.c
xorg-server/hw/xwin/ddraw.h
xorg-server/hw/xwin/glx/glwrap.c
xorg-server/hw/xwin/glx/indirect.c
xorg-server/hw/xwin/glx/wgl_ext_api.h
xorg-server/hw/xwin/glx/winpriv.c
xorg-server/hw/xwin/win.h
xorg-server/hw/xwin/winallpriv.c
xorg-server/hw/xwin/winauth.c
xorg-server/hw/xwin/winclipboard.h
xorg-server/hw/xwin/winclipboardinit.c
xorg-server/hw/xwin/winclipboardthread.c
xorg-server/hw/xwin/winclipboardunicode.c
xorg-server/hw/xwin/winclipboardwndproc.c
xorg-server/hw/xwin/winclipboardwrappers.c
xorg-server/hw/xwin/winclipboardxevents.c
xorg-server/hw/xwin/wincmap.c
xorg-server/hw/xwin/winconfig.c
xorg-server/hw/xwin/wincreatewnd.c
xorg-server/hw/xwin/wincursor.c
xorg-server/hw/xwin/windialogs.c
xorg-server/hw/xwin/winengine.c
xorg-server/hw/xwin/winerror.c
xorg-server/hw/xwin/wingc.c
xorg-server/hw/xwin/wingetsp.c
xorg-server/hw/xwin/winkeybd.c
xorg-server/hw/xwin/winkeybd.h
xorg-server/hw/xwin/winlayouts.h
xorg-server/hw/xwin/winmisc.c
xorg-server/hw/xwin/winmonitors.c
xorg-server/hw/xwin/winmouse.c
xorg-server/hw/xwin/winmsg.c
xorg-server/hw/xwin/winmsg.h
xorg-server/hw/xwin/winmultiwindowclass.c
xorg-server/hw/xwin/winmultiwindowicons.c
xorg-server/hw/xwin/winmultiwindowshape.c
xorg-server/hw/xwin/winmultiwindowwindow.c
xorg-server/hw/xwin/winmultiwindowwm.c
xorg-server/hw/xwin/winmultiwindowwndproc.c
xorg-server/hw/xwin/winnativegdi.c
xorg-server/hw/xwin/winpfbdd.c
xorg-server/hw/xwin/winpixmap.c
xorg-server/hw/xwin/winpolyline.c
xorg-server/hw/xwin/winprefs.c
xorg-server/hw/xwin/winprocarg.c
xorg-server/hw/xwin/winregistry.c
xorg-server/hw/xwin/winscrinit.c
xorg-server/hw/xwin/winsetsp.c
xorg-server/hw/xwin/winshaddd.c
xorg-server/hw/xwin/winshadddnl.c
xorg-server/hw/xwin/winshadgdi.c
xorg-server/hw/xwin/wintrayicon.c
xorg-server/hw/xwin/winwin32rootless.c
xorg-server/hw/xwin/winwin32rootlesswindow.c
xorg-server/hw/xwin/winwin32rootlesswndproc.c
xorg-server/hw/xwin/winwindow.c
xorg-server/hw/xwin/winwindow.h
xorg-server/hw/xwin/winwindowswm.c
xorg-server/hw/xwin/winwndproc.c
xorg-server/include/callback.h
xorg-server/include/dixstruct.h
xorg-server/include/misc.h
xorg-server/include/os.h
xorg-server/include/scrnintstr.h
xorg-server/mi/micmap.c
xorg-server/mi/miinitext.c
xorg-server/mi/mioverlay.c
xorg-server/mi/misprite.c
xorg-server/mi/mivaltree.c
xorg-server/mi/miwindow.c
xorg-server/miext/damage/damage.c
xorg-server/miext/rootless/rootlessGC.c
xorg-server/miext/rootless/rootlessWindow.c
xorg-server/os/WaitFor.c
xorg-server/os/access.c
xorg-server/os/connection.c
xorg-server/os/io.c
xorg-server/os/log.c
xorg-server/os/osinit.c
xorg-server/os/utils.c
xorg-server/os/xdmcp.c
xorg-server/os/xprintf.c
xorg-server/os/xstrans.c
xorg-server/render/mipict.c
xorg-server/xkb/xkbActions.c
xorg-server/xkb/xkbInit.c
xorg-server/xkeyboard-config/compat/default.in
Diffstat (limited to 'xorg-server/damageext')
-rw-r--r-- | xorg-server/damageext/damageext.c | 424 |
1 files changed, 204 insertions, 220 deletions
diff --git a/xorg-server/damageext/damageext.c b/xorg-server/damageext/damageext.c index 86f880c1e..f21f71ca8 100644 --- a/xorg-server/damageext/damageext.c +++ b/xorg-server/damageext/damageext.c @@ -27,24 +27,25 @@ #include "damageextint.h" #include "protocol-versions.h" -static unsigned char DamageReqCode; -static int DamageEventBase; -static RESTYPE DamageExtType; -static RESTYPE DamageExtWinType; +static unsigned char DamageReqCode; +static int DamageEventBase; +static RESTYPE DamageExtType; +static RESTYPE DamageExtWinType; static DevPrivateKeyRec DamageClientPrivateKeyRec; + #define DamageClientPrivateKey (&DamageClientPrivateKeyRec) static void -DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes) +DamageExtNotify(DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes) { - ClientPtr pClient = pDamageExt->pClient; - DamageClientPtr pDamageClient = GetDamageClient (pClient); - DrawablePtr pDrawable = pDamageExt->pDrawable; - xDamageNotifyEvent ev; - int i; + ClientPtr pClient = pDamageExt->pClient; + DamageClientPtr pDamageClient = GetDamageClient(pClient); + DrawablePtr pDrawable = pDamageExt->pDrawable; + xDamageNotifyEvent ev; + int i; - UpdateCurrentTimeIf (); + UpdateCurrentTimeIf(); ev.type = DamageEventBase + XDamageNotify; ev.level = pDamageExt->level; ev.drawable = pDamageExt->drawable; @@ -54,81 +55,79 @@ DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes) ev.geometry.y = pDrawable->y; ev.geometry.width = pDrawable->width; ev.geometry.height = pDrawable->height; - if (pBoxes) - { - for (i = 0; i < nBoxes; i++) - { - ev.level = pDamageExt->level; - if (i < nBoxes - 1) - ev.level |= DamageNotifyMore; - ev.area.x = pBoxes[i].x1; - ev.area.y = pBoxes[i].y1; - ev.area.width = pBoxes[i].x2 - pBoxes[i].x1; - ev.area.height = pBoxes[i].y2 - pBoxes[i].y1; - WriteEventsToClient (pClient, 1, (xEvent *) &ev); - } + if (pBoxes) { + for (i = 0; i < nBoxes; i++) { + ev.level = pDamageExt->level; + if (i < nBoxes - 1) + ev.level |= DamageNotifyMore; + ev.area.x = pBoxes[i].x1; + ev.area.y = pBoxes[i].y1; + ev.area.width = pBoxes[i].x2 - pBoxes[i].x1; + ev.area.height = pBoxes[i].y2 - pBoxes[i].y1; + WriteEventsToClient(pClient, 1, (xEvent *) &ev); + } } - else - { - ev.area.x = 0; - ev.area.y = 0; - ev.area.width = pDrawable->width; - ev.area.height = pDrawable->height; - WriteEventsToClient (pClient, 1, (xEvent *) &ev); + else { + ev.area.x = 0; + ev.area.y = 0; + ev.area.width = pDrawable->width; + ev.area.height = pDrawable->height; + WriteEventsToClient(pClient, 1, (xEvent *) &ev); } /* Composite extension marks clients with manual Subwindows as critical */ - if (pDamageClient->critical > 0) - { - SetCriticalOutputPending (); - pClient->smart_priority = SMART_MAX_PRIORITY; + if (pDamageClient->critical > 0) { + SetCriticalOutputPending(); + pClient->smart_priority = SMART_MAX_PRIORITY; } } static void -DamageExtReport (DamagePtr pDamage, RegionPtr pRegion, void *closure) +DamageExtReport(DamagePtr pDamage, RegionPtr pRegion, void *closure) { - DamageExtPtr pDamageExt = closure; + DamageExtPtr pDamageExt = closure; switch (pDamageExt->level) { case DamageReportRawRegion: case DamageReportDeltaRegion: - DamageExtNotify (pDamageExt, RegionRects(pRegion), RegionNumRects(pRegion)); - break; + DamageExtNotify(pDamageExt, RegionRects(pRegion), + RegionNumRects(pRegion)); + break; case DamageReportBoundingBox: - DamageExtNotify (pDamageExt, RegionExtents(pRegion), 1); - break; + DamageExtNotify(pDamageExt, RegionExtents(pRegion), 1); + break; case DamageReportNonEmpty: - DamageExtNotify (pDamageExt, NullBox, 0); - break; + DamageExtNotify(pDamageExt, NullBox, 0); + break; case DamageReportNone: - break; + break; } } static void -DamageExtDestroy (DamagePtr pDamage, void *closure) +DamageExtDestroy(DamagePtr pDamage, void *closure) { - DamageExtPtr pDamageExt = closure; - + DamageExtPtr pDamageExt = closure; + pDamageExt->pDamage = 0; if (pDamageExt->id) - FreeResource (pDamageExt->id, RT_NONE); + FreeResource(pDamageExt->id, RT_NONE); } void -DamageExtSetCritical (ClientPtr pClient, Bool critical) +DamageExtSetCritical(ClientPtr pClient, Bool critical) { - DamageClientPtr pDamageClient = GetDamageClient (pClient); + DamageClientPtr pDamageClient = GetDamageClient(pClient); if (pDamageClient) - pDamageClient->critical += critical ? 1 : -1; + pDamageClient->critical += critical ? 1 : -1; } static int ProcDamageQueryVersion(ClientPtr client) { - DamageClientPtr pDamageClient = GetDamageClient (client); + DamageClientPtr pDamageClient = GetDamageClient(client); xDamageQueryVersionReply rep; + REQUEST(xDamageQueryVersionReq); REQUEST_SIZE_MATCH(xDamageQueryVersionReq); @@ -136,157 +135,153 @@ ProcDamageQueryVersion(ClientPtr client) rep.length = 0; rep.sequenceNumber = client->sequence; if (stuff->majorVersion < SERVER_DAMAGE_MAJOR_VERSION) { - rep.majorVersion = stuff->majorVersion; - rep.minorVersion = stuff->minorVersion; - } else { - rep.majorVersion = SERVER_DAMAGE_MAJOR_VERSION; - if (stuff->majorVersion == SERVER_DAMAGE_MAJOR_VERSION && - stuff->minorVersion < SERVER_DAMAGE_MINOR_VERSION) - rep.minorVersion = stuff->minorVersion; - else - rep.minorVersion = SERVER_DAMAGE_MINOR_VERSION; + rep.majorVersion = stuff->majorVersion; + rep.minorVersion = stuff->minorVersion; + } + else { + rep.majorVersion = SERVER_DAMAGE_MAJOR_VERSION; + if (stuff->majorVersion == SERVER_DAMAGE_MAJOR_VERSION && + stuff->minorVersion < SERVER_DAMAGE_MINOR_VERSION) + rep.minorVersion = stuff->minorVersion; + else + rep.minorVersion = SERVER_DAMAGE_MINOR_VERSION; } pDamageClient->major_version = rep.majorVersion; pDamageClient->minor_version = rep.minorVersion; if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.majorVersion); - swapl(&rep.minorVersion); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.majorVersion); + swapl(&rep.minorVersion); } - WriteToClient(client, sizeof(xDamageQueryVersionReply), (char *)&rep); + WriteToClient(client, sizeof(xDamageQueryVersionReply), (char *) &rep); return Success; } static int -ProcDamageCreate (ClientPtr client) +ProcDamageCreate(ClientPtr client) { - DrawablePtr pDrawable; - DamageExtPtr pDamageExt; - DamageReportLevel level; - RegionPtr pRegion; - int rc; - + DrawablePtr pDrawable; + DamageExtPtr pDamageExt; + DamageReportLevel level; + RegionPtr pRegion; + int rc; + REQUEST(xDamageCreateReq); REQUEST_SIZE_MATCH(xDamageCreateReq); LEGAL_NEW_RESOURCE(stuff->damage, client); rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, - DixGetAttrAccess|DixReadAccess); + DixGetAttrAccess | DixReadAccess); if (rc != Success) - return rc; + return rc; switch (stuff->level) { case XDamageReportRawRectangles: - level = DamageReportRawRegion; - break; + level = DamageReportRawRegion; + break; case XDamageReportDeltaRectangles: - level = DamageReportDeltaRegion; - break; + level = DamageReportDeltaRegion; + break; case XDamageReportBoundingBox: - level = DamageReportBoundingBox; - break; + level = DamageReportBoundingBox; + break; case XDamageReportNonEmpty: - level = DamageReportNonEmpty; - break; + level = DamageReportNonEmpty; + break; default: - client->errorValue = stuff->level; - return BadValue; + client->errorValue = stuff->level; + return BadValue; } - - pDamageExt = malloc(sizeof (DamageExtRec)); + + pDamageExt = malloc(sizeof(DamageExtRec)); if (!pDamageExt) - return BadAlloc; + return BadAlloc; pDamageExt->id = stuff->damage; pDamageExt->drawable = stuff->drawable; pDamageExt->pDrawable = pDrawable; pDamageExt->level = level; pDamageExt->pClient = client; - pDamageExt->pDamage = DamageCreate (DamageExtReport, - DamageExtDestroy, - level, - FALSE, - pDrawable->pScreen, - pDamageExt); - if (!pDamageExt->pDamage) - { - free(pDamageExt); - return BadAlloc; + pDamageExt->pDamage = DamageCreate(DamageExtReport, + DamageExtDestroy, + level, + FALSE, pDrawable->pScreen, pDamageExt); + if (!pDamageExt->pDamage) { + free(pDamageExt); + return BadAlloc; } - if (!AddResource (stuff->damage, DamageExtType, (pointer) pDamageExt)) - return BadAlloc; + if (!AddResource(stuff->damage, DamageExtType, (pointer) pDamageExt)) + return BadAlloc; - DamageSetReportAfterOp (pDamageExt->pDamage, TRUE); - DamageRegister (pDamageExt->pDrawable, pDamageExt->pDamage); + DamageSetReportAfterOp(pDamageExt->pDamage, TRUE); + DamageRegister(pDamageExt->pDrawable, pDamageExt->pDamage); - if (pDrawable->type == DRAWABLE_WINDOW) - { - pRegion = &((WindowPtr) pDrawable)->borderClip; - DamageReportDamage(pDamageExt->pDamage, pRegion); + if (pDrawable->type == DRAWABLE_WINDOW) { + pRegion = &((WindowPtr) pDrawable)->borderClip; + DamageReportDamage(pDamageExt->pDamage, pRegion); } return Success; } static int -ProcDamageDestroy (ClientPtr client) +ProcDamageDestroy(ClientPtr client) { REQUEST(xDamageDestroyReq); - DamageExtPtr pDamageExt; + DamageExtPtr pDamageExt; REQUEST_SIZE_MATCH(xDamageDestroyReq); VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess); - FreeResource (stuff->damage, RT_NONE); + FreeResource(stuff->damage, RT_NONE); return Success; } static int -ProcDamageSubtract (ClientPtr client) +ProcDamageSubtract(ClientPtr client) { REQUEST(xDamageSubtractReq); - DamageExtPtr pDamageExt; - RegionPtr pRepair; - RegionPtr pParts; + DamageExtPtr pDamageExt; + RegionPtr pRepair; + RegionPtr pParts; REQUEST_SIZE_MATCH(xDamageSubtractReq); VERIFY_DAMAGEEXT(pDamageExt, stuff->damage, client, DixWriteAccess); VERIFY_REGION_OR_NONE(pRepair, stuff->repair, client, DixWriteAccess); VERIFY_REGION_OR_NONE(pParts, stuff->parts, client, DixWriteAccess); - if (pDamageExt->level != DamageReportRawRegion) - { - DamagePtr pDamage = pDamageExt->pDamage; - if (pRepair) - { - if (pParts) - RegionIntersect(pParts, DamageRegion (pDamage), pRepair); - if (DamageSubtract (pDamage, pRepair)) - DamageExtReport (pDamage, DamageRegion (pDamage), (void *) pDamageExt); - } - else - { - if (pParts) - RegionCopy(pParts, DamageRegion (pDamage)); - DamageEmpty (pDamage); - } + if (pDamageExt->level != DamageReportRawRegion) { + DamagePtr pDamage = pDamageExt->pDamage; + + if (pRepair) { + if (pParts) + RegionIntersect(pParts, DamageRegion(pDamage), pRepair); + if (DamageSubtract(pDamage, pRepair)) + DamageExtReport(pDamage, DamageRegion(pDamage), + (void *) pDamageExt); + } + else { + if (pParts) + RegionCopy(pParts, DamageRegion(pDamage)); + DamageEmpty(pDamage); + } } return Success; } static int -ProcDamageAdd (ClientPtr client) +ProcDamageAdd(ClientPtr client) { REQUEST(xDamageAddReq); - DrawablePtr pDrawable; - RegionPtr pRegion; - int rc; + DrawablePtr pDrawable; + RegionPtr pRegion; + int rc; REQUEST_SIZE_MATCH(xDamageAddReq); VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess); rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, - DixWriteAccess); + DixWriteAccess); if (rc != Success) - return rc; + return rc; /* The region is relative to the drawable origin, so translate it out to * screen coordinates like damage expects. @@ -300,33 +295,29 @@ ProcDamageAdd (ClientPtr client) /* Major version controls available requests */ static const int version_requests[] = { - X_DamageQueryVersion, /* before client sends QueryVersion */ - X_DamageAdd, /* Version 1 */ + X_DamageQueryVersion, /* before client sends QueryVersion */ + X_DamageAdd, /* Version 1 */ }; #define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0])) - -static int (*ProcDamageVector[XDamageNumberRequests])(ClientPtr) = { + +static int (*ProcDamageVector[XDamageNumberRequests]) (ClientPtr) = { /*************** Version 1 ******************/ ProcDamageQueryVersion, - ProcDamageCreate, - ProcDamageDestroy, - ProcDamageSubtract, + ProcDamageCreate, ProcDamageDestroy, ProcDamageSubtract, /*************** Version 1.1 ****************/ - ProcDamageAdd, -}; - +ProcDamageAdd,}; static int -ProcDamageDispatch (ClientPtr client) +ProcDamageDispatch(ClientPtr client) { REQUEST(xDamageReq); - DamageClientPtr pDamageClient = GetDamageClient (client); + DamageClientPtr pDamageClient = GetDamageClient(client); if (pDamageClient->major_version >= NUM_VERSION_REQUESTS) - return BadRequest; + return BadRequest; if (stuff->damageReqType > version_requests[pDamageClient->major_version]) - return BadRequest; + return BadRequest; return (*ProcDamageVector[stuff->damageReqType]) (client); } @@ -343,10 +334,10 @@ SProcDamageQueryVersion(ClientPtr client) } static int -SProcDamageCreate (ClientPtr client) +SProcDamageCreate(ClientPtr client) { REQUEST(xDamageCreateReq); - + swaps(&stuff->length); REQUEST_SIZE_MATCH(xDamageCreateReq); swapl(&stuff->damage); @@ -355,10 +346,10 @@ SProcDamageCreate (ClientPtr client) } static int -SProcDamageDestroy (ClientPtr client) +SProcDamageDestroy(ClientPtr client) { REQUEST(xDamageDestroyReq); - + swaps(&stuff->length); REQUEST_SIZE_MATCH(xDamageDestroyReq); swapl(&stuff->damage); @@ -366,10 +357,10 @@ SProcDamageDestroy (ClientPtr client) } static int -SProcDamageSubtract (ClientPtr client) +SProcDamageSubtract(ClientPtr client) { REQUEST(xDamageSubtractReq); - + swaps(&stuff->length); REQUEST_SIZE_MATCH(xDamageSubtractReq); swapl(&stuff->damage); @@ -379,7 +370,7 @@ SProcDamageSubtract (ClientPtr client) } static int -SProcDamageAdd (ClientPtr client) +SProcDamageAdd(ClientPtr client) { REQUEST(xDamageAddReq); @@ -390,126 +381,119 @@ SProcDamageAdd (ClientPtr client) return (*ProcDamageVector[stuff->damageReqType]) (client); } -static int (*SProcDamageVector[XDamageNumberRequests])(ClientPtr) = { +static int (*SProcDamageVector[XDamageNumberRequests]) (ClientPtr) = { /*************** Version 1 ******************/ SProcDamageQueryVersion, - SProcDamageCreate, - SProcDamageDestroy, - SProcDamageSubtract, + SProcDamageCreate, SProcDamageDestroy, SProcDamageSubtract, /*************** Version 1.1 ****************/ - SProcDamageAdd, -}; +SProcDamageAdd,}; static int -SProcDamageDispatch (ClientPtr client) +SProcDamageDispatch(ClientPtr client) { REQUEST(xDamageReq); if (stuff->damageReqType >= XDamageNumberRequests) - return BadRequest; + return BadRequest; return (*SProcDamageVector[stuff->damageReqType]) (client); } static void -DamageClientCallback (CallbackListPtr *list, - pointer closure, - pointer data) +DamageClientCallback(CallbackListPtr *list, pointer closure, pointer data) { - NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; - ClientPtr pClient = clientinfo->client; - DamageClientPtr pDamageClient = GetDamageClient (pClient); + NewClientInfoRec *clientinfo = (NewClientInfoRec *) data; + ClientPtr pClient = clientinfo->client; + DamageClientPtr pDamageClient = GetDamageClient(pClient); pDamageClient->critical = 0; pDamageClient->major_version = 0; pDamageClient->minor_version = 0; } -/*ARGSUSED*/ -static void -DamageResetProc (ExtensionEntry *extEntry) + /*ARGSUSED*/ static void +DamageResetProc(ExtensionEntry * extEntry) { - DeleteCallback (&ClientStateCallback, DamageClientCallback, 0); + DeleteCallback(&ClientStateCallback, DamageClientCallback, 0); } static int -FreeDamageExt (pointer value, XID did) +FreeDamageExt(pointer value, XID did) { - DamageExtPtr pDamageExt = (DamageExtPtr) value; + DamageExtPtr pDamageExt = (DamageExtPtr) value; /* * Get rid of the resource table entry hanging from the window id */ pDamageExt->id = 0; if (WindowDrawable(pDamageExt->pDrawable->type)) - FreeResourceByType (pDamageExt->pDrawable->id, DamageExtWinType, TRUE); - if (pDamageExt->pDamage) - { - DamageUnregister (pDamageExt->pDrawable, pDamageExt->pDamage); - DamageDestroy (pDamageExt->pDamage); + FreeResourceByType(pDamageExt->pDrawable->id, DamageExtWinType, TRUE); + if (pDamageExt->pDamage) { + DamageUnregister(pDamageExt->pDrawable, pDamageExt->pDamage); + DamageDestroy(pDamageExt->pDamage); } free(pDamageExt); return Success; } static int -FreeDamageExtWin (pointer value, XID wid) +FreeDamageExtWin(pointer value, XID wid) { - DamageExtPtr pDamageExt = (DamageExtPtr) value; + DamageExtPtr pDamageExt = (DamageExtPtr) value; if (pDamageExt->id) - FreeResource (pDamageExt->id, RT_NONE); + FreeResource(pDamageExt->id, RT_NONE); return Success; } static void -SDamageNotifyEvent (xDamageNotifyEvent *from, - xDamageNotifyEvent *to) +SDamageNotifyEvent(xDamageNotifyEvent * from, xDamageNotifyEvent * to) { to->type = from->type; - cpswaps (from->sequenceNumber, to->sequenceNumber); - cpswapl (from->drawable, to->drawable); - cpswapl (from->damage, to->damage); - cpswaps (from->area.x, to->area.x); - cpswaps (from->area.y, to->area.y); - cpswaps (from->area.width, to->area.width); - cpswaps (from->area.height, to->area.height); - cpswaps (from->geometry.x, to->geometry.x); - cpswaps (from->geometry.y, to->geometry.y); - cpswaps (from->geometry.width, to->geometry.width); - cpswaps (from->geometry.height, to->geometry.height); + cpswaps(from->sequenceNumber, to->sequenceNumber); + cpswapl(from->drawable, to->drawable); + cpswapl(from->damage, to->damage); + cpswaps(from->area.x, to->area.x); + cpswaps(from->area.y, to->area.y); + cpswaps(from->area.width, to->area.width); + cpswaps(from->area.height, to->area.height); + cpswaps(from->geometry.x, to->geometry.x); + cpswaps(from->geometry.y, to->geometry.y); + cpswaps(from->geometry.width, to->geometry.width); + cpswaps(from->geometry.height, to->geometry.height); } void DamageExtensionInit(void) { ExtensionEntry *extEntry; - int s; + int s; for (s = 0; s < screenInfo.numScreens; s++) - DamageSetup (screenInfo.screens[s]); + DamageSetup(screenInfo.screens[s]); - DamageExtType = CreateNewResourceType (FreeDamageExt, "DamageExt"); + DamageExtType = CreateNewResourceType(FreeDamageExt, "DamageExt"); if (!DamageExtType) - return; + return; - DamageExtWinType = CreateNewResourceType (FreeDamageExtWin, "DamageExtWin"); + DamageExtWinType = CreateNewResourceType(FreeDamageExtWin, "DamageExtWin"); if (!DamageExtWinType) - return; - - if (!dixRegisterPrivateKey(&DamageClientPrivateKeyRec, PRIVATE_CLIENT, sizeof (DamageClientRec))) - return; - - if (!AddCallback (&ClientStateCallback, DamageClientCallback, 0)) - return; - - if ((extEntry = AddExtension(DAMAGE_NAME, XDamageNumberEvents, - XDamageNumberErrors, - ProcDamageDispatch, SProcDamageDispatch, - DamageResetProc, StandardMinorOpcode)) != 0) - { - DamageReqCode = (unsigned char)extEntry->base; - DamageEventBase = extEntry->eventBase; - EventSwapVector[DamageEventBase + XDamageNotify] = - (EventSwapPtr) SDamageNotifyEvent; - SetResourceTypeErrorValue(DamageExtType, extEntry->errorBase + BadDamage); + return; + + if (!dixRegisterPrivateKey + (&DamageClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(DamageClientRec))) + return; + + if (!AddCallback(&ClientStateCallback, DamageClientCallback, 0)) + return; + + if ((extEntry = AddExtension(DAMAGE_NAME, XDamageNumberEvents, + XDamageNumberErrors, + ProcDamageDispatch, SProcDamageDispatch, + DamageResetProc, StandardMinorOpcode)) != 0) { + DamageReqCode = (unsigned char) extEntry->base; + DamageEventBase = extEntry->eventBase; + EventSwapVector[DamageEventBase + XDamageNotify] = + (EventSwapPtr) SDamageNotifyEvent; + SetResourceTypeErrorValue(DamageExtType, + extEntry->errorBase + BadDamage); } } |