diff options
author | marha <marha@users.sourceforge.net> | 2013-12-22 12:51:45 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-12-22 12:51:45 +0100 |
commit | c81020559f329a516191927222b3698ba7370aca (patch) | |
tree | 6f004f5723ca41881b2ba703ed619a92faebfe16 /xorg-server/damageext | |
parent | c043f97a8572e1f509251288d8bcd70d0fb96770 (diff) | |
download | vcxsrv-c81020559f329a516191927222b3698ba7370aca.tar.gz vcxsrv-c81020559f329a516191927222b3698ba7370aca.tar.bz2 vcxsrv-c81020559f329a516191927222b3698ba7370aca.zip |
libxtrans fontconfig glproto libX11 libxcb xcbproto mesa xserver pixman xkeyboard-config git update 22 Dec 2013
xserver commit a68df147421da21528b5be2d34678383922fa352
libxcb commit f653464554469b5767f1c99abced25a76bace047
libxcb/xcb-proto commit 4087fc682c5ceb849b74442e17a6b73176e5eecb
xkeyboard-config commit a224a636139d22e1dc7ca7d23782cd656e87bcf5
libX11 commit 3d69b0a83e62f8f6fbdd952fc49cdbdf8825e1e6
libXdmcp commit 089081dca4ba3598c6f9bf401c029378943b5854
libXext commit bb24f2970f2e425f4df90c9b73d078ad15a73fbb
libfontenc commit 3acba630d8b57084f7e92c15732408711ed5137a
libXinerama commit edd95182b26eb5d576d4878c559e0f17dddaa909
libXau commit 304a11be4727c5a7feeb2501e8e001466f8ce84e
xkbcomp commit e3e6e938535532bfad175c1635256ab7fb3ac943
pixman commit 945ab7a6f3eb6241f07e8f094dc0e647d1f10d9d
xextproto commit 3f355f138d6df57e067458a20f47307883048adb
randrproto commit e7526e6b5fe0966929cda10b2ded0258413744db
glproto commit f84853d97d5749308992412a215fa518b6536eb3
mkfontscale commit 880a0c4733e62e54e6a0f1238c7430727d23657b
xwininfo commit ba0d1b0da21d2dbdd81098ed5778f3792b472e13
libXft commit 4acfdaf95adb0a05c2a25550bdde036c865902f4
libXmu commit 22d9c590901e121936f50dee97dc60c4f7defb63
libxtrans commit 2c0a7840a28ae696e80e73157856d7a049fdf6c7
fontconfig commit 5c725f2f5829238d16116f782d00d8bb0defaf08
mesa commit 2efe7927d38983029784825fc4897e9b77aa237e
Diffstat (limited to 'xorg-server/damageext')
-rw-r--r-- | xorg-server/damageext/damageext.c | 389 | ||||
-rw-r--r-- | xorg-server/damageext/damageextint.h | 3 |
2 files changed, 340 insertions, 52 deletions
diff --git a/xorg-server/damageext/damageext.c b/xorg-server/damageext/damageext.c index 9521c2676..5650953f2 100644 --- a/xorg-server/damageext/damageext.c +++ b/xorg-server/damageext/damageext.c @@ -1,5 +1,6 @@ /* * Copyright © 2002 Keith Packard + * Copyright 2013 Red Hat, Inc. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -25,9 +26,24 @@ #endif #include "damageextint.h" +#include "damagestr.h" #include "protocol-versions.h" #include "extinit.h" +#ifdef PANORAMIX +#include "panoramiX.h" +#include "panoramiXsrv.h" + +typedef struct { + DamageExtPtr ext; + DamagePtr damage[MAXSCREENS]; +} PanoramiXDamageRes; + +static RESTYPE XRT_DAMAGE; +static int (*PanoramiXSaveDamageCreate) (ClientPtr); + +#endif + static unsigned char DamageReqCode; static int DamageEventBase; static RESTYPE DamageExtType; @@ -37,13 +53,49 @@ static DevPrivateKeyRec DamageClientPrivateKeyRec; #define DamageClientPrivateKey (&DamageClientPrivateKeyRec) static void +DamageNoteCritical(ClientPtr pClient) +{ + DamageClientPtr pDamageClient = GetDamageClient(pClient); + + /* Composite extension marks clients with manual Subwindows as critical */ + if (pDamageClient->critical > 0) { + SetCriticalOutputPending(); + pClient->smart_priority = SMART_MAX_PRIORITY; + } +} + +static void +damageGetGeometry(DrawablePtr draw, int *x, int *y, int *w, int *h) +{ +#ifdef PANORAMIX + if (!noPanoramiXExtension && draw->type == DRAWABLE_WINDOW) { + WindowPtr win = (WindowPtr)draw; + + if (!win->parent) { + *x = screenInfo.x; + *y = screenInfo.y; + *w = screenInfo.width; + *h = screenInfo.height; + return; + } + } +#endif + + *x = draw->x; + *y = draw->y; + *w = draw->width; + *h = draw->height; +} + +static void DamageExtNotify(DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes) { ClientPtr pClient = pDamageExt->pClient; - DamageClientPtr pDamageClient = GetDamageClient(pClient); DrawablePtr pDrawable = pDamageExt->pDrawable; xDamageNotifyEvent ev; - int i; + int i, x, y, w, h; + + damageGetGeometry(pDrawable, &x, &y, &w, &h); UpdateCurrentTimeIf(); ev = (xDamageNotifyEvent) { @@ -52,10 +104,10 @@ DamageExtNotify(DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes) .drawable = pDamageExt->drawable, .damage = pDamageExt->id, .timestamp = currentTime.milliseconds, - .geometry.x = pDrawable->x, - .geometry.y = pDrawable->y, - .geometry.width = pDrawable->width, - .geometry.height = pDrawable->height + .geometry.x = x, + .geometry.y = y, + .geometry.width = w, + .geometry.height = h }; if (pBoxes) { for (i = 0; i < nBoxes; i++) { @@ -72,15 +124,12 @@ DamageExtNotify(DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes) else { ev.area.x = 0; ev.area.y = 0; - ev.area.width = pDrawable->width; - ev.area.height = pDrawable->height; + ev.area.width = w; + ev.area.height = h; 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; - } + + DamageNoteCritical(pClient); } static void @@ -162,23 +211,62 @@ ProcDamageQueryVersion(ClientPtr client) return Success; } -static int -ProcDamageCreate(ClientPtr client) +static void +DamageExtRegister(DrawablePtr pDrawable, DamagePtr pDamage, Bool report) +{ + DamageSetReportAfterOp(pDamage, TRUE); + DamageRegister(pDrawable, pDamage); + + if (report) { + RegionPtr pRegion = &((WindowPtr) pDrawable)->borderClip; + RegionTranslate(pRegion, -pDrawable->x, -pDrawable->y); + DamageReportDamage(pDamage, pRegion); + RegionTranslate(pRegion, pDrawable->x, pDrawable->y); + } +} + +static DamageExtPtr +DamageExtCreate(DrawablePtr pDrawable, DamageReportLevel level, + ClientPtr client, XID id, XID drawable) +{ + DamageExtPtr pDamageExt = malloc(sizeof(DamageExtRec)); + if (!pDamageExt) + return NULL; + + pDamageExt->id = id; + pDamageExt->drawable = 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 NULL; + } + + if (!AddResource(id, DamageExtType, (pointer) pDamageExt)) + return NULL; + + DamageExtRegister(pDrawable, pDamageExt->pDamage, + pDrawable->type == DRAWABLE_WINDOW); + + return pDamageExt; +} + +static DamageExtPtr +doDamageCreate(ClientPtr client, 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); - if (rc != Success) - return rc; + *rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, + DixGetAttrAccess | DixReadAccess); + if (*rc != Success) + return NULL; switch (stuff->level) { case XDamageReportRawRectangles: @@ -195,39 +283,27 @@ ProcDamageCreate(ClientPtr client) break; default: client->errorValue = stuff->level; - return BadValue; + *rc = BadValue; + return NULL; } - pDamageExt = malloc(sizeof(DamageExtRec)); + pDamageExt = DamageExtCreate(pDrawable, level, client, stuff->damage, + stuff->drawable); if (!pDamageExt) - 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; - } - if (!AddResource(stuff->damage, DamageExtType, (pointer) pDamageExt)) - return BadAlloc; - - DamageSetReportAfterOp(pDamageExt->pDamage, TRUE); - DamageRegister(pDamageExt->pDrawable, pDamageExt->pDamage); + *rc = BadAlloc; - if (pDrawable->type == DRAWABLE_WINDOW) { - pRegion = &((WindowPtr) pDrawable)->borderClip; - RegionTranslate(pRegion, -pDrawable->x, -pDrawable->y); - DamageReportDamage(pDamageExt->pDamage, pRegion); - RegionTranslate(pRegion, pDrawable->x, pDrawable->y); - } + return pDamageExt; +} - return Success; +static int +ProcDamageCreate(ClientPtr client) +{ + int rc; + REQUEST(xDamageCreateReq); + REQUEST_SIZE_MATCH(xDamageCreateReq); + LEGAL_NEW_RESOURCE(stuff->damage, client); + doDamageCreate(client, &rc); + return rc; } static int @@ -242,6 +318,88 @@ ProcDamageDestroy(ClientPtr client) return Success; } +#ifdef PANORAMIX +static RegionPtr +DamageExtSubtractWindowClip(DamageExtPtr pDamageExt) +{ + WindowPtr win = (WindowPtr)pDamageExt->pDrawable; + PanoramiXRes *res = NULL; + RegionPtr ret; + int i; + + if (!win->parent) + return &PanoramiXScreenRegion; + + dixLookupResourceByType((void **)&res, win->drawable.id, XRT_WINDOW, + serverClient, DixReadAccess); + if (!res) + return NULL; + + ret = RegionCreate(NULL, 0); + if (!ret) + return NULL; + + FOR_NSCREENS_FORWARD(i) { + ScreenPtr screen; + if (Success != dixLookupWindow(&win, res->info[i].id, serverClient, + DixReadAccess)) + goto out; + + screen = win->drawable.pScreen; + + RegionTranslate(ret, -screen->x, -screen->y); + if (!RegionUnion(ret, ret, &win->borderClip)) + goto out; + RegionTranslate(ret, screen->x, screen->y); + } + + return ret; + +out: + RegionDestroy(ret); + return NULL; +} + +static void +DamageExtFreeWindowClip(RegionPtr reg) +{ + if (reg != &PanoramiXScreenRegion) + RegionDestroy(reg); +} +#endif + +/* + * DamageSubtract intersects with borderClip, so we must reconstruct the + * protocol's perspective of same... + */ +static Bool +DamageExtSubtract(DamageExtPtr pDamageExt, const RegionPtr pRegion) +{ + DamagePtr pDamage = pDamageExt->pDamage; + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + RegionPtr damage = DamageRegion(pDamage); + RegionSubtract(damage, damage, pRegion); + + if (pDamageExt->pDrawable->type == DRAWABLE_WINDOW) { + DrawablePtr pDraw = pDamageExt->pDrawable; + RegionPtr clip = DamageExtSubtractWindowClip(pDamageExt); + if (clip) { + RegionTranslate(clip, -pDraw->x, -pDraw->y); + RegionIntersect(damage, damage, clip); + RegionTranslate(clip, pDraw->x, pDraw->y); + DamageExtFreeWindowClip(clip); + } + } + + return RegionNotEmpty(damage); + } +#endif + + return DamageSubtract(pDamage, pRegion); +} + static int ProcDamageSubtract(ClientPtr client) { @@ -261,7 +419,7 @@ ProcDamageSubtract(ClientPtr client) if (pRepair) { if (pParts) RegionIntersect(pParts, DamageRegion(pDamage), pRepair); - if (DamageSubtract(pDamage, pRepair)) + if (DamageExtSubtract(pDamageExt, pRepair)) DamageExtReport(pDamage, DamageRegion(pDamage), (void *) pDamageExt); } @@ -271,6 +429,7 @@ ProcDamageSubtract(ClientPtr client) DamageEmpty(pDamage); } } + return Success; } @@ -460,6 +619,127 @@ SDamageNotifyEvent(xDamageNotifyEvent * from, xDamageNotifyEvent * to) cpswaps(from->geometry.height, to->geometry.height); } +#ifdef PANORAMIX + +static void +PanoramiXDamageReport(DamagePtr pDamage, RegionPtr pRegion, void *closure) +{ + PanoramiXDamageRes *res = closure; + DamageExtPtr pDamageExt = res->ext; + WindowPtr pWin = (WindowPtr)pDamage->pDrawable; + ScreenPtr pScreen = pDamage->pScreen; + + /* happens on unmap? sigh xinerama */ + if (RegionNil(pRegion)) + return; + + /* translate root windows if necessary */ + if (!pWin->parent) + RegionTranslate(pRegion, pScreen->x, pScreen->y); + + /* add our damage to the protocol view */ + DamageReportDamage(pDamageExt->pDamage, pRegion); + + /* empty our view */ + DamageEmpty(pDamage); +} + +static void +PanoramiXDamageExtDestroy(DamagePtr pDamage, void *closure) +{ + PanoramiXDamageRes *damage = closure; + damage->damage[pDamage->pScreen->myNum] = NULL; +} + +static int +PanoramiXDamageCreate(ClientPtr client) +{ + PanoramiXDamageRes *damage; + PanoramiXRes *draw; + int i, rc; + + REQUEST(xDamageCreateReq); + + REQUEST_SIZE_MATCH(xDamageCreateReq); + LEGAL_NEW_RESOURCE(stuff->damage, client); + rc = dixLookupResourceByClass((void **)&draw, stuff->drawable, XRC_DRAWABLE, + client, DixGetAttrAccess | DixReadAccess); + if (rc != Success) + return rc; + + if (!(damage = calloc(1, sizeof(PanoramiXDamageRes)))) + return BadAlloc; + + if (!AddResource(stuff->damage, XRT_DAMAGE, damage)) + return BadAlloc; + + damage->ext = doDamageCreate(client, &rc); + if (rc == Success && draw->type == XRT_WINDOW) { + FOR_NSCREENS_FORWARD(i) { + DrawablePtr pDrawable; + DamagePtr pDamage = DamageCreate(PanoramiXDamageReport, + PanoramiXDamageExtDestroy, + DamageReportRawRegion, + FALSE, + screenInfo.screens[i], + damage); + if (!pDamage) { + rc = BadAlloc; + } else { + damage->damage[i] = pDamage; + rc = dixLookupDrawable(&pDrawable, draw->info[i].id, client, + M_WINDOW, + DixGetAttrAccess | DixReadAccess); + } + if (rc != Success) + break; + + DamageExtRegister(pDrawable, pDamage, i != 0); + } + } + + if (rc != Success) + FreeResource(stuff->damage, RT_NONE); + + return rc; +} + +static int +PanoramiXDamageDelete(void *res, XID id) +{ + int i; + PanoramiXDamageRes *damage = res; + + FOR_NSCREENS_BACKWARD(i) { + if (damage->damage[i]) { + DamageDestroy(damage->damage[i]); + damage->damage[i] = NULL; + } + } + + free(damage); + return 1; +} + +void +PanoramiXDamageInit(void) +{ + XRT_DAMAGE = CreateNewResourceType(PanoramiXDamageDelete, "XineramaDamage"); + if (!XRT_DAMAGE) + FatalError("Couldn't Xineramify Damage extension\n"); + + PanoramiXSaveDamageCreate = ProcDamageVector[X_DamageCreate]; + ProcDamageVector[X_DamageCreate] = PanoramiXDamageCreate; +} + +void +PanoramiXDamageReset(void) +{ + ProcDamageVector[X_DamageCreate] = PanoramiXSaveDamageCreate; +} + +#endif /* PANORAMIX */ + void DamageExtensionInit(void) { @@ -490,5 +770,10 @@ DamageExtensionInit(void) (EventSwapPtr) SDamageNotifyEvent; SetResourceTypeErrorValue(DamageExtType, extEntry->errorBase + BadDamage); +#ifdef PANORAMIX + if (XRT_DAMAGE) + SetResourceTypeErrorValue(XRT_DAMAGE, + extEntry->errorBase + BadDamage); +#endif } } diff --git a/xorg-server/damageext/damageextint.h b/xorg-server/damageext/damageextint.h index 272337922..e50149501 100644 --- a/xorg-server/damageext/damageextint.h +++ b/xorg-server/damageext/damageextint.h @@ -67,4 +67,7 @@ typedef struct _DamageExt { void DamageExtSetCritical(ClientPtr pClient, Bool critical); +void PanoramiXDamageInit(void); +void PanoramiXDamageReset(void); + #endif /* _DAMAGEEXTINT_H_ */ |