Unverified Commit 17f3e3bc authored by Mike Gabriel's avatar Mike Gabriel

Merge branch 'sunweaver-pr/xrandr-extension-upgrade-1.5' into 3.6.x

Attributes GH PR #137: https://github.com/ArcticaProject/nx-libs/pull/137 Reviewed by: Ulrich Sibiller <uli42@gmx.de> -- Mon, 20 Jun 2016 12:40:52 -0700
parents 9013a24d 4c8fc6be
...@@ -28,7 +28,7 @@ Build-Depends: ...@@ -28,7 +28,7 @@ Build-Depends:
pkg-config, pkg-config,
x11proto-core-dev, x11proto-core-dev,
expat, expat,
libpixman-1-dev, libpixman-1-dev (>= 0.13.2),
Standards-Version: 3.9.6 Standards-Version: 3.9.6
Homepage: http://code.x2go.org/gitweb?p=nx-libs.git;a=summary Homepage: http://code.x2go.org/gitweb?p=nx-libs.git;a=summary
Vcs-Git: git://code.x2go.org/nx-libs.git Vcs-Git: git://code.x2go.org/nx-libs.git
......
...@@ -323,7 +323,7 @@ index 862f75a..5405568 100644 ...@@ -323,7 +323,7 @@ index 862f75a..5405568 100644
x.u.u.type = SelectionRequest; x.u.u.type = SelectionRequest;
x.u.selectionRequest.time = GetTimeInMillis(); x.u.selectionRequest.time = GetTimeInMillis();
x.u.selectionRequest.owner = lastOwnerWindow; x.u.selectionRequest.owner = lastOwnerWindow;
x.u.selectionRequest.requestor = WindowTable[0]->drawable.id; x.u.selectionRequest.requestor = screenInfo.screens[0]->root->drawable.id;
- x.u.selectionRequest.selection = XA_PRIMARY; - x.u.selectionRequest.selection = XA_PRIMARY;
+/* My changes */ +/* My changes */
+/* +/*
......
...@@ -8,7 +8,7 @@ Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> ...@@ -8,7 +8,7 @@ Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Last-Update: 2012-01-12 Last-Update: 2012-01-12
--- a/nx-X11/programs/Xserver/Xext/security.c --- a/nx-X11/programs/Xserver/Xext/security.c
+++ b/nx-X11/programs/Xserver/Xext/security.c +++ b/nx-X11/programs/Xserver/Xext/security.c
@@ -86,7 +86,7 @@ @@ -78,7 +78,7 @@
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
......
...@@ -896,7 +896,7 @@ void PanoramiXConsolidate(void) ...@@ -896,7 +896,7 @@ void PanoramiXConsolidate(void)
for (i = 0; i < PanoramiXNumScreens; i++) { for (i = 0; i < PanoramiXNumScreens; i++) {
root->info[i].id = WindowTable[i]->drawable.id; root->info[i].id = screenInfo.screens[i]->root->drawable.id;
root->u.win.class = InputOutput; root->u.win.class = InputOutput;
root->u.win.root = TRUE; root->u.win.root = TRUE;
saver->info[i].id = savedScreenInfo[i].wid; saver->info[i].id = savedScreenInfo[i].wid;
......
...@@ -89,11 +89,11 @@ typedef struct { ...@@ -89,11 +89,11 @@ typedef struct {
#define FORCE_ROOT(a) { \ #define FORCE_ROOT(a) { \
int _j; \ int _j; \
for (_j = PanoramiXNumScreens - 1; _j; _j--) \ for (_j = PanoramiXNumScreens - 1; _j; _j--) \
if ((a).root == WindowTable[_j]->drawable.id) \ if ((a).root == screenInfo.screens[_j]->root->drawable.id) \
break; \ break; \
(a).rootX += panoramiXdataPtr[_j].x; \ (a).rootX += panoramiXdataPtr[_j].x; \
(a).rootY += panoramiXdataPtr[_j].y; \ (a).rootY += panoramiXdataPtr[_j].y; \
(a).root = WindowTable[0]->drawable.id; \ (a).root = screenInfo.screens[0]->root->drawable.id; \
} }
#define FORCE_WIN(a) { \ #define FORCE_WIN(a) { \
......
...@@ -146,7 +146,7 @@ int PanoramiXCreateWindow(ClientPtr client) ...@@ -146,7 +146,7 @@ int PanoramiXCreateWindow(ClientPtr client)
orig_visual = stuff->visual; orig_visual = stuff->visual;
orig_x = stuff->x; orig_x = stuff->x;
orig_y = stuff->y; orig_y = stuff->y;
parentIsRoot = (stuff->parent == WindowTable[0]->drawable.id) || parentIsRoot = (stuff->parent == screenInfo.screens[0]->root->drawable.id) ||
(stuff->parent == savedScreenInfo[0].wid); (stuff->parent == savedScreenInfo[0].wid);
FOR_NSCREENS_BACKWARD(j) { FOR_NSCREENS_BACKWARD(j) {
stuff->wid = newWin->info[j].id; stuff->wid = newWin->info[j].id;
...@@ -336,7 +336,7 @@ int PanoramiXReparentWindow(ClientPtr client) ...@@ -336,7 +336,7 @@ int PanoramiXReparentWindow(ClientPtr client)
x = stuff->x; x = stuff->x;
y = stuff->y; y = stuff->y;
parentIsRoot = (stuff->parent == WindowTable[0]->drawable.id) || parentIsRoot = (stuff->parent == screenInfo.screens[0]->root->drawable.id) ||
(stuff->parent == savedScreenInfo[0].wid); (stuff->parent == savedScreenInfo[0].wid);
FOR_NSCREENS_BACKWARD(j) { FOR_NSCREENS_BACKWARD(j) {
stuff->window = win->info[j].id; stuff->window = win->info[j].id;
...@@ -476,7 +476,7 @@ int PanoramiXConfigureWindow(ClientPtr client) ...@@ -476,7 +476,7 @@ int PanoramiXConfigureWindow(ClientPtr client)
} }
} }
if(pWin->parent && ((pWin->parent == WindowTable[0]) || if(pWin->parent && ((pWin->parent == screenInfo.screens[0]->root) ||
(pWin->parent->drawable.id == savedScreenInfo[0].wid))) (pWin->parent->drawable.id == savedScreenInfo[0].wid)))
{ {
if ((Mask)stuff->mask & CWX) { if ((Mask)stuff->mask & CWX) {
...@@ -540,7 +540,7 @@ int PanoramiXGetGeometry(ClientPtr client) ...@@ -540,7 +540,7 @@ int PanoramiXGetGeometry(ClientPtr client)
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.root = WindowTable[0]->drawable.id; rep.root = screenInfo.screens[0]->root->drawable.id;
rep.depth = pDraw->depth; rep.depth = pDraw->depth;
rep.width = pDraw->width; rep.width = pDraw->width;
rep.height = pDraw->height; rep.height = pDraw->height;
...@@ -558,7 +558,7 @@ int PanoramiXGetGeometry(ClientPtr client) ...@@ -558,7 +558,7 @@ int PanoramiXGetGeometry(ClientPtr client)
WindowPtr pWin = (WindowPtr)pDraw; WindowPtr pWin = (WindowPtr)pDraw;
rep.x = pWin->origin.x - wBorderWidth (pWin); rep.x = pWin->origin.x - wBorderWidth (pWin);
rep.y = pWin->origin.y - wBorderWidth (pWin); rep.y = pWin->origin.y - wBorderWidth (pWin);
if((pWin->parent == WindowTable[0]) || if((pWin->parent == screenInfo.screens[0]->root) ||
(pWin->parent->drawable.id == savedScreenInfo[0].wid)) (pWin->parent->drawable.id == savedScreenInfo[0].wid))
{ {
rep.x += panoramiXdataPtr[0].x; rep.x += panoramiXdataPtr[0].x;
...@@ -594,7 +594,7 @@ int PanoramiXTranslateCoords(ClientPtr client) ...@@ -594,7 +594,7 @@ int PanoramiXTranslateCoords(ClientPtr client)
rep.sameScreen = xTrue; rep.sameScreen = xTrue;
rep.child = None; rep.child = None;
if((pWin == WindowTable[0]) || if((pWin == screenInfo.screens[0]->root) ||
(pWin->drawable.id == savedScreenInfo[0].wid)) (pWin->drawable.id == savedScreenInfo[0].wid))
{ {
x = stuff->srcX - panoramiXdataPtr[0].x; x = stuff->srcX - panoramiXdataPtr[0].x;
...@@ -636,7 +636,7 @@ int PanoramiXTranslateCoords(ClientPtr client) ...@@ -636,7 +636,7 @@ int PanoramiXTranslateCoords(ClientPtr client)
} }
rep.dstX = x - pDst->drawable.x; rep.dstX = x - pDst->drawable.x;
rep.dstY = y - pDst->drawable.y; rep.dstY = y - pDst->drawable.y;
if((pDst == WindowTable[0]) || if((pDst == screenInfo.screens[0]->root) ||
(pDst->drawable.id == savedScreenInfo[0].wid)) (pDst->drawable.id == savedScreenInfo[0].wid))
{ {
rep.dstX += panoramiXdataPtr[0].x; rep.dstX += panoramiXdataPtr[0].x;
......
...@@ -473,7 +473,7 @@ SendScreenSaverNotify (pScreen, state, forced) ...@@ -473,7 +473,7 @@ SendScreenSaverNotify (pScreen, state, forced)
ev.state = state; ev.state = state;
ev.sequenceNumber = client->sequence; ev.sequenceNumber = client->sequence;
ev.timestamp = currentTime.milliseconds; ev.timestamp = currentTime.milliseconds;
ev.root = WindowTable[pScreen->myNum]->drawable.id; ev.root = pScreen->root->drawable.id;
ev.window = savedScreenInfo[pScreen->myNum].wid; ev.window = savedScreenInfo[pScreen->myNum].wid;
ev.kind = kind; ev.kind = kind;
ev.forced = forced; ev.forced = forced;
...@@ -549,7 +549,7 @@ CreateSaverWindow (pScreen) ...@@ -549,7 +549,7 @@ CreateSaverWindow (pScreen)
if (GrabInProgress && GrabInProgress != pAttr->client->index) if (GrabInProgress && GrabInProgress != pAttr->client->index)
return FALSE; return FALSE;
pWin = CreateWindow (pSaver->wid, WindowTable[pScreen->myNum], pWin = CreateWindow (pSaver->wid, pScreen->root,
pAttr->x, pAttr->y, pAttr->width, pAttr->height, pAttr->x, pAttr->y, pAttr->width, pAttr->height,
pAttr->borderWidth, pAttr->class, pAttr->borderWidth, pAttr->class,
pAttr->mask, (XID *)pAttr->values, pAttr->mask, (XID *)pAttr->values,
...@@ -830,7 +830,7 @@ ScreenSaverSetAttributes (ClientPtr client) ...@@ -830,7 +830,7 @@ ScreenSaverSetAttributes (ClientPtr client)
if (!pDraw) if (!pDraw)
return BadDrawable; return BadDrawable;
pScreen = pDraw->pScreen; pScreen = pDraw->pScreen;
pParent = WindowTable[pScreen->myNum]; pParent = pScreen->root;
len = stuff->length - (sizeof(xScreenSaverSetAttributesReq) >> 2); len = stuff->length - (sizeof(xScreenSaverSetAttributesReq) >> 2);
if (Ones(stuff->mask) != len) if (Ones(stuff->mask) != len)
......
...@@ -409,7 +409,7 @@ ProcXTestFakeInput(client) ...@@ -409,7 +409,7 @@ ProcXTestFakeInput(client)
if (RegionContainsPoint( if (RegionContainsPoint(
&XineramaScreenRegions[i], &XineramaScreenRegions[i],
x, y, &box)) { x, y, &box)) {
root = WindowTable[i]; root = screenInfo.screens[i]->root;
x -= panoramiXdataPtr[i].x; x -= panoramiXdataPtr[i].x;
y -= panoramiXdataPtr[i].y; y -= panoramiXdataPtr[i].y;
ev->u.keyButtonPointer.rootX = x; ev->u.keyButtonPointer.rootX = x;
......
...@@ -208,7 +208,7 @@ SendEventToAllWindows (dev, mask, ev, count) ...@@ -208,7 +208,7 @@ SendEventToAllWindows (dev, mask, ev, count)
for (i=0; i<screenInfo.numScreens; i++) for (i=0; i<screenInfo.numScreens; i++)
{ {
pWin = WindowTable[i]; pWin = screenInfo.screens[i]->root;
(void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id); (void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id);
p1 = pWin->firstChild; p1 = pWin->firstChild;
FindInterestedChildren (dev, p1, mask, ev, count); FindInterestedChildren (dev, p1, mask, ev, count);
......
...@@ -124,7 +124,7 @@ ProcXCloseDevice(client) ...@@ -124,7 +124,7 @@ ProcXCloseDevice(client)
for (i=0; i<screenInfo.numScreens; i++) for (i=0; i<screenInfo.numScreens; i++)
{ {
pWin = WindowTable[i]; pWin = screenInfo.screens[i]->root;
DeleteDeviceEvents (d, pWin, client); DeleteDeviceEvents (d, pWin, client);
p1 = pWin->firstChild; p1 = pWin->firstChild;
DeleteEventsFromChildren (d, p1, client); DeleteEventsFromChildren (d, p1, client);
......
...@@ -32,7 +32,7 @@ static void ...@@ -32,7 +32,7 @@ static void
compScreenUpdate(ScreenPtr pScreen) compScreenUpdate(ScreenPtr pScreen)
{ {
compCheckTree(pScreen); compCheckTree(pScreen);
compPaintChildrenToWindow(pScreen, WindowTable[pScreen->myNum]); compPaintChildrenToWindow(pScreen, pScreen->root);
} }
static void static void
......
...@@ -129,7 +129,7 @@ Bool ...@@ -129,7 +129,7 @@ Bool
compCreateOverlayWindow(ScreenPtr pScreen) compCreateOverlayWindow(ScreenPtr pScreen)
{ {
CompScreenPtr cs = GetCompScreen(pScreen); CompScreenPtr cs = GetCompScreen(pScreen);
WindowPtr pRoot = WindowTable[pScreen->myNum]; WindowPtr pRoot = pScreen->root;
WindowPtr pWin; WindowPtr pWin;
XID attrs[] = { None, TRUE }; /* backPixmap, overrideRedirect */ XID attrs[] = { None, TRUE }; /* backPixmap, overrideRedirect */
int result; int result;
......
...@@ -234,8 +234,8 @@ FlushClientCaches(XID id) ...@@ -234,8 +234,8 @@ FlushClientCaches(XID id)
{ {
if (client->lastDrawableID == id) if (client->lastDrawableID == id)
{ {
client->lastDrawableID = WindowTable[0]->drawable.id; client->lastDrawableID = screenInfo.screens[0]->root->drawable.id;
client->lastDrawable = (DrawablePtr)WindowTable[0]; client->lastDrawable = (DrawablePtr)screenInfo.screens[0]->root;
} }
else if (client->lastGCID == id) else if (client->lastGCID == id)
{ {
...@@ -793,7 +793,7 @@ GetGeometry(register ClientPtr client, xGetGeometryReply *rep) ...@@ -793,7 +793,7 @@ GetGeometry(register ClientPtr client, xGetGeometryReply *rep)
rep->type = X_Reply; rep->type = X_Reply;
rep->length = 0; rep->length = 0;
rep->sequenceNumber = client->sequence; rep->sequenceNumber = client->sequence;
rep->root = WindowTable[pDraw->pScreen->myNum]->drawable.id; rep->root = pDraw->pScreen->root->drawable.id;
rep->depth = pDraw->depth; rep->depth = pDraw->depth;
rep->width = pDraw->width; rep->width = pDraw->width;
rep->height = pDraw->height; rep->height = pDraw->height;
...@@ -854,7 +854,7 @@ ProcQueryTree(register ClientPtr client) ...@@ -854,7 +854,7 @@ ProcQueryTree(register ClientPtr client)
return(BadWindow); return(BadWindow);
memset(&reply, 0, sizeof(xQueryTreeReply)); memset(&reply, 0, sizeof(xQueryTreeReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; reply.root = pWin->drawable.pScreen->root->drawable.id;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
if (pWin->parent) if (pWin->parent)
reply.parent = pWin->parent->drawable.id; reply.parent = pWin->parent->drawable.id;
...@@ -3633,8 +3633,8 @@ void InitClient(ClientPtr client, int i, void * ospriv) ...@@ -3633,8 +3633,8 @@ void InitClient(ClientPtr client, int i, void * ospriv)
if (i) if (i)
{ {
client->closeDownMode = DestroyAll; client->closeDownMode = DestroyAll;
client->lastDrawable = (DrawablePtr)WindowTable[0]; client->lastDrawable = (DrawablePtr)screenInfo.screens[0]->root;
client->lastDrawableID = WindowTable[0]->drawable.id; client->lastDrawableID = screenInfo.screens[0]->root->drawable.id;
} }
else else
{ {
...@@ -3853,8 +3853,8 @@ SendConnSetup(register ClientPtr client, char *reason) ...@@ -3853,8 +3853,8 @@ SendConnSetup(register ClientPtr client, char *reason)
register unsigned int j; register unsigned int j;
register xDepth *pDepth; register xDepth *pDepth;
root->currentInputMask = WindowTable[i]->eventMask | root->currentInputMask = screenInfo.screens[i]->root->eventMask |
wOtherEventMasks (WindowTable[i]); wOtherEventMasks (screenInfo.screens[i]->root);
pDepth = (xDepth *)(root + 1); pDepth = (xDepth *)(root + 1);
for (j = 0; j < root->nDepths; j++) for (j = 0; j < root->nDepths; j++)
{ {
......
...@@ -413,9 +413,10 @@ XineramaCheckPhysLimits( ...@@ -413,9 +413,10 @@ XineramaCheckPhysLimits(
static Bool static Bool
XineramaSetWindowPntrs(WindowPtr pWin) XineramaSetWindowPntrs(WindowPtr pWin)
{ {
if(pWin == WindowTable[0]) { if(pWin == screenInfo.screens[0]->root) {
memcpy(sprite.windows, WindowTable, int i;
PanoramiXNumScreens*sizeof(WindowPtr)); for (i = 0; i < PanoramiXNumScreens; i++)
sprite.windows[i] = screenInfo.screens[i]->root;
} else { } else {
PanoramiXRes *win; PanoramiXRes *win;
int i; int i;
...@@ -601,7 +602,7 @@ XineramaConfineCursorToWindow(WindowPtr pWin, Bool generateEvents) ...@@ -601,7 +602,7 @@ XineramaConfineCursorToWindow(WindowPtr pWin, Bool generateEvents)
sprite.hotShape = NullRegion; sprite.hotShape = NullRegion;
sprite.confined = FALSE; sprite.confined = FALSE;
sprite.confineWin = (pWin == WindowTable[0]) ? NullWindow : pWin; sprite.confineWin = (pWin == screenInfo.screens[0]->root) ? NullWindow : pWin;
XineramaCheckPhysLimits(sprite.current, generateEvents); XineramaCheckPhysLimits(sprite.current, generateEvents);
} }
...@@ -797,7 +798,7 @@ CheckVirtualMotion( ...@@ -797,7 +798,7 @@ CheckVirtualMotion(
qe->event->u.keyButtonPointer.rootY = sprite.hot.y; qe->event->u.keyButtonPointer.rootY = sprite.hot.y;
} }
} }
ROOT = WindowTable[sprite.hot.pScreen->myNum]; ROOT = sprite.hot.pScreen->root;
} }
static void static void
...@@ -997,7 +998,7 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count) ...@@ -997,7 +998,7 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count)
*/ */
if (xE->u.u.type == MotionNotify) if (xE->u.u.type == MotionNotify)
XE_KBPTR.root = XE_KBPTR.root =
WindowTable[sprite.hotPhys.pScreen->myNum]->drawable.id; sprite.hotPhys.pScreen->root->drawable.id;
eventinfo.events = xE; eventinfo.events = xE;
eventinfo.count = count; eventinfo.count = count;
CallCallbacks(&DeviceEventCallback, (void *)&eventinfo); CallCallbacks(&DeviceEventCallback, (void *)&eventinfo);
...@@ -1160,7 +1161,7 @@ playmore: ...@@ -1160,7 +1161,7 @@ playmore:
ConfineCursorToWindow(grab->confineTo, TRUE, TRUE); ConfineCursorToWindow(grab->confineTo, TRUE, TRUE);
} }
else else
ConfineCursorToWindow(WindowTable[sprite.hotPhys.pScreen->myNum], ConfineCursorToWindow(sprite.hotPhys.pScreen->root,
TRUE, FALSE); TRUE, FALSE);
PostNewCursor(); PostNewCursor();
} }
...@@ -1178,7 +1179,7 @@ ScreenRestructured (ScreenPtr pScreen) ...@@ -1178,7 +1179,7 @@ ScreenRestructured (ScreenPtr pScreen)
ConfineCursorToWindow(grab->confineTo, TRUE, TRUE); ConfineCursorToWindow(grab->confineTo, TRUE, TRUE);
} }
else else
ConfineCursorToWindow(WindowTable[sprite.hotPhys.pScreen->myNum], ConfineCursorToWindow(sprite.hotPhys.pScreen->root,
TRUE, FALSE); TRUE, FALSE);
} }
#endif #endif
...@@ -1976,7 +1977,7 @@ CheckMotion(xEvent *xE) ...@@ -1976,7 +1977,7 @@ CheckMotion(xEvent *xE)
if (sprite.hot.pScreen != sprite.hotPhys.pScreen) if (sprite.hot.pScreen != sprite.hotPhys.pScreen)
{ {
sprite.hot.pScreen = sprite.hotPhys.pScreen; sprite.hot.pScreen = sprite.hotPhys.pScreen;
ROOT = WindowTable[sprite.hot.pScreen->myNum]; ROOT = sprite.hot.pScreen->root;
} }
sprite.hot.x = XE_KBPTR.rootX; sprite.hot.x = XE_KBPTR.rootX;
sprite.hot.y = XE_KBPTR.rootY; sprite.hot.y = XE_KBPTR.rootY;
...@@ -2034,13 +2035,12 @@ WindowsRestructured() ...@@ -2034,13 +2035,12 @@ WindowsRestructured()
#ifdef PANORAMIX #ifdef PANORAMIX
/* This was added to support reconfiguration under Xdmx. The problem is /* This was added to support reconfiguration under Xdmx. The problem is
* that if the 0th screen (i.e., WindowTable[0]) is moved to an origin * that if the 0th screen (i.e., screenInfo.screens[0]->root) is moved to an origin
* other than 0,0, the information in the private sprite structure must * other than 0,0, the information in the private sprite structure must
* be updated accordingly, or XYToWindow (and other routines) will not * be updated accordingly, or XYToWindow (and other routines) will not
* compute correctly. */ * compute correctly. */
void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff) void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff)
{ {
ScreenPtr pScreen = win->drawable.pScreen;
GrabPtr grab; GrabPtr grab;
if (noPanoramiXExtension) return; if (noPanoramiXExtension) return;
...@@ -2067,7 +2067,7 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff) ...@@ -2067,7 +2067,7 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff)
sprite.hotPhys.x = sprite.hotPhys.y = 0; sprite.hotPhys.x = sprite.hotPhys.y = 0;
ConfineCursorToWindow(grab->confineTo, TRUE, TRUE); ConfineCursorToWindow(grab->confineTo, TRUE, TRUE);
} else } else
ConfineCursorToWindow(WindowTable[sprite.hotPhys.pScreen->myNum], ConfineCursorToWindow(sprite.hotPhys.pScreen->root,
TRUE, FALSE); TRUE, FALSE);
} }
#endif #endif
...@@ -2144,7 +2144,7 @@ NewCurrentScreen(ScreenPtr newScreen, int x, int y) ...@@ -2144,7 +2144,7 @@ NewCurrentScreen(ScreenPtr newScreen, int x, int y)
if(sprite.confineWin) if(sprite.confineWin)
XineramaConfineCursorToWindow(sprite.confineWin, TRUE); XineramaConfineCursorToWindow(sprite.confineWin, TRUE);
else else
XineramaConfineCursorToWindow(WindowTable[0], TRUE); XineramaConfineCursorToWindow(screenInfo.screens[0]->root, TRUE);
/* if the pointer wasn't confined, the DDX won't get /* if the pointer wasn't confined, the DDX won't get
told of the pointer warp so we reposition it here */ told of the pointer warp so we reposition it here */
if(!syncEvents.playingEvents) if(!syncEvents.playingEvents)
...@@ -2157,7 +2157,7 @@ NewCurrentScreen(ScreenPtr newScreen, int x, int y) ...@@ -2157,7 +2157,7 @@ NewCurrentScreen(ScreenPtr newScreen, int x, int y)
} else } else
#endif #endif
if (newScreen != sprite.hotPhys.pScreen) if (newScreen != sprite.hotPhys.pScreen)
ConfineCursorToWindow(WindowTable[newScreen->myNum], TRUE, FALSE); ConfineCursorToWindow(newScreen->root, TRUE, FALSE);
} }
#ifdef PANORAMIX #ifdef PANORAMIX
...@@ -2169,7 +2169,6 @@ XineramaPointInWindowIsVisible( ...@@ -2169,7 +2169,6 @@ XineramaPointInWindowIsVisible(
int y int y
) )
{ {
ScreenPtr pScreen = pWin->drawable.pScreen;
BoxRec box; BoxRec box;
int i, xoff, yoff; int i, xoff, yoff;
...@@ -2185,7 +2184,6 @@ XineramaPointInWindowIsVisible( ...@@ -2185,7 +2184,6 @@ XineramaPointInWindowIsVisible(
for(i = 1; i < PanoramiXNumScreens; i++) { for(i = 1; i < PanoramiXNumScreens; i++) {
pWin = sprite.windows[i]; pWin = sprite.windows[i];
pScreen = pWin->drawable.pScreen;
x = xoff - panoramiXdataPtr[i].x; x = xoff - panoramiXdataPtr[i].x;
y = yoff - panoramiXdataPtr[i].y; y = yoff - panoramiXdataPtr[i].y;
...@@ -2231,7 +2229,7 @@ XineramaWarpPointer(ClientPtr client) ...@@ -2231,7 +2229,7 @@ XineramaWarpPointer(ClientPtr client)
winX = source->drawable.x; winX = source->drawable.x;
winY = source->drawable.y; winY = source->drawable.y;
if(source == WindowTable[0]) { if(source == screenInfo.screens[0]->root) {
winX -= panoramiXdataPtr[0].x; winX -= panoramiXdataPtr[0].x;
winY -= panoramiXdataPtr[0].y; winY -= panoramiXdataPtr[0].y;
} }
...@@ -2247,7 +2245,7 @@ XineramaWarpPointer(ClientPtr client) ...@@ -2247,7 +2245,7 @@ XineramaWarpPointer(ClientPtr client)
if (dest) { if (dest) {
x = dest->drawable.x; x = dest->drawable.x;
y = dest->drawable.y; y = dest->drawable.y;
if(dest == WindowTable[0]) { if(dest == screenInfo.screens[0]->root) {
x -= panoramiXdataPtr[0].x; x -= panoramiXdataPtr[0].x;
y -= panoramiXdataPtr[0].y; y -= panoramiXdataPtr[0].y;
} }
...@@ -2822,7 +2820,7 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count ...@@ -2822,7 +2820,7 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
/* see comment in EnqueueEvents regarding the next three lines */ /* see comment in EnqueueEvents regarding the next three lines */
if (xE->u.u.type == MotionNotify) if (xE->u.u.type == MotionNotify)
XE_KBPTR.root = XE_KBPTR.root =
WindowTable[sprite.hotPhys.pScreen->myNum]->drawable.id; sprite.hotPhys.pScreen->root->drawable.id;
eventinfo.events = xE; eventinfo.events = xE;
eventinfo.count = count; eventinfo.count = count;
CallCallbacks(&DeviceEventCallback, (void *)&eventinfo); CallCallbacks(&DeviceEventCallback, (void *)&eventinfo);
...@@ -3356,11 +3354,11 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode) ...@@ -3356,11 +3354,11 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode)
/* Notify all the roots */ /* Notify all the roots */
#ifdef PANORAMIX #ifdef PANORAMIX
if ( !noPanoramiXExtension ) if ( !noPanoramiXExtension )
FocusEvent(dev, FocusOut, mode, out, WindowTable[0]); FocusEvent(dev, FocusOut, mode, out, screenInfo.screens[0]->root);
else else
#endif #endif
for (i=0; i<screenInfo.numScreens; i++) for (i=0; i<screenInfo.numScreens; i++)
FocusEvent(dev, FocusOut, mode, out, WindowTable[i]); FocusEvent(dev, FocusOut, mode, out, screenInfo.screens[i]->root);
} }
else else
{ {
...@@ -3375,11 +3373,11 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode) ...@@ -3375,11 +3373,11 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode)
/* Notify all the roots */ /* Notify all the roots */
#ifdef PANORAMIX #ifdef PANORAMIX
if ( !noPanoramiXExtension ) if ( !noPanoramiXExtension )
FocusEvent(dev, FocusIn, mode, in, WindowTable[0]); FocusEvent(dev, FocusIn, mode, in, screenInfo.screens[0]->root);
else else
#endif #endif
for (i=0; i<screenInfo.numScreens; i++) for (i=0; i<screenInfo.numScreens; i++)
FocusEvent(dev, FocusIn, mode, in, WindowTable[i]); FocusEvent(dev, FocusIn, mode, in, screenInfo.screens[i]->root);
if (toWin == PointerRootWin) if (toWin == PointerRootWin)
(void)FocusInEvents(dev, ROOT, sprite.win, NullWindow, mode, (void)FocusInEvents(dev, ROOT, sprite.win, NullWindow, mode,
NotifyPointer, TRUE); NotifyPointer, TRUE);
...@@ -3393,11 +3391,11 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode) ...@@ -3393,11 +3391,11 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode)
TRUE); TRUE);
#ifdef PANORAMIX #ifdef PANORAMIX
if ( !noPanoramiXExtension ) if ( !noPanoramiXExtension )
FocusEvent(dev, FocusOut, mode, out, WindowTable[0]); FocusEvent(dev, FocusOut, mode, out, screenInfo.screens[0]->root);
else else
#endif #endif
for (i=0; i<screenInfo.numScreens; i++) for (i=0; i<screenInfo.numScreens; i++)
FocusEvent(dev, FocusOut, mode, out, WindowTable[i]); FocusEvent(dev, FocusOut, mode, out, screenInfo.screens[i]->root);
if (toWin->parent != NullWindow) if (toWin->parent != NullWindow)
(void)FocusInEvents(dev, ROOT, toWin, toWin, mode, (void)FocusInEvents(dev, ROOT, toWin, toWin, mode,
NotifyNonlinearVirtual, TRUE); NotifyNonlinearVirtual, TRUE);
......
...@@ -89,7 +89,7 @@ AddExtension(char *name, int NumEvents, int NumErrors, ...@@ -89,7 +89,7 @@ AddExtension(char *name, int NumEvents, int NumErrors,
int i; int i;
register ExtensionEntry *ext, **newexts; register ExtensionEntry *ext, **newexts;
if (!MainProc || !SwappedMainProc || !CloseDownProc || !MinorOpcodeProc) if (!MainProc || !SwappedMainProc || !MinorOpcodeProc)
return((ExtensionEntry *) NULL); return((ExtensionEntry *) NULL);
if ((lastEvent + NumEvents > LAST_EVENT) || if ((lastEvent + NumEvents > LAST_EVENT) ||
(unsigned)(lastError + NumErrors > LAST_ERROR)) (unsigned)(lastError + NumErrors > LAST_ERROR))
...@@ -260,7 +260,8 @@ CloseDownExtensions() ...@@ -260,7 +260,8 @@ CloseDownExtensions()
for (i = NumExtensions - 1; i >= 0; i--) for (i = NumExtensions - 1; i >= 0; i--)
{ {
(* extensions[i]->CloseDown)(extensions[i]); if (extensions[i]->CloseDown)
(* extensions[i]->CloseDown)(extensions[i]);
NumExtensions = i; NumExtensions = i;
xfree(extensions[i]->name); xfree(extensions[i]->name);
for (j = extensions[i]->num_aliases; --j >= 0;) for (j = extensions[i]->num_aliases; --j >= 0;)
......
...@@ -86,8 +86,6 @@ ClientPtr serverClient; ...@@ -86,8 +86,6 @@ ClientPtr serverClient;
int currentMaxClients; /* current size of clients array */ int currentMaxClients; /* current size of clients array */
long maxBigRequestSize = MAX_BIG_REQUEST_SIZE; long maxBigRequestSize = MAX_BIG_REQUEST_SIZE;
WindowPtr *WindowTable;
unsigned long globalSerialNumber = 0; unsigned long globalSerialNumber = 0;
unsigned long serverGeneration = 0; unsigned long serverGeneration = 0;
...@@ -161,3 +159,5 @@ int argcGlobal; ...@@ -161,3 +159,5 @@ int argcGlobal;
char **argvGlobal; char **argvGlobal;
DDXPointRec dixScreenOrigins[MAXSCREENS]; DDXPointRec dixScreenOrigins[MAXSCREENS];
char *ConnectionInfo;
...@@ -121,7 +121,6 @@ extern int InitClientPrivates(ClientPtr client); ...@@ -121,7 +121,6 @@ extern int InitClientPrivates(ClientPtr client);
extern void Dispatch(void); extern void Dispatch(void);
char *ConnectionInfo;
xConnSetupPrefix connSetupPrefix; xConnSetupPrefix connSetupPrefix;
extern FontPtr defaultFont; extern FontPtr defaultFont;
...@@ -333,9 +332,6 @@ main(int argc, char *argv[], char *envp[]) ...@@ -333,9 +332,6 @@ main(int argc, char *argv[], char *envp[])
screenInfo.arraySize = MAXSCREENS; screenInfo.arraySize = MAXSCREENS;
screenInfo.numScreens = 0; screenInfo.numScreens = 0;
screenInfo.numVideoScreens = -1; screenInfo.numVideoScreens = -1;
WindowTable = (WindowPtr *)xalloc(MAXSCREENS * sizeof(WindowPtr));
if (!WindowTable)
FatalError("couldn't create root window table");
/* /*
* Just in case the ddx doesnt supply a format for depth 1 (like qvss). * Just in case the ddx doesnt supply a format for depth 1 (like qvss).
...@@ -420,8 +416,8 @@ main(int argc, char *argv[], char *envp[]) ...@@ -420,8 +416,8 @@ main(int argc, char *argv[], char *envp[])
#endif #endif
for (i = 0; i < screenInfo.numScreens; i++) for (i = 0; i < screenInfo.numScreens; i++)
InitRootWindow(WindowTable[i]); InitRootWindow(screenInfo.screens[i]->root);
DefineInitialRootWindow(WindowTable[0]); DefineInitialRootWindow(screenInfo.screens[0]->root);
SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
#ifdef DPMSExtension #ifdef DPMSExtension
SetDPMSTimers(); SetDPMSTimers();
...@@ -457,7 +453,11 @@ main(int argc, char *argv[], char *envp[]) ...@@ -457,7 +453,11 @@ main(int argc, char *argv[], char *envp[])
FreeAllResources(); FreeAllResources();
#endif #endif
for (i = 0; i < screenInfo.numScreens; i++)
screenInfo.screens[i]->root = NullWindow;
CloseDownDevices(); CloseDownDevices();
CloseDownEvents();
for (i = screenInfo.numScreens - 1; i >= 0; i--) for (i = screenInfo.numScreens - 1; i >= 0; i--)
{ {
FreeScratchPixmapsForScreen(i); FreeScratchPixmapsForScreen(i);
...@@ -467,9 +467,6 @@ main(int argc, char *argv[], char *envp[]) ...@@ -467,9 +467,6 @@ main(int argc, char *argv[], char *envp[])
FreeScreen(screenInfo.screens[i]); FreeScreen(screenInfo.screens[i]);
screenInfo.numScreens = i; screenInfo.numScreens = i;
} }
CloseDownEvents();
xfree(WindowTable);
WindowTable = NULL;
FreeFonts(); FreeFonts();
#ifdef DPMSExtension #ifdef DPMSExtension
...@@ -596,7 +593,7 @@ CreateConnectionBlock() ...@@ -596,7 +593,7 @@ CreateConnectionBlock()
VisualPtr pVisual; VisualPtr pVisual;
pScreen = screenInfo.screens[i]; pScreen = screenInfo.screens[i];
root.windowId = WindowTable[i]->drawable.id; root.windowId = screenInfo.screens[i]->root->drawable.id;
root.defaultColormap = pScreen->defColormap; root.defaultColormap = pScreen->defColormap;
root.whitePixel = pScreen->whitePixel; root.whitePixel = pScreen->whitePixel;
root.blackPixel = pScreen->blackPixel; root.blackPixel = pScreen->blackPixel;
...@@ -770,7 +767,6 @@ AddScreen( ...@@ -770,7 +767,6 @@ AddScreen(
multiple screens. multiple screens.
*/ */
pScreen->rgf = ~0L; /* there are no scratch GCs yet*/ pScreen->rgf = ~0L; /* there are no scratch GCs yet*/
WindowTable[i] = NullWindow;
screenInfo.screens[i] = pScreen; screenInfo.screens[i] = pScreen;
screenInfo.numScreens++; screenInfo.numScreens++;
if (!(*pfnInit)(i, pScreen, argc, argv)) if (!(*pfnInit)(i, pScreen, argc, argv))
...@@ -785,6 +781,7 @@ AddScreen( ...@@ -785,6 +781,7 @@ AddScreen(
static void static void
FreeScreen(ScreenPtr pScreen) FreeScreen(ScreenPtr pScreen)
{ {
pScreen->root = NullWindow;
xfree(pScreen->WindowPrivateSizes); xfree(pScreen->WindowPrivateSizes);
xfree(pScreen->GCPrivateSizes); xfree(pScreen->GCPrivateSizes);
#ifdef PIXPRIV #ifdef PIXPRIV
......
...@@ -530,8 +530,6 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType) ...@@ -530,8 +530,6 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
RESTYPE rtype = res->type; RESTYPE rtype = res->type;
*prev = res->next; *prev = res->next;
elements = --*eltptr; elements = --*eltptr;
if (rtype & RC_CACHED)
FlushClientCaches(res->id);
if (rtype != skipDeleteFuncType) if (rtype != skipDeleteFuncType)
(*DeleteFuncs[rtype & TypeMask])(res->value, res->id); (*DeleteFuncs[rtype & TypeMask])(res->value, res->id);
xfree(res); xfree(res);
...@@ -542,11 +540,6 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType) ...@@ -542,11 +540,6 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
else else
prev = &res->next; prev = &res->next;
} }
if(clients[cid] && (id == clients[cid]->lastDrawableID))
{
clients[cid]->lastDrawable = (DrawablePtr)WindowTable[0];
clients[cid]->lastDrawableID = WindowTable[0]->drawable.id;
}
} }
if (!gotOne) if (!gotOne)
ErrorF("Freeing resource id=%lX which isn't there.\n", ErrorF("Freeing resource id=%lX which isn't there.\n",
...@@ -570,8 +563,6 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree) ...@@ -570,8 +563,6 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
if (res->id == id && res->type == type) if (res->id == id && res->type == type)
{ {
*prev = res->next; *prev = res->next;
if (type & RC_CACHED)
FlushClientCaches(res->id);
if (!skipFree) if (!skipFree)
(*DeleteFuncs[type & TypeMask])(res->value, res->id); (*DeleteFuncs[type & TypeMask])(res->value, res->id);
xfree(res); xfree(res);
...@@ -580,11 +571,6 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree) ...@@ -580,11 +571,6 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
else else
prev = &res->next; prev = &res->next;
} }
if(clients[cid] && (id == clients[cid]->lastDrawableID))
{
clients[cid]->lastDrawable = (DrawablePtr)WindowTable[0];
clients[cid]->lastDrawableID = WindowTable[0]->drawable.id;
}
} }
} }
...@@ -607,8 +593,6 @@ ChangeResourceValue (XID id, RESTYPE rtype, void * value) ...@@ -607,8 +593,6 @@ ChangeResourceValue (XID id, RESTYPE rtype, void * value)
for (; res; res = res->next) for (; res; res = res->next)
if ((res->id == id) && (res->type == rtype)) if ((res->id == id) && (res->type == rtype))
{ {
if (rtype & RC_CACHED)
FlushClientCaches(res->id);
res->value = value; res->value = value;
return TRUE; return TRUE;
} }
...@@ -732,8 +716,6 @@ FreeClientNeverRetainResources(ClientPtr client) ...@@ -732,8 +716,6 @@ FreeClientNeverRetainResources(ClientPtr client)
if (rtype & RC_NEVERRETAIN) if (rtype & RC_NEVERRETAIN)
{ {
*prev = this->next; *prev = this->next;
if (rtype & RC_CACHED)
FlushClientCaches(this->id);
(*DeleteFuncs[rtype & TypeMask])(this->value, this->id); (*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
xfree(this); xfree(this);
} }
...@@ -778,8 +760,6 @@ FreeClientResources(ClientPtr client) ...@@ -778,8 +760,6 @@ FreeClientResources(ClientPtr client)
{ {
RESTYPE rtype = this->type; RESTYPE rtype = this->type;
*head = this->next; *head = this->next;
if (rtype & RC_CACHED)
FlushClientCaches(this->id);
(*DeleteFuncs[rtype & TypeMask])(this->value, this->id); (*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
xfree(this); xfree(this);
} }
......
...@@ -191,7 +191,7 @@ PrintWindowTree() ...@@ -191,7 +191,7 @@ PrintWindowTree()
for (i=0; i<screenInfo.numScreens; i++) for (i=0; i<screenInfo.numScreens; i++)
{ {
ErrorF( "WINDOW %d\n", i); ErrorF( "WINDOW %d\n", i);
pWin = WindowTable[i]; pWin = screenInfo.screens[i]->root;
RegionPrint(&pWin->clipList); RegionPrint(&pWin->clipList);
p1 = pWin->firstChild; p1 = pWin->firstChild;
PrintChildren(p1, 4); PrintChildren(p1, 4);
...@@ -237,7 +237,7 @@ TraverseTree(register WindowPtr pWin, VisitWindowProcPtr func, void * data) ...@@ -237,7 +237,7 @@ TraverseTree(register WindowPtr pWin, VisitWindowProcPtr func, void * data)
int int
WalkTree(ScreenPtr pScreen, VisitWindowProcPtr func, void * data) WalkTree(ScreenPtr pScreen, VisitWindowProcPtr func, void * data)
{ {
return(TraverseTree(WindowTable[pScreen->myNum], func, data)); return(TraverseTree(pScreen->root, func, data));
} }
/* hack for forcing backing store on all windows */ /* hack for forcing backing store on all windows */
...@@ -384,7 +384,7 @@ CreateRootWindow(ScreenPtr pScreen) ...@@ -384,7 +384,7 @@ CreateRootWindow(ScreenPtr pScreen)
savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL; savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL;
screenIsSaved = SCREEN_SAVER_OFF; screenIsSaved = SCREEN_SAVER_OFF;
WindowTable[pScreen->myNum] = pWin; pScreen->root = pWin;
pWin->drawable.pScreen = pScreen; pWin->drawable.pScreen = pScreen;
pWin->drawable.type = DRAWABLE_WINDOW; pWin->drawable.type = DRAWABLE_WINDOW;
...@@ -1348,7 +1348,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt ...@@ -1348,7 +1348,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt
*/ */
if ( cursorID == None) if ( cursorID == None)
{ {
if (pWin == WindowTable[pWin->drawable.pScreen->myNum]) if (pWin == pWin->drawable.pScreen->root)
pCursor = rootCursor; pCursor = rootCursor;
else else
pCursor = (CursorPtr) None; pCursor = (CursorPtr) None;
...@@ -3088,7 +3088,7 @@ HandleSaveSet(register ClientPtr client) ...@@ -3088,7 +3088,7 @@ HandleSaveSet(register ClientPtr client)
pWin = SaveSetWindow(client->saveSet[j]); pWin = SaveSetWindow(client->saveSet[j]);
#ifdef XFIXES #ifdef XFIXES
if (SaveSetToRoot(client->saveSet[j])) if (SaveSetToRoot(client->saveSet[j]))
pParent = WindowTable[pWin->drawable.pScreen->myNum]; pParent = pWin->drawable.pScreen->root;
else else
#endif #endif
{ {
...@@ -3382,9 +3382,9 @@ TileScreenSaver(int i, int kind) ...@@ -3382,9 +3382,9 @@ TileScreenSaver(int i, int kind)
attri = 0; attri = 0;
switch (kind) { switch (kind) {
case SCREEN_IS_TILED: case SCREEN_IS_TILED:
switch (WindowTable[i]->backgroundState) { switch (screenInfo.screens[i]->root->backgroundState) {
case BackgroundPixel: case BackgroundPixel:
attributes[attri++] = WindowTable[i]->background.pixel; attributes[attri++] = screenInfo.screens[i]->root->background.pixel;
mask |= CWBackPixel; mask |= CWBackPixel;
break; break;
case BackgroundPixmap: case BackgroundPixmap:
...@@ -3396,7 +3396,7 @@ TileScreenSaver(int i, int kind) ...@@ -3396,7 +3396,7 @@ TileScreenSaver(int i, int kind)
} }
break; break;
case SCREEN_IS_BLACK: case SCREEN_IS_BLACK:
attributes[attri++] = WindowTable[i]->drawable.pScreen->blackPixel; attributes[attri++] = screenInfo.screens[i]->root->drawable.pScreen->blackPixel;
mask |= CWBackPixel; mask |= CWBackPixel;
break; break;
} }
...@@ -3444,12 +3444,12 @@ TileScreenSaver(int i, int kind) ...@@ -3444,12 +3444,12 @@ TileScreenSaver(int i, int kind)
pWin = savedScreenInfo[i].pWindow = pWin = savedScreenInfo[i].pWindow =
CreateWindow(savedScreenInfo[i].wid, CreateWindow(savedScreenInfo[i].wid,
WindowTable[i], screenInfo.screens[i]->root,
-RANDOM_WIDTH, -RANDOM_WIDTH, -RANDOM_WIDTH, -RANDOM_WIDTH,
(unsigned short)screenInfo.screens[i]->width + RANDOM_WIDTH, (unsigned short)screenInfo.screens[i]->width + RANDOM_WIDTH,
(unsigned short)screenInfo.screens[i]->height + RANDOM_WIDTH, (unsigned short)screenInfo.screens[i]->height + RANDOM_WIDTH,
0, InputOutput, mask, attributes, 0, serverClient, 0, InputOutput, mask, attributes, 0, serverClient,
wVisual (WindowTable[i]), &result); wVisual (screenInfo.screens[i]->root), &result);
if (cursor) if (cursor)
FreeResource (cursorID, RT_NONE); FreeResource (cursorID, RT_NONE);
......
...@@ -582,8 +582,7 @@ extern const GCFuncs fbGCFuncs; ...@@ -582,8 +582,7 @@ extern const GCFuncs fbGCFuncs;
#endif #endif
#ifdef FB_OLD_SCREEN #ifdef FB_OLD_SCREEN
# define FB_OLD_MISCREENINIT /* miScreenInit requires 14 args, not 13 */ # define FB_OLD_MISCREENINIT /* miScreenInit requires 14 args, not 13 */
extern WindowPtr *WindowTable;
#endif #endif
#ifdef FB_24_32BIT #ifdef FB_24_32BIT
...@@ -704,7 +703,7 @@ typedef struct { ...@@ -704,7 +703,7 @@ typedef struct {
#define fbWindowEnabled(pWin) \ #define fbWindowEnabled(pWin) \
RegionNotEmpty(\ RegionNotEmpty(\
&WindowTable[(pWin)->drawable.pScreen->myNum]->borderClip) &(pWin)->drawable.pScreen->root->borderClip)
#define fbDrawableEnabled(pDrawable) \ #define fbDrawableEnabled(pDrawable) \
((pDrawable)->type == DRAWABLE_PIXMAP ? \ ((pDrawable)->type == DRAWABLE_PIXMAP ? \
......
...@@ -262,7 +262,7 @@ fbFillRegionTiled (DrawablePtr pDrawable, ...@@ -262,7 +262,7 @@ fbFillRegionTiled (DrawablePtr pDrawable,
if(!noPanoramiXExtension) if(!noPanoramiXExtension)
{ {
int index = pDrawable->pScreen->myNum; int index = pDrawable->pScreen->myNum;
if(&WindowTable[index]->drawable == pDrawable) if(&screenInfo.screens[index]->root->drawable == pDrawable)
{ {
xRot -= panoramiXdataPtr[index].x; xRot -= panoramiXdataPtr[index].x;
yRot -= panoramiXdataPtr[index].y; yRot -= panoramiXdataPtr[index].y;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "Xatom.h" #include "Xatom.h"
#include "selection.h" #include "selection.h"
#include "windowstr.h" #include "windowstr.h"
#include "scrnintstr.h"
#include "Windows.h" #include "Windows.h"
#include "Atoms.h" #include "Atoms.h"
...@@ -255,7 +256,7 @@ void nxagentClearSelection(XEvent *X) ...@@ -255,7 +256,7 @@ void nxagentClearSelection(XEvent *X)
NullGrab); NullGrab);
} }
CurrentSelections[i].window = WindowTable[0]->drawable.id; CurrentSelections[i].window = screenInfo.screens[0]->root->drawable.id;
CurrentSelections[i].client = NullClient; CurrentSelections[i].client = NullClient;
lastSelectionOwner[i].client = NULL; lastSelectionOwner[i].client = NULL;
...@@ -424,7 +425,7 @@ FIXME: Do we need this? ...@@ -424,7 +425,7 @@ FIXME: Do we need this?
* Fictitious window. * Fictitious window.
*/ */
x.u.selectionRequest.requestor = WindowTable[0]->drawable.id; x.u.selectionRequest.requestor = screenInfo.screens[0]->root->drawable.id;
/* /*
* Don't send the same window, some programs are * Don't send the same window, some programs are
...@@ -1502,13 +1503,13 @@ int nxagentInitClipboard(WindowPtr pWin) ...@@ -1502,13 +1503,13 @@ int nxagentInitClipboard(WindowPtr pWin)
lastSelectionOwner[nxagentPrimarySelection].selection = XA_PRIMARY; lastSelectionOwner[nxagentPrimarySelection].selection = XA_PRIMARY;
lastSelectionOwner[nxagentPrimarySelection].client = NullClient; lastSelectionOwner[nxagentPrimarySelection].client = NullClient;
lastSelectionOwner[nxagentPrimarySelection].window = WindowTable[0]->drawable.id; lastSelectionOwner[nxagentPrimarySelection].window = screenInfo.screens[0]->root->drawable.id;
lastSelectionOwner[nxagentPrimarySelection].windowPtr = NULL; lastSelectionOwner[nxagentPrimarySelection].windowPtr = NULL;
lastSelectionOwner[nxagentPrimarySelection].lastTimeChanged = GetTimeInMillis(); lastSelectionOwner[nxagentPrimarySelection].lastTimeChanged = GetTimeInMillis();
lastSelectionOwner[nxagentClipboardSelection].selection = nxagentClipboardAtom; lastSelectionOwner[nxagentClipboardSelection].selection = nxagentClipboardAtom;
lastSelectionOwner[nxagentClipboardSelection].client = NullClient; lastSelectionOwner[nxagentClipboardSelection].client = NullClient;
lastSelectionOwner[nxagentClipboardSelection].window = WindowTable[0]->drawable.id; lastSelectionOwner[nxagentClipboardSelection].window = screenInfo.screens[0]->root->drawable.id;
lastSelectionOwner[nxagentClipboardSelection].windowPtr = NULL; lastSelectionOwner[nxagentClipboardSelection].windowPtr = NULL;
lastSelectionOwner[nxagentClipboardSelection].lastTimeChanged = GetTimeInMillis(); lastSelectionOwner[nxagentClipboardSelection].lastTimeChanged = GetTimeInMillis();
......
...@@ -125,7 +125,7 @@ void nxagentRedirectDefaultWindows() ...@@ -125,7 +125,7 @@ void nxagentRedirectDefaultWindows()
for (i = 0; i < screenInfo.numScreens; i++) for (i = 0; i < screenInfo.numScreens; i++)
{ {
WindowPtr pWin = WindowTable[i]; WindowPtr pWin = screenInfo.screens[i]->root;
ScreenPtr pScreen = pWin -> drawable.pScreen; ScreenPtr pScreen = pWin -> drawable.pScreen;
......
...@@ -3292,7 +3292,7 @@ void nxagentSendDeferredBackgroundExposures(void) ...@@ -3292,7 +3292,7 @@ void nxagentSendDeferredBackgroundExposures(void)
fprintf(stderr, "nxagentSendDeferredBackgroundExposures: Going to send deferred exposures to the root window.\n"); fprintf(stderr, "nxagentSendDeferredBackgroundExposures: Going to send deferred exposures to the root window.\n");
#endif #endif
TraverseTree(WindowTable[0], nxagentClipAndSendClearExpose, (void *) nxagentDeferredBackgroundExposures); TraverseTree(screenInfo.screens[0]->root, nxagentClipAndSendClearExpose, (void *) nxagentDeferredBackgroundExposures);
RegionEmpty(nxagentDeferredBackgroundExposures); RegionEmpty(nxagentDeferredBackgroundExposures);
} }
......
...@@ -629,8 +629,8 @@ void nxagentShadowSwitchResizeMode(ScreenPtr pScreen) ...@@ -629,8 +629,8 @@ void nxagentShadowSwitchResizeMode(ScreenPtr pScreen)
{ {
nxagentShadowSetRatio(1.0, 1.0); nxagentShadowSetRatio(1.0, 1.0);
nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], WindowTable[0], nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], screenInfo.screens[0]->root,
WindowTable[0] -> drawable.width, WindowTable[0] -> drawable.height); screenInfo.screens[0]->root -> drawable.width, screenInfo.screens[0]->root -> drawable.height);
sizeHints.max_width = nxagentOption(RootWidth); sizeHints.max_width = nxagentOption(RootWidth);
sizeHints.max_height = nxagentOption(RootHeight); sizeHints.max_height = nxagentOption(RootHeight);
...@@ -640,13 +640,13 @@ void nxagentShadowSwitchResizeMode(ScreenPtr pScreen) ...@@ -640,13 +640,13 @@ void nxagentShadowSwitchResizeMode(ScreenPtr pScreen)
else else
{ {
nxagentShadowSetRatio(nxagentOption(Width) * 1.0 / nxagentShadowSetRatio(nxagentOption(Width) * 1.0 /
WindowTable[0] -> drawable.width, screenInfo.screens[0]->root -> drawable.width,
nxagentOption(Height) * 1.0 / nxagentOption(Height) * 1.0 /
WindowTable[0] -> drawable.height); screenInfo.screens[0]->root -> drawable.height);
nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)],
WindowTable[0], WindowTable[0] -> drawable.width, screenInfo.screens[0]->root, screenInfo.screens[0]->root -> drawable.width,
WindowTable[0] -> drawable.height); screenInfo.screens[0]->root -> drawable.height);
sizeHints.max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); sizeHints.max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
sizeHints.max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); sizeHints.max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
...@@ -963,10 +963,10 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) ...@@ -963,10 +963,10 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
case doDebugTree: case doDebugTree:
{ {
fprintf(stderr, "\n ========== nxagentRemoteWindowsTree ==========\n"); fprintf(stderr, "\n ========== nxagentRemoteWindowsTree ==========\n");
nxagentRemoteWindowsTree(nxagentWindow(WindowTable[0]), 0); nxagentRemoteWindowsTree(nxagentWindow(screenInfo.screens[0]->root), 0);
fprintf(stderr, "\n========== nxagentInternalWindowsTree ==========\n"); fprintf(stderr, "\n========== nxagentInternalWindowsTree ==========\n");
nxagentInternalWindowsTree(WindowTable[0], 0); nxagentInternalWindowsTree(screenInfo.screens[0]->root, 0);
break; break;
} }
...@@ -1405,7 +1405,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was ...@@ -1405,7 +1405,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
(X.xmotion.y_root < nxagentLastEnteredTopLevelWindow -> drawable.y + 4)) (X.xmotion.y_root < nxagentLastEnteredTopLevelWindow -> drawable.y + 4))
{ {
if (pWin && nxagentClientIsDialog(wClient(pWin)) == 0 && if (pWin && nxagentClientIsDialog(wClient(pWin)) == 0 &&
nxagentLastEnteredTopLevelWindow -> parent == WindowTable[0] && nxagentLastEnteredTopLevelWindow -> parent == screenInfo.screens[0]->root &&
nxagentLastEnteredTopLevelWindow -> overrideRedirect == False && nxagentLastEnteredTopLevelWindow -> overrideRedirect == False &&
X.xmotion.x_root > (nxagentLastEnteredTopLevelWindow -> drawable.x + X.xmotion.x_root > (nxagentLastEnteredTopLevelWindow -> drawable.x +
(nxagentLastEnteredTopLevelWindow -> drawable.width >> 1) - 50) && (nxagentLastEnteredTopLevelWindow -> drawable.width >> 1) - 50) &&
...@@ -1625,7 +1625,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was ...@@ -1625,7 +1625,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
if (pWin != NULL) if (pWin != NULL)
{ {
for (pTLWin = pWin; for (pTLWin = pWin;
pTLWin -> parent != WindowTable[pTLWin -> drawable.pScreen -> myNum]; pTLWin -> parent != pTLWin -> drawable.pScreen -> root;
pTLWin = pTLWin -> parent); pTLWin = pTLWin -> parent);
} }
...@@ -2454,7 +2454,7 @@ FIXME: This can be maybe optimized by consuming the ...@@ -2454,7 +2454,7 @@ FIXME: This can be maybe optimized by consuming the
RegionValidate(&sum, &overlap); RegionValidate(&sum, &overlap);
RegionIntersect(&sum, &sum, RegionIntersect(&sum, &sum,
&WindowTable[pWin->drawable.pScreen->myNum]->winSize); &pWin->drawable.pScreen->root->winSize);
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "nxagentHandleExposeEvent: Sending events for window id [%ld].\n", fprintf(stderr, "nxagentHandleExposeEvent: Sending events for window id [%ld].\n",
...@@ -3147,7 +3147,7 @@ int nxagentCheckWindowConfiguration(XConfigureEvent* X) ...@@ -3147,7 +3147,7 @@ int nxagentCheckWindowConfiguration(XConfigureEvent* X)
fprintf(stderr, "nxagentCheckWindowConfiguration: Before restacking top level window [%p]\n", fprintf(stderr, "nxagentCheckWindowConfiguration: Before restacking top level window [%p]\n",
(void *) nxagentWindowPtr(X -> window)); (void *) nxagentWindowPtr(X -> window));
for (pSib = WindowTable[0] -> firstChild; pSib; pSib = pSib -> nextSib) for (pSib = screenInfo.screens[0]->root -> firstChild; pSib; pSib = pSib -> nextSib)
{ {
fprintf(stderr, "nxagentCheckWindowConfiguration: Top level window: [%p].\n", fprintf(stderr, "nxagentCheckWindowConfiguration: Top level window: [%p].\n",
(void *) pSib); (void *) pSib);
...@@ -3431,7 +3431,7 @@ int nxagentHandleConfigureNotify(XEvent* X) ...@@ -3431,7 +3431,7 @@ int nxagentHandleConfigureNotify(XEvent* X)
nxagentUpdateViewportFrame(0, 0, nxagentOption(RootWidth), nxagentUpdateViewportFrame(0, 0, nxagentOption(RootWidth),
nxagentOption(RootHeight)); nxagentOption(RootHeight));
XMoveWindow(nxagentDisplay, nxagentWindow(WindowTable[pScreen -> myNum]), XMoveWindow(nxagentDisplay, nxagentWindow(pScreen->root),
nxagentOption(RootX), nxagentOption(RootY)); nxagentOption(RootX), nxagentOption(RootY));
} }
...@@ -4245,7 +4245,7 @@ void nxagentForwardRemoteExpose(void) ...@@ -4245,7 +4245,7 @@ void nxagentForwardRemoteExpose(void)
fprintf(stderr, "nxagentForwardRemoteExpose: Going to forward events.\n"); fprintf(stderr, "nxagentForwardRemoteExpose: Going to forward events.\n");
#endif #endif
TraverseTree(WindowTable[0], nxagentClipAndSendExpose, (void *)nxagentRemoteExposeRegion); TraverseTree(screenInfo.screens[0]->root, nxagentClipAndSendExpose, (void *)nxagentRemoteExposeRegion);
/* /*
* Now this region should be empty. * Now this region should be empty.
...@@ -4420,7 +4420,7 @@ int nxagentHandleRRScreenChangeNotify(XEvent *X) ...@@ -4420,7 +4420,7 @@ int nxagentHandleRRScreenChangeNotify(XEvent *X)
nxagentResizeScreen(screenInfo.screens[DefaultScreen(nxagentDisplay)], Xr -> width, Xr -> height, nxagentResizeScreen(screenInfo.screens[DefaultScreen(nxagentDisplay)], Xr -> width, Xr -> height,
Xr -> mwidth, Xr -> mheight); Xr -> mwidth, Xr -> mheight);
nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], WindowTable[0], nxagentShadowCreateMainWindow(screenInfo.screens[DefaultScreen(nxagentDisplay)], screenInfo.screens[0]->root,
Xr -> width, Xr -> height); Xr -> width, Xr -> height);
nxagentShadowSetWindowsSize(); nxagentShadowSetWindowsSize();
......
...@@ -35,6 +35,32 @@ static int nxagentRandRScreenSetSize(ScreenPtr pScreen, CARD16 width, ...@@ -35,6 +35,32 @@ static int nxagentRandRScreenSetSize(ScreenPtr pScreen, CARD16 width,
static int nxagentRandRInitSizes(ScreenPtr pScreen); static int nxagentRandRInitSizes(ScreenPtr pScreen);
#if RANDR_14_INTERFACE
static Bool
nxagentRandRReplaceScanoutPixmap(DrawablePtr pDrawable,
PixmapPtr pPixmap,
Bool enable);
#endif
#if RANDR_13_INTERFACE
static Bool
nxagentRandROutputGetProperty(ScreenPtr pScreen,
RROutputPtr output,
Atom property);
static Bool
nxagentRandRGetPanning(ScreenPtr pScrn,
RRCrtcPtr crtc,
BoxPtr totalArea,
BoxPtr trackingArea,
INT16 *border);
static Bool
nxagentRandRSetPanning(ScreenPtr pScrn,
RRCrtcPtr crtc,
BoxPtr totalArea,
BoxPtr trackingArea,
INT16 *border);
#endif
#if RANDR_12_INTERFACE #if RANDR_12_INTERFACE
static Bool nxagentRandRCrtcSet (ScreenPtr pScreen, RRCrtcPtr crtc, static Bool nxagentRandRCrtcSet (ScreenPtr pScreen, RRCrtcPtr crtc,
RRModePtr mode, int x, int y, RRModePtr mode, int x, int y,
...@@ -104,6 +130,29 @@ void nxagentInitRandRExtension(ScreenPtr pScreen) ...@@ -104,6 +130,29 @@ void nxagentInitRandRExtension(ScreenPtr pScreen)
pRandRScrPriv -> rrGetInfo = nxagentRandRGetInfo; pRandRScrPriv -> rrGetInfo = nxagentRandRGetInfo;
#if RANDR_15_INTERFACE
/* nothing to be assigned here, so far */
#endif
#if RANDR_14_INTERFACE
/* no pixmap sharing in nx-X11 */
pScreen->ReplaceScanoutPixmap = nxagentRandRReplaceScanoutPixmap;
pRandRScrPriv -> rrCrtcSetScanoutPixmap = NULL;
/* only fake provider support in nx-X11, so far */
pRandRScrPriv -> provider = RRProviderCreate(pScreen, "default", 7);
pRandRScrPriv -> rrProviderSetOutputSource = NULL;
pRandRScrPriv -> rrProviderSetOffloadSink;
pRandRScrPriv -> rrProviderGetProperty;
pRandRScrPriv -> rrProviderSetProperty;
#endif
#if RANDR_13_INTERFACE
pRandRScrPriv -> rrOutputGetProperty = nxagentRandROutputGetProperty;
pRandRScrPriv -> rrGetPanning = nxagentRandRGetPanning;
pRandRScrPriv -> rrSetPanning = nxagentRandRSetPanning;
#endif
#if RANDR_12_INTERFACE #if RANDR_12_INTERFACE
pRandRScrPriv -> rrScreenSetSize = nxagentRandRScreenSetSize; pRandRScrPriv -> rrScreenSetSize = nxagentRandRScreenSetSize;
pRandRScrPriv -> rrCrtcSet = nxagentRandRCrtcSet; pRandRScrPriv -> rrCrtcSet = nxagentRandRCrtcSet;
...@@ -114,13 +163,70 @@ void nxagentInitRandRExtension(ScreenPtr pScreen) ...@@ -114,13 +163,70 @@ void nxagentInitRandRExtension(ScreenPtr pScreen)
#endif #endif
} }
void #if RANDR_14_INTERFACE
RRResetProc (ExtensionEntry *extEntry) static Bool
nxagentRandRReplaceScanoutPixmap(DrawablePtr pDrawable,
PixmapPtr pPixmap,
Bool enable)
{
/* FALSE means: not supported */
#ifdef DEBUG
fprintf(stderr, "nxagentRandRReplaceScanoutPixmap: NX's RANDR does not support scan-out pixmaps.\n");
#endif
return FALSE;
}
#endif
#if RANDR_13_INTERFACE
static Bool
nxagentRandROutputGetProperty(ScreenPtr pScreen,
RROutputPtr output,
Atom property)
{ {
fprintf(stderr, "RANDR going down - NX version\n"); /* FALSE means: no property required to be modified on the fly here */
return FALSE;
} }
static Bool
nxagentRandRGetPanning(ScreenPtr pScrn,
RRCrtcPtr crtc,
BoxPtr totalArea,
BoxPtr trackingArea,
INT16 *border)
{
/* FALSE means: no, panning is not supported at the moment...
* Panning requires several modes to be available for
* the NX<n> output(s).
*
* FIXME: Add more modes per output than the current window size.
* At least when in fullscreen mode.
*/
#ifdef DEBUG
fprintf(stderr, "nxagentRandRGetPanning: RANDR Panning is currently not supported.\n");
#endif
return FALSE;
}
static Bool
nxagentRandRSetPanning(ScreenPtr pScrn,
RRCrtcPtr crtc,
BoxPtr totalArea,
BoxPtr trackingArea,
INT16 *border)
{
/* FALSE means: no, panning is not supported at the moment...
* Panning requires several modes to be available for
* the NX<n> output(s).
*
* FIXME: Add more modes per output than the current window size.
* At least when in fullscreen mode.
*/
#ifdef DEBUG
fprintf(stderr, "nxagentRandRSetPanning: RANDR Panning is currently not supported.\n");
#endif
return FALSE;
}
#endif
#if RANDR_12_INTERFACE #if RANDR_12_INTERFACE
/* /*
...@@ -137,7 +243,7 @@ nxagentRandRCrtcSet (ScreenPtr pScreen, ...@@ -137,7 +243,7 @@ nxagentRandRCrtcSet (ScreenPtr pScreen,
int numOutputs, int numOutputs,
RROutputPtr *outputs) RROutputPtr *outputs)
{ {
return RRCrtcNotify(crtc, mode, x, y, rotation, numOutputs, outputs); return RRCrtcNotify(crtc, mode, x, y, rotation, NULL, numOutputs, outputs);
} }
#endif #endif
......
...@@ -209,8 +209,11 @@ DEFINES = -g $(OS_DEFINES) $(EXT_DEFINES) $(NX_DEFINES) \ ...@@ -209,8 +209,11 @@ DEFINES = -g $(OS_DEFINES) $(EXT_DEFINES) $(NX_DEFINES) \
-DNXAGENT_ARTSD \ -DNXAGENT_ARTSD \
-DNXAGENT_RANDR_MODE_PREFIX \ -DNXAGENT_RANDR_MODE_PREFIX \
-UNX_DEBUG_INPUT \ -UNX_DEBUG_INPUT \
-DRANDR_10_INTERFACE \ -DRANDR_10_INTERFACE=1 \
-DRANDR_12_INTERFACE \ -DRANDR_12_INTERFACE=1 \
-DRANDR_13_INTERFACE=1 \
-DRANDR_14_INTERFACE=1 \
-DRANDR_15_INTERFACE=1 \
-DPANORAMIX \ -DPANORAMIX \
-UDEBUG_TREE -UDEBUG_TREE
......
...@@ -344,13 +344,13 @@ InitSelections() ...@@ -344,13 +344,13 @@ InitSelections()
CurrentSelections[0].selection = XA_PRIMARY; CurrentSelections[0].selection = XA_PRIMARY;
CurrentSelections[0].lastTimeChanged = ClientTimeToServerTime(0); CurrentSelections[0].lastTimeChanged = ClientTimeToServerTime(0);
CurrentSelections[0].window = WindowTable[0]->drawable.id; CurrentSelections[0].window = screenInfo.screens[0]->root->drawable.id;
CurrentSelections[0].pWin = NULL; CurrentSelections[0].pWin = NULL;
CurrentSelections[0].client = NullClient; CurrentSelections[0].client = NullClient;
CurrentSelections[1].selection = MakeAtom("CLIPBOARD", 9, 1); CurrentSelections[1].selection = MakeAtom("CLIPBOARD", 9, 1);
CurrentSelections[1].lastTimeChanged = ClientTimeToServerTime(0); CurrentSelections[1].lastTimeChanged = ClientTimeToServerTime(0);
CurrentSelections[1].window = WindowTable[0]->drawable.id; CurrentSelections[1].window = screenInfo.screens[0]->root->drawable.id;
CurrentSelections[1].pWin = NULL; CurrentSelections[1].pWin = NULL;
CurrentSelections[1].client = NullClient; CurrentSelections[1].client = NullClient;
} }
...@@ -374,8 +374,8 @@ FlushClientCaches(XID id) ...@@ -374,8 +374,8 @@ FlushClientCaches(XID id)
{ {
if (client->lastDrawableID == id) if (client->lastDrawableID == id)
{ {
client->lastDrawableID = WindowTable[0]->drawable.id; client->lastDrawableID = screenInfo.screens[0]->root->drawable.id;
client->lastDrawable = (DrawablePtr)WindowTable[0]; client->lastDrawable = (DrawablePtr)screenInfo.screens[0]->root;
} }
else if (client->lastGCID == id) else if (client->lastGCID == id)
{ {
...@@ -1161,7 +1161,7 @@ GetGeometry(register ClientPtr client, xGetGeometryReply *rep) ...@@ -1161,7 +1161,7 @@ GetGeometry(register ClientPtr client, xGetGeometryReply *rep)
rep->type = X_Reply; rep->type = X_Reply;
rep->length = 0; rep->length = 0;
rep->sequenceNumber = client->sequence; rep->sequenceNumber = client->sequence;
rep->root = WindowTable[pDraw->pScreen->myNum]->drawable.id; rep->root = pDraw->pScreen->root->drawable.id;
rep->depth = pDraw->depth; rep->depth = pDraw->depth;
rep->width = pDraw->width; rep->width = pDraw->width;
rep->height = pDraw->height; rep->height = pDraw->height;
...@@ -1221,7 +1221,7 @@ ProcQueryTree(register ClientPtr client) ...@@ -1221,7 +1221,7 @@ ProcQueryTree(register ClientPtr client)
return(BadWindow); return(BadWindow);
memset(&reply, 0, sizeof(xQueryTreeReply)); memset(&reply, 0, sizeof(xQueryTreeReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; reply.root = pWin->drawable.pScreen->root->drawable.id;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
if (pWin->parent) if (pWin->parent)
reply.parent = pWin->parent->drawable.id; reply.parent = pWin->parent->drawable.id;
...@@ -4319,8 +4319,8 @@ void InitClient(ClientPtr client, int i, void * ospriv) ...@@ -4319,8 +4319,8 @@ void InitClient(ClientPtr client, int i, void * ospriv)
if (i) if (i)
{ {
client->closeDownMode = DestroyAll; client->closeDownMode = DestroyAll;
client->lastDrawable = (DrawablePtr)WindowTable[0]; client->lastDrawable = (DrawablePtr)screenInfo.screens[0]->root;
client->lastDrawableID = WindowTable[0]->drawable.id; client->lastDrawableID = screenInfo.screens[0]->root->drawable.id;
} }
else else
{ {
...@@ -4563,8 +4563,8 @@ SendConnSetup(register ClientPtr client, char *reason) ...@@ -4563,8 +4563,8 @@ SendConnSetup(register ClientPtr client, char *reason)
register unsigned int j; register unsigned int j;
register xDepth *pDepth; register xDepth *pDepth;
root->currentInputMask = WindowTable[i]->eventMask | root->currentInputMask = screenInfo.screens[i]->root->eventMask |
wOtherEventMasks (WindowTable[i]); wOtherEventMasks (screenInfo.screens[i]->root);
pDepth = (xDepth *)(root + 1); pDepth = (xDepth *)(root + 1);
for (j = 0; j < root->nDepths; j++) for (j = 0; j < root->nDepths; j++)
{ {
......
...@@ -162,7 +162,6 @@ extern Bool XkbFilterEvents(ClientPtr, int, xEvent *); ...@@ -162,7 +162,6 @@ extern Bool XkbFilterEvents(ClientPtr, int, xEvent *);
#endif #endif
#ifdef XEVIE #ifdef XEVIE
extern WindowPtr *WindowTable;
extern int xevieFlag; extern int xevieFlag;
extern int xevieClientIndex; extern int xevieClientIndex;
extern DeviceIntPtr xeviemouse; extern DeviceIntPtr xeviemouse;
...@@ -465,9 +464,10 @@ XineramaCheckPhysLimits( ...@@ -465,9 +464,10 @@ XineramaCheckPhysLimits(
static Bool static Bool
XineramaSetWindowPntrs(WindowPtr pWin) XineramaSetWindowPntrs(WindowPtr pWin)
{ {
if(pWin == WindowTable[0]) { if(pWin == screenInfo.screens[0]->root) {
memcpy(sprite.windows, WindowTable, int i;
PanoramiXNumScreens*sizeof(WindowPtr)); for (i = 0; i < PanoramiXNumScreens; i++)
sprite.windows[i] = screenInfo.screens[i]->root;
} else { } else {
PanoramiXRes *win; PanoramiXRes *win;
int i; int i;
...@@ -692,7 +692,7 @@ XineramaConfineCursorToWindow(WindowPtr pWin, Bool generateEvents) ...@@ -692,7 +692,7 @@ XineramaConfineCursorToWindow(WindowPtr pWin, Bool generateEvents)
sprite.hotShape = NullRegion; sprite.hotShape = NullRegion;
sprite.confined = FALSE; sprite.confined = FALSE;
sprite.confineWin = (pWin == WindowTable[0]) ? NullWindow : pWin; sprite.confineWin = (pWin == screenInfo.screens[0]->root) ? NullWindow : pWin;
XineramaCheckPhysLimits(sprite.current, generateEvents); XineramaCheckPhysLimits(sprite.current, generateEvents);
} }
...@@ -909,7 +909,7 @@ CheckVirtualMotion( ...@@ -909,7 +909,7 @@ CheckVirtualMotion(
qe->event->u.keyButtonPointer.rootY = sprite.hot.y; qe->event->u.keyButtonPointer.rootY = sprite.hot.y;
} }
} }
ROOT = WindowTable[sprite.hot.pScreen->myNum]; ROOT = sprite.hot.pScreen->root;
} }
static void static void
...@@ -1109,7 +1109,7 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count) ...@@ -1109,7 +1109,7 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count)
*/ */
if (xE->u.u.type == MotionNotify) if (xE->u.u.type == MotionNotify)
XE_KBPTR.root = XE_KBPTR.root =
WindowTable[sprite.hotPhys.pScreen->myNum]->drawable.id; sprite.hotPhys.pScreen->root->drawable.id;
eventinfo.events = xE; eventinfo.events = xE;
eventinfo.count = count; eventinfo.count = count;
CallCallbacks(&DeviceEventCallback, (void *)&eventinfo); CallCallbacks(&DeviceEventCallback, (void *)&eventinfo);
...@@ -1272,7 +1272,7 @@ playmore: ...@@ -1272,7 +1272,7 @@ playmore:
ConfineCursorToWindow(grab->confineTo, TRUE, TRUE); ConfineCursorToWindow(grab->confineTo, TRUE, TRUE);
} }
else else
ConfineCursorToWindow(WindowTable[sprite.hotPhys.pScreen->myNum], ConfineCursorToWindow(sprite.hotPhys.pScreen->root,
TRUE, FALSE); TRUE, FALSE);
PostNewCursor(); PostNewCursor();
} }
...@@ -1290,7 +1290,7 @@ ScreenRestructured (ScreenPtr pScreen) ...@@ -1290,7 +1290,7 @@ ScreenRestructured (ScreenPtr pScreen)
ConfineCursorToWindow(grab->confineTo, TRUE, TRUE); ConfineCursorToWindow(grab->confineTo, TRUE, TRUE);
} }
else else
ConfineCursorToWindow(WindowTable[sprite.hotPhys.pScreen->myNum], ConfineCursorToWindow(sprite.hotPhys.pScreen->root,
TRUE, FALSE); TRUE, FALSE);
} }
#endif #endif
...@@ -2219,7 +2219,7 @@ CheckMotion(xEvent *xE) ...@@ -2219,7 +2219,7 @@ CheckMotion(xEvent *xE)
if (sprite.hot.pScreen != sprite.hotPhys.pScreen) if (sprite.hot.pScreen != sprite.hotPhys.pScreen)
{ {
sprite.hot.pScreen = sprite.hotPhys.pScreen; sprite.hot.pScreen = sprite.hotPhys.pScreen;
ROOT = WindowTable[sprite.hot.pScreen->myNum]; ROOT = sprite.hot.pScreen->root;
} }
#ifdef XEVIE #ifdef XEVIE
xeviehot.x = xeviehot.x =
...@@ -2307,9 +2307,9 @@ WindowsRestructured() ...@@ -2307,9 +2307,9 @@ WindowsRestructured()
#ifdef PANORAMIX #ifdef PANORAMIX
/* This was added to support reconfiguration under Xdmx. The problem is /* This was added to support reconfiguration under Xdmx. The problem is
* that if the 0th screen (i.e., WindowTable[0]) is moved to an origin * that if the 0th screen (i.e., screenInfo.screens[0]->root) is moved to
* other than 0,0, the information in the private sprite structure must * an origin other than 0,0, the information in the private sprite structure
* be updated accordingly, or XYToWindow (and other routines) will not * must be updated accordingly, or XYToWindow (and other routines) will not
* compute correctly. */ * compute correctly. */
void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff) void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff)
{ {
...@@ -2339,7 +2339,7 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff) ...@@ -2339,7 +2339,7 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff)
sprite.hotPhys.x = sprite.hotPhys.y = 0; sprite.hotPhys.x = sprite.hotPhys.y = 0;
ConfineCursorToWindow(grab->confineTo, TRUE, TRUE); ConfineCursorToWindow(grab->confineTo, TRUE, TRUE);
} else } else
ConfineCursorToWindow(WindowTable[sprite.hotPhys.pScreen->myNum], ConfineCursorToWindow(sprite.hotPhys.pScreen->root,
TRUE, FALSE); TRUE, FALSE);
} }
#endif #endif
...@@ -2435,7 +2435,7 @@ NewCurrentScreen(ScreenPtr newScreen, int x, int y) ...@@ -2435,7 +2435,7 @@ NewCurrentScreen(ScreenPtr newScreen, int x, int y)
if(sprite.confineWin) if(sprite.confineWin)
XineramaConfineCursorToWindow(sprite.confineWin, TRUE); XineramaConfineCursorToWindow(sprite.confineWin, TRUE);
else else
XineramaConfineCursorToWindow(WindowTable[0], TRUE); XineramaConfineCursorToWindow(screenInfo.screens[0]->root, TRUE);
/* if the pointer wasn't confined, the DDX won't get /* if the pointer wasn't confined, the DDX won't get
told of the pointer warp so we reposition it here */ told of the pointer warp so we reposition it here */
if(!syncEvents.playingEvents) if(!syncEvents.playingEvents)
...@@ -2448,7 +2448,7 @@ NewCurrentScreen(ScreenPtr newScreen, int x, int y) ...@@ -2448,7 +2448,7 @@ NewCurrentScreen(ScreenPtr newScreen, int x, int y)
} else } else
#endif #endif
if (newScreen != sprite.hotPhys.pScreen) if (newScreen != sprite.hotPhys.pScreen)
ConfineCursorToWindow(WindowTable[newScreen->myNum], TRUE, FALSE); ConfineCursorToWindow(newScreen->root, TRUE, FALSE);
} }
#ifdef PANORAMIX #ifdef PANORAMIX
...@@ -2520,7 +2520,7 @@ XineramaWarpPointer(ClientPtr client) ...@@ -2520,7 +2520,7 @@ XineramaWarpPointer(ClientPtr client)
winX = source->drawable.x; winX = source->drawable.x;
winY = source->drawable.y; winY = source->drawable.y;
if(source == WindowTable[0]) { if(source == screenInfo.screens[0]->root) {
winX -= panoramiXdataPtr[0].x; winX -= panoramiXdataPtr[0].x;
winY -= panoramiXdataPtr[0].y; winY -= panoramiXdataPtr[0].y;
} }
...@@ -2536,7 +2536,7 @@ XineramaWarpPointer(ClientPtr client) ...@@ -2536,7 +2536,7 @@ XineramaWarpPointer(ClientPtr client)
if (dest) { if (dest) {
x = dest->drawable.x; x = dest->drawable.x;
y = dest->drawable.y; y = dest->drawable.y;
if(dest == WindowTable[0]) { if(dest == screenInfo.screens[0]->root) {
x -= panoramiXdataPtr[0].x; x -= panoramiXdataPtr[0].x;
y -= panoramiXdataPtr[0].y; y -= panoramiXdataPtr[0].y;
} }
...@@ -3206,7 +3206,7 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count ...@@ -3206,7 +3206,7 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
/* see comment in EnqueueEvents regarding the next three lines */ /* see comment in EnqueueEvents regarding the next three lines */
if (xE->u.u.type == MotionNotify) if (xE->u.u.type == MotionNotify)
XE_KBPTR.root = XE_KBPTR.root =
WindowTable[sprite.hotPhys.pScreen->myNum]->drawable.id; sprite.hotPhys.pScreen->root->drawable.id;
eventinfo.events = xE; eventinfo.events = xE;
eventinfo.count = count; eventinfo.count = count;
CallCallbacks(&DeviceEventCallback, (void *)&eventinfo); CallCallbacks(&DeviceEventCallback, (void *)&eventinfo);
...@@ -3818,11 +3818,11 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode) ...@@ -3818,11 +3818,11 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode)
/* Notify all the roots */ /* Notify all the roots */
#ifdef PANORAMIX #ifdef PANORAMIX
if ( !noPanoramiXExtension ) if ( !noPanoramiXExtension )
FocusEvent(dev, FocusOut, mode, out, WindowTable[0]); FocusEvent(dev, FocusOut, mode, out, screenInfo.screens[0]->root);
else else
#endif #endif
for (i=0; i<screenInfo.numScreens; i++) for (i=0; i<screenInfo.numScreens; i++)
FocusEvent(dev, FocusOut, mode, out, WindowTable[i]); FocusEvent(dev, FocusOut, mode, out, screenInfo.screens[i]->root);
} }
else else
{ {
...@@ -3837,11 +3837,11 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode) ...@@ -3837,11 +3837,11 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode)
/* Notify all the roots */ /* Notify all the roots */
#ifdef PANORAMIX #ifdef PANORAMIX
if ( !noPanoramiXExtension ) if ( !noPanoramiXExtension )
FocusEvent(dev, FocusIn, mode, in, WindowTable[0]); FocusEvent(dev, FocusIn, mode, in, screenInfo.screens[0]->root);
else else
#endif #endif
for (i=0; i<screenInfo.numScreens; i++) for (i=0; i<screenInfo.numScreens; i++)
FocusEvent(dev, FocusIn, mode, in, WindowTable[i]); FocusEvent(dev, FocusIn, mode, in, screenInfo.screens[i]->root);
if (toWin == PointerRootWin) if (toWin == PointerRootWin)
(void)FocusInEvents(dev, ROOT, sprite.win, NullWindow, mode, (void)FocusInEvents(dev, ROOT, sprite.win, NullWindow, mode,
NotifyPointer, TRUE); NotifyPointer, TRUE);
...@@ -3855,11 +3855,11 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode) ...@@ -3855,11 +3855,11 @@ DoFocusEvents(DeviceIntPtr dev, WindowPtr fromWin, WindowPtr toWin, int mode)
TRUE); TRUE);
#ifdef PANORAMIX #ifdef PANORAMIX
if ( !noPanoramiXExtension ) if ( !noPanoramiXExtension )
FocusEvent(dev, FocusOut, mode, out, WindowTable[0]); FocusEvent(dev, FocusOut, mode, out, screenInfo.screens[0]->root);
else else
#endif #endif
for (i=0; i<screenInfo.numScreens; i++) for (i=0; i<screenInfo.numScreens; i++)
FocusEvent(dev, FocusOut, mode, out, WindowTable[i]); FocusEvent(dev, FocusOut, mode, out, screenInfo.screens[i]->root);
if (toWin->parent != NullWindow) if (toWin->parent != NullWindow)
(void)FocusInEvents(dev, ROOT, toWin, toWin, mode, (void)FocusInEvents(dev, ROOT, toWin, toWin, mode,
NotifyNonlinearVirtual, TRUE); NotifyNonlinearVirtual, TRUE);
......
...@@ -111,7 +111,7 @@ AddExtension(char *name, int NumEvents, int NumErrors, ...@@ -111,7 +111,7 @@ AddExtension(char *name, int NumEvents, int NumErrors,
int i; int i;
register ExtensionEntry *ext, **newexts; register ExtensionEntry *ext, **newexts;
if (!MainProc || !SwappedMainProc || !CloseDownProc || !MinorOpcodeProc) if (!MainProc || !SwappedMainProc || !MinorOpcodeProc)
return((ExtensionEntry *) NULL); return((ExtensionEntry *) NULL);
if ((lastEvent + NumEvents > LAST_EVENT) || if ((lastEvent + NumEvents > LAST_EVENT) ||
(unsigned)(lastError + NumErrors > LAST_ERROR)) (unsigned)(lastError + NumErrors > LAST_ERROR))
...@@ -296,7 +296,8 @@ CloseDownExtensions() ...@@ -296,7 +296,8 @@ CloseDownExtensions()
for (i = NumExtensions - 1; i >= 0; i--) for (i = NumExtensions - 1; i >= 0; i--)
{ {
(* extensions[i]->CloseDown)(extensions[i]); if (extensions[i]->CloseDown)
(* extensions[i]->CloseDown)(extensions[i]);
NumExtensions = i; NumExtensions = i;
xfree(extensions[i]->name); xfree(extensions[i]->name);
for (j = extensions[i]->num_aliases; --j >= 0;) for (j = extensions[i]->num_aliases; --j >= 0;)
......
...@@ -504,7 +504,7 @@ miSendExposures(pWin, pRgn, dx, dy) ...@@ -504,7 +504,7 @@ miSendExposures(pWin, pRgn, dx, dy)
if(!pWin->parent) { if(!pWin->parent) {
x = panoramiXdataPtr[scrnum].x; x = panoramiXdataPtr[scrnum].x;
y = panoramiXdataPtr[scrnum].y; y = panoramiXdataPtr[scrnum].y;
pWin = WindowTable[0]; pWin = screenInfo.screens[0]->root;
realWin = pWin->drawable.id; realWin = pWin->drawable.id;
} else if (scrnum) { } else if (scrnum) {
PanoramiXRes *win; PanoramiXRes *win;
...@@ -788,7 +788,7 @@ int what; ...@@ -788,7 +788,7 @@ int what;
gcmask |= GCFunction | GCClipMask; gcmask |= GCFunction | GCClipMask;
i = pScreen->myNum; i = pScreen->myNum;
pRoot = WindowTable[i]; pRoot = screenInfo.screens[i]->root;
pBgWin = pWin; pBgWin = pWin;
if (what == PW_BORDER) if (what == PW_BORDER)
......
...@@ -2051,74 +2051,6 @@ AddTraps (PicturePtr pPicture, ...@@ -2051,74 +2051,6 @@ AddTraps (PicturePtr pPicture,
(*ps->AddTraps) (pPicture, xOff, yOff, ntrap, traps); (*ps->AddTraps) (pPicture, xOff, yOff, ntrap, traps);
} }
#define MAX_FIXED_48_16 ((xFixed_48_16) 0x7fffffff)
#define MIN_FIXED_48_16 (-((xFixed_48_16) 1 << 31))
Bool
PictureTransformPoint3d (PictTransformPtr transform,
PictVectorPtr vector)
{
PictVector result;
int i, j;
xFixed_32_32 partial;
xFixed_48_16 v;
for (j = 0; j < 3; j++)
{
v = 0;
for (i = 0; i < 3; i++)
{
partial = ((xFixed_48_16) transform->matrix[j][i] *
(xFixed_48_16) vector->vector[i]);
v += partial >> 16;
}
if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16)
return FALSE;
result.vector[j] = (xFixed) v;
}
if (!result.vector[2])
return FALSE;
*vector = result;
return TRUE;
}
Bool
PictureTransformPoint (PictTransformPtr transform,
PictVectorPtr vector)
{
PictVector result;
int i, j;
xFixed_32_32 partial;
xFixed_48_16 v;
for (j = 0; j < 3; j++)
{
v = 0;
for (i = 0; i < 3; i++)
{
partial = ((xFixed_48_16) transform->matrix[j][i] *
(xFixed_48_16) vector->vector[i]);
v += partial >> 16;
}
if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16)
return FALSE;
result.vector[j] = (xFixed) v;
}
if (!result.vector[2])
return FALSE;
for (j = 0; j < 2; j++)
{
partial = (xFixed_48_16) result.vector[j] << 16;
v = partial / result.vector[2];
if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16)
return FALSE;
vector->vector[j] = (xFixed) v;
}
vector->vector[2] = xFixed1;
return TRUE;
}
#ifndef True #ifndef True
# define True 1 # define True 1
#endif #endif
......
...@@ -78,13 +78,10 @@ typedef struct _PictFormat { ...@@ -78,13 +78,10 @@ typedef struct _PictFormat {
IndexFormatRec index; IndexFormatRec index;
} PictFormatRec; } PictFormatRec;
typedef struct _PictVector { typedef struct pixman_vector PictVector, *PictVectorPtr;
xFixed vector[3]; typedef struct pixman_transform PictTransform, *PictTransformPtr;
} PictVector, *PictVectorPtr;
typedef struct _PictTransform { #define pict_f_transform pixman_f_transform
xFixed matrix[3][3];
} PictTransform, *PictTransformPtr;
#define PICT_GRADIENT_STOPTABLE_SIZE 1024 #define PICT_GRADIENT_STOPTABLE_SIZE 1024
#define SourcePictTypeSolidFill 0 #define SourcePictTypeSolidFill 0
...@@ -193,12 +190,14 @@ typedef struct _Picture { ...@@ -193,12 +190,14 @@ typedef struct _Picture {
SourcePictPtr pSourcePict; SourcePictPtr pSourcePict;
} PictureRec; } PictureRec;
typedef Bool (*PictFilterValidateParamsProcPtr) (PicturePtr pPicture, int id, typedef Bool (*PictFilterValidateParamsProcPtr) (ScreenPtr pScreen, int id,
xFixed *params, int nparams); xFixed *params, int nparams,
int *width, int *height);
typedef struct { typedef struct {
char *name; char *name;
int id; int id;
PictFilterValidateParamsProcPtr ValidateParams; PictFilterValidateParamsProcPtr ValidateParams;
int width, height;
} PictFilterRec, *PictFilterPtr; } PictFilterRec, *PictFilterPtr;
#define PictFilterNearest 0 #define PictFilterNearest 0
...@@ -482,7 +481,12 @@ PictFilterPtr ...@@ -482,7 +481,12 @@ PictFilterPtr
PictureFindFilter (ScreenPtr pScreen, char *name, int len); PictureFindFilter (ScreenPtr pScreen, char *name, int len);
int int
SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams); SetPicturePictFilter (PicturePtr pPicture, PictFilterPtr pFilter,
xFixed *params, int nparams);
int
SetPictureFilter (PicturePtr pPicture, char *name, int len,
xFixed *params, int nparams);
Bool Bool
PictureFinishInit (void); PictureFinishInit (void);
...@@ -682,4 +686,22 @@ void PanoramiXRenderInit (void); ...@@ -682,4 +686,22 @@ void PanoramiXRenderInit (void);
void PanoramiXRenderReset (void); void PanoramiXRenderReset (void);
#endif #endif
/*
* matrix.c
*/
extern _X_EXPORT void
PictTransform_from_xRenderTransform(PictTransformPtr pict,
xRenderTransform * render);
extern _X_EXPORT void
xRenderTransform_from_PictTransform(xRenderTransform * render,
PictTransformPtr pict);
extern _X_EXPORT Bool
PictureTransformPoint(PictTransformPtr transform, PictVectorPtr vector);
extern _X_EXPORT Bool
PictureTransformPoint3d(PictTransformPtr transform, PictVectorPtr vector);
#endif /* _PICTURESTR_H_ */ #endif /* _PICTURESTR_H_ */
...@@ -3204,7 +3204,7 @@ PanoramiXRenderCreatePicture (ClientPtr client) ...@@ -3204,7 +3204,7 @@ PanoramiXRenderCreatePicture (ClientPtr client)
newPict->info[0].id = stuff->pid; newPict->info[0].id = stuff->pid;
if (refDraw->type == XRT_WINDOW && if (refDraw->type == XRT_WINDOW &&
stuff->drawable == WindowTable[0]->drawable.id) stuff->drawable == screenInfo.screens[0]->root->drawable.id)
{ {
newPict->u.pict.root = TRUE; newPict->u.pict.root = TRUE;
} }
......
...@@ -685,8 +685,6 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType) ...@@ -685,8 +685,6 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
nxagentResChangedFlag = 1; nxagentResChangedFlag = 1;
#endif #endif
if (rtype & RC_CACHED)
FlushClientCaches(res->id);
if (rtype != skipDeleteFuncType) if (rtype != skipDeleteFuncType)
(*DeleteFuncs[rtype & TypeMask])(res->value, res->id); (*DeleteFuncs[rtype & TypeMask])(res->value, res->id);
xfree(res); xfree(res);
...@@ -697,11 +695,6 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType) ...@@ -697,11 +695,6 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
else else
prev = &res->next; prev = &res->next;
} }
if(clients[cid] && (id == clients[cid]->lastDrawableID))
{
clients[cid]->lastDrawable = (DrawablePtr)WindowTable[0];
clients[cid]->lastDrawableID = WindowTable[0]->drawable.id;
}
} }
if (!gotOne) if (!gotOne)
ErrorF("Freeing resource id=%lX which isn't there.\n", ErrorF("Freeing resource id=%lX which isn't there.\n",
...@@ -728,8 +721,6 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree) ...@@ -728,8 +721,6 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
#ifdef NXAGENT_SERVER #ifdef NXAGENT_SERVER
nxagentResChangedFlag = 1; nxagentResChangedFlag = 1;
#endif #endif
if (type & RC_CACHED)
FlushClientCaches(res->id);
if (!skipFree) if (!skipFree)
(*DeleteFuncs[type & TypeMask])(res->value, res->id); (*DeleteFuncs[type & TypeMask])(res->value, res->id);
xfree(res); xfree(res);
...@@ -738,11 +729,6 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree) ...@@ -738,11 +729,6 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
else else
prev = &res->next; prev = &res->next;
} }
if(clients[cid] && (id == clients[cid]->lastDrawableID))
{
clients[cid]->lastDrawable = (DrawablePtr)WindowTable[0];
clients[cid]->lastDrawableID = WindowTable[0]->drawable.id;
}
} }
} }
...@@ -765,8 +751,6 @@ ChangeResourceValue (XID id, RESTYPE rtype, void * value) ...@@ -765,8 +751,6 @@ ChangeResourceValue (XID id, RESTYPE rtype, void * value)
for (; res; res = res->next) for (; res; res = res->next)
if ((res->id == id) && (res->type == rtype)) if ((res->id == id) && (res->type == rtype))
{ {
if (rtype & RC_CACHED)
FlushClientCaches(res->id);
res->value = value; res->value = value;
return TRUE; return TRUE;
} }
...@@ -1027,8 +1011,6 @@ FreeClientNeverRetainResources(ClientPtr client) ...@@ -1027,8 +1011,6 @@ FreeClientNeverRetainResources(ClientPtr client)
if (rtype & RC_NEVERRETAIN) if (rtype & RC_NEVERRETAIN)
{ {
*prev = this->next; *prev = this->next;
if (rtype & RC_CACHED)
FlushClientCaches(this->id);
(*DeleteFuncs[rtype & TypeMask])(this->value, this->id); (*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
xfree(this); xfree(this);
} }
...@@ -1073,8 +1055,6 @@ FreeClientResources(ClientPtr client) ...@@ -1073,8 +1055,6 @@ FreeClientResources(ClientPtr client)
{ {
RESTYPE rtype = this->type; RESTYPE rtype = this->type;
*head = this->next; *head = this->next;
if (rtype & RC_CACHED)
FlushClientCaches(this->id);
(*DeleteFuncs[rtype & TypeMask])(this->value, this->id); (*DeleteFuncs[rtype & TypeMask])(this->value, this->id);
xfree(this); xfree(this);
} }
......
...@@ -240,7 +240,7 @@ PrintWindowTree() ...@@ -240,7 +240,7 @@ PrintWindowTree()
for (i=0; i<screenInfo.numScreens; i++) for (i=0; i<screenInfo.numScreens; i++)
{ {
ErrorF( "WINDOW %d\n", i); ErrorF( "WINDOW %d\n", i);
pWin = WindowTable[i]; pWin = screenInfo.screens[i]->root;
RegionPrint(&pWin->clipList); RegionPrint(&pWin->clipList);
p1 = pWin->firstChild; p1 = pWin->firstChild;
PrintChildren(p1, 4); PrintChildren(p1, 4);
...@@ -286,7 +286,7 @@ TraverseTree(register WindowPtr pWin, VisitWindowProcPtr func, void * data) ...@@ -286,7 +286,7 @@ TraverseTree(register WindowPtr pWin, VisitWindowProcPtr func, void * data)
int int
WalkTree(ScreenPtr pScreen, VisitWindowProcPtr func, void * data) WalkTree(ScreenPtr pScreen, VisitWindowProcPtr func, void * data)
{ {
return(TraverseTree(WindowTable[pScreen->myNum], func, data)); return(TraverseTree(pScreen->root, func, data));
} }
/* hack for forcing backing store on all windows */ /* hack for forcing backing store on all windows */
...@@ -457,7 +457,9 @@ CreateRootWindow(ScreenPtr pScreen) ...@@ -457,7 +457,9 @@ CreateRootWindow(ScreenPtr pScreen)
savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL; savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL;
screenIsSaved = SCREEN_SAVER_OFF; screenIsSaved = SCREEN_SAVER_OFF;
WindowTable[pScreen->myNum] = pWin; pScreen->root = pWin;
pScreen->root = pWin;
pWin->drawable.pScreen = pScreen; pWin->drawable.pScreen = pScreen;
pWin->drawable.type = DRAWABLE_WINDOW; pWin->drawable.type = DRAWABLE_WINDOW;
...@@ -583,11 +585,11 @@ InitRootWindow(WindowPtr pWin) ...@@ -583,11 +585,11 @@ InitRootWindow(WindowPtr pWin)
/* /*
* A root window is created for each screen by main * A root window is created for each screen by main
* and the pointer is saved in WindowTable as in the * and the pointer is saved in screenInfo.screens as
* following snippet: * in the following snippet:
* *
* for (i = 0; i < screenInfo.numScreens; i++) * for (i = 0; i < screenInfo.numScreens; i++)
* InitRootWindow(WindowTable[i]); * InitRootWindow(screenInfo.screens[i]->root);
* *
* Our root window on the real display was already * Our root window on the real display was already
* created at the time the screen was opened, so it * created at the time the screen was opened, so it
...@@ -1583,7 +1585,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt ...@@ -1583,7 +1585,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt
*/ */
if ( cursorID == None) if ( cursorID == None)
{ {
if (pWin == WindowTable[pWin->drawable.pScreen->myNum]) if (pWin == pWin->drawable.pScreen->root)
pCursor = rootCursor; pCursor = rootCursor;
else else
pCursor = (CursorPtr) None; pCursor = (CursorPtr) None;
...@@ -2863,7 +2865,7 @@ ReparentWindow(register WindowPtr pWin, register WindowPtr pParent, ...@@ -2863,7 +2865,7 @@ ReparentWindow(register WindowPtr pWin, register WindowPtr pParent,
pWin->parent = pParent; pWin->parent = pParent;
pPrev = RealChildHead(pParent); pPrev = RealChildHead(pParent);
if (pWin->parent == WindowTable[0]) if (pWin->parent == screenInfo.screens[0]->root)
{ {
nxagentSetTopLevelEventMask(pWin); nxagentSetTopLevelEventMask(pWin);
} }
...@@ -3442,7 +3444,7 @@ HandleSaveSet(register ClientPtr client) ...@@ -3442,7 +3444,7 @@ HandleSaveSet(register ClientPtr client)
pWin = SaveSetWindow(client->saveSet[j]); pWin = SaveSetWindow(client->saveSet[j]);
#ifdef XFIXES #ifdef XFIXES
if (SaveSetToRoot(client->saveSet[j])) if (SaveSetToRoot(client->saveSet[j]))
pParent = WindowTable[pWin->drawable.pScreen->myNum]; pParent = pWin->drawable.pScreen->root;
else else
#endif #endif
{ {
...@@ -3744,9 +3746,9 @@ TileScreenSaver(int i, int kind) ...@@ -3744,9 +3746,9 @@ TileScreenSaver(int i, int kind)
attri = 0; attri = 0;
switch (kind) { switch (kind) {
case SCREEN_IS_TILED: case SCREEN_IS_TILED:
switch (WindowTable[i]->backgroundState) { switch (screenInfo.screens[i]->root->backgroundState) {
case BackgroundPixel: case BackgroundPixel:
attributes[attri++] = WindowTable[i]->background.pixel; attributes[attri++] = screenInfo.screens[i]->root->background.pixel;
mask |= CWBackPixel; mask |= CWBackPixel;
break; break;
case BackgroundPixmap: case BackgroundPixmap:
...@@ -3758,7 +3760,7 @@ TileScreenSaver(int i, int kind) ...@@ -3758,7 +3760,7 @@ TileScreenSaver(int i, int kind)
} }
break; break;
case SCREEN_IS_BLACK: case SCREEN_IS_BLACK:
attributes[attri++] = WindowTable[i]->drawable.pScreen->blackPixel; attributes[attri++] = screenInfo.screens[i]->root->drawable.pScreen->blackPixel;
mask |= CWBackPixel; mask |= CWBackPixel;
break; break;
} }
...@@ -3806,12 +3808,12 @@ TileScreenSaver(int i, int kind) ...@@ -3806,12 +3808,12 @@ TileScreenSaver(int i, int kind)
pWin = savedScreenInfo[i].pWindow = pWin = savedScreenInfo[i].pWindow =
CreateWindow(savedScreenInfo[i].wid, CreateWindow(savedScreenInfo[i].wid,
WindowTable[i], screenInfo.screens[i]->root,
-RANDOM_WIDTH, -RANDOM_WIDTH, -RANDOM_WIDTH, -RANDOM_WIDTH,
(unsigned short)screenInfo.screens[i]->width + RANDOM_WIDTH, (unsigned short)screenInfo.screens[i]->width + RANDOM_WIDTH,
(unsigned short)screenInfo.screens[i]->height + RANDOM_WIDTH, (unsigned short)screenInfo.screens[i]->height + RANDOM_WIDTH,
0, InputOutput, mask, attributes, 0, serverClient, 0, InputOutput, mask, attributes, 0, serverClient,
wVisual (WindowTable[i]), &result); wVisual (screenInfo.screens[i]->root), &result);
if (cursor) if (cursor)
FreeResource (cursorID, RT_NONE); FreeResource (cursorID, RT_NONE);
......
...@@ -1449,7 +1449,7 @@ Bool nxagentFbOnShadowDisplay() ...@@ -1449,7 +1449,7 @@ Bool nxagentFbOnShadowDisplay()
XGCValues value; XGCValues value;
XImage *image; XImage *image;
Visual *pVisual; Visual *pVisual;
WindowPtr pWin = WindowTable[0]; WindowPtr pWin = screenInfo.screens[0]->root;
unsigned int format; unsigned int format;
int depth, width, height, length; int depth, width, height, length;
char *data = NULL; char *data = NULL;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "../../include/window.h" #include "../../include/window.h"
#include "windowstr.h" #include "windowstr.h"
#include "colormapst.h" #include "colormapst.h"
#include "scrnintstr.h"
#include "propertyst.h" #include "propertyst.h"
#include "Agent.h" #include "Agent.h"
...@@ -242,7 +243,7 @@ Bool nxagentRootlessTreesMatch() ...@@ -242,7 +243,7 @@ Bool nxagentRootlessTreesMatch()
Window *children_return; Window *children_return;
unsigned int nChildrenReturn; unsigned int nChildrenReturn;
WindowPtr pW; WindowPtr pW;
WindowPtr pTestWin = WindowTable[0] -> firstChild; WindowPtr pTestWin = screenInfo.screens[0]->root -> firstChild;
Bool treesMatch = True; Bool treesMatch = True;
Status result; Status result;
...@@ -267,7 +268,7 @@ Bool nxagentRootlessTreesMatch() ...@@ -267,7 +268,7 @@ Bool nxagentRootlessTreesMatch()
pW = nxagentRootlessTopLevelWindow(children_return[nChildrenReturn]); pW = nxagentRootlessTopLevelWindow(children_return[nChildrenReturn]);
} }
if (pW && pW != WindowTable[0]) if (pW && pW != screenInfo.screens[0]->root)
{ {
if (treesMatch && pTestWin && pTestWin == pW) if (treesMatch && pTestWin && pTestWin == pW)
{ {
...@@ -316,7 +317,7 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren) ...@@ -316,7 +317,7 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren)
pWin = nxagentRootlessTopLevelWindow(children[i]); pWin = nxagentRootlessTopLevelWindow(children[i]);
} }
if (pWin && pWin != WindowTable[0]) if (pWin && pWin != screenInfo.screens[0]->root)
{ {
toplevel[ntoplevel++] = pWin; toplevel[ntoplevel++] = pWin;
} }
...@@ -338,14 +339,14 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren) ...@@ -338,14 +339,14 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren)
fprintf(stderr, "nxagentRootlessRestack: Internal top level windows before restack:"); fprintf(stderr, "nxagentRootlessRestack: Internal top level windows before restack:");
for (pWin = WindowTable[0] -> firstChild; pWin != NULL; pWin = pWin -> nextSib) for (pWin = screenInfo.screens[0]->root -> firstChild; pWin != NULL; pWin = pWin -> nextSib)
{ {
fprintf(stderr, "[%p]\n", pWin); fprintf(stderr, "[%p]\n", pWin);
} }
#endif #endif
pWin = WindowTable[0] -> firstChild; pWin = screenInfo.screens[0]->root -> firstChild;
values[1] = (XID) Above; values[1] = (XID) Above;
...@@ -381,7 +382,7 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren) ...@@ -381,7 +382,7 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren)
fprintf(stderr, "nxagentRootlessRestack: Internal top level windows after restack:"); fprintf(stderr, "nxagentRootlessRestack: Internal top level windows after restack:");
for (pWin = WindowTable[0] -> firstChild; pWin != NULL; pWin = pWin -> nextSib) for (pWin = screenInfo.screens[0]->root -> firstChild; pWin != NULL; pWin = pWin -> nextSib)
{ {
fprintf(stderr, "[%p]\n", pWin); fprintf(stderr, "[%p]\n", pWin);
} }
......
...@@ -2116,7 +2116,7 @@ Bool nxagentCloseScreen(int index, ScreenPtr pScreen) ...@@ -2116,7 +2116,7 @@ Bool nxagentCloseScreen(int index, ScreenPtr pScreen)
static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable) static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable)
{ {
WindowPtr pWin = WindowTable[pScreen->myNum]; WindowPtr pWin = pScreen->root;
WindowPtr pChild; WindowPtr pChild;
Bool WasViewable = (Bool)(pWin->viewable); Bool WasViewable = (Bool)(pWin->viewable);
Bool anyMarked = FALSE; Bool anyMarked = FALSE;
...@@ -2409,21 +2409,21 @@ FIXME: We should try to restore the previously ...@@ -2409,21 +2409,21 @@ FIXME: We should try to restore the previously
box.x2 = width; box.x2 = width;
box.y2 = height; box.y2 = height;
WindowTable[pScreen -> myNum] -> drawable.width = width; pScreen->root -> drawable.width = width;
WindowTable[pScreen -> myNum] -> drawable.height = height; pScreen->root -> drawable.height = height;
WindowTable[pScreen -> myNum] -> drawable.x = 0; pScreen->root -> drawable.x = 0;
WindowTable[pScreen -> myNum] -> drawable.y = 0; pScreen->root -> drawable.y = 0;
RegionInit(&WindowTable[pScreen -> myNum] -> borderSize, &box, 1); RegionInit(&pScreen->root -> borderSize, &box, 1);
RegionInit(&WindowTable[pScreen -> myNum] -> winSize, &box, 1); RegionInit(&pScreen->root -> winSize, &box, 1);
RegionInit(&WindowTable[pScreen -> myNum] -> clipList, &box, 1); RegionInit(&pScreen->root -> clipList, &box, 1);
RegionInit(&WindowTable[pScreen -> myNum] -> borderClip, &box, 1); RegionInit(&pScreen->root -> borderClip, &box, 1);
(*pScreen -> PositionWindow)(WindowTable[pScreen -> myNum], 0, 0); (*pScreen -> PositionWindow)(pScreen->root, 0, 0);
nxagentSetRootClip(pScreen, 1); nxagentSetRootClip(pScreen, 1);
XMoveWindow(nxagentDisplay, nxagentWindow(WindowTable[0]), XMoveWindow(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root),
nxagentOption(RootX), nxagentOption(RootY)); nxagentOption(RootX), nxagentOption(RootY));
nxagentMoveViewport(pScreen, 0, 0); nxagentMoveViewport(pScreen, 0, 0);
...@@ -3522,7 +3522,7 @@ FIXME: The port information is not used at the moment and produces a ...@@ -3522,7 +3522,7 @@ FIXME: The port information is not used at the moment and produces a
{ {
mcop_local_atom = MakeAtom(mcop_atom, strlen(mcop_atom), 1); mcop_local_atom = MakeAtom(mcop_atom, strlen(mcop_atom), 1);
ChangeWindowProperty(WindowTable[pScreen->myNum], ChangeWindowProperty(pScreen->root,
mcop_local_atom, mcop_local_atom,
XA_STRING, XA_STRING,
iReturnFormat, PropModeReplace, iReturnFormat, PropModeReplace,
...@@ -3667,9 +3667,9 @@ int nxagentChangeScreenConfig(int screen, int width, int height, int mmWidth, in ...@@ -3667,9 +3667,9 @@ int nxagentChangeScreenConfig(int screen, int width, int height, int mmWidth, in
int r; int r;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentChangeScreenConfig: WindowTable[%d] is %p\n", screen, WindowTable[screen]); fprintf(stderr, "nxagentChangeScreenConfig: screenInfo.screens[%d]->root is %p\n", screen, screenInfo.screens[screen]);
#endif #endif
if (WindowTable[screen] == NULL) if (screenInfo.screens[screen]->root == NULL)
{ {
return 0; return 0;
} }
...@@ -3692,7 +3692,7 @@ int nxagentChangeScreenConfig(int screen, int width, int height, int mmWidth, in ...@@ -3692,7 +3692,7 @@ int nxagentChangeScreenConfig(int screen, int width, int height, int mmWidth, in
return 0; return 0;
} }
pScreen = WindowTable[screen] -> drawable.pScreen; pScreen = screenInfo.screens[screen] -> root -> drawable.pScreen;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentChangeScreenConfig: Changing config to %dx%d.\n", width, height); fprintf(stderr, "nxagentChangeScreenConfig: Changing config to %dx%d.\n", width, height);
...@@ -3793,7 +3793,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) ...@@ -3793,7 +3793,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
* do this here it will be done implicitely later and add mode(s) to * do this here it will be done implicitely later and add mode(s) to
* our crtc(s)! * our crtc(s)!
*/ */
rrgetinfo = RRGetInfo(pScreen); rrgetinfo = RRGetInfo(pScreen, FALSE);
fprintf(stderr, "nxagentAdjustRandRXinerama: RRGetInfo returned [%d]\n", rrgetinfo); fprintf(stderr, "nxagentAdjustRandRXinerama: RRGetInfo returned [%d]\n", rrgetinfo);
} }
...@@ -4124,7 +4124,7 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, ...@@ -4124,7 +4124,7 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
values.subwindow_mode = IncludeInferiors; values.subwindow_mode = IncludeInferiors;
gc = XCreateGC(nxagentDisplay, nxagentWindow(WindowTable[0]), GCSubwindowMode, &values); gc = XCreateGC(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), GCSubwindowMode, &values);
/* /*
* Initialize to the corrupted region. * Initialize to the corrupted region.
...@@ -4234,7 +4234,7 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, ...@@ -4234,7 +4234,7 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
*/ */
RegionIntersect(prgnRestore, prgnRestore, RegionIntersect(prgnRestore, prgnRestore,
&WindowTable[pWin -> drawable.pScreen -> myNum] -> winSize); &pWin -> drawable.pScreen -> root -> winSize);
pBackingStore = (miBSWindowPtr) pWin -> backStorage; pBackingStore = (miBSWindowPtr) pWin -> backStorage;
...@@ -4245,7 +4245,7 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, ...@@ -4245,7 +4245,7 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
values.subwindow_mode = ClipByChildren; values.subwindow_mode = ClipByChildren;
gc = XCreateGC(nxagentDisplay, nxagentWindow(WindowTable[0]), GCSubwindowMode, &values); gc = XCreateGC(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), GCSubwindowMode, &values);
/* /*
* Translate the reference point to the origin of the window. * Translate the reference point to the origin of the window.
...@@ -4406,7 +4406,7 @@ void nxagentShadowAdaptToRatio(void) ...@@ -4406,7 +4406,7 @@ void nxagentShadowAdaptToRatio(void)
nxagentShadowSetRatio(nxagentOption(Width) * 1.0 / nxagentShadowWidth, nxagentShadowSetRatio(nxagentOption(Width) * 1.0 / nxagentShadowWidth,
nxagentOption(Height) * 1.0 / nxagentShadowHeight); nxagentOption(Height) * 1.0 / nxagentShadowHeight);
nxagentShadowCreateMainWindow(pScreen, WindowTable[0], nxagentShadowWidth, nxagentShadowHeight); nxagentShadowCreateMainWindow(pScreen, screenInfo.screens[0]->root, nxagentShadowWidth, nxagentShadowHeight);
sizeHints.max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); sizeHints.max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
sizeHints.max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); sizeHints.max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
...@@ -4456,7 +4456,7 @@ void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height) ...@@ -4456,7 +4456,7 @@ void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height)
XlibGC gc; XlibGC gc;
XGCValues value; XGCValues value;
XImage *image; XImage *image;
WindowPtr pWin = WindowTable[0]; WindowPtr pWin = screenInfo.screens[0]->root;
unsigned int format; unsigned int format;
int depth, pixmapWidth, pixmapHeight, length; int depth, pixmapWidth, pixmapHeight, length;
char *data; char *data;
...@@ -4668,7 +4668,7 @@ FIXME ...@@ -4668,7 +4668,7 @@ FIXME
value.fill_style = FillSolid; value.fill_style = FillSolid;
value.function = GXcopy; value.function = GXcopy;
gc = XCreateGC(shadow, nxagentWindow(WindowTable[0]), GCBackground | gc = XCreateGC(shadow, nxagentWindow(screenInfo.screens[0]->root), GCBackground |
GCForeground | GCFillStyle | GCPlaneMask | GCFunction, &value); GCForeground | GCFillStyle | GCPlaneMask | GCFunction, &value);
NXCleanImage(image); NXCleanImage(image);
......
...@@ -396,15 +396,15 @@ void nxagentRemoveSplashWindow(WindowPtr pWin) ...@@ -396,15 +396,15 @@ void nxagentRemoveSplashWindow(WindowPtr pWin)
XDestroyWindow(nxagentDisplay, nxagentSplashWindow); XDestroyWindow(nxagentDisplay, nxagentSplashWindow);
nxagentSplashWindow = None; nxagentSplashWindow = None;
nxagentRefreshWindows(WindowTable[0]); nxagentRefreshWindows(screenInfo.screens[0]->root);
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentRemoveSplashWindow: setting the ownership of %s (%d) on window 0x%lx\n", fprintf(stderr, "nxagentRemoveSplashWindow: setting the ownership of %s (%d) on window 0x%lx\n",
"NX_CUT_BUFFER_SERVER", (int)serverCutProperty, nxagentWindow(WindowTable[0])); "NX_CUT_BUFFER_SERVER", (int)serverCutProperty, nxagentWindow(screenInfo.screens[0]->root));
#endif #endif
XSetSelectionOwner(nxagentDisplay, serverCutProperty, XSetSelectionOwner(nxagentDisplay, serverCutProperty,
nxagentWindow(WindowTable[0]), CurrentTime); nxagentWindow(screenInfo.screens[0]->root), CurrentTime);
} }
if (nxagentPixmapLogo) if (nxagentPixmapLogo)
......
...@@ -196,7 +196,7 @@ static Bool nxagentCheckWindowIntegrity(WindowPtr pWin); ...@@ -196,7 +196,7 @@ static Bool nxagentCheckWindowIntegrity(WindowPtr pWin);
WindowPtr nxagentGetWindowFromID(Window id) WindowPtr nxagentGetWindowFromID(Window id)
{ {
WindowPtr pWin = WindowTable[0]; WindowPtr pWin = screenInfo.screens[0]->root;
while (pWin && nxagentWindowPriv(pWin)) while (pWin && nxagentWindowPriv(pWin))
{ {
...@@ -508,7 +508,7 @@ FIXME: Do all the windows for which nxagentWindowTopLevel(pWin) ...@@ -508,7 +508,7 @@ FIXME: Do all the windows for which nxagentWindowTopLevel(pWin)
Bool nxagentSomeWindowsAreMapped() Bool nxagentSomeWindowsAreMapped()
{ {
WindowPtr pWin = WindowTable[0] -> firstChild; WindowPtr pWin = screenInfo.screens[0]->root -> firstChild;
while (pWin) while (pWin)
{ {
...@@ -884,7 +884,7 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn) ...@@ -884,7 +884,7 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
nxagentUpdateViewportFrame(0, 0, nxagentOption(RootWidth), nxagentOption(RootHeight)); nxagentUpdateViewportFrame(0, 0, nxagentOption(RootWidth), nxagentOption(RootHeight));
XMoveWindow(nxagentDisplay, nxagentWindow(WindowTable[pScreen -> myNum]), XMoveWindow(nxagentDisplay, nxagentWindow(pScreen->root),
nxagentOption(RootX), nxagentOption(RootY)); nxagentOption(RootX), nxagentOption(RootY));
/* /*
...@@ -995,7 +995,7 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn) ...@@ -995,7 +995,7 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
nxagentUpdateViewportFrame(0, 0, nxagentOption(Width), nxagentOption(Height)); nxagentUpdateViewportFrame(0, 0, nxagentOption(Width), nxagentOption(Height));
XMoveWindow(nxagentDisplay, nxagentWindow(WindowTable[pScreen -> myNum]), 0, 0); XMoveWindow(nxagentDisplay, nxagentWindow(pScreen->root), 0, 0);
XMapWindow(nxagentDisplay, w); XMapWindow(nxagentDisplay, w);
nxagentChangeOption(RootX, 0); nxagentChangeOption(RootX, 0);
...@@ -1156,11 +1156,11 @@ void nxagentMoveViewport(ScreenPtr pScreen, int hShift, int vShift) ...@@ -1156,11 +1156,11 @@ void nxagentMoveViewport(ScreenPtr pScreen, int hShift, int vShift)
-nxagentOption(RootY) + nxagentOption(Height)); -nxagentOption(RootY) + nxagentOption(Height));
fprintf(stderr, "nxagentMoveViewport: Root geometry x=[%d] y=[%d]\n", fprintf(stderr, "nxagentMoveViewport: Root geometry x=[%d] y=[%d]\n",
WindowTable[pScreen -> myNum] -> drawable.x, pScreen->root -> drawable.x,
WindowTable[pScreen -> myNum] -> drawable.y ); pScreen->root -> drawable.y );
#endif #endif
XMoveWindow(nxagentDisplay, nxagentWindow(WindowTable[pScreen -> myNum]), XMoveWindow(nxagentDisplay, nxagentWindow(pScreen->root),
nxagentOption(RootX), nxagentOption(RootY)); nxagentOption(RootX), nxagentOption(RootY));
if (nxagentOption(ClientOs) == ClientOsWinnt) if (nxagentOption(ClientOs) == ClientOsWinnt)
...@@ -2437,7 +2437,7 @@ static int nxagentForceExposure(WindowPtr pWin, void * ptr) ...@@ -2437,7 +2437,7 @@ static int nxagentForceExposure(WindowPtr pWin, void * ptr)
{ {
RegionPtr exposedRgn; RegionPtr exposedRgn;
BoxRec Box; BoxRec Box;
WindowPtr pRoot = WindowTable[pWin->drawable.pScreen->myNum]; WindowPtr pRoot = pWin->drawable.pScreen->root;
if (pWin -> drawable.class != InputOnly) if (pWin -> drawable.class != InputOnly)
{ {
...@@ -2491,7 +2491,7 @@ void nxagentMapDefaultWindows() ...@@ -2491,7 +2491,7 @@ void nxagentMapDefaultWindows()
for (i = 0; i < screenInfo.numScreens; i++) for (i = 0; i < screenInfo.numScreens; i++)
{ {
WindowPtr pWin = WindowTable[i]; WindowPtr pWin = screenInfo.screens[i]->root;
ScreenPtr pScreen = pWin -> drawable.pScreen; ScreenPtr pScreen = pWin -> drawable.pScreen;
...@@ -2606,7 +2606,7 @@ Bool nxagentDisconnectAllWindows(void) ...@@ -2606,7 +2606,7 @@ Bool nxagentDisconnectAllWindows(void)
for (i = 0; i < screenInfo.numScreens; i++) for (i = 0; i < screenInfo.numScreens; i++)
{ {
pWin = WindowTable[i]; pWin = screenInfo.screens[i]->root;
nxagentTraverseWindow( pWin, nxagentDisconnectWindow, &succeded); nxagentTraverseWindow( pWin, nxagentDisconnectWindow, &succeded);
nxagentDefaultWindows[i] = None; nxagentDefaultWindows[i] = None;
} }
...@@ -2684,16 +2684,16 @@ Bool nxagentReconnectAllWindows(void *p0) ...@@ -2684,16 +2684,16 @@ Bool nxagentReconnectAllWindows(void *p0)
fprintf(stderr, "nxagentReconnectAllWindows\n"); fprintf(stderr, "nxagentReconnectAllWindows\n");
#endif #endif
if (WindowTable[0] -> backgroundState == BackgroundPixmap && if (screenInfo.screens[0]->root -> backgroundState == BackgroundPixmap &&
WindowTable[0] -> background.pixmap == NULL) screenInfo.screens[0]->root -> background.pixmap == NULL)
{ {
FatalError("nxagentReconnectAllWindows: correct the FIXME\n"); FatalError("nxagentReconnectAllWindows: correct the FIXME\n");
} }
if (nxagentOption(Fullscreen)) if (nxagentOption(Fullscreen))
{ {
WindowTable[0] -> origin.x = nxagentOption(RootX); screenInfo.screens[0]->root -> origin.x = nxagentOption(RootX);
WindowTable[0] -> origin.y = nxagentOption(RootY); screenInfo.screens[0]->root -> origin.y = nxagentOption(RootY);
} }
if (!nxagentLoopOverWindows(nxagentReconnectWindow)) if (!nxagentLoopOverWindows(nxagentReconnectWindow))
...@@ -2739,8 +2739,8 @@ Bool nxagentReconnectAllWindows(void *p0) ...@@ -2739,8 +2739,8 @@ Bool nxagentReconnectAllWindows(void *p0)
if (nxagentOption(Fullscreen)) if (nxagentOption(Fullscreen))
{ {
WindowTable[0] -> origin.x = 0; screenInfo.screens[0]->root -> origin.x = 0;
WindowTable[0] -> origin.y = 0; screenInfo.screens[0]->root -> origin.y = 0;
} }
#ifdef NXAGENT_RECONNECT_WINDOW_DEBUG #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG
...@@ -2751,7 +2751,7 @@ Bool nxagentReconnectAllWindows(void *p0) ...@@ -2751,7 +2751,7 @@ Bool nxagentReconnectAllWindows(void *p0)
#endif #endif
if (nxagentInitClipboard(WindowTable[0]) == -1) if (nxagentInitClipboard(screenInfo.screens[0]->root) == -1)
{ {
#ifdef WARNING #ifdef WARNING
fprintf(stderr, "nxagentReconnectAllWindows: WARNING! Couldn't initialize the clipboard.\n"); fprintf(stderr, "nxagentReconnectAllWindows: WARNING! Couldn't initialize the clipboard.\n");
...@@ -2848,7 +2848,7 @@ static Bool nxagentLoopOverWindows(void (*pF)(void *, XID, void *)) ...@@ -2848,7 +2848,7 @@ static Bool nxagentLoopOverWindows(void (*pF)(void *, XID, void *))
for (i = 0; i < screenInfo.numScreens; i++) for (i = 0; i < screenInfo.numScreens; i++)
{ {
pWin = WindowTable[i]; pWin = screenInfo.screens[i]->root;
nxagentTraverseWindow(pWin, pF, &windowSuccess); nxagentTraverseWindow(pWin, pF, &windowSuccess);
} }
...@@ -2995,7 +2995,7 @@ FIXME: Do we need to set save unders attribute here? ...@@ -2995,7 +2995,7 @@ FIXME: Do we need to set save unders attribute here?
* if a client handles this. * if a client handles this.
*/ */
if (nxagentOption(Rootless) && (pWin != WindowTable[0])) if (nxagentOption(Rootless) && (pWin != screenInfo.screens[0]->root))
{ {
if (nxagentWindowTopLevel(pWin)) if (nxagentWindowTopLevel(pWin))
{ {
...@@ -3196,7 +3196,7 @@ static void nxagentReconfigureWindow(void * param0, XID param1, void * data_buff ...@@ -3196,7 +3196,7 @@ static void nxagentReconfigureWindow(void * param0, XID param1, void * data_buff
nxagentShapeWindow(pWin); nxagentShapeWindow(pWin);
#endif #endif
if (pWin != WindowTable[0]) if (pWin != screenInfo.screens[0]->root)
{ {
if (pWin->realized) if (pWin->realized)
{ {
...@@ -3238,7 +3238,7 @@ Bool nxagentCheckIllegalRootMonitoring(WindowPtr pWin, Mask mask) ...@@ -3238,7 +3238,7 @@ Bool nxagentCheckIllegalRootMonitoring(WindowPtr pWin, Mask mask)
Mask invalidMask = SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask; Mask invalidMask = SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask;
if (nxagentOption(Rootless) && if (nxagentOption(Rootless) &&
pWin == WindowTable[0] && pWin == screenInfo.screens[0]->root &&
(mask & invalidMask)) (mask & invalidMask))
{ {
return True; return True;
......
...@@ -167,7 +167,7 @@ extern int nxagentWindowPrivateIndex; ...@@ -167,7 +167,7 @@ extern int nxagentWindowPrivateIndex;
#define nxagentRefreshScreen() \ #define nxagentRefreshScreen() \
do\ do\
{\ {\
nxagentRefreshWindows(WindowTable[0]);\ nxagentRefreshWindows(screenInfo.screens[0]->root);\
} while (0) } while (0)
WindowPtr nxagentWindowPtr(Window window); WindowPtr nxagentWindowPtr(Window window);
......
...@@ -20,8 +20,8 @@ extern Bool loadableFonts; ...@@ -20,8 +20,8 @@ extern Bool loadableFonts;
extern int defaultColorVisualClass; extern int defaultColorVisualClass;
extern Bool Must_have_memory; extern Bool Must_have_memory;
extern WindowPtr *WindowTable;
extern int GrabInProgress; extern int GrabInProgress;
extern char *ConnectionInfo;
extern Bool noTestExtensions; extern Bool noTestExtensions;
extern DDXPointRec dixScreenOrigins[MAXSCREENS]; extern DDXPointRec dixScreenOrigins[MAXSCREENS];
......
...@@ -81,6 +81,7 @@ extern unsigned long serverGeneration; ...@@ -81,6 +81,7 @@ extern unsigned long serverGeneration;
#include <nx-X11/Xfuncproto.h> #include <nx-X11/Xfuncproto.h>
#include <nx-X11/Xmd.h> #include <nx-X11/Xmd.h>
#include <nx-X11/X.h> #include <nx-X11/X.h>
#include <stdint.h>
#ifndef _XTYPEDEF_POINTER #ifndef _XTYPEDEF_POINTER
/* Don't let Xdefs.h define 'pointer' */ /* Don't let Xdefs.h define 'pointer' */
...@@ -237,6 +238,28 @@ pad_to_int32(const int bytes) { ...@@ -237,6 +238,28 @@ pad_to_int32(const int bytes) {
return (((bytes) + 3) & ~3); return (((bytes) + 3) & ~3);
} }
/**
* Compare the two version numbers comprising of major.minor.
*
* @return A value less than 0 if a is less than b, 0 if a is equal to b,
* or a value greater than 0
*/
static inline int
version_compare(uint32_t a_major, uint32_t a_minor,
uint32_t b_major, uint32_t b_minor)
{
if (a_major > b_major)
return 1;
if (a_major < b_major)
return -1;
if (a_minor > b_minor)
return 1;
if (a_minor < b_minor)
return -1;
return 0;
}
/* some macros to help swap requests, replies, and events */ /* some macros to help swap requests, replies, and events */
#define LengthRestB(stuff) \ #define LengthRestB(stuff) \
......
...@@ -523,6 +523,17 @@ typedef void (* MarkUnrealizedWindowProcPtr)( ...@@ -523,6 +523,17 @@ typedef void (* MarkUnrealizedWindowProcPtr)(
WindowPtr /*pWin*/, WindowPtr /*pWin*/,
Bool /*fromConfigure*/); Bool /*fromConfigure*/);
typedef void (*ConstrainCursorHarderProcPtr)(
ScreenPtr, /*pScreen*/
int, /*mode*/
int *, /*x*/
int * /*y*/);
typedef Bool (*ReplaceScanoutPixmapProcPtr)(
DrawablePtr, /*pDrawable*/
PixmapPtr, /*pPixmap*/
Bool /*enable*/);
typedef struct _Screen { typedef struct _Screen {
int myNum; /* index of this instance in Screens[] */ int myNum; /* index of this instance in Screens[] */
ATOM id; ATOM id;
...@@ -549,6 +560,7 @@ typedef struct _Screen { ...@@ -549,6 +560,7 @@ typedef struct _Screen {
void * devPrivate; void * devPrivate;
short numVisuals; short numVisuals;
VisualPtr visuals; VisualPtr visuals;
WindowPtr root;
int WindowPrivateLen; int WindowPrivateLen;
unsigned *WindowPrivateSizes; unsigned *WindowPrivateSizes;
unsigned totalWindowSize; unsigned totalWindowSize;
...@@ -611,6 +623,7 @@ typedef struct _Screen { ...@@ -611,6 +623,7 @@ typedef struct _Screen {
/* Cursor Procedures */ /* Cursor Procedures */
ConstrainCursorProcPtr ConstrainCursor; ConstrainCursorProcPtr ConstrainCursor;
ConstrainCursorHarderProcPtr ConstrainCursorHarder;
CursorLimitsProcPtr CursorLimits; CursorLimitsProcPtr CursorLimits;
DisplayCursorProcPtr DisplayCursor; DisplayCursorProcPtr DisplayCursor;
RealizeCursorProcPtr RealizeCursor; RealizeCursorProcPtr RealizeCursor;
...@@ -707,6 +720,7 @@ typedef struct _Screen { ...@@ -707,6 +720,7 @@ typedef struct _Screen {
ChangeBorderWidthProcPtr ChangeBorderWidth; ChangeBorderWidthProcPtr ChangeBorderWidth;
MarkUnrealizedWindowProcPtr MarkUnrealizedWindow; MarkUnrealizedWindowProcPtr MarkUnrealizedWindow;
ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap;
} ScreenRec; } ScreenRec;
static inline RegionPtr BitmapToRegion(ScreenPtr _pScreen, PixmapPtr pPix) { static inline RegionPtr BitmapToRegion(ScreenPtr _pScreen, PixmapPtr pPix) {
......
...@@ -1768,7 +1768,7 @@ miBankGetImage( ...@@ -1768,7 +1768,7 @@ miBankGetImage(
pBankImage); pBankImage);
(*pScreenPriv->pBankGC->ops->CopyArea)( (*pScreenPriv->pBankGC->ops->CopyArea)(
(DrawablePtr)WindowTable[pScreen->myNum], (DrawablePtr)pScreen->root,
(DrawablePtr)pScreenPriv->pBankPixmap, (DrawablePtr)pScreenPriv->pBankPixmap,
pScreenPriv->pBankGC, pScreenPriv->pBankGC,
sx + pDrawable->x, sy + pDrawable->y, w, h, 0, 0); sx + pDrawable->x, sy + pDrawable->y, w, h, 0, 0);
...@@ -1835,7 +1835,7 @@ miBankGetSpans( ...@@ -1835,7 +1835,7 @@ miBankGetSpans(
continue; continue;
(*pScreenPriv->pBankGC->ops->CopyArea)( (*pScreenPriv->pBankGC->ops->CopyArea)(
(DrawablePtr)WindowTable[pScreen->myNum], (DrawablePtr)pScreen->root,
(DrawablePtr)pScreenPriv->pBankPixmap, (DrawablePtr)pScreenPriv->pBankPixmap,
pScreenPriv->pBankGC, pScreenPriv->pBankGC,
ppt->x, ppt->y, *pwidth, 1, 0, 0); ppt->x, ppt->y, *pwidth, 1, 0, 0);
...@@ -1958,7 +1958,7 @@ miBankCopyWindow( ...@@ -1958,7 +1958,7 @@ miBankCopyWindow(
ScreenPtr pScreen = pWindow->drawable.pScreen; ScreenPtr pScreen = pWindow->drawable.pScreen;
GCPtr pGC; GCPtr pGC;
int dx, dy, nBox; int dx, dy, nBox;
DrawablePtr pDrawable = (DrawablePtr)WindowTable[pScreen->myNum]; DrawablePtr pDrawable = (DrawablePtr)pScreen->root;
RegionPtr pRgnDst; RegionPtr pRgnDst;
BoxPtr pBox, pBoxTmp, pBoxNext, pBoxBase, pBoxNew1, pBoxNew2; BoxPtr pBox, pBoxTmp, pBoxNext, pBoxBase, pBoxNew1, pBoxNew2;
XID subWindowMode = IncludeInferiors; XID subWindowMode = IncludeInferiors;
......
...@@ -477,7 +477,7 @@ miDCPutUpCursor (pScreen, pCursor, x, y, source, mask) ...@@ -477,7 +477,7 @@ miDCPutUpCursor (pScreen, pCursor, x, y, source, mask)
return FALSE; return FALSE;
} }
pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr;
pWin = WindowTable[pScreen->myNum]; pWin = pScreen->root;
#ifdef ARGB_CURSOR #ifdef ARGB_CURSOR
if (pPriv->pPicture) if (pPriv->pPicture)
{ {
...@@ -523,7 +523,7 @@ miDCSaveUnderCursor (pScreen, x, y, w, h) ...@@ -523,7 +523,7 @@ miDCSaveUnderCursor (pScreen, x, y, w, h)
pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr;
pSave = pScreenPriv->pSave; pSave = pScreenPriv->pSave;
pWin = WindowTable[pScreen->myNum]; pWin = pScreen->root;
if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h) if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h)
{ {
if (pSave) if (pSave)
...@@ -555,7 +555,7 @@ miDCRestoreUnderCursor (pScreen, x, y, w, h) ...@@ -555,7 +555,7 @@ miDCRestoreUnderCursor (pScreen, x, y, w, h)
pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr;
pSave = pScreenPriv->pSave; pSave = pScreenPriv->pSave;
pWin = WindowTable[pScreen->myNum]; pWin = pScreen->root;
if (!pSave) if (!pSave)
return FALSE; return FALSE;
if (!EnsureGC(pScreenPriv->pRestoreGC, pWin)) if (!EnsureGC(pScreenPriv->pRestoreGC, pWin))
...@@ -581,7 +581,7 @@ miDCChangeSave (pScreen, x, y, w, h, dx, dy) ...@@ -581,7 +581,7 @@ miDCChangeSave (pScreen, x, y, w, h, dx, dy)
pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr;
pSave = pScreenPriv->pSave; pSave = pScreenPriv->pSave;
pWin = WindowTable[pScreen->myNum]; pWin = pScreen->root;
/* /*
* restore the bits which are about to get trashed * restore the bits which are about to get trashed
*/ */
...@@ -723,7 +723,7 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask) ...@@ -723,7 +723,7 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask)
return FALSE; return FALSE;
} }
pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr; pScreenPriv = (miDCScreenPtr) pScreen->devPrivates[miDCScreenIndex].ptr;
pWin = WindowTable[pScreen->myNum]; pWin = pScreen->root;
pTemp = pScreenPriv->pTemp; pTemp = pScreenPriv->pTemp;
if (!pTemp || if (!pTemp ||
pTemp->drawable.width != pScreenPriv->pSave->drawable.width || pTemp->drawable.width != pScreenPriv->pSave->drawable.width ||
......
...@@ -468,7 +468,7 @@ miSendExposures(pWin, pRgn, dx, dy) ...@@ -468,7 +468,7 @@ miSendExposures(pWin, pRgn, dx, dy)
if(!pWin->parent) { if(!pWin->parent) {
x = panoramiXdataPtr[scrnum].x; x = panoramiXdataPtr[scrnum].x;
y = panoramiXdataPtr[scrnum].y; y = panoramiXdataPtr[scrnum].y;
pWin = WindowTable[0]; pWin = screenInfo.screens[0]->root;
realWin = pWin->drawable.id; realWin = pWin->drawable.id;
} else if (scrnum) { } else if (scrnum) {
PanoramiXRes *win; PanoramiXRes *win;
...@@ -715,7 +715,7 @@ int what; ...@@ -715,7 +715,7 @@ int what;
gcmask |= GCFunction | GCClipMask; gcmask |= GCFunction | GCClipMask;
i = pScreen->myNum; i = pScreen->myNum;
pRoot = WindowTable[i]; pRoot = screenInfo.screens[i]->root;
pBgWin = pWin; pBgWin = pWin;
if (what == PW_BORDER) if (what == PW_BORDER)
......
...@@ -317,7 +317,7 @@ miOverlayReparentWindow(WindowPtr pWin, WindowPtr pPriorParent) ...@@ -317,7 +317,7 @@ miOverlayReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
{ {
if(IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin)) { if(IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin)) {
/* This could probably be more optimal */ /* This could probably be more optimal */
RebuildTree(WindowTable[pWin->drawable.pScreen->myNum]->firstChild); RebuildTree(pWin->drawable.pScreen->root->firstChild);
} }
} }
...@@ -1733,7 +1733,7 @@ miOverlayChangeBorderWidth( ...@@ -1733,7 +1733,7 @@ miOverlayChangeBorderWidth(
void void
miOverlaySetRootClip(ScreenPtr pScreen, Bool enable) miOverlaySetRootClip(ScreenPtr pScreen, Bool enable)
{ {
WindowPtr pRoot = WindowTable[pScreen->myNum]; WindowPtr pRoot = pScreen->root;
miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pRoot); miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pRoot);
MARK_UNDERLAY(pRoot); MARK_UNDERLAY(pRoot);
......
...@@ -46,6 +46,7 @@ in this Software without prior written authorization from The Open Group. ...@@ -46,6 +46,7 @@ in this Software without prior written authorization from The Open Group.
# include "mipointrst.h" # include "mipointrst.h"
# include "cursorstr.h" # include "cursorstr.h"
# include "dixstruct.h" # include "dixstruct.h"
# include <nx-X11/extensions/XI.h>
int miPointerScreenIndex; int miPointerScreenIndex;
static unsigned long miPointerGeneration = 0; static unsigned long miPointerGeneration = 0;
...@@ -224,6 +225,10 @@ miPointerSetCursorPosition(pScreen, x, y, generateEvent) ...@@ -224,6 +225,10 @@ miPointerSetCursorPosition(pScreen, x, y, generateEvent)
SetupScreen (pScreen); SetupScreen (pScreen);
GenerateEvent = generateEvent; GenerateEvent = generateEvent;
if (pScreen->ConstrainCursorHarder)
pScreen->ConstrainCursorHarder(pScreen, Absolute, &x, &y);
/* device dependent - must pend signal and call miPointerWarpCursor */ /* device dependent - must pend signal and call miPointerWarpCursor */
(*pScreenPriv->screenFuncs->WarpCursor) (pScreen, x, y); (*pScreenPriv->screenFuncs->WarpCursor) (pScreen, x, y);
if (!generateEvent) if (!generateEvent)
......
...@@ -17,18 +17,61 @@ ...@@ -17,18 +17,61 @@
XCOMM $XFree86: xc/programs/Xserver/randr/Imakefile,v 1.1 2001/05/23 03:29:44 keithp Exp $ XCOMM $XFree86: xc/programs/Xserver/randr/Imakefile,v 1.1 2001/05/23 03:29:44 keithp Exp $
#include <Server.tmpl> #include <Server.tmpl>
SRCS = mirandr.c randr.c rrcrtc.c rrdispatch.c rrinfo.c rrmode.c rroutput.c rrpointer.c rrproperty.c rrscreen.c rrsdispatch.c rrxinerama.c NULL =
OBJS = mirandr.o randr.o rrcrtc.o rrdispatch.o rrinfo.o rrmode.o rroutput.o rrpointer.o rrproperty.o rrscreen.o rrsdispatch.o rrxinerama.o SRCS = randr.c \
rrcrtc.c \
rrdispatch.c \
rrinfo.c \
rrmode.c \
rrmonitor.c \
rroutput.c \
rrpointer.c \
rrproperty.c \
rrprovider.c \
rrproviderproperty.c \
rrscreen.c \
rrsdispatch.c \
rrtransform.c \
rrxinerama.c \
$(NULL)
OBJS = randr.o \
rrcrtc.o \
rrdispatch.o \
rrinfo.o \
rrmode.o \
rrmonitor.o \
rroutput.o \
rrpointer.o \
rrproperty.o \
rrprovider.o \
rrproviderproperty.o \
rrscreen.o \
rrsdispatch.o \
rrtransform.o \
rrxinerama.o \
$(NULL)
INCLUDES = -I../include -I../mi \ INCLUDES = -I../include -I../mi \
-I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \ -I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \
-I../render \ -I../render \
`pkg-config --cflags-only-I pixman-1` `pkg-config --cflags-only-I pixman-1`
#if defined(BuildXinerama)
PNRX_DEFINES = -DXINERAMA -DPANORAMIX
#endif
#if defined(NXAgentServer)
NX_DEFINES = -DNXAGENT_SERVER
#endif
LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
DEFINES = -DNXAGENT_SERVER DEFINES = \
$(PNRX_DEFINES) \
$(NX_DEFINES) \
$(NULL)
NormalLibraryTarget(randr,$(OBJS)) NormalLibraryTarget(randr,$(OBJS))
NormalLibraryObjectRule() NormalLibraryObjectRule()
......
/*
* Copyright © 2000 Compaq Computer Corporation
* Copyright © 2002 Hewlett-Packard Company
* Copyright © 2006 Intel Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*
* Author: Jim Gettys, Hewlett-Packard Company, Inc.
* Keith Packard, Intel Corporation
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "scrnintstr.h"
#include "mi.h"
#include "randrstr.h"
#include <stdio.h>
Bool
miRRGetInfo (ScreenPtr pScreen, Rotation *rotations)
{
return TRUE;
}
/*
* Any hardware that can actually change anything will need something
* different here
*/
Bool
miRRCrtcSet (ScreenPtr pScreen,
RRCrtcPtr crtc,
RRModePtr mode,
int x,
int y,
Rotation rotation,
int numOutput,
RROutputPtr *outputs)
{
return TRUE;
}
static Bool
miRRCrtcSetGamma (ScreenPtr pScreen,
RRCrtcPtr crtc)
{
return TRUE;
}
Bool
miRROutputSetProperty (ScreenPtr pScreen,
RROutputPtr output,
Atom property,
RRPropertyValuePtr value)
{
return TRUE;
}
Bool
miRROutputValidateMode (ScreenPtr pScreen,
RROutputPtr output,
RRModePtr mode)
{
return FALSE;
}
void
miRRModeDestroy (ScreenPtr pScreen,
RRModePtr mode)
{
}
/*
* This function assumes that only a single depth can be
* displayed at a time, but that all visuals of that depth
* can be displayed simultaneously. It further assumes that
* only a single size is available. Hardware providing
* additional capabilties should use different code.
* XXX what to do here....
*/
Bool
miRandRInit (ScreenPtr pScreen)
{
rrScrPrivPtr pScrPriv;
#if RANDR_12_INTERFACE
RRModePtr mode;
RRCrtcPtr crtc;
RROutputPtr output;
xRRModeInfo modeInfo;
char name[64];
#endif
if (!RRScreenInit (pScreen))
return FALSE;
pScrPriv = rrGetScrPriv(pScreen);
pScrPriv->rrGetInfo = miRRGetInfo;
#if RANDR_12_INTERFACE
pScrPriv->rrCrtcSet = miRRCrtcSet;
pScrPriv->rrCrtcSetGamma = miRRCrtcSetGamma;
pScrPriv->rrOutputSetProperty = miRROutputSetProperty;
pScrPriv->rrOutputValidateMode = miRROutputValidateMode;
pScrPriv->rrModeDestroy = miRRModeDestroy;
RRScreenSetSizeRange (pScreen,
pScreen->width, pScreen->height,
pScreen->width, pScreen->height);
sprintf (name, "%dx%d", pScreen->width, pScreen->height);
memset (&modeInfo, '\0', sizeof (modeInfo));
modeInfo.width = pScreen->width;
modeInfo.height = pScreen->height;
modeInfo.nameLength = strlen (name);
mode = RRModeGet (&modeInfo, name);
if (!mode)
return FALSE;
crtc = RRCrtcCreate (pScreen, NULL);
if (!crtc)
return FALSE;
output = RROutputCreate (pScreen, "screen", 6, NULL);
if (!output)
return FALSE;
if (!RROutputSetClones (output, NULL, 0))
return FALSE;
if (!RROutputSetModes (output, &mode, 1, 0))
return FALSE;
if (!RROutputSetCrtcs (output, &crtc, 1))
return FALSE;
if (!RROutputSetConnection (output, RR_Connected))
return FALSE;
RRCrtcNotify (crtc, mode, 0, 0, RR_Rotate_0, 1, &output);
#endif
return TRUE;
}
...@@ -41,152 +41,160 @@ Equipment Corporation. ...@@ -41,152 +41,160 @@ Equipment Corporation.
#define X_XineramaQueryScreens 5 #define X_XineramaQueryScreens 5
typedef struct _PanoramiXQueryVersion { typedef struct _PanoramiXQueryVersion {
CARD8 reqType; /* always PanoramiXReqCode */ CARD8 reqType; /* always PanoramiXReqCode */
CARD8 panoramiXReqType; /* always X_PanoramiXQueryVersion */ CARD8 panoramiXReqType; /* always X_PanoramiXQueryVersion */
CARD16 length B16; CARD16 length B16;
CARD8 clientMajor; CARD8 clientMajor;
CARD8 clientMinor; CARD8 clientMinor;
CARD16 unused B16; CARD16 unused B16;
} xPanoramiXQueryVersionReq; } xPanoramiXQueryVersionReq;
#define sz_xPanoramiXQueryVersionReq 8 #define sz_xPanoramiXQueryVersionReq 8
typedef struct { typedef struct {
CARD8 type; /* must be X_Reply */ CARD8 type; /* must be X_Reply */
CARD8 pad1; /* unused */ CARD8 pad1; /* unused */
CARD16 sequenceNumber B16; /* last sequence number */ CARD16 sequenceNumber B16; /* last sequence number */
CARD32 length B32; /* 0 */ CARD32 length B32; /* 0 */
CARD16 majorVersion B16; CARD16 majorVersion B16;
CARD16 minorVersion B16; CARD16 minorVersion B16;
CARD32 pad2 B32; /* unused */ CARD32 pad2 B32; /* unused */
CARD32 pad3 B32; /* unused */ CARD32 pad3 B32; /* unused */
CARD32 pad4 B32; /* unused */ CARD32 pad4 B32; /* unused */
CARD32 pad5 B32; /* unused */ CARD32 pad5 B32; /* unused */
CARD32 pad6 B32; /* unused */ CARD32 pad6 B32; /* unused */
} xPanoramiXQueryVersionReply; } xPanoramiXQueryVersionReply;
#define sz_xPanoramiXQueryVersionReply 32 #define sz_xPanoramiXQueryVersionReply 32
typedef struct _PanoramiXGetState {
typedef struct _PanoramiXGetState { CARD8 reqType; /* always PanoramiXReqCode */
CARD8 reqType; /* always PanoramiXReqCode */ CARD8 panoramiXReqType; /* always X_PanoramiXGetState */
CARD8 panoramiXReqType; /* always X_PanoramiXGetState */ CARD16 length B16;
CARD16 length B16; CARD32 window B32;
CARD32 window B32;
} xPanoramiXGetStateReq; } xPanoramiXGetStateReq;
#define sz_xPanoramiXGetStateReq 8
#define sz_xPanoramiXGetStateReq 8
typedef struct { typedef struct {
BYTE type; BYTE type;
BYTE state; BYTE state;
CARD16 sequenceNumber B16; CARD16 sequenceNumber B16;
CARD32 length B32; CARD32 length B32;
CARD32 window B32; CARD32 window B32;
CARD32 pad1 B32; /* unused */ CARD32 pad1 B32; /* unused */
CARD32 pad2 B32; /* unused */ CARD32 pad2 B32; /* unused */
CARD32 pad3 B32; /* unused */ CARD32 pad3 B32; /* unused */
CARD32 pad4 B32; /* unused */ CARD32 pad4 B32; /* unused */
CARD32 pad5 B32; /* unused */ CARD32 pad5 B32; /* unused */
} xPanoramiXGetStateReply; } xPanoramiXGetStateReply;
#define sz_panoramiXGetStateReply 32 #define sz_panoramiXGetStateReply 32
typedef struct _PanoramiXGetScreenCount { typedef struct _PanoramiXGetScreenCount {
CARD8 reqType; /* always PanoramiXReqCode */ CARD8 reqType; /* always PanoramiXReqCode */
CARD8 panoramiXReqType; /* always X_PanoramiXGetScreenCount */ CARD8 panoramiXReqType; /* always X_PanoramiXGetScreenCount */
CARD16 length B16; CARD16 length B16;
CARD32 window B32; CARD32 window B32;
} xPanoramiXGetScreenCountReq; } xPanoramiXGetScreenCountReq;
#define sz_xPanoramiXGetScreenCountReq 8 #define sz_xPanoramiXGetScreenCountReq 8
typedef struct { typedef struct {
BYTE type; BYTE type;
BYTE ScreenCount; BYTE ScreenCount;
CARD16 sequenceNumber B16; CARD16 sequenceNumber B16;
CARD32 length B32; CARD32 length B32;
CARD32 window B32; CARD32 window B32;
CARD32 pad1 B32; /* unused */ CARD32 pad1 B32; /* unused */
CARD32 pad2 B32; /* unused */ CARD32 pad2 B32; /* unused */
CARD32 pad3 B32; /* unused */ CARD32 pad3 B32; /* unused */
CARD32 pad4 B32; /* unused */ CARD32 pad4 B32; /* unused */
CARD32 pad5 B32; /* unused */ CARD32 pad5 B32; /* unused */
} xPanoramiXGetScreenCountReply; } xPanoramiXGetScreenCountReply;
#define sz_panoramiXGetScreenCountReply 32 #define sz_panoramiXGetScreenCountReply 32
typedef struct _PanoramiXGetScreenSize { typedef struct _PanoramiXGetScreenSize {
CARD8 reqType; /* always PanoramiXReqCode */ CARD8 reqType; /* always PanoramiXReqCode */
CARD8 panoramiXReqType; /* always X_PanoramiXGetState */ CARD8 panoramiXReqType; /* always X_PanoramiXGetState */
CARD16 length B16; CARD16 length B16;
CARD32 window B32; CARD32 window B32;
CARD32 screen B32; CARD32 screen B32;
} xPanoramiXGetScreenSizeReq; } xPanoramiXGetScreenSizeReq;
#define sz_xPanoramiXGetScreenSizeReq 12
#define sz_xPanoramiXGetScreenSizeReq 12
typedef struct { typedef struct {
BYTE type; BYTE type;
CARD8 pad1; CARD8 pad1;
CARD16 sequenceNumber B16; CARD16 sequenceNumber B16;
CARD32 length B32; CARD32 length B32;
CARD32 width B32; CARD32 width B32;
CARD32 height B32; CARD32 height B32;
CARD32 window B32; CARD32 window B32;
CARD32 screen B32; CARD32 screen B32;
CARD32 pad2 B32; /* unused */ CARD32 pad2 B32; /* unused */
CARD32 pad3 B32; /* unused */ CARD32 pad3 B32; /* unused */
} xPanoramiXGetScreenSizeReply; } xPanoramiXGetScreenSizeReply;
#define sz_panoramiXGetScreenSizeReply 32
#define sz_panoramiXGetScreenSizeReply 32
/************ Alternate protocol ******************/ /************ Alternate protocol ******************/
typedef struct { typedef struct {
CARD8 reqType; CARD8 reqType;
CARD8 panoramiXReqType; CARD8 panoramiXReqType;
CARD16 length B16; CARD16 length B16;
} xXineramaIsActiveReq; } xXineramaIsActiveReq;
#define sz_xXineramaIsActiveReq 4 #define sz_xXineramaIsActiveReq 4
typedef struct { typedef struct {
BYTE type; BYTE type;
CARD8 pad1; CARD8 pad1;
CARD16 sequenceNumber B16; CARD16 sequenceNumber B16;
CARD32 length B32; CARD32 length B32;
CARD32 state B32; CARD32 state B32;
CARD32 pad2 B32; CARD32 pad2 B32;
CARD32 pad3 B32; CARD32 pad3 B32;
CARD32 pad4 B32; CARD32 pad4 B32;
CARD32 pad5 B32; CARD32 pad5 B32;
CARD32 pad6 B32; CARD32 pad6 B32;
} xXineramaIsActiveReply; } xXineramaIsActiveReply;
#define sz_XineramaIsActiveReply 32
#define sz_XineramaIsActiveReply 32
typedef struct { typedef struct {
CARD8 reqType; CARD8 reqType;
CARD8 panoramiXReqType; CARD8 panoramiXReqType;
CARD16 length B16; CARD16 length B16;
} xXineramaQueryScreensReq; } xXineramaQueryScreensReq;
#define sz_xXineramaQueryScreensReq 4 #define sz_xXineramaQueryScreensReq 4
typedef struct { typedef struct {
BYTE type; BYTE type;
CARD8 pad1; CARD8 pad1;
CARD16 sequenceNumber B16; CARD16 sequenceNumber B16;
CARD32 length B32; CARD32 length B32;
CARD32 number B32; CARD32 number B32;
CARD32 pad2 B32; CARD32 pad2 B32;
CARD32 pad3 B32; CARD32 pad3 B32;
CARD32 pad4 B32; CARD32 pad4 B32;
CARD32 pad5 B32; CARD32 pad5 B32;
CARD32 pad6 B32; CARD32 pad6 B32;
} xXineramaQueryScreensReply; } xXineramaQueryScreensReply;
#define sz_XineramaQueryScreensReply 32
#define sz_XineramaQueryScreensReply 32
typedef struct { typedef struct {
INT16 x_org B16; INT16 x_org B16;
INT16 y_org B16; INT16 y_org B16;
CARD16 width B16; CARD16 width B16;
CARD16 height B16; CARD16 height B16;
} xXineramaScreenInfo; } xXineramaScreenInfo;
#define sz_XineramaScreenInfo 8 #define sz_XineramaScreenInfo 8
#endif #endif
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* Copyright © 2000 Compaq Computer Corporation * Copyright © 2000 Compaq Computer Corporation
* Copyright © 2002 Hewlett Packard Company * Copyright © 2002 Hewlett Packard Company
* Copyright © 2006 Intel Corporation * Copyright © 2006 Intel Corporation
* Copyright © 2008 Red Hat, Inc.
* *
* Permission to use, copy, modify, distribute, and sell this software and its * Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that * documentation for any purpose is hereby granted without fee, provided that
...@@ -28,22 +29,22 @@ ...@@ -28,22 +29,22 @@
#ifndef _RANDR_H_ #ifndef _RANDR_H_
#define _RANDR_H_ #define _RANDR_H_
typedef unsigned short Rotation; typedef unsigned short Rotation;
typedef unsigned short SizeID; typedef unsigned short SizeID;
typedef unsigned short SubpixelOrder; typedef unsigned short SubpixelOrder;
typedef unsigned short Connection; typedef unsigned short Connection;
typedef unsigned short XRandrRotation; typedef unsigned short XRandrRotation;
typedef unsigned short XRandrSizeID; typedef unsigned short XRandrSizeID;
typedef unsigned short XRandrSubpixelOrder; typedef unsigned short XRandrSubpixelOrder;
typedef unsigned long XRandrModeFlags; typedef unsigned long XRandrModeFlags;
#define RANDR_NAME "RANDR" #define RANDR_NAME "RANDR"
#define RANDR_MAJOR 1 #define RANDR_MAJOR 1
#define RANDR_MINOR 2 #define RANDR_MINOR 5
#define RRNumberErrors 3 #define RRNumberErrors 4
#define RRNumberEvents 2 #define RRNumberEvents 2
#define RRNumberRequests 25 #define RRNumberRequests 45
#define X_RRQueryVersion 0 #define X_RRQueryVersion 0
/* we skip 1 to make old clients fail pretty immediately */ /* we skip 1 to make old clients fail pretty immediately */
...@@ -77,12 +78,47 @@ typedef unsigned long XRandrModeFlags; ...@@ -77,12 +78,47 @@ typedef unsigned long XRandrModeFlags;
#define X_RRGetCrtcGamma 23 #define X_RRGetCrtcGamma 23
#define X_RRSetCrtcGamma 24 #define X_RRSetCrtcGamma 24
/* V1.3 additions */
#define X_RRGetScreenResourcesCurrent 25
#define X_RRSetCrtcTransform 26
#define X_RRGetCrtcTransform 27
#define X_RRGetPanning 28
#define X_RRSetPanning 29
#define X_RRSetOutputPrimary 30
#define X_RRGetOutputPrimary 31
#define RRTransformUnit (1L << 0)
#define RRTransformScaleUp (1L << 1)
#define RRTransformScaleDown (1L << 2)
#define RRTransformProjective (1L << 3)
/* v1.4 */
#define X_RRGetProviders 32
#define X_RRGetProviderInfo 33
#define X_RRSetProviderOffloadSink 34
#define X_RRSetProviderOutputSource 35
#define X_RRListProviderProperties 36
#define X_RRQueryProviderProperty 37
#define X_RRConfigureProviderProperty 38
#define X_RRChangeProviderProperty 39
#define X_RRDeleteProviderProperty 40
#define X_RRGetProviderProperty 41
/* v1.5 */
#define X_RRGetMonitors 42
#define X_RRSetMonitor 43
#define X_RRDeleteMonitor 44
/* Event selection bits */ /* Event selection bits */
#define RRScreenChangeNotifyMask (1L << 0) #define RRScreenChangeNotifyMask (1L << 0)
/* V1.2 additions */ /* V1.2 additions */
#define RRCrtcChangeNotifyMask (1L << 1) #define RRCrtcChangeNotifyMask (1L << 1)
#define RROutputChangeNotifyMask (1L << 2) #define RROutputChangeNotifyMask (1L << 2)
#define RROutputPropertyNotifyMask (1L << 3) #define RROutputPropertyNotifyMask (1L << 3)
/* V1.4 additions */
#define RRProviderChangeNotifyMask (1L << 4)
#define RRProviderPropertyNotifyMask (1L << 5)
#define RRResourceChangeNotifyMask (1L << 6)
/* Event codes */ /* Event codes */
#define RRScreenChangeNotify 0 #define RRScreenChangeNotify 0
...@@ -92,7 +128,9 @@ typedef unsigned long XRandrModeFlags; ...@@ -92,7 +128,9 @@ typedef unsigned long XRandrModeFlags;
#define RRNotify_CrtcChange 0 #define RRNotify_CrtcChange 0
#define RRNotify_OutputChange 1 #define RRNotify_OutputChange 1
#define RRNotify_OutputProperty 2 #define RRNotify_OutputProperty 2
#define RRNotify_ProviderChange 3
#define RRNotify_ProviderProperty 4
#define RRNotify_ResourceChange 5
/* used in the rotation field; rotation and reflection in 0.1 proto. */ /* used in the rotation field; rotation and reflection in 0.1 proto. */
#define RR_Rotate_0 1 #define RR_Rotate_0 1
#define RR_Rotate_90 2 #define RR_Rotate_90 2
...@@ -133,9 +171,28 @@ typedef unsigned long XRandrModeFlags; ...@@ -133,9 +171,28 @@ typedef unsigned long XRandrModeFlags;
#define BadRROutput 0 #define BadRROutput 0
#define BadRRCrtc 1 #define BadRRCrtc 1
#define BadRRMode 2 #define BadRRMode 2
#define BadRRProvider 3
/* Conventional RandR output properties */ /* Conventional RandR output properties */
#define RR_PROPERTY_RANDR_EDID "RANDR_EDID" #define RR_PROPERTY_BACKLIGHT "Backlight"
#define RR_PROPERTY_RANDR_EDID "EDID"
#endif /* _RANDR_H_ */ #define RR_PROPERTY_SIGNAL_FORMAT "SignalFormat"
#define RR_PROPERTY_SIGNAL_PROPERTIES "SignalProperties"
#define RR_PROPERTY_CONNECTOR_TYPE "ConnectorType"
#define RR_PROPERTY_CONNECTOR_NUMBER "ConnectorNumber"
#define RR_PROPERTY_COMPATIBILITY_LIST "CompatibilityList"
#define RR_PROPERTY_CLONE_LIST "CloneList"
#define RR_PROPERTY_BORDER "Border"
#define RR_PROPERTY_BORDER_DIMENSIONS "BorderDimensions"
#define RR_PROPERTY_GUID "GUID"
#define RR_PROPERTY_RANDR_TILE "TILE"
/* roles this device can carry out */
#define RR_Capability_None 0
#define RR_Capability_SourceOutput 1
#define RR_Capability_SinkOutput 2
#define RR_Capability_SourceOffload 4
#define RR_Capability_SinkOffload 8
#endif /* _RANDR_H_ */
...@@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ...@@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* not be a stack variable. * not be a stack variable.
*/ */
void RegisterResourceName(RESTYPE type, char *name); void RegisterResourceName(RESTYPE type, char *name);
void RegisterExtensionNames(ExtensionEntry *ext); void RegisterExtensionNames(ExtensionEntry * ext);
/* /*
* Lookup functions. The returned string must not be modified or freed. * Lookup functions. The returned string must not be modified or freed.
...@@ -45,7 +45,7 @@ const char *LookupResourceName(RESTYPE rtype); ...@@ -45,7 +45,7 @@ const char *LookupResourceName(RESTYPE rtype);
*/ */
void dixResetRegistry(void); void dixResetRegistry(void);
#else /* XREGISTRY */ #else /* XREGISTRY */
/* Define calls away when the registry is not being built. */ /* Define calls away when the registry is not being built. */
...@@ -60,5 +60,5 @@ void dixResetRegistry(void); ...@@ -60,5 +60,5 @@ void dixResetRegistry(void);
#define dixResetRegistry() { ; } #define dixResetRegistry() { ; }
#endif /* XREGISTRY */ #endif /* XREGISTRY */
#endif /* DIX_REGISTRY_H */ #endif /* DIX_REGISTRY_H */
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
*/ */
#include "randrstr.h" #include "randrstr.h"
#include "inputstr.h"
/* /*
* When the pointer moves, check to see if the specified position is outside * When the pointer moves, check to see if the specified position is outside
...@@ -31,19 +32,19 @@ ...@@ -31,19 +32,19 @@
*/ */
static Bool static Bool
RRCrtcContainsPosition (RRCrtcPtr crtc, int x, int y) RRCrtcContainsPosition(RRCrtcPtr crtc, int x, int y)
{ {
RRModePtr mode = crtc->mode; RRModePtr mode = crtc->mode;
int scan_width, scan_height; int scan_width, scan_height;
if (!mode) if (!mode)
return FALSE; return FALSE;
RRCrtcGetScanoutSize (crtc, &scan_width, &scan_height); RRCrtcGetScanoutSize(crtc, &scan_width, &scan_height);
if (crtc->x <= x && x < crtc->x + scan_width && if (crtc->x <= x && x < crtc->x + scan_width &&
crtc->y <= y && y < crtc->y + scan_height) crtc->y <= y && y < crtc->y + scan_height)
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
...@@ -51,95 +52,131 @@ RRCrtcContainsPosition (RRCrtcPtr crtc, int x, int y) ...@@ -51,95 +52,131 @@ RRCrtcContainsPosition (RRCrtcPtr crtc, int x, int y)
* Find the CRTC nearest the specified position, ignoring 'skip' * Find the CRTC nearest the specified position, ignoring 'skip'
*/ */
static void static void
RRPointerToNearestCrtc (ScreenPtr pScreen, int x, int y, RRCrtcPtr skip) RRPointerToNearestCrtc(
#ifndef NXAGENT_SERVER
DeviceIntPtr pDev,
#endif /* !defined(NXAGENT_SERVER) */
ScreenPtr pScreen, int x, int y, RRCrtcPtr skip)
{ {
rrScrPriv (pScreen); rrScrPriv(pScreen);
int c; int c;
RRCrtcPtr nearest = NULL; RRCrtcPtr nearest = NULL;
int best = 0; int best = 0;
int best_dx = 0, best_dy = 0; int best_dx = 0, best_dy = 0;
for (c = 0; c < pScrPriv->numCrtcs; c++) for (c = 0; c < pScrPriv->numCrtcs; c++) {
{ RRCrtcPtr crtc = pScrPriv->crtcs[c];
RRCrtcPtr crtc = pScrPriv->crtcs[c]; RRModePtr mode = crtc->mode;
RRModePtr mode = crtc->mode; int dx, dy;
int dx, dy; int dist;
int dist; int scan_width, scan_height;
int scan_width, scan_height;
if (!mode)
if (!mode) continue;
continue; if (crtc == skip)
if (crtc == skip) continue;
continue;
RRCrtcGetScanoutSize(crtc, &scan_width, &scan_height);
RRCrtcGetScanoutSize (crtc, &scan_width, &scan_height);
if (x < crtc->x)
if (x < crtc->x) dx = crtc->x - x;
dx = crtc->x - x; else if (x > crtc->x + scan_width - 1)
else if (x > crtc->x + scan_width) dx = crtc->x + (scan_width - 1) - x;
dx = x - (crtc->x + scan_width); else
else dx = 0;
dx = 0; if (y < crtc->y)
if (y < crtc->y) dy = crtc->y - y;
dy = crtc->y - x; else if (y > crtc->y + scan_height - 1)
else if (y > crtc->y + scan_height) dy = crtc->y + (scan_height - 1) - y;
dy = y - (crtc->y + scan_height); else
else dy = 0;
dy = 0; dist = dx * dx + dy * dy;
dist = dx + dy; if (!nearest || dist < best) {
if (!nearest || dist < best) nearest = crtc;
{ best_dx = dx;
nearest = crtc; best_dy = dy;
best_dx = dx; best = dist;
best_dy = dy; }
}
} }
if (best_dx || best_dy) if (best_dx || best_dy)
(*pScreen->SetCursorPosition) (pScreen, x + best_dx, y + best_dy, TRUE); (*pScreen->SetCursorPosition) (
#ifndef NXAGENT_SERVER
pDev,
#endif /* !defined(NXAGENT_SERVER) */
pScreen, x + best_dx, y + best_dy,
TRUE);
pScrPriv->pointerCrtc = nearest; pScrPriv->pointerCrtc = nearest;
} }
void void
RRPointerMoved (ScreenPtr pScreen, int x, int y) RRPointerMoved(ScreenPtr pScreen, int x, int y)
{ {
rrScrPriv (pScreen); rrScrPriv(pScreen);
RRCrtcPtr pointerCrtc = pScrPriv->pointerCrtc; RRCrtcPtr pointerCrtc = pScrPriv->pointerCrtc;
int c; int c;
/* Check last known CRTC */ /* Check last known CRTC */
if (pointerCrtc && RRCrtcContainsPosition (pointerCrtc, x, y)) if (pointerCrtc && RRCrtcContainsPosition(pointerCrtc, x, y))
return; return;
/* Check all CRTCs */ /* Check all CRTCs */
for (c = 0; c < pScrPriv->numCrtcs; c++) for (c = 0; c < pScrPriv->numCrtcs; c++) {
{ RRCrtcPtr crtc = pScrPriv->crtcs[c];
RRCrtcPtr crtc = pScrPriv->crtcs[c];
if (RRCrtcContainsPosition(crtc, x, y)) {
if (RRCrtcContainsPosition (crtc, x, y)) /* Remember containing CRTC */
{ pScrPriv->pointerCrtc = crtc;
/* Remember containing CRTC */ return;
pScrPriv->pointerCrtc = crtc; }
return;
}
} }
/* None contain pointer, find nearest */ /* None contain pointer, find nearest */
RRPointerToNearestCrtc (pScreen, x, y, pointerCrtc); ErrorF("RRPointerMoved: Untested, may cause \"bogus pointer event\"\n");
RRPointerToNearestCrtc(
#ifndef NXAGENT_SERVER
inputInfo.pointer,
#endif /* !defined(NXAGENT_SERVER) */
pScreen, x, y, pointerCrtc);
} }
/* /*
* When the screen is reconfigured, move the pointer to the nearest * When the screen is reconfigured, move all pointers to the nearest
* CRTC * CRTC
*/ */
void void
RRPointerScreenConfigured (ScreenPtr pScreen) RRPointerScreenConfigured(ScreenPtr pScreen)
{ {
WindowPtr pRoot = GetCurrentRootWindow (); WindowPtr pRoot;
ScreenPtr pCurrentScreen = pRoot ? pRoot->drawable.pScreen : NULL; ScreenPtr pCurrentScreen;
int x, y; int x, y;
if (pScreen != pCurrentScreen) #ifndef NXAGENT_SERVER
return; DeviceIntPtr pDev;
GetSpritePosition (&x, &y);
RRPointerToNearestCrtc (pScreen, x, y, NULL); for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if (IsPointerDevice(pDev)) {
#endif /* NXAGENT_SERVER */
pRoot = GetCurrentRootWindow(
#ifndef NXAGENT_SERVER
pDev
#endif /* NXAGENT_SERVER */
);
pCurrentScreen = pRoot ? pRoot->drawable.pScreen : NULL;
if (pScreen == pCurrentScreen) {
GetSpritePosition(
#ifndef NXAGENT_SERVER
pDev,
#endif /* NXAGENT_SERVER */
&x, &y);
RRPointerToNearestCrtc(
#ifndef NXAGENT_SERVER
pDev,
#endif /* NXAGENT_SERVER */
pScreen, x, y, NULL);
#ifndef NXAGENT_SERVER
}
}
#endif /* NXAGENT_SERVER */
}
} }
/*
* Copyright © 2007 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include "randrstr.h"
#include "rrtransform.h"
void
RRTransformInit(RRTransformPtr transform)
{
pixman_transform_init_identity(&transform->transform);
pixman_f_transform_init_identity(&transform->f_transform);
pixman_f_transform_init_identity(&transform->f_inverse);
transform->filter = NULL;
transform->params = NULL;
transform->nparams = 0;
}
void
RRTransformFini(RRTransformPtr transform)
{
xfree(transform->params);
}
Bool
RRTransformEqual(RRTransformPtr a, RRTransformPtr b)
{
if (a && pixman_transform_is_identity(&a->transform))
a = NULL;
if (b && pixman_transform_is_identity(&b->transform))
b = NULL;
if (a == NULL && b == NULL)
return TRUE;
if (a == NULL || b == NULL)
return FALSE;
if (memcmp(&a->transform, &b->transform, sizeof(a->transform)) != 0)
return FALSE;
if (a->filter != b->filter)
return FALSE;
if (a->nparams != b->nparams)
return FALSE;
if (memcmp(a->params, b->params, a->nparams * sizeof(xFixed)) != 0)
return FALSE;
return TRUE;
}
Bool
RRTransformSetFilter(RRTransformPtr dst,
PictFilterPtr filter,
xFixed * params, int nparams, int width, int height)
{
xFixed *new_params;
if (nparams) {
#ifndef NXAGENT_SERVER
new_params = xallocarray(nparams, sizeof(xFixed));
#else /* !defined(NXAGENT_SERVER) */
new_params = xalloc(nparams * sizeof(xFixed));
#endif /* !defined(NXAGENT_SERVER) */
if (!new_params)
return FALSE;
memcpy(new_params, params, nparams * sizeof(xFixed));
}
else
new_params = NULL;
xfree(dst->params);
dst->filter = filter;
dst->params = new_params;
dst->nparams = nparams;
dst->width = width;
dst->height = height;
return TRUE;
}
Bool
RRTransformCopy(RRTransformPtr dst, RRTransformPtr src)
{
if (src && pixman_transform_is_identity(&src->transform))
src = NULL;
if (src) {
if (!RRTransformSetFilter(dst, src->filter,
src->params, src->nparams, src->width,
src->height))
return FALSE;
dst->transform = src->transform;
dst->f_transform = src->f_transform;
dst->f_inverse = src->f_inverse;
}
else {
if (!RRTransformSetFilter(dst, NULL, NULL, 0, 0, 0))
return FALSE;
pixman_transform_init_identity(&dst->transform);
pixman_f_transform_init_identity(&dst->f_transform);
pixman_f_transform_init_identity(&dst->f_inverse);
}
return TRUE;
}
#define F(x) IntToxFixed(x)
static void
RRTransformRescale(struct pixman_f_transform *f_transform, double limit)
{
double max = 0, v, scale;
int i, j;
for (j = 0; j < 3; j++)
for (i = 0; i < 3; i++)
if ((v = fabs(f_transform->m[j][i])) > max)
max = v;
scale = limit / max;
for (j = 0; j < 3; j++)
for (i = 0; i < 3; i++)
f_transform->m[j][i] *= scale;
}
/*
* Compute the complete transformation matrix including
* client-specified transform, rotation/reflection values and the crtc
* offset.
*
* Return TRUE if the resulting transform is not a simple translation.
*/
Bool
RRTransformCompute(int x,
int y,
int width,
int height,
Rotation rotation,
RRTransformPtr rr_transform,
PictTransformPtr transform,
struct pixman_f_transform *f_transform,
struct pixman_f_transform *f_inverse)
{
PictTransform t_transform, inverse;
struct pixman_f_transform tf_transform, tf_inverse;
Bool overflow = FALSE;
if (!transform)
transform = &t_transform;
if (!f_transform)
f_transform = &tf_transform;
if (!f_inverse)
f_inverse = &tf_inverse;
pixman_transform_init_identity(transform);
pixman_transform_init_identity(&inverse);
pixman_f_transform_init_identity(f_transform);
pixman_f_transform_init_identity(f_inverse);
if (rotation != RR_Rotate_0) {
double f_rot_cos, f_rot_sin, f_rot_dx, f_rot_dy;
double f_scale_x, f_scale_y, f_scale_dx, f_scale_dy;
xFixed rot_cos, rot_sin, rot_dx, rot_dy;
xFixed scale_x, scale_y, scale_dx, scale_dy;
/* rotation */
switch (rotation & 0xf) {
default:
case RR_Rotate_0:
f_rot_cos = 1;
f_rot_sin = 0;
f_rot_dx = 0;
f_rot_dy = 0;
rot_cos = F(1);
rot_sin = F(0);
rot_dx = F(0);
rot_dy = F(0);
break;
case RR_Rotate_90:
f_rot_cos = 0;
f_rot_sin = 1;
f_rot_dx = height;
f_rot_dy = 0;
rot_cos = F(0);
rot_sin = F(1);
rot_dx = F(height);
rot_dy = F(0);
break;
case RR_Rotate_180:
f_rot_cos = -1;
f_rot_sin = 0;
f_rot_dx = width;
f_rot_dy = height;
rot_cos = F(~0u);
rot_sin = F(0);
rot_dx = F(width);
rot_dy = F(height);
break;
case RR_Rotate_270:
f_rot_cos = 0;
f_rot_sin = -1;
f_rot_dx = 0;
f_rot_dy = width;
rot_cos = F(0);
rot_sin = F(~0u);
rot_dx = F(0);
rot_dy = F(width);
break;
}
pixman_transform_rotate(transform, &inverse, rot_cos, rot_sin);
pixman_transform_translate(transform, &inverse, rot_dx, rot_dy);
pixman_f_transform_rotate(f_transform, f_inverse, f_rot_cos, f_rot_sin);
pixman_f_transform_translate(f_transform, f_inverse, f_rot_dx,
f_rot_dy);
/* reflection */
f_scale_x = 1;
f_scale_dx = 0;
f_scale_y = 1;
f_scale_dy = 0;
scale_x = F(1);
scale_dx = 0;
scale_y = F(1);
scale_dy = 0;
if (rotation & RR_Reflect_X) {
f_scale_x = -1;
scale_x = F(~0u);
if (rotation & (RR_Rotate_0 | RR_Rotate_180)) {
f_scale_dx = width;
scale_dx = F(width);
}
else {
f_scale_dx = height;
scale_dx = F(height);
}
}
if (rotation & RR_Reflect_Y) {
f_scale_y = -1;
scale_y = F(~0u);
if (rotation & (RR_Rotate_0 | RR_Rotate_180)) {
f_scale_dy = height;
scale_dy = F(height);
}
else {
f_scale_dy = width;
scale_dy = F(width);
}
}
pixman_transform_scale(transform, &inverse, scale_x, scale_y);
pixman_f_transform_scale(f_transform, f_inverse, f_scale_x, f_scale_y);
pixman_transform_translate(transform, &inverse, scale_dx, scale_dy);
pixman_f_transform_translate(f_transform, f_inverse, f_scale_dx,
f_scale_dy);
}
#ifdef RANDR_12_INTERFACE
if (rr_transform) {
if (!pixman_transform_multiply
(transform, &rr_transform->transform, transform))
overflow = TRUE;
pixman_f_transform_multiply(f_transform, &rr_transform->f_transform,
f_transform);
pixman_f_transform_multiply(f_inverse, f_inverse,
&rr_transform->f_inverse);
}
#endif
/*
* Compute the class of the resulting transform
*/
if (!overflow && pixman_transform_is_identity(transform)) {
pixman_transform_init_translate(transform, F(x), F(y));
pixman_f_transform_init_translate(f_transform, x, y);
pixman_f_transform_init_translate(f_inverse, -x, -y);
return FALSE;
}
else {
pixman_f_transform_translate(f_transform, f_inverse, x, y);
if (!pixman_transform_translate(transform, &inverse, F(x), F(y)))
overflow = TRUE;
if (overflow) {
struct pixman_f_transform f_scaled;
f_scaled = *f_transform;
RRTransformRescale(&f_scaled, 16384.0);
pixman_transform_from_pixman_f_transform(transform, &f_scaled);
}
return TRUE;
}
}
/*
* Copyright © 2007 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef _RRTRANSFORM_H_
#define _RRTRANSFORM_H_
#include "randr.h"
#include "picturestr.h"
typedef struct _rrTransform RRTransformRec, *RRTransformPtr;
struct _rrTransform {
PictTransform transform;
struct pict_f_transform f_transform;
struct pict_f_transform f_inverse;
PictFilterPtr filter;
xFixed *params;
int nparams;
int width;
int height;
};
extern _X_EXPORT void
RRTransformInit(RRTransformPtr transform);
extern _X_EXPORT void
RRTransformFini(RRTransformPtr transform);
extern _X_EXPORT Bool
RRTransformEqual(RRTransformPtr a, RRTransformPtr b);
extern _X_EXPORT Bool
RRTransformSetFilter(RRTransformPtr dst,
PictFilterPtr filter,
xFixed * params, int nparams, int width, int height);
extern _X_EXPORT Bool
RRTransformCopy(RRTransformPtr dst, RRTransformPtr src);
/*
* Compute the complete transformation matrix including
* client-specified transform, rotation/reflection values and the crtc
* offset.
*
* Return TRUE if the resulting transform is not a simple translation.
*/
extern _X_EXPORT Bool
RRTransformCompute(int x,
int y,
int width,
int height,
Rotation rotation,
RRTransformPtr rr_transform,
PictTransformPtr transform,
struct pict_f_transform *f_transform,
struct pict_f_transform *f_inverse);
#endif /* _RRTRANSFORM_H_ */
...@@ -4,6 +4,7 @@ XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.10 2002/11/23 02:38:15 ...@@ -4,6 +4,7 @@ XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.10 2002/11/23 02:38:15
SRCS = animcur.c \ SRCS = animcur.c \
filter.c \ filter.c \
glyph.c \ glyph.c \
matrix.c \
miglyph.c \ miglyph.c \
miindex.c \ miindex.c \
mipict.c \ mipict.c \
...@@ -17,6 +18,7 @@ XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.10 2002/11/23 02:38:15 ...@@ -17,6 +18,7 @@ XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.10 2002/11/23 02:38:15
OBJS = animcur.o \ OBJS = animcur.o \
filter.o \ filter.o \
glyph.o \ glyph.o \
matrix.o \
miglyph.o \ miglyph.o \
miindex.o \ miindex.o \
mipict.o \ mipict.o \
......
...@@ -215,21 +215,30 @@ PictureFindFilter (ScreenPtr pScreen, char *name, int len) ...@@ -215,21 +215,30 @@ PictureFindFilter (ScreenPtr pScreen, char *name, int len)
} }
static Bool static Bool
convolutionFilterValidateParams (PicturePtr pPicture, convolutionFilterValidateParams (ScreenPtr pScreen,
int filter, int filter,
xFixed *params, xFixed *params,
int nparams) int nparams,
int* width,
int* height)
{ {
int w, h;
if (nparams < 3) if (nparams < 3)
return FALSE; return FALSE;
if (xFixedFrac (params[0]) || xFixedFrac (params[1])) if (xFixedFrac (params[0]) || xFixedFrac (params[1]))
return FALSE; return FALSE;
w = xFixedToInt (params[0]);
h = xFixedToInt (params[1]);
nparams -= 2; nparams -= 2;
if ((xFixedToInt (params[0]) * xFixedToInt (params[1])) > nparams) if (w * h > nparams)
return FALSE; return FALSE;
*width = w;
*height = h;
return TRUE; return TRUE;
} }
...@@ -271,10 +280,8 @@ PictureResetFilters (ScreenPtr pScreen) ...@@ -271,10 +280,8 @@ PictureResetFilters (ScreenPtr pScreen)
int int
SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams) SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams)
{ {
ScreenPtr pScreen;
PictFilterPtr pFilter; PictFilterPtr pFilter;
xFixed *new_params; ScreenPtr pScreen;
int i;
if (pPicture->pDrawable) { if (pPicture->pDrawable) {
pScreen = pPicture->pDrawable->pScreen; pScreen = pPicture->pDrawable->pScreen;
...@@ -288,7 +295,7 @@ SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int ...@@ -288,7 +295,7 @@ SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int
if (!pFilter) if (!pFilter)
return BadName; return BadName;
if (!pPicture->pDrawable) { if (pPicture->pDrawable == NULL) {
int s; int s;
/* For source pictures, the picture isn't tied to a screen. So, ensure /* For source pictures, the picture isn't tied to a screen. So, ensure
...@@ -303,8 +310,25 @@ SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int ...@@ -303,8 +310,25 @@ SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int
} }
} }
return SetPicturePictFilter (pPicture, pFilter, params, nparams);
}
int
SetPicturePictFilter (PicturePtr pPicture, PictFilterPtr pFilter,
xFixed *params, int nparams)
{
ScreenPtr pScreen;
int i;
if (pPicture->pDrawable)
pScreen = pPicture->pDrawable->pScreen;
else
pScreen = screenInfo.screens[0];
if (pFilter->ValidateParams) { if (pFilter->ValidateParams) {
if (!(*pFilter->ValidateParams) (pPicture, pFilter->id, params, nparams)) int width, height;
if (!(*pFilter->ValidateParams) (pScreen, pFilter->id, params, nparams, &width, &height))
return BadMatch; return BadMatch;
} }
else if (nparams) { else if (nparams) {
...@@ -312,7 +336,7 @@ SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int ...@@ -312,7 +336,7 @@ SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int
} }
if (nparams != pPicture->filter_nparams) { if (nparams != pPicture->filter_nparams) {
new_params = xalloc (nparams * sizeof (xFixed)); xFixed *new_params = xalloc (nparams * sizeof (xFixed));
if (!new_params && nparams) if (!new_params && nparams)
return BadAlloc; return BadAlloc;
...@@ -324,9 +348,10 @@ SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int ...@@ -324,9 +348,10 @@ SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int
pPicture->filter_params[i] = params[i]; pPicture->filter_params[i] = params[i];
pPicture->filter = pFilter->id; pPicture->filter = pFilter->id;
if (pPicture->pDrawable) { if (pPicture->pDrawable)
PictureScreenPtr ps = GetPictureScreen (pScreen); {
int result; PictureScreenPtr ps = GetPictureScreen(pScreen);
int result;
result = (*ps->ChangePictureFilter) (pPicture, pPicture->filter, result = (*ps->ChangePictureFilter) (pPicture, pPicture->filter,
params, nparams); params, nparams);
...@@ -335,5 +360,5 @@ SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int ...@@ -335,5 +360,5 @@ SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int
} }
pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT; pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
return Success; return ;
} }
/*
* Copyright © 2007 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "misc.h"
#include "scrnintstr.h"
#include "os.h"
#include "regionstr.h"
#include "validate.h"
#include "windowstr.h"
#include "input.h"
#include "resource.h"
#include "colormapst.h"
#include "cursorstr.h"
#include "dixstruct.h"
#include "gcstruct.h"
#include "servermd.h"
#include "picturestr.h"
void
PictTransform_from_xRenderTransform(PictTransformPtr pict,
xRenderTransform * render)
{
pict->matrix[0][0] = render->matrix11;
pict->matrix[0][1] = render->matrix12;
pict->matrix[0][2] = render->matrix13;
pict->matrix[1][0] = render->matrix21;
pict->matrix[1][1] = render->matrix22;
pict->matrix[1][2] = render->matrix23;
pict->matrix[2][0] = render->matrix31;
pict->matrix[2][1] = render->matrix32;
pict->matrix[2][2] = render->matrix33;
}
void
xRenderTransform_from_PictTransform(xRenderTransform * render,
PictTransformPtr pict)
{
render->matrix11 = pict->matrix[0][0];
render->matrix12 = pict->matrix[0][1];
render->matrix13 = pict->matrix[0][2];
render->matrix21 = pict->matrix[1][0];
render->matrix22 = pict->matrix[1][1];
render->matrix23 = pict->matrix[1][2];
render->matrix31 = pict->matrix[2][0];
render->matrix32 = pict->matrix[2][1];
render->matrix33 = pict->matrix[2][2];
}
Bool
PictureTransformPoint(PictTransformPtr transform, PictVectorPtr vector)
{
return pixman_transform_point(transform, vector);
}
Bool
PictureTransformPoint3d(PictTransformPtr transform, PictVectorPtr vector)
{
return pixman_transform_point_3d(transform, vector);
}
...@@ -1892,71 +1892,3 @@ AddTraps (PicturePtr pPicture, ...@@ -1892,71 +1892,3 @@ AddTraps (PicturePtr pPicture,
ValidatePicture (pPicture); ValidatePicture (pPicture);
(*ps->AddTraps) (pPicture, xOff, yOff, ntrap, traps); (*ps->AddTraps) (pPicture, xOff, yOff, ntrap, traps);
} }
#define MAX_FIXED_48_16 ((xFixed_48_16) 0x7fffffff)
#define MIN_FIXED_48_16 (-((xFixed_48_16) 1 << 31))
Bool
PictureTransformPoint3d (PictTransformPtr transform,
PictVectorPtr vector)
{
PictVector result;
int i, j;
xFixed_32_32 partial;
xFixed_48_16 v;
for (j = 0; j < 3; j++)
{
v = 0;
for (i = 0; i < 3; i++)
{
partial = ((xFixed_48_16) transform->matrix[j][i] *
(xFixed_48_16) vector->vector[i]);
v += partial >> 16;
}
if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16)
return FALSE;
result.vector[j] = (xFixed) v;
}
if (!result.vector[2])
return FALSE;
*vector = result;
return TRUE;
}
Bool
PictureTransformPoint (PictTransformPtr transform,
PictVectorPtr vector)
{
PictVector result;
int i, j;
xFixed_32_32 partial;
xFixed_48_16 v;
for (j = 0; j < 3; j++)
{
v = 0;
for (i = 0; i < 3; i++)
{
partial = ((xFixed_48_16) transform->matrix[j][i] *
(xFixed_48_16) vector->vector[i]);
v += partial >> 16;
}
if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16)
return FALSE;
result.vector[j] = (xFixed) v;
}
if (!result.vector[2])
return FALSE;
for (j = 0; j < 2; j++)
{
partial = (xFixed_48_16) result.vector[j] << 16;
v = partial / result.vector[2];
if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16)
return FALSE;
vector->vector[j] = (xFixed) v;
}
vector->vector[2] = xFixed1;
return TRUE;
}
...@@ -54,13 +54,10 @@ typedef struct _PictFormat { ...@@ -54,13 +54,10 @@ typedef struct _PictFormat {
IndexFormatRec index; IndexFormatRec index;
} PictFormatRec; } PictFormatRec;
typedef struct _PictVector { typedef struct pixman_vector PictVector, *PictVectorPtr;
xFixed vector[3]; typedef struct pixman_transform PictTransform, *PictTransformPtr;
} PictVector, *PictVectorPtr;
typedef struct _PictTransform { #define pict_f_transform pixman_f_transform
xFixed matrix[3][3];
} PictTransform, *PictTransformPtr;
#define PICT_GRADIENT_STOPTABLE_SIZE 1024 #define PICT_GRADIENT_STOPTABLE_SIZE 1024
#define SourcePictTypeSolidFill 0 #define SourcePictTypeSolidFill 0
...@@ -168,12 +165,14 @@ typedef struct _Picture { ...@@ -168,12 +165,14 @@ typedef struct _Picture {
SourcePictPtr pSourcePict; SourcePictPtr pSourcePict;
} PictureRec; } PictureRec;
typedef Bool (*PictFilterValidateParamsProcPtr) (PicturePtr pPicture, int id, typedef Bool (*PictFilterValidateParamsProcPtr) (ScreenPtr pScreen, int id,
xFixed *params, int nparams); xFixed *params, int nparams,
int *width, int *height);
typedef struct { typedef struct {
char *name; char *name;
int id; int id;
PictFilterValidateParamsProcPtr ValidateParams; PictFilterValidateParamsProcPtr ValidateParams;
int width, height;
} PictFilterRec, *PictFilterPtr; } PictFilterRec, *PictFilterPtr;
#define PictFilterNearest 0 #define PictFilterNearest 0
...@@ -457,7 +456,12 @@ PictFilterPtr ...@@ -457,7 +456,12 @@ PictFilterPtr
PictureFindFilter (ScreenPtr pScreen, char *name, int len); PictureFindFilter (ScreenPtr pScreen, char *name, int len);
int int
SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams); SetPicturePictFilter (PicturePtr pPicture, PictFilterPtr pFilter,
xFixed *params, int nparams);
int
SetPictureFilter (PicturePtr pPicture, char *name, int len,
xFixed *params, int nparams);
Bool Bool
PictureFinishInit (void); PictureFinishInit (void);
...@@ -657,4 +661,22 @@ void PanoramiXRenderInit (void); ...@@ -657,4 +661,22 @@ void PanoramiXRenderInit (void);
void PanoramiXRenderReset (void); void PanoramiXRenderReset (void);
#endif #endif
/*
* matrix.c
*/
extern _X_EXPORT void
PictTransform_from_xRenderTransform(PictTransformPtr pict,
xRenderTransform * render);
extern _X_EXPORT void
xRenderTransform_from_PictTransform(xRenderTransform * render,
PictTransformPtr pict);
extern _X_EXPORT Bool
PictureTransformPoint(PictTransformPtr transform, PictVectorPtr vector);
extern _X_EXPORT Bool
PictureTransformPoint3d(PictTransformPtr transform, PictVectorPtr vector);
#endif /* _PICTURESTR_H_ */ #endif /* _PICTURESTR_H_ */
...@@ -2663,7 +2663,7 @@ PanoramiXRenderCreatePicture (ClientPtr client) ...@@ -2663,7 +2663,7 @@ PanoramiXRenderCreatePicture (ClientPtr client)
newPict->info[0].id = stuff->pid; newPict->info[0].id = stuff->pid;
if (refDraw->type == XRT_WINDOW && if (refDraw->type == XRT_WINDOW &&
stuff->drawable == WindowTable[0]->drawable.id) stuff->drawable == screenInfo.screens[0]->root->drawable.id)
{ {
newPict->u.pict.root = TRUE; newPict->u.pict.root = TRUE;
} }
......
...@@ -616,7 +616,7 @@ ReplaceCursor (CursorPtr pCursor, ...@@ -616,7 +616,7 @@ ReplaceCursor (CursorPtr pCursor,
} }
} }
/* this "knows" that WindowHasNewCursor doesn't depend on it's argument */ /* this "knows" that WindowHasNewCursor doesn't depend on it's argument */
WindowHasNewCursor (WindowTable[0]); WindowHasNewCursor (screenInfo.screens[0]->root);
} }
static Bool static Bool
......
...@@ -49,6 +49,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -49,6 +49,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h" #include "inputstr.h"
#include "opaque.h" #include "opaque.h"
#include "property.h" #include "property.h"
#include "scrnintstr.h"
#define XKBSRV_NEED_FILE_FUNCS #define XKBSRV_NEED_FILE_FUNCS
#include <nx-X11/extensions/XKBsrv.h> #include <nx-X11/extensions/XKBsrv.h>
#include <nx-X11/extensions/XKBgeom.h> #include <nx-X11/extensions/XKBgeom.h>
...@@ -230,7 +231,7 @@ char * pval; ...@@ -230,7 +231,7 @@ char * pval;
ErrorF("Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n", ErrorF("Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n",
out,len); out,len);
} }
ChangeWindowProperty(WindowTable[0],name,XA_STRING,8,PropModeReplace, ChangeWindowProperty(screenInfo.screens[0]->root,name,XA_STRING,8,PropModeReplace,
len,pval,True); len,pval,True);
DEALLOCATE_LOCAL(pval); DEALLOCATE_LOCAL(pval);
return True; return True;
......
#!/bin/sh
where=`dirname $0`
git ls-files | grep '\.[chm]$' | xargs sh "$where"/x-indent.sh
#!/bin/sh
# We want GNU indent, so first search for gindent to avoid /usr/bin/indent
# on the BSDs, which won't work for us
INDENT=`which gnuindent || which gindent || which indent`
if [ -z "${INDENT}" ] ; then
echo "Could not find indent, sorry..." >&2
exit 1
fi
$INDENT -linux -bad -bap -blf -bli0 -cbi0 -cdw -nce -cs -i4 -lc80 -psl -nbbo \
-nbc -psl -nbfda -nut -nss -T pointer -T ScreenPtr -T ScrnInfoPtr -T pointer \
-T DeviceIntPtr -T DevicePtr -T ClientPtr -T CallbackListPtr \
-T CallbackProcPtr -T OsTimerPtr -T CARD32 -T CARD16 -T CARD8 \
-T INT32 -T INT16 -T INT8 -T Atom -T Time -T WindowPtr -T DrawablePtr \
-T PixmapPtr -T ColormapPtr -T CursorPtr -T Font -T XID -T Mask \
-T BlockHandlerProcPtr -T WakeupHandlerProcPtr -T RegionPtr \
-T InternalEvent -T GrabPtr -T Timestamp -T Bool -T TimeStamp \
-T xEvent -T DeviceEvent -T RawDeviceEvent -T GrabMask -T Window \
-T Drawable -T FontPtr -T CallbackPtr -T XIPropertyValuePtr \
-T GrabParameters -T deviceKeyButtonPointer -T TouchOwnershipEvent \
-T xGenericEvent -T DeviceChangedEvent -T GCPtr -T BITS32 \
-T xRectangle -T BoxPtr -T RegionRec -T ValuatorMask -T KeyCode \
-T KeySymsPtr -T XkbDescPtr -T InputOption -T XI2Mask -T DevUnion \
-T DevPrivateKey -T DevScreenPrivateKey -T PropertyPtr -T RESTYPE \
-T XkbAction -T XkbChangesPtr -T XkbControlsPtr -T PrivatePtr -T pmWait \
-T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT "$@"
...@@ -29,7 +29,7 @@ BuildRequires: fdupes ...@@ -29,7 +29,7 @@ BuildRequires: fdupes
BuildRequires: pkgconfig(expat) BuildRequires: pkgconfig(expat)
BuildRequires: pkgconfig(libpng) BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(pixman-1) BuildRequires: pkgconfig(pixman-1) >= 0.13.2
BuildRequires: pkgconfig(x11) BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xext) BuildRequires: pkgconfig(xext)
BuildRequires: pkgconfig(xpm) BuildRequires: pkgconfig(xpm)
...@@ -45,7 +45,7 @@ BuildRequires: pkgconfig(xinerama) ...@@ -45,7 +45,7 @@ BuildRequires: pkgconfig(xinerama)
BuildRequires: libexpat-devel BuildRequires: libexpat-devel
BuildRequires: libpng-devel BuildRequires: libpng-devel
BuildRequires: libxml2-devel BuildRequires: libxml2-devel
BuildRequires: pixman-devel BuildRequires: pixman-devel >= 0.13.2
BuildRequires: xorg-x11-libX11-devel BuildRequires: xorg-x11-libX11-devel
BuildRequires: xorg-x11-libXext-devel BuildRequires: xorg-x11-libXext-devel
BuildRequires: xorg-x11-libXpm-devel BuildRequires: xorg-x11-libXpm-devel
...@@ -65,7 +65,7 @@ BuildRequires: xorg-x11-util-devel ...@@ -65,7 +65,7 @@ BuildRequires: xorg-x11-util-devel
BuildRequires: expat-devel BuildRequires: expat-devel
BuildRequires: libpng-devel BuildRequires: libpng-devel
BuildRequires: libxml2-devel BuildRequires: libxml2-devel
BuildRequires: pixman-devel BuildRequires: pixman-devel >= 0.13.2
BuildRequires: libX11-devel BuildRequires: libX11-devel
BuildRequires: libXext-devel BuildRequires: libXext-devel
BuildRequires: libXpm-devel BuildRequires: libXpm-devel
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment