mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-07 15:38:04 +02:00
External output window support.
This commit is contained in:
parent
6b81895cc6
commit
fc833276ac
16 changed files with 177 additions and 1231 deletions
|
|
@ -199,13 +199,7 @@ static DMXScreenInfo *dmxConfigAddDisplay(const char *name,
|
|||
int authTypeLen,
|
||||
const char *authData,
|
||||
int authDataLen,
|
||||
int virtualFb,
|
||||
int scrnWidth, int scrnHeight,
|
||||
int scrnX, int scrnY,
|
||||
int scrnXSign, int scrnYSign,
|
||||
int rootWidth, int rootHeight,
|
||||
int rootX, int rootY,
|
||||
int rootXSign, int rootYSign)
|
||||
int virtualFb)
|
||||
{
|
||||
DMXScreenInfo *dmxScreen;
|
||||
|
||||
|
|
@ -220,16 +214,10 @@ static DMXScreenInfo *dmxConfigAddDisplay(const char *name,
|
|||
dmxScreen->name = strdup (name);
|
||||
dmxScreen->display = strdup (display);
|
||||
dmxScreen->index = dmxNumScreens;
|
||||
dmxScreen->scrnWidth = scrnWidth;
|
||||
dmxScreen->scrnHeight = scrnHeight;
|
||||
dmxScreen->scrnX = scrnX;
|
||||
dmxScreen->scrnY = scrnY;
|
||||
dmxScreen->scrnXSign = scrnXSign;
|
||||
dmxScreen->scrnYSign = scrnYSign;
|
||||
dmxScreen->rootWidth = rootWidth;
|
||||
dmxScreen->rootHeight = rootHeight;
|
||||
dmxScreen->rootX = rootX;
|
||||
dmxScreen->rootY = rootY;
|
||||
dmxScreen->scrnWidth = 0;
|
||||
dmxScreen->scrnHeight = 0;
|
||||
dmxScreen->rootX = 0;
|
||||
dmxScreen->rootY = 0;
|
||||
dmxScreen->stat = dmxStatAlloc();
|
||||
dmxScreen->authType = dmxMemDup (authType, authTypeLen);
|
||||
dmxScreen->authTypeLen = authTypeLen;
|
||||
|
|
@ -265,15 +253,8 @@ static void dmxConfigCopyFromDisplay(DMXConfigDisplayPtr d)
|
|||
{
|
||||
DMXScreenInfo *dmxScreen;
|
||||
|
||||
dmxScreen = dmxConfigAddDisplay(d->name,
|
||||
d->name,
|
||||
NULL, 0, NULL, 0, 0,
|
||||
d->scrnWidth, d->scrnHeight,
|
||||
d->scrnX, d->scrnY,
|
||||
d->scrnXSign, d->scrnYSign,
|
||||
d->rootWidth, d->rootHeight,
|
||||
d->rootX, d->rootY,
|
||||
d->rootXSign, d->rootXSign);
|
||||
dmxScreen = dmxConfigAddDisplay(d->name, d->name,
|
||||
NULL, 0, NULL, 0, 0);
|
||||
dmxScreen->where = PosAbsolute;
|
||||
dmxScreen->whereX = d->rootXOrigin;
|
||||
dmxScreen->whereY = d->rootYOrigin;
|
||||
|
|
@ -294,9 +275,7 @@ static void dmxConfigCopyFromWall(DMXConfigWallPtr w)
|
|||
|
||||
for (pt = w->nameList; pt; pt = pt->next) {
|
||||
dmxScreen = dmxConfigAddDisplay(pt->string, pt->string,
|
||||
NULL, 0, NULL, 0, 0,
|
||||
w->width, w->height,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
NULL, 0, NULL, 0, 0);
|
||||
if (pt == w->nameList) { /* Upper left */
|
||||
dmxScreen->where = PosAbsolute;
|
||||
dmxScreen->whereX = 0;
|
||||
|
|
@ -406,9 +385,7 @@ static void dmxConfigFromCommandLine(void)
|
|||
pt->value[2].val,
|
||||
pt->value[3].ptr,
|
||||
pt->value[4].val,
|
||||
pt->value[5].val,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0);
|
||||
pt->value[5].val);
|
||||
if (dmxNumScreens == 1) {
|
||||
dmxScreen->where = PosAbsolute;
|
||||
dmxScreen->whereX = 0;
|
||||
|
|
@ -434,9 +411,7 @@ static void dmxConfigFromCommandLine(void)
|
|||
{
|
||||
DMXScreenInfo *dmxScreen = dmxConfigAddDisplay ("", "",
|
||||
NULL, 0, NULL, 0,
|
||||
0,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0);
|
||||
0);
|
||||
dmxScreen->where = PosAbsolute;
|
||||
dmxScreen->whereX = 0;
|
||||
dmxScreen->whereY = 0;
|
||||
|
|
|
|||
38
hw/dmx/dmx.c
38
hw/dmx/dmx.c
|
|
@ -453,13 +453,6 @@ static int ProcDMXChangeScreensAttributes(ClientPtr client)
|
|||
value_list += count;
|
||||
}
|
||||
|
||||
#if PANORAMIX
|
||||
status = dmxConfigureScreenWindows(stuff->screenCount,
|
||||
screen_list,
|
||||
attribs,
|
||||
&errorScreen);
|
||||
#endif
|
||||
|
||||
xfree(attribs);
|
||||
|
||||
if (status == BadValue) return status;
|
||||
|
|
@ -494,7 +487,6 @@ static int ProcDMXAddScreen(ClientPtr client)
|
|||
char *name;
|
||||
int len;
|
||||
int paddedLength;
|
||||
int physicalScreen;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xDMXAddScreenReq);
|
||||
paddedLength = (stuff->displayNameLength + 3) & ~3;
|
||||
|
|
@ -512,24 +504,9 @@ static int ProcDMXAddScreen(ClientPtr client)
|
|||
memcpy(name, &value_list[count], stuff->displayNameLength);
|
||||
name[stuff->displayNameLength] = '\0';
|
||||
attr.displayName = name;
|
||||
|
||||
physicalScreen = stuff->physicalScreen;
|
||||
if (physicalScreen >= dmxGetNumScreens ())
|
||||
{
|
||||
DMXScreenAttributesRec attribs;
|
||||
|
||||
for (physicalScreen = 0;
|
||||
physicalScreen < dmxGetNumScreens ();
|
||||
physicalScreen++)
|
||||
{
|
||||
dmxGetScreenAttributes (physicalScreen, &attribs);
|
||||
|
||||
if (!attribs.displayName || !*attribs.displayName)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
status = dmxAttachScreen(physicalScreen, &attr, 0, NULL, 0, NULL, 0, NULL,
|
||||
|
||||
status = dmxAttachScreen(stuff->physicalScreen,
|
||||
&attr, 0, NULL, 0, NULL, 0, NULL,
|
||||
0, 0);
|
||||
|
||||
xfree(name);
|
||||
|
|
@ -538,7 +515,7 @@ static int ProcDMXAddScreen(ClientPtr client)
|
|||
rep.sequenceNumber = client->sequence;
|
||||
rep.length = 0;
|
||||
rep.status = status;
|
||||
rep.physicalScreen = physicalScreen;
|
||||
rep.physicalScreen = stuff->physicalScreen;
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber, n);
|
||||
swapl(&rep.length, n);
|
||||
|
|
@ -785,15 +762,8 @@ static int ProcDMXChangeDesktopAttributes(ClientPtr client)
|
|||
dmxGetDesktopAttributes(&attr);
|
||||
dmxFetchDesktopAttributes(stuff->valueMask, &attr, value_list);
|
||||
|
||||
#if PANORAMIX
|
||||
status = dmxConfigureDesktop(&attr);
|
||||
#endif
|
||||
if (status == BadValue) return status;
|
||||
|
||||
#ifdef RANDR
|
||||
RRScreenSizeNotify (screenInfo.screens[0]);
|
||||
#endif
|
||||
|
||||
noxinerama:
|
||||
rep.type = X_Reply;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
|
|
|||
20
hw/dmx/dmx.h
20
hw/dmx/dmx.h
|
|
@ -176,18 +176,13 @@ typedef struct _DMXScreenInfo {
|
|||
char *authData;
|
||||
int authDataLen;
|
||||
|
||||
int beUseRoot;
|
||||
int virtualFb;
|
||||
|
||||
/*---------- Screen window information ----------*/
|
||||
|
||||
Window scrnWin; /**< "Screen" window on backend display */
|
||||
int scrnX; /**< X offset of "screen" WRT BE display */
|
||||
int scrnY; /**< Y offset of "screen" WRT BE display */
|
||||
int scrnWidth; /**< Width of "screen" */
|
||||
int scrnHeight; /**< Height of "screen" */
|
||||
int scrnXSign; /**< X offset sign of "screen" */
|
||||
int scrnYSign; /**< Y offset sign of "screen" */
|
||||
|
||||
/** Default drawables for "screen" */
|
||||
Drawable scrnDefDrawables[MAXFORMATS];
|
||||
|
|
@ -200,11 +195,6 @@ typedef struct _DMXScreenInfo {
|
|||
Window rootWin; /**< "Root" window on backend display */
|
||||
int rootX; /**< X offset of "root" window WRT "screen"*/
|
||||
int rootY; /**< Y offset of "root" window WRT "screen"*/
|
||||
int rootWidth; /**< Width of "root" window */
|
||||
int rootHeight; /**< Height of "root" window */
|
||||
|
||||
int rootXOrigin; /**< Global X origin of "root" window */
|
||||
int rootYOrigin; /**< Global Y origin of "root" window */
|
||||
|
||||
/*---------- Shadow framebuffer information ----------*/
|
||||
|
||||
|
|
@ -216,16 +206,6 @@ typedef struct _DMXScreenInfo {
|
|||
|
||||
int shared; /**< Non-zero if another Xdmx is running */
|
||||
|
||||
Bool WMRunningOnBE;
|
||||
|
||||
Cursor noCursor;
|
||||
Cursor curCursor;
|
||||
/* Support for cursors on overlapped
|
||||
* backend displays. */
|
||||
CursorPtr cursor;
|
||||
int cursorVisible;
|
||||
int cursorNotShared; /* for overlapping screens on a backend */
|
||||
|
||||
PositionType where; /**< Relative layout information */
|
||||
int whereX; /**< Relative layout information */
|
||||
int whereY; /**< Relative layout information */
|
||||
|
|
|
|||
|
|
@ -77,10 +77,10 @@ void dmxComputeWidthHeight(DMXRecomputeFlag flag)
|
|||
/* Don't use root* here because this is
|
||||
* the global bounding box. */
|
||||
dmxScreen = &dmxScreens[i];
|
||||
if (w < dmxScreen->scrnWidth + dmxScreen->rootXOrigin)
|
||||
w = dmxScreen->scrnWidth + dmxScreen->rootXOrigin;
|
||||
if (h < dmxScreen->scrnHeight + dmxScreen->rootYOrigin)
|
||||
h = dmxScreen->scrnHeight + dmxScreen->rootYOrigin;
|
||||
if (w < dmxScreen->scrnWidth)
|
||||
w = dmxScreen->scrnWidth;
|
||||
if (h < dmxScreen->scrnHeight)
|
||||
h = dmxScreen->scrnHeight;
|
||||
}
|
||||
if (!dmxGlobalWidth && !dmxGlobalHeight) {
|
||||
dmxLog(dmxInfo, "Using %dx%d as global bounding box\n", w, h);
|
||||
|
|
|
|||
|
|
@ -126,55 +126,6 @@ Bool dmxInitCursor(ScreenPtr pScreen)
|
|||
|
||||
static Bool dmxCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
|
||||
{
|
||||
DMXScreenInfo *dmxScreen;
|
||||
int i;
|
||||
int localX = *x;
|
||||
int localY = *y;
|
||||
int globalX;
|
||||
int globalY;
|
||||
|
||||
if (screenInfo.numScreens == 1)
|
||||
return FALSE;
|
||||
|
||||
/* On current screen? */
|
||||
dmxScreen = &dmxScreens[(*ppScreen)->myNum];
|
||||
if (localX >= 0
|
||||
&& localX < dmxScreen->rootWidth
|
||||
&& localY >= 0
|
||||
&& localY < dmxScreen->rootHeight)
|
||||
return FALSE;
|
||||
|
||||
/* Convert to global coordinate space */
|
||||
globalX = dmxScreen->rootXOrigin + localX;
|
||||
globalY = dmxScreen->rootYOrigin + localY;
|
||||
|
||||
/* Is cursor on the current screen?
|
||||
* This efficiently exits this routine
|
||||
* for the most common case. */
|
||||
if (ppScreen && *ppScreen) {
|
||||
dmxScreen = &dmxScreens[(*ppScreen)->myNum];
|
||||
if (globalX >= dmxScreen->rootXOrigin
|
||||
&& globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth
|
||||
&& globalY >= dmxScreen->rootYOrigin
|
||||
&& globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Find first screen cursor is on */
|
||||
for (i = 0; i < dmxNumScreens; i++) {
|
||||
dmxScreen = &dmxScreens[i];
|
||||
if (globalX >= dmxScreen->rootXOrigin
|
||||
&& globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth
|
||||
&& globalY >= dmxScreen->rootYOrigin
|
||||
&& globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight) {
|
||||
if (dmxScreen->index == (*ppScreen)->myNum)
|
||||
return FALSE;
|
||||
*ppScreen = screenInfo.screens[dmxScreen->index];
|
||||
*x = globalX - dmxScreen->rootXOrigin;
|
||||
*y = globalY - dmxScreen->rootYOrigin;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -206,380 +157,6 @@ miPointerScreenFuncRec dmxPointerCursorFuncs = {
|
|||
dmxWarpCursor
|
||||
};
|
||||
|
||||
/** Create a list of screens that we'll manipulate. */
|
||||
static int *dmxSLCreate(void)
|
||||
{
|
||||
int *list = malloc(dmxNumScreens * sizeof(*list));
|
||||
int i;
|
||||
|
||||
for (i = 0; i < dmxNumScreens; i++)
|
||||
list[i] = 1;
|
||||
return list;
|
||||
}
|
||||
|
||||
/** Free list. */
|
||||
static void dmxSLFree(int *list)
|
||||
{
|
||||
free(list);
|
||||
}
|
||||
|
||||
/** Find next uninitialized entry in list. */
|
||||
static int dmxSLFindNext(int *list)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < dmxNumScreens; i++)
|
||||
if (list[i])
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** Make one pass over all the screens and return the number updated. */
|
||||
static int dmxTryComputeScreenOrigins(int *screensLeft)
|
||||
{
|
||||
ScreenPtr pScreen;
|
||||
DMXScreenInfo *screen;
|
||||
int i, ref;
|
||||
int changed = 0;
|
||||
|
||||
for (i = 0; i < dmxNumScreens; i++) {
|
||||
if (!screensLeft[i])
|
||||
continue;
|
||||
screen = &dmxScreens[i];
|
||||
switch (screen->where) {
|
||||
case PosAbsolute:
|
||||
dixScreenOrigins[i].x = screen->whereX;
|
||||
dixScreenOrigins[i].y = screen->whereY;
|
||||
++changed, screensLeft[i] = 0;
|
||||
break;
|
||||
case PosRelative:
|
||||
ref = screen->whereRefScreen;
|
||||
if (screensLeft[ref])
|
||||
break;
|
||||
dixScreenOrigins[i].x = dixScreenOrigins[ref].x + screen->whereX;
|
||||
dixScreenOrigins[i].y = dixScreenOrigins[ref].y + screen->whereY;
|
||||
++changed, screensLeft[i] = 0;
|
||||
break;
|
||||
case PosRightOf:
|
||||
ref = screen->whereRefScreen;
|
||||
if (screensLeft[ref])
|
||||
break;
|
||||
pScreen = screenInfo.screens[ref];
|
||||
dixScreenOrigins[i].x = dixScreenOrigins[ref].x + pScreen->width;
|
||||
dixScreenOrigins[i].y = dixScreenOrigins[ref].y;
|
||||
++changed, screensLeft[i] = 0;
|
||||
break;
|
||||
case PosLeftOf:
|
||||
ref = screen->whereRefScreen;
|
||||
if (screensLeft[ref])
|
||||
break;
|
||||
pScreen = screenInfo.screens[i];
|
||||
dixScreenOrigins[i].x = dixScreenOrigins[ref].x - pScreen->width;
|
||||
dixScreenOrigins[i].y = dixScreenOrigins[ref].y;
|
||||
++changed, screensLeft[i] = 0;
|
||||
break;
|
||||
case PosBelow:
|
||||
ref = screen->whereRefScreen;
|
||||
if (screensLeft[ref])
|
||||
break;
|
||||
pScreen = screenInfo.screens[ref];
|
||||
dixScreenOrigins[i].x = dixScreenOrigins[ref].x;
|
||||
dixScreenOrigins[i].y = dixScreenOrigins[ref].y + pScreen->height;
|
||||
++changed, screensLeft[i] = 0;
|
||||
break;
|
||||
case PosAbove:
|
||||
ref = screen->whereRefScreen;
|
||||
if (screensLeft[ref])
|
||||
break;
|
||||
pScreen = screenInfo.screens[i];
|
||||
dixScreenOrigins[i].x = dixScreenOrigins[ref].x;
|
||||
dixScreenOrigins[i].y = dixScreenOrigins[ref].y - pScreen->height;
|
||||
++changed, screensLeft[i] = 0;
|
||||
break;
|
||||
case PosNone:
|
||||
dmxLog(dmxFatal, "No position information for screen %d\n", i);
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
static void dmxComputeScreenOrigins(void)
|
||||
{
|
||||
int *screensLeft;
|
||||
int i, ref;
|
||||
int minX, minY;
|
||||
|
||||
/* Compute origins based on
|
||||
* configuration information. */
|
||||
screensLeft = dmxSLCreate();
|
||||
while ((i = dmxSLFindNext(screensLeft)) >= 0) {
|
||||
while (dmxTryComputeScreenOrigins(screensLeft));
|
||||
if ((i = dmxSLFindNext(screensLeft)) >= 0) {
|
||||
/* All of the remaining screens are referencing each other.
|
||||
* Assign a value to one of them and go through again. This
|
||||
* guarantees that we will eventually terminate.
|
||||
*/
|
||||
ref = dmxScreens[i].whereRefScreen;
|
||||
dixScreenOrigins[ref].x = dixScreenOrigins[ref].y = 0;
|
||||
screensLeft[ref] = 0;
|
||||
}
|
||||
}
|
||||
dmxSLFree(screensLeft);
|
||||
|
||||
|
||||
/* Justify the topmost and leftmost to
|
||||
* (0,0). */
|
||||
minX = dixScreenOrigins[0].x;
|
||||
minY = dixScreenOrigins[0].y;
|
||||
for (i = 1; i < dmxNumScreens; i++) { /* Compute minX, minY */
|
||||
if (dixScreenOrigins[i].x < minX)
|
||||
minX = dixScreenOrigins[i].x;
|
||||
if (dixScreenOrigins[i].y < minY)
|
||||
minY = dixScreenOrigins[i].y;
|
||||
}
|
||||
if (minX || minY) {
|
||||
for (i = 0; i < dmxNumScreens; i++) {
|
||||
dixScreenOrigins[i].x -= minX;
|
||||
dixScreenOrigins[i].y -= minY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Recompute origin information in the #dmxScreens list. This is
|
||||
* either called from #dmxInitOrigins() or from #dmxReconfig(). */
|
||||
void dmxReInitOrigins(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (dmxNumScreens > MAXSCREENS)
|
||||
dmxLog(dmxFatal, "dmxNumScreens = %d > MAXSCREENS = %d\n",
|
||||
dmxNumScreens, MAXSCREENS);
|
||||
|
||||
for (i = 0; i < dmxNumScreens; i++) {
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[i];
|
||||
dmxLogOutput(dmxScreen,
|
||||
"s=%dx%d%+d%+d r=%dx%d%+d%+d @%d,%d"
|
||||
" (be=%dx%d depth=%d bpp=%d)\n",
|
||||
dmxScreen->scrnWidth, dmxScreen->scrnHeight,
|
||||
dmxScreen->scrnX, dmxScreen->scrnY,
|
||||
|
||||
dmxScreen->rootWidth, dmxScreen->rootHeight,
|
||||
dmxScreen->rootX, dmxScreen->rootY,
|
||||
|
||||
dmxScreen->rootXOrigin, dmxScreen->rootYOrigin,
|
||||
dmxScreen->beWidth, dmxScreen->beHeight,
|
||||
dmxScreen->beDepth, dmxScreen->beBPP);
|
||||
}
|
||||
}
|
||||
|
||||
/** Initialize screen origins (and relative position). This is called
|
||||
* for each server generation. For dynamic reconfiguration, use
|
||||
* #dmxReInitOrigins() instead. */
|
||||
void dmxInitOrigins(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (dmxNumScreens > MAXSCREENS)
|
||||
dmxLog(dmxFatal, "dmxNumScreens = %d > MAXSCREENS = %d\n",
|
||||
dmxNumScreens, MAXSCREENS);
|
||||
|
||||
for (i = 0; i < dmxNumScreens; i++) {
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[i];
|
||||
dmxLogOutput(dmxScreen,
|
||||
"(request) s=%dx%d%+d%+d r=%dx%d%+d%+d @%d,%d (%d)"
|
||||
" (be=%dx%d depth=%d bpp=%d)\n",
|
||||
dmxScreen->scrnWidth, dmxScreen->scrnHeight,
|
||||
dmxScreen->scrnX, dmxScreen->scrnY,
|
||||
|
||||
dmxScreen->rootWidth, dmxScreen->rootHeight,
|
||||
dmxScreen->rootX, dmxScreen->rootY,
|
||||
|
||||
dmxScreen->whereX, dmxScreen->whereY,
|
||||
dmxScreen->where,
|
||||
|
||||
dmxScreen->beWidth, dmxScreen->beHeight,
|
||||
dmxScreen->beDepth, dmxScreen->beBPP);
|
||||
}
|
||||
|
||||
dmxComputeScreenOrigins();
|
||||
|
||||
for (i = 0; i < dmxNumScreens; i++) {
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[i];
|
||||
dmxScreen->rootXOrigin = dixScreenOrigins[i].x;
|
||||
dmxScreen->rootYOrigin = dixScreenOrigins[i].y;
|
||||
}
|
||||
|
||||
dmxReInitOrigins();
|
||||
}
|
||||
|
||||
/** Returns non-zero if the global \a x, \a y coordinate is on the
|
||||
* screen window of the \a dmxScreen. */
|
||||
static int dmxOnScreen(int x, int y, DMXScreenInfo *dmxScreen)
|
||||
{
|
||||
#if DMX_CURSOR_DEBUG > 1
|
||||
dmxLog(dmxDebug,
|
||||
"dmxOnScreen %d %d,%d (r=%dx%d%+d%+d@%d,%d s=%dx%d%+d%+d)\n",
|
||||
dmxScreen->index, x, y,
|
||||
dmxScreen->rootWidth, dmxScreen->rootHeight,
|
||||
dmxScreen->rootX, dmxScreen->rootY,
|
||||
dmxScreen->rootXOrigin, dmxScreen->rootYOrigin,
|
||||
dmxScreen->scrnWidth, dmxScreen->scrnHeight,
|
||||
dmxScreen->scrnX, dmxScreen->scrnY);
|
||||
#endif
|
||||
if (x >= dmxScreen->rootXOrigin
|
||||
&& x < dmxScreen->rootXOrigin + dmxScreen->rootWidth
|
||||
&& y >= dmxScreen->rootYOrigin
|
||||
&& y < dmxScreen->rootYOrigin + dmxScreen->rootHeight) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Returns non-zero if \a a overlaps \a b. */
|
||||
static int dmxDoesOverlap(DMXScreenInfo *a, DMXScreenInfo *b)
|
||||
{
|
||||
if (dmxOnScreen(a->rootXOrigin,
|
||||
a->rootYOrigin, b))
|
||||
return 1;
|
||||
|
||||
if (dmxOnScreen(a->rootXOrigin,
|
||||
a->rootYOrigin + a->scrnWidth, b))
|
||||
return 1;
|
||||
|
||||
if (dmxOnScreen(a->rootXOrigin + a->scrnHeight,
|
||||
a->rootYOrigin, b))
|
||||
return 1;
|
||||
|
||||
if (dmxOnScreen(a->rootXOrigin + a->scrnHeight,
|
||||
a->rootYOrigin + a->scrnWidth, b))
|
||||
return 1;
|
||||
|
||||
if (dmxOnScreen(b->rootXOrigin,
|
||||
b->rootYOrigin, a))
|
||||
return 1;
|
||||
|
||||
if (dmxOnScreen(b->rootXOrigin,
|
||||
b->rootYOrigin + b->scrnWidth, a))
|
||||
return 1;
|
||||
|
||||
if (dmxOnScreen(b->rootXOrigin + b->scrnHeight,
|
||||
b->rootYOrigin, a))
|
||||
return 1;
|
||||
|
||||
if (dmxOnScreen(b->rootXOrigin + b->scrnHeight,
|
||||
b->rootYOrigin + b->scrnWidth, a))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Used with #dmxInterateOverlap to print out a list of screens which
|
||||
* overlap each other. */
|
||||
static void *dmxPrintOverlap(DMXScreenInfo *dmxScreen, void *closure)
|
||||
{
|
||||
DMXScreenInfo *a = closure;
|
||||
if (dmxScreen != a) {
|
||||
if (dmxScreen->cursorNotShared)
|
||||
dmxLogOutputCont(a, " [%d/%s]", dmxScreen->index, dmxScreen->name);
|
||||
else
|
||||
dmxLogOutputCont(a, " %d/%s", dmxScreen->index, dmxScreen->name);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Iterate over the screens which overlap with the \a start screen,
|
||||
* calling \a f with the \a closure for each argument. Often used with
|
||||
* #dmxPrintOverlap. */
|
||||
static void *dmxIterateOverlap(DMXScreenInfo *start,
|
||||
void *(*f)(DMXScreenInfo *dmxScreen, void *),
|
||||
void *closure)
|
||||
{
|
||||
DMXScreenInfo *pt;
|
||||
|
||||
if (!start->over) return f(start, closure);
|
||||
|
||||
for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
|
||||
void *retval;
|
||||
if ((retval = f(pt, closure))) return retval;
|
||||
if (pt == start) break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Used with #dmxPropertyIterate to determine if screen \a a is the
|
||||
* same as the screen \a closure. */
|
||||
static void *dmxTestSameDisplay(DMXScreenInfo *a, void *closure)
|
||||
{
|
||||
DMXScreenInfo *b = closure;
|
||||
|
||||
if (a == b)
|
||||
return a;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Detects overlapping dmxScreens and creates circular lists. This
|
||||
* uses an O(dmxNumScreens^2) algorithm, but dmxNumScreens is < 100 and
|
||||
* the computation only needs to be performed for every server
|
||||
* generation or dynamic reconfiguration . */
|
||||
void dmxInitOverlap(void)
|
||||
{
|
||||
int i, j;
|
||||
DMXScreenInfo *a, *b, *pt;
|
||||
|
||||
for (i = 0; i < dmxNumScreens; i++)
|
||||
dmxScreens[i].over = NULL;
|
||||
|
||||
for (i = 0; i < dmxNumScreens; i++) {
|
||||
a = &dmxScreens[i];
|
||||
|
||||
for (j = i+1; j < dmxNumScreens; j++) {
|
||||
b = &dmxScreens[j];
|
||||
if (b->over)
|
||||
continue;
|
||||
|
||||
if (dmxDoesOverlap(a, b)) {
|
||||
DMXDBG6("%d overlaps %d: a=%p %p b=%p %p\n",
|
||||
a->index, b->index, a, a->over, b, b->over);
|
||||
b->over = (a->over ? a->over : a);
|
||||
a->over = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < dmxNumScreens; i++) {
|
||||
a = &dmxScreens[i];
|
||||
|
||||
if (!a->over)
|
||||
continue;
|
||||
|
||||
/* Flag all pairs that are on same display */
|
||||
for (pt = a->over; pt != a; pt = pt->over) {
|
||||
if (dmxPropertyIterate(a, dmxTestSameDisplay, pt)) {
|
||||
/* The ->over sets contain the transitive set of screens
|
||||
* that overlap. For screens that are on the same
|
||||
* backend display, we only want to exclude pairs of
|
||||
* screens that mutually overlap on the backend display,
|
||||
* so we call dmxDoesOverlap, which is stricter than the
|
||||
* ->over set. */
|
||||
if (!dmxDoesOverlap(a, pt))
|
||||
continue;
|
||||
a->cursorNotShared = 1;
|
||||
pt->cursorNotShared = 1;
|
||||
dmxLog(dmxInfo,
|
||||
"Screen %d and %d overlap on %s\n",
|
||||
a->index, pt->index, a->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < dmxNumScreens; i++) {
|
||||
a = &dmxScreens[i];
|
||||
|
||||
if (a->over) {
|
||||
dmxLogOutput(a, "Overlaps");
|
||||
dmxIterateOverlap(a, dmxPrintOverlap, a);
|
||||
dmxLogOutputCont(a, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ARGB_CURSOR
|
||||
|
||||
static Cursor
|
||||
|
|
|
|||
|
|
@ -53,9 +53,6 @@ extern miPointerScreenFuncRec dmxPointerCursorFuncs;
|
|||
extern miPointerSpriteFuncRec dmxPointerSpriteFuncs;
|
||||
|
||||
extern Bool dmxInitCursor(ScreenPtr pScreen);
|
||||
extern void dmxReInitOrigins(void);
|
||||
extern void dmxInitOrigins(void);
|
||||
extern void dmxInitOverlap(void);
|
||||
|
||||
extern void dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor);
|
||||
extern Bool dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor);
|
||||
|
|
|
|||
|
|
@ -118,9 +118,6 @@ attach_screen (DBusMessage *message,
|
|||
error,
|
||||
DBUS_ERROR_FAILED);
|
||||
|
||||
free (auth_type);
|
||||
free (auth_data);
|
||||
|
||||
if (ret != Success)
|
||||
{
|
||||
DebugF ("[dmx/dbus] dmxAttachScreen failed\n");
|
||||
|
|
|
|||
|
|
@ -107,16 +107,16 @@ Bool dmxGetScreenAttributes(int physical, DMXScreenAttributesPtr attr)
|
|||
|
||||
attr->screenWindowWidth = dmxScreen->scrnWidth;
|
||||
attr->screenWindowHeight = dmxScreen->scrnHeight;
|
||||
attr->screenWindowXoffset = dmxScreen->scrnX;
|
||||
attr->screenWindowYoffset = dmxScreen->scrnY;
|
||||
attr->screenWindowXoffset = 0;
|
||||
attr->screenWindowYoffset = 0;
|
||||
|
||||
attr->rootWindowWidth = dmxScreen->rootWidth;
|
||||
attr->rootWindowHeight = dmxScreen->rootHeight;
|
||||
attr->rootWindowWidth = WindowTable[physical]->drawable.width;
|
||||
attr->rootWindowHeight = WindowTable[physical]->drawable.height;
|
||||
attr->rootWindowXoffset = dmxScreen->rootX;
|
||||
attr->rootWindowYoffset = dmxScreen->rootY;
|
||||
|
||||
attr->rootWindowXorigin = dmxScreen->rootXOrigin;
|
||||
attr->rootWindowYorigin = dmxScreen->rootYOrigin;
|
||||
attr->rootWindowXorigin = 0;
|
||||
attr->rootWindowYorigin = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -315,8 +315,6 @@ static void dmxAdjustCursorBoundaries(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
dmxReInitOrigins();
|
||||
dmxInitOverlap();
|
||||
dmxComputeWidthHeight(DMX_NO_RECOMPUTE_BOUNDING_BOX);
|
||||
dmxConnectionBlockCallback();
|
||||
for (i = 0; i < dmxNumInputs; i++) {
|
||||
|
|
@ -482,348 +480,6 @@ void dmxUpdateScreenResources(ScreenPtr pScreen, int x, int y, int w, int h)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef PANORAMIX
|
||||
/** Change the "screen" window attributes by resizing the actual window
|
||||
* on the back-end display (if necessary). */
|
||||
static void dmxConfigureScreenWindow(int idx,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
|
||||
ScreenPtr pScreen = screenInfo.screens[idx];
|
||||
|
||||
/* Resize "screen" window */
|
||||
if (dmxScreen->scrnX != x ||
|
||||
dmxScreen->scrnY != y ||
|
||||
dmxScreen->scrnWidth != w ||
|
||||
dmxScreen->scrnHeight != h) {
|
||||
dmxResizeScreenWindow(pScreen, x, y, w, h);
|
||||
}
|
||||
|
||||
/* Change "screen" window values */
|
||||
dmxScreen->scrnX = x;
|
||||
dmxScreen->scrnY = y;
|
||||
dmxScreen->scrnWidth = w;
|
||||
dmxScreen->scrnHeight = h;
|
||||
}
|
||||
|
||||
/** Change the "root" window position and size by resizing the actual
|
||||
* window on the back-end display (if necessary) and updating all of
|
||||
* DMX's resources by calling #dmxUpdateScreenResources. */
|
||||
static void dmxConfigureRootWindow(int idx, int x, int y, int w, int h)
|
||||
{
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
|
||||
WindowPtr pRoot = WindowTable[idx];
|
||||
|
||||
/* NOTE: Either this function or the ones that it calls must handle
|
||||
* the case where w == 0 || h == 0. Currently, the functions that
|
||||
* this one calls handle that case. */
|
||||
|
||||
/* 1. Resize "root" window */
|
||||
if (dmxScreen->rootX != x ||
|
||||
dmxScreen->rootY != y ||
|
||||
dmxScreen->rootWidth != w ||
|
||||
dmxScreen->rootHeight != h) {
|
||||
dmxResizeRootWindow(pRoot, x, y, w, h);
|
||||
}
|
||||
|
||||
/* 2. Update all of the screen's resources associated with this root
|
||||
* window */
|
||||
if (dmxScreen->rootWidth != w ||
|
||||
dmxScreen->rootHeight != h) {
|
||||
dmxUpdateScreenResources(screenInfo.screens[idx], x, y, w, h);
|
||||
}
|
||||
|
||||
/* Change "root" window values */
|
||||
dmxScreen->rootX = x;
|
||||
dmxScreen->rootY = y;
|
||||
dmxScreen->rootWidth = w;
|
||||
dmxScreen->rootHeight = h;
|
||||
}
|
||||
|
||||
/** Change the "root" window's origin by updating DMX's internal data
|
||||
* structures (dix and Xinerama) to use the new origin and adjust the
|
||||
* positions of windows that overlap this "root" window. */
|
||||
static void dmxSetRootWindowOrigin(int idx, int x, int y)
|
||||
{
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
|
||||
ScreenPtr pScreen = screenInfo.screens[idx];
|
||||
WindowPtr pRoot = WindowTable[idx];
|
||||
WindowPtr pChild;
|
||||
int xoff;
|
||||
int yoff;
|
||||
|
||||
/* Change "root" window's origin */
|
||||
dmxScreen->rootXOrigin = x;
|
||||
dmxScreen->rootYOrigin = y;
|
||||
|
||||
/* Compute offsets here in case <x,y> has been changed above */
|
||||
xoff = x - dixScreenOrigins[idx].x;
|
||||
yoff = y - dixScreenOrigins[idx].y;
|
||||
|
||||
/* Adjust the root window's position in dixScreenOrigins */
|
||||
dixScreenOrigins[idx].x = dmxScreen->rootXOrigin;
|
||||
dixScreenOrigins[idx].y = dmxScreen->rootYOrigin;
|
||||
|
||||
/* Recalculate the Xinerama regions and data structs */
|
||||
XineramaReinitData(pScreen);
|
||||
|
||||
/* Adjust each of the root window's children */
|
||||
if (!idx) ReinitializeRootWindow(WindowTable[0], xoff, yoff);
|
||||
pChild = pRoot->firstChild;
|
||||
while (pChild) {
|
||||
/* Adjust child window's position */
|
||||
pScreen->MoveWindow(pChild,
|
||||
pChild->origin.x - wBorderWidth(pChild) - xoff,
|
||||
pChild->origin.y - wBorderWidth(pChild) - yoff,
|
||||
pChild->nextSib,
|
||||
VTMove);
|
||||
|
||||
/* Note that the call to MoveWindow will eventually call
|
||||
* dmxPositionWindow which will automatically create a
|
||||
* window if it is now exposed on screen (for lazy window
|
||||
* creation optimization) and it will properly set the
|
||||
* offscreen flag.
|
||||
*/
|
||||
|
||||
pChild = pChild->nextSib;
|
||||
}
|
||||
}
|
||||
|
||||
/** Configure the attributes of each "screen" and "root" window. */
|
||||
int dmxConfigureScreenWindows(int nscreens,
|
||||
CARD32 *screens,
|
||||
DMXScreenAttributesPtr attribs,
|
||||
int *errorScreen)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nscreens; i++) {
|
||||
DMXScreenAttributesPtr attr = &attribs[i];
|
||||
int idx = screens[i];
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
|
||||
|
||||
if (errorScreen) *errorScreen = i;
|
||||
|
||||
if (!dmxScreen->beDisplay) return DMX_BAD_VALUE;
|
||||
|
||||
/* Check for illegal values */
|
||||
if (idx < 0 || idx >= dmxNumScreens) return BadValue;
|
||||
|
||||
/* The "screen" and "root" windows must have valid sizes */
|
||||
if (attr->screenWindowWidth <= 0 || attr->screenWindowHeight <= 0 ||
|
||||
attr->rootWindowWidth < 0 || attr->rootWindowHeight < 0)
|
||||
{
|
||||
dmxLog(dmxWarning,
|
||||
"The \"screen\" and \"root\" windows must have valid "
|
||||
"sizes\n");
|
||||
return DMX_BAD_VALUE;
|
||||
}
|
||||
|
||||
/* The "screen" window must fit entirely within the BE display */
|
||||
if (attr->screenWindowXoffset < 0 ||
|
||||
attr->screenWindowYoffset < 0 ||
|
||||
attr->screenWindowXoffset
|
||||
+ attr->screenWindowWidth > (unsigned)dmxScreen->beWidth ||
|
||||
attr->screenWindowYoffset
|
||||
+ attr->screenWindowHeight > (unsigned)dmxScreen->beHeight)
|
||||
{
|
||||
dmxLog(dmxWarning,
|
||||
"The \"screen\" window must fit entirely within the "
|
||||
"BE display\n");
|
||||
return DMX_BAD_VALUE;
|
||||
}
|
||||
|
||||
/* The "root" window must fit entirely within the "screen" window */
|
||||
if (attr->rootWindowXoffset < 0 ||
|
||||
attr->rootWindowYoffset < 0 ||
|
||||
attr->rootWindowXoffset
|
||||
+ attr->rootWindowWidth > attr->screenWindowWidth ||
|
||||
attr->rootWindowYoffset
|
||||
+ attr->rootWindowHeight > attr->screenWindowHeight)
|
||||
{
|
||||
dmxLog(dmxWarning,
|
||||
"The \"root\" window must fit entirely within the "
|
||||
"\"screen\" window\n");
|
||||
return DMX_BAD_VALUE;
|
||||
}
|
||||
|
||||
/* The "root" window must not expose unaddressable coordinates */
|
||||
if (attr->rootWindowXorigin < 0 ||
|
||||
attr->rootWindowYorigin < 0 ||
|
||||
attr->rootWindowXorigin + attr->rootWindowWidth > 32767 ||
|
||||
attr->rootWindowYorigin + attr->rootWindowHeight > 32767)
|
||||
{
|
||||
dmxLog(dmxWarning,
|
||||
"The \"root\" window must not expose unaddressable "
|
||||
"coordinates\n");
|
||||
return DMX_BAD_VALUE;
|
||||
}
|
||||
|
||||
/* FIXME: Handle the rest of the illegal value checking */
|
||||
}
|
||||
|
||||
/* No illegal values found */
|
||||
if (errorScreen) *errorScreen = 0;
|
||||
|
||||
for (i = 0; i < nscreens; i++) {
|
||||
DMXScreenAttributesPtr attr = &attribs[i];
|
||||
int idx = screens[i];
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
|
||||
|
||||
dmxLog(dmxInfo, "Changing screen #%d attributes "
|
||||
"from %dx%d+%d+%d %dx%d+%d+%d +%d+%d "
|
||||
"to %dx%d+%d+%d %dx%d+%d+%d +%d+%d\n",
|
||||
idx,
|
||||
dmxScreen->scrnWidth, dmxScreen->scrnHeight,
|
||||
dmxScreen->scrnX, dmxScreen->scrnY,
|
||||
dmxScreen->rootWidth, dmxScreen->rootHeight,
|
||||
dmxScreen->rootX, dmxScreen->rootY,
|
||||
dmxScreen->rootXOrigin, dmxScreen->rootYOrigin,
|
||||
attr->screenWindowWidth, attr->screenWindowHeight,
|
||||
attr->screenWindowXoffset, attr->screenWindowYoffset,
|
||||
attr->rootWindowWidth, attr->rootWindowHeight,
|
||||
attr->rootWindowXoffset, attr->rootWindowYoffset,
|
||||
attr->rootWindowXorigin, attr->rootWindowYorigin);
|
||||
|
||||
/* Configure "screen" window */
|
||||
dmxConfigureScreenWindow(idx,
|
||||
attr->screenWindowXoffset,
|
||||
attr->screenWindowYoffset,
|
||||
attr->screenWindowWidth,
|
||||
attr->screenWindowHeight);
|
||||
|
||||
/* Configure "root" window */
|
||||
dmxConfigureRootWindow(idx,
|
||||
attr->rootWindowXoffset,
|
||||
attr->rootWindowYoffset,
|
||||
attr->rootWindowWidth,
|
||||
attr->rootWindowHeight);
|
||||
|
||||
|
||||
/* Set "root" window's origin */
|
||||
dmxSetRootWindowOrigin(idx,
|
||||
attr->rootWindowXorigin,
|
||||
attr->rootWindowYorigin);
|
||||
}
|
||||
|
||||
/* Adjust the cursor boundaries */
|
||||
dmxAdjustCursorBoundaries();
|
||||
|
||||
/* Force completion of the changes */
|
||||
dmxSync(NULL, TRUE);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
/** Configure the attributes of the global desktop. */
|
||||
int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs)
|
||||
{
|
||||
if (attribs->width <= 0 || attribs->width >= 32767 ||
|
||||
attribs->height <= 0 || attribs->height >= 32767)
|
||||
return DMX_BAD_VALUE;
|
||||
|
||||
/* If the desktop is changing size, adjust the "root" windows on each
|
||||
* "screen" window to only show the visible desktop. Also, handle
|
||||
* the special case where the desktop shrinks such that the it no
|
||||
* longer overlaps an portion of a "screen" window. */
|
||||
if (attribs->width != dmxGlobalWidth || attribs->height != dmxGlobalHeight) {
|
||||
int i;
|
||||
for (i = 0; i < dmxNumScreens; i++) {
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[i];
|
||||
int w, h;
|
||||
|
||||
w = attribs->width;
|
||||
h = attribs->height;
|
||||
|
||||
#ifdef RANDR
|
||||
if (dmxScreen->beRandr)
|
||||
{
|
||||
if (w > dmxScreen->beWidth) w = dmxScreen->beWidth;
|
||||
if (h > dmxScreen->beHeight) h = dmxScreen->beHeight;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
{
|
||||
if (w > dmxScreen->scrnWidth) w = dmxScreen->scrnWidth;
|
||||
if (h > dmxScreen->scrnHeight) h = dmxScreen->scrnHeight;
|
||||
}
|
||||
|
||||
dmxConfigureScreenWindow (i,
|
||||
dmxScreen->scrnX,
|
||||
dmxScreen->scrnY,
|
||||
w,
|
||||
h);
|
||||
|
||||
if ((w = attribs->width - dmxScreen->rootXOrigin) < 0) w = 0;
|
||||
if ((h = attribs->height - dmxScreen->rootYOrigin) < 0) h = 0;
|
||||
|
||||
#ifdef RANDR
|
||||
if (dmxScreen->beRandr)
|
||||
{
|
||||
if (w > dmxScreen->beWidth) w = dmxScreen->beWidth;
|
||||
if (h > dmxScreen->beHeight) h = dmxScreen->beHeight;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
{
|
||||
if (w > dmxScreen->rootWidth) w = dmxScreen->rootWidth;
|
||||
if (h > dmxScreen->rootHeight) h = dmxScreen->rootHeight;
|
||||
}
|
||||
|
||||
dmxConfigureRootWindow (i,
|
||||
dmxScreen->rootX,
|
||||
dmxScreen->rootY,
|
||||
w, h);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the global width/height */
|
||||
dmxSetWidthHeight(attribs->width, attribs->height);
|
||||
|
||||
/* Handle shift[XY] changes */
|
||||
if (attribs->shiftX || attribs->shiftY) {
|
||||
int i;
|
||||
for (i = 0; i < dmxNumScreens; i++) {
|
||||
ScreenPtr pScreen = screenInfo.screens[i];
|
||||
WindowPtr pChild = WindowTable[i]->firstChild;
|
||||
while (pChild) {
|
||||
/* Adjust child window's position */
|
||||
pScreen->MoveWindow(pChild,
|
||||
pChild->origin.x - wBorderWidth(pChild)
|
||||
- attribs->shiftX,
|
||||
pChild->origin.y - wBorderWidth(pChild)
|
||||
- attribs->shiftY,
|
||||
pChild->nextSib,
|
||||
VTMove);
|
||||
|
||||
/* Note that the call to MoveWindow will eventually call
|
||||
* dmxPositionWindow which will automatically create a
|
||||
* window if it is now exposed on screen (for lazy
|
||||
* window creation optimization) and it will properly
|
||||
* set the offscreen flag.
|
||||
*/
|
||||
|
||||
pChild = pChild->nextSib;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Update connection block, Xinerama, etc. -- these appears to
|
||||
* already be handled in dmxConnectionBlockCallback(), which is
|
||||
* called from dmxAdjustCursorBoundaries() [below]. */
|
||||
|
||||
/* Adjust the cursor boundaries */
|
||||
dmxAdjustCursorBoundaries();
|
||||
|
||||
/* Force completion of the changes */
|
||||
dmxSync(NULL, TRUE);
|
||||
|
||||
return Success;
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Create the scratch GCs per depth. */
|
||||
static void dmxBECreateScratchGCs(int scrnNum)
|
||||
{
|
||||
|
|
@ -1800,7 +1456,6 @@ dmxAttachScreen (int idx,
|
|||
{
|
||||
ScreenPtr pScreen;
|
||||
DMXScreenInfo *dmxScreen;
|
||||
CARD32 scrnNum = idx;
|
||||
DMXScreenInfo oldDMXScreen;
|
||||
int i;
|
||||
|
||||
|
|
@ -1844,7 +1499,7 @@ dmxAttachScreen (int idx,
|
|||
/* Save old info */
|
||||
oldDMXScreen = *dmxScreen;
|
||||
|
||||
dmxScreen->beUseRoot = !window;
|
||||
dmxScreen->scrnWin = window;
|
||||
dmxScreen->virtualFb = FALSE;
|
||||
|
||||
/* Copy the display name to the new screen */
|
||||
|
|
@ -1871,22 +1526,12 @@ dmxAttachScreen (int idx,
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (!dmxScreen->scrnWin)
|
||||
dmxScreen->scrnWin = DefaultRootWindow (dmxScreen->beDisplay);
|
||||
|
||||
dmxSetErrorHandler(dmxScreen);
|
||||
dmxCheckForWM(dmxScreen);
|
||||
dmxGetScreenAttribs(dmxScreen);
|
||||
|
||||
if (dmxScreen->beUseRoot && dmxScreen->WMRunningOnBE)
|
||||
{
|
||||
dmxLogErrorSet (dmxWarning, errorSet, error, errorName,
|
||||
"WM running. cannot use back-end server "
|
||||
"root window\n");
|
||||
|
||||
dmxCloseDisplay (dmxScreen);
|
||||
/* Restore the old screen */
|
||||
*dmxScreen = oldDMXScreen;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef MITSHM
|
||||
dmxScreen->beShm = dmxShmInit (pScreen);
|
||||
if (dmxScreen->beShm)
|
||||
|
|
@ -1901,17 +1546,12 @@ dmxAttachScreen (int idx,
|
|||
dmxScreen->beRandr = FALSE;
|
||||
#endif
|
||||
|
||||
if (attr->screenWindowWidth == 0 || attr->screenWindowHeight == 0)
|
||||
if (dmxScreen->scrnWin == DefaultRootWindow (dmxScreen->beDisplay))
|
||||
{
|
||||
|
||||
#ifdef RANDR
|
||||
int major, minor, status = 0;
|
||||
#endif
|
||||
|
||||
attr->screenWindowWidth = dmxScreen->beWidth;
|
||||
attr->screenWindowHeight = dmxScreen->beHeight;
|
||||
|
||||
#ifdef RANDR
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
status = XRRQueryVersion (dmxScreen->beDisplay, &major, &minor);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
|
|
@ -1929,11 +1569,6 @@ dmxAttachScreen (int idx,
|
|||
&ignore);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
|
||||
if (attr->screenWindowWidth > dmxGlobalWidth)
|
||||
attr->screenWindowWidth = dmxGlobalWidth;
|
||||
if (attr->screenWindowHeight > dmxGlobalHeight)
|
||||
attr->screenWindowHeight = dmxGlobalHeight;
|
||||
|
||||
dmxLog (dmxInfo, "RandR 1.2 is present\n");
|
||||
}
|
||||
else
|
||||
|
|
@ -1947,16 +1582,6 @@ dmxAttachScreen (int idx,
|
|||
}
|
||||
#endif
|
||||
|
||||
attr->screenWindowXoffset = 0;
|
||||
attr->screenWindowYoffset = 0;
|
||||
|
||||
attr->rootWindowWidth = attr->screenWindowWidth;
|
||||
attr->rootWindowHeight = attr->screenWindowHeight;
|
||||
attr->rootWindowXoffset = 0;
|
||||
attr->rootWindowYoffset = 0;
|
||||
|
||||
attr->rootWindowXorigin = 0;
|
||||
attr->rootWindowYorigin = 0;
|
||||
}
|
||||
|
||||
if (!dmxGetVisualInfo(dmxScreen)) {
|
||||
|
|
@ -2070,18 +1695,6 @@ dmxAttachScreen (int idx,
|
|||
XFree(oldDMXScreen.bePixmapFormats);
|
||||
/* TODO: should oldDMXScreen.name be freed?? */
|
||||
|
||||
#ifdef PANORAMIX
|
||||
if (!noPanoramiXExtension)
|
||||
{
|
||||
if (dmxConfigureScreenWindows(1, &scrnNum, attr, NULL))
|
||||
{
|
||||
dmxErrorSet (errorSet, error, errorName,
|
||||
"Failed to configure screen windows");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RANDR
|
||||
RRGetInfo (screenInfo.screens[0]);
|
||||
#endif
|
||||
|
|
@ -2492,14 +2105,8 @@ int dmxDetachScreen(int idx)
|
|||
|
||||
dmxScreen->scrnWidth = 1;
|
||||
dmxScreen->scrnHeight = 1;
|
||||
dmxScreen->scrnX = 0;
|
||||
dmxScreen->scrnY = 0;
|
||||
dmxScreen->rootWidth = 0;
|
||||
dmxScreen->rootHeight = 0;
|
||||
dmxScreen->rootX = 0;
|
||||
dmxScreen->rootY = 0;
|
||||
dmxScreen->rootXOrigin = 0;
|
||||
dmxScreen->rootYOrigin = 0;
|
||||
dmxScreen->beWidth = 1;
|
||||
dmxScreen->beHeight = 1;
|
||||
dmxScreen->beXDPI = 75;
|
||||
|
|
|
|||
|
|
@ -405,14 +405,6 @@ static void dmxPrintScreenInfo(DMXScreenInfo *dmxScreen)
|
|||
(DoesBackingStore (s) == NotUseful) ? "no" :
|
||||
((DoesBackingStore (s) == Always) ? "yes" : "when mapped"),
|
||||
DoesSaveUnders (s) ? "yes" : "no");
|
||||
dmxLogOutput(dmxScreen, "Window Manager running: %s\n",
|
||||
(dmxScreen->WMRunningOnBE) ? "yes" : "no");
|
||||
|
||||
if (dmxScreen->WMRunningOnBE) {
|
||||
dmxLogOutputWarning(dmxScreen,
|
||||
"Window manager running "
|
||||
"-- colormaps not supported\n");
|
||||
}
|
||||
XFree(depths);
|
||||
}
|
||||
|
||||
|
|
@ -428,37 +420,6 @@ void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen)
|
|||
|
||||
dmxScreen->beWidth = attribs.width;
|
||||
dmxScreen->beHeight = attribs.height;
|
||||
|
||||
/* Fill in missing geometry information */
|
||||
if (dmxScreen->scrnXSign < 0) {
|
||||
if (dmxScreen->scrnWidth) {
|
||||
dmxScreen->scrnX = (attribs.width - dmxScreen->scrnWidth
|
||||
- dmxScreen->scrnX);
|
||||
} else {
|
||||
dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
|
||||
dmxScreen->scrnX = 0;
|
||||
}
|
||||
}
|
||||
if (dmxScreen->scrnYSign < 0) {
|
||||
if (dmxScreen->scrnHeight) {
|
||||
dmxScreen->scrnY = (attribs.height - dmxScreen->scrnHeight
|
||||
- dmxScreen->scrnY);
|
||||
} else {
|
||||
dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY;
|
||||
dmxScreen->scrnY = 0;
|
||||
}
|
||||
}
|
||||
if (!dmxScreen->scrnWidth)
|
||||
dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
|
||||
if (!dmxScreen->scrnHeight)
|
||||
dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY;
|
||||
|
||||
if (!dmxScreen->rootWidth) dmxScreen->rootWidth = dmxScreen->scrnWidth;
|
||||
if (!dmxScreen->rootHeight) dmxScreen->rootHeight = dmxScreen->scrnHeight;
|
||||
if (dmxScreen->rootWidth + dmxScreen->rootX > dmxScreen->scrnWidth)
|
||||
dmxScreen->rootWidth = dmxScreen->scrnWidth - dmxScreen->rootX;
|
||||
if (dmxScreen->rootHeight + dmxScreen->rootY > dmxScreen->scrnHeight)
|
||||
dmxScreen->rootHeight = dmxScreen->scrnHeight - dmxScreen->rootY;
|
||||
|
||||
/* FIXME: Get these from the back-end server */
|
||||
dmxScreen->beXDPI = 96;
|
||||
|
|
@ -476,6 +437,12 @@ void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen)
|
|||
else if (dmxScreen->beDepth <= 16) dmxScreen->beBPP = 16;
|
||||
else dmxScreen->beBPP = 32;
|
||||
|
||||
if (dmxScreen->scrnWin != DefaultRootWindow(dpy))
|
||||
XGetWindowAttributes(dpy, dmxScreen->scrnWin, &attribs);
|
||||
|
||||
dmxScreen->scrnWidth = attribs.width;
|
||||
dmxScreen->scrnHeight = attribs.height;
|
||||
|
||||
#ifdef GLXEXT
|
||||
/* get the majorOpcode for the back-end GLX extension */
|
||||
XQueryExtension(dpy, "GLX", &dmxScreen->glxMajorOpcode,
|
||||
|
|
@ -483,9 +450,8 @@ void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen)
|
|||
#endif
|
||||
|
||||
dmxPrintScreenInfo(dmxScreen);
|
||||
dmxLogOutput(dmxScreen, "%dx%d+%d+%d on %dx%d at depth=%d, bpp=%d\n",
|
||||
dmxLogOutput(dmxScreen, "%dx%d on %dx%d at depth=%d, bpp=%d\n",
|
||||
dmxScreen->scrnWidth, dmxScreen->scrnHeight,
|
||||
dmxScreen->scrnX, dmxScreen->scrnY,
|
||||
dmxScreen->beWidth, dmxScreen->beHeight,
|
||||
dmxScreen->beDepth, dmxScreen->beBPP);
|
||||
if (dmxScreen->beDepth == 8)
|
||||
|
|
@ -607,19 +573,6 @@ static Bool dmxSetPixmapFormats(ScreenInfo *pScreenInfo,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void dmxCheckForWM(DMXScreenInfo *dmxScreen)
|
||||
{
|
||||
Status status;
|
||||
XWindowAttributes xwa;
|
||||
|
||||
status = XGetWindowAttributes(dmxScreen->beDisplay,
|
||||
DefaultRootWindow(dmxScreen->beDisplay),
|
||||
&xwa);
|
||||
dmxScreen->WMRunningOnBE =
|
||||
(status &&
|
||||
(xwa.all_event_masks & SubstructureRedirectMask));
|
||||
}
|
||||
|
||||
/** Initialize the display and collect relevant information about the
|
||||
* display properties */
|
||||
static Bool dmxDisplayInit(DMXScreenInfo *dmxScreen)
|
||||
|
|
@ -633,8 +586,15 @@ static Bool dmxDisplayInit(DMXScreenInfo *dmxScreen)
|
|||
|
||||
dmxScreen->scrnWidth = 1;
|
||||
dmxScreen->scrnHeight = 1;
|
||||
dmxScreen->scrnX = 0;
|
||||
dmxScreen->scrnY = 0;
|
||||
|
||||
#ifdef PANORAMIX
|
||||
if (!noPanoramiXExtension)
|
||||
{
|
||||
dmxScreen->scrnWidth = dmxScreens[0].scrnWidth;
|
||||
dmxScreen->scrnHeight = dmxScreens[0].scrnHeight;
|
||||
}
|
||||
#endif
|
||||
|
||||
dmxScreen->beWidth = 1;
|
||||
dmxScreen->beHeight = 1;
|
||||
dmxScreen->beXDPI = 96;
|
||||
|
|
@ -646,23 +606,12 @@ static Bool dmxDisplayInit(DMXScreenInfo *dmxScreen)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!dmxScreen->scrnWin)
|
||||
dmxScreen->scrnWin = DefaultRootWindow (dmxScreen->beDisplay);
|
||||
|
||||
dmxSetErrorHandler(dmxScreen);
|
||||
dmxCheckForWM(dmxScreen);
|
||||
dmxGetScreenAttribs(dmxScreen);
|
||||
|
||||
if (dmxScreen->beUseRoot && dmxScreen->WMRunningOnBE)
|
||||
{
|
||||
dmxLog (dmxWarning,
|
||||
"WM running. cannot use back-end server root window\n");
|
||||
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
XCloseDisplay(dmxScreen->beDisplay);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
dmxScreen->beDisplay = NULL;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!dmxGetVisualInfo(dmxScreen))
|
||||
{
|
||||
dmxLog(dmxWarning,
|
||||
|
|
@ -972,12 +921,6 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
|
|||
AddScreen(dmxScreenInit, argc, argv);
|
||||
}
|
||||
|
||||
/* Compute origin information. */
|
||||
dmxInitOrigins();
|
||||
|
||||
/* Compute overlap information. */
|
||||
dmxInitOverlap();
|
||||
|
||||
/* Make sure there is a global width/height available */
|
||||
dmxComputeWidthHeight(DMX_NO_RECOMPUTE_BOUNDING_BOX);
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@
|
|||
extern Bool dmxOpenDisplay(DMXScreenInfo *dmxScreen);
|
||||
extern void dmxCloseDisplay(DMXScreenInfo *dmxScreen);
|
||||
extern void dmxSetErrorHandler(DMXScreenInfo *dmxScreen);
|
||||
extern void dmxCheckForWM(DMXScreenInfo *dmxScreen);
|
||||
extern void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen);
|
||||
extern Bool dmxGetVisualInfo(DMXScreenInfo *dmxScreen);
|
||||
extern void dmxGetColormaps(DMXScreenInfo *dmxScreen);
|
||||
|
|
|
|||
|
|
@ -461,7 +461,7 @@ dmxRRGetInfo (ScreenPtr pScreen,
|
|||
{
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
r = XRRGetScreenResources (dmxScreen->beDisplay,
|
||||
DefaultRootWindow (dmxScreen->beDisplay));
|
||||
dmxScreen->scrnWin);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
|
||||
if (r)
|
||||
|
|
@ -561,11 +561,11 @@ dmxRRGetInfo (ScreenPtr pScreen,
|
|||
|
||||
sprintf (name,
|
||||
"%dx%d",
|
||||
dmxScreen->beWidth, dmxScreen->beHeight);
|
||||
dmxScreen->scrnWidth, dmxScreen->scrnHeight);
|
||||
|
||||
memset (&modeInfo, '\0', sizeof (modeInfo));
|
||||
modeInfo.width = dmxScreen->beWidth;
|
||||
modeInfo.height = dmxScreen->beHeight;
|
||||
modeInfo.width = dmxScreen->scrnWidth;
|
||||
modeInfo.height = dmxScreen->scrnHeight;
|
||||
modeInfo.nameLength = strlen (name);
|
||||
|
||||
mode = RRModeGet (&modeInfo, name);
|
||||
|
|
@ -618,18 +618,20 @@ dmxRRGetInfo (ScreenPtr pScreen,
|
|||
|
||||
sprintf (name,
|
||||
"%dx%d",
|
||||
dmxScreen->beWidth, dmxScreen->beHeight);
|
||||
dmxScreen->scrnWidth, dmxScreen->scrnHeight);
|
||||
|
||||
memset (&modeInfo, '\0', sizeof (modeInfo));
|
||||
modeInfo.width = dmxScreen->beWidth;
|
||||
modeInfo.height = dmxScreen->beHeight;
|
||||
modeInfo.width = dmxScreen->scrnWidth;
|
||||
modeInfo.height = dmxScreen->scrnHeight;
|
||||
modeInfo.nameLength = strlen (name);
|
||||
|
||||
mode = RRModeGet (&modeInfo, name);
|
||||
if (!mode)
|
||||
return (dmxScreen->beRandrPending = FALSE);
|
||||
|
||||
RRCrtcNotify (crtc, mode, 0, 0, RR_Rotate_0, 1,
|
||||
RRCrtcNotify (crtc, mode,
|
||||
dmxScreen->rootX, dmxScreen->rootY,
|
||||
RR_Rotate_0, 1,
|
||||
&pScrPriv->outputs[baseOutput]);
|
||||
}
|
||||
else
|
||||
|
|
@ -689,18 +691,19 @@ dmxRRScreenSetSize (ScreenPtr pScreen,
|
|||
CARD32 mmWidth,
|
||||
CARD32 mmHeight)
|
||||
{
|
||||
DMXDesktopAttributesRec attr;
|
||||
|
||||
dmxGetDesktopAttributes (&attr);
|
||||
|
||||
if (attr.width != width || attr.height != height)
|
||||
#ifdef PANORAMIX
|
||||
if (!noPanoramiXExtension)
|
||||
{
|
||||
attr.width = width;
|
||||
attr.height = height;
|
||||
int i;
|
||||
|
||||
if (dmxConfigureDesktop (&attr) != Success)
|
||||
return FALSE;
|
||||
for (i = 0; i < dmxNumScreens; i++)
|
||||
dmxUpdateScreenResources (screenInfo.screens[i],
|
||||
0, 0, width, height);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
dmxUpdateScreenResources (pScreen, 0, 0, width, height);
|
||||
|
||||
pScreen->mmWidth = mmWidth;
|
||||
pScreen->mmHeight = mmHeight;
|
||||
|
|
@ -1021,8 +1024,7 @@ dmxRRModeDestroy (ScreenPtr pScreen,
|
|||
r = NULL;
|
||||
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
r = XRRGetScreenResources (dmxScreen->beDisplay,
|
||||
DefaultRootWindow (dmxScreen->beDisplay));
|
||||
r = XRRGetScreenResources (dmxScreen->beDisplay, dmxScreen->scrnWin);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
|
||||
if (r)
|
||||
|
|
@ -1052,19 +1054,40 @@ dmxScreenEventCheckRR (ScreenPtr pScreen,
|
|||
xcb_generic_event_t *event)
|
||||
{
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
||||
int beWidth = dmxScreen->beWidth;
|
||||
int beHeight = dmxScreen->beHeight;
|
||||
|
||||
xcb_configure_notify_event_t *xconfigure =
|
||||
(xcb_configure_notify_event_t *) event;
|
||||
xcb_randr_screen_change_notify_event_t *scevent =
|
||||
(xcb_randr_screen_change_notify_event_t *) event;
|
||||
|
||||
switch (event->response_type & ~0x80) {
|
||||
case XCB_MAP_NOTIFY:
|
||||
return TRUE;
|
||||
if (((xcb_map_notify_event_t *) event)->window == dmxScreen->rootWin)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
case XCB_CONFIGURE_NOTIFY: {
|
||||
XEvent X;
|
||||
xcb_configure_notify_event_t *xconfigure =
|
||||
(xcb_configure_notify_event_t *) event;
|
||||
XEvent X;
|
||||
|
||||
if (xconfigure->window == dmxScreen->scrnWin)
|
||||
{
|
||||
if (dmxScreen->scrnWidth == xconfigure->width &&
|
||||
dmxScreen->scrnHeight == xconfigure->height)
|
||||
return TRUE;
|
||||
|
||||
dmxScreen->scrnWidth = xconfigure->width;
|
||||
dmxScreen->scrnHeight = xconfigure->height;
|
||||
}
|
||||
else if (xconfigure->window == dmxScreen->rootWin)
|
||||
{
|
||||
if (dmxScreen->rootX == xconfigure->x &&
|
||||
dmxScreen->rootY == xconfigure->y)
|
||||
return TRUE;
|
||||
|
||||
dmxScreen->rootX = xconfigure->x;
|
||||
dmxScreen->rootY = xconfigure->y;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
X.xconfigure.type = XCB_CONFIGURE_NOTIFY;
|
||||
X.xconfigure.display = dmxScreen->beDisplay;
|
||||
|
|
@ -1080,7 +1103,9 @@ dmxScreenEventCheckRR (ScreenPtr pScreen,
|
|||
|
||||
switch ((event->response_type & ~0x80) - dmxScreen->beRandrEventBase) {
|
||||
case XCB_RANDR_SCREEN_CHANGE_NOTIFY: {
|
||||
XRRScreenChangeNotifyEvent X;
|
||||
xcb_randr_screen_change_notify_event_t *scevent =
|
||||
(xcb_randr_screen_change_notify_event_t *) event;
|
||||
XRRScreenChangeNotifyEvent X;
|
||||
|
||||
X.type = event->response_type;
|
||||
X.display = dmxScreen->beDisplay;
|
||||
|
|
@ -1108,35 +1133,7 @@ dmxScreenEventCheckRR (ScreenPtr pScreen,
|
|||
DisplayHeight (dmxScreen->beDisplay,
|
||||
DefaultScreen (dmxScreen->beDisplay));
|
||||
|
||||
if (dmxScreen->beRandr)
|
||||
{
|
||||
if (dmxScreen->beWidth != beWidth || dmxScreen->beHeight != beHeight)
|
||||
{
|
||||
DMXScreenAttributesRec attr;
|
||||
CARD32 scrnNum = dmxScreen->index;
|
||||
|
||||
memset (&attr, 0, sizeof (attr));
|
||||
|
||||
attr.screenWindowWidth = dmxGlobalWidth;
|
||||
attr.screenWindowHeight = dmxGlobalHeight;
|
||||
|
||||
if (attr.screenWindowWidth > dmxScreen->beWidth)
|
||||
attr.screenWindowWidth = dmxScreen->beWidth;
|
||||
if (attr.screenWindowHeight > dmxScreen->beHeight)
|
||||
attr.screenWindowHeight = dmxScreen->beHeight;
|
||||
|
||||
attr.rootWindowWidth = attr.screenWindowWidth;
|
||||
attr.rootWindowHeight = attr.screenWindowHeight;
|
||||
|
||||
dmxConfigureScreenWindows (1, &scrnNum, &attr, NULL);
|
||||
|
||||
RRGetInfo (screenInfo.screens[0]);
|
||||
}
|
||||
else if ((event->response_type & ~0x80) != XCB_CONFIGURE_NOTIFY)
|
||||
{
|
||||
RRGetInfo (screenInfo.screens[0]);
|
||||
}
|
||||
}
|
||||
RRGetInfo (screenInfo.screens[0]);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,6 @@ DevPrivateKey dmxGlyphPrivateKey = &dmxGlyphPrivateKeyIndex; /**< Private index
|
|||
void dmxBEScreenInit(int idx, ScreenPtr pScreen)
|
||||
{
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
|
||||
XSetWindowAttributes attribs;
|
||||
XGCValues gcvals;
|
||||
unsigned long mask;
|
||||
int i, j;
|
||||
|
|
@ -144,62 +143,11 @@ void dmxBEScreenInit(int idx, ScreenPtr pScreen)
|
|||
/* Handle screen savers and DPMS on the backend */
|
||||
dmxDPMSInit(dmxScreen);
|
||||
|
||||
/* Create root window for screen */
|
||||
mask = CWBackPixel | CWEventMask | CWColormap | CWOverrideRedirect;
|
||||
attribs.background_pixel = dmxScreen->beBlackPixel;
|
||||
attribs.event_mask = StructureNotifyMask | SubstructureRedirectMask;
|
||||
attribs.colormap = dmxScreen->beDefColormaps[dmxScreen->beDefVisualIndex];
|
||||
attribs.override_redirect = True;
|
||||
|
||||
if (!dmxScreen->beUseRoot)
|
||||
{
|
||||
dmxScreen->scrnWin =
|
||||
XCreateWindow(dmxScreen->beDisplay,
|
||||
DefaultRootWindow(dmxScreen->beDisplay),
|
||||
dmxScreen->scrnX,
|
||||
dmxScreen->scrnY,
|
||||
dmxScreen->scrnWidth,
|
||||
dmxScreen->scrnHeight,
|
||||
0,
|
||||
pScreen->rootDepth,
|
||||
InputOutput,
|
||||
dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
|
||||
mask,
|
||||
&attribs);
|
||||
}
|
||||
else
|
||||
{
|
||||
dmxScreen->scrnWin = DefaultRootWindow (dmxScreen->beDisplay);
|
||||
XSetWindowBackground (dmxScreen->beDisplay, dmxScreen->scrnWin,
|
||||
attribs.background_pixel);
|
||||
XSelectInput (dmxScreen->beDisplay, dmxScreen->scrnWin,
|
||||
attribs.event_mask);
|
||||
}
|
||||
XSelectInput (dmxScreen->beDisplay,
|
||||
dmxScreen->scrnWin,
|
||||
StructureNotifyMask);
|
||||
dmxPropertyWindow(dmxScreen);
|
||||
|
||||
/*
|
||||
* This turns off the cursor by defining a cursor with no visible
|
||||
* components.
|
||||
*/
|
||||
if (1) {
|
||||
char noCursorData[] = {0, 0, 0, 0,
|
||||
0, 0, 0, 0};
|
||||
Pixmap pixmap;
|
||||
XColor color, tmp;
|
||||
|
||||
pixmap = XCreateBitmapFromData(dmxScreen->beDisplay, dmxScreen->scrnWin,
|
||||
noCursorData, 8, 8);
|
||||
XAllocNamedColor(dmxScreen->beDisplay, dmxScreen->beDefColormaps[0],
|
||||
"black", &color, &tmp);
|
||||
dmxScreen->noCursor = XCreatePixmapCursor(dmxScreen->beDisplay,
|
||||
pixmap, pixmap,
|
||||
&color, &color, 0, 0);
|
||||
XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
|
||||
dmxScreen->noCursor);
|
||||
|
||||
XFreePixmap(dmxScreen->beDisplay, pixmap);
|
||||
}
|
||||
|
||||
#ifdef RANDR
|
||||
dmxBERRScreenInit (pScreen);
|
||||
#endif
|
||||
|
|
@ -208,9 +156,6 @@ void dmxBEScreenInit(int idx, ScreenPtr pScreen)
|
|||
dmxBEXvScreenInit (pScreen);
|
||||
#endif
|
||||
|
||||
if (!dmxScreen->beUseRoot)
|
||||
XMapWindow (dmxScreen->beDisplay, dmxScreen->scrnWin);
|
||||
|
||||
if (dmxShadowFB) {
|
||||
mask = (GCFunction
|
||||
| GCPlaneMask
|
||||
|
|
@ -374,10 +319,35 @@ dmxScreenEventCheckExpose (ScreenPtr pScreen,
|
|||
}
|
||||
|
||||
static Bool
|
||||
dmxScreenEventCheckManageWindow (ScreenPtr pScreen,
|
||||
dmxScreenEventCheckOutputWindow (ScreenPtr pScreen,
|
||||
xcb_generic_event_t *event)
|
||||
{
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
||||
|
||||
switch (event->response_type & ~0x80) {
|
||||
case XCB_DESTROY_NOTIFY: {
|
||||
xcb_destroy_notify_event_t *xdestroy =
|
||||
(xcb_destroy_notify_event_t *) event;
|
||||
|
||||
if (xdestroy->window != dmxScreen->scrnWin)
|
||||
return FALSE;
|
||||
|
||||
/* output window has been destroyed, detach screen when we reach
|
||||
the block handler */
|
||||
dmxScreen->scrnWin = None;
|
||||
} break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
dmxScreenEventCheckManageRoot (ScreenPtr pScreen,
|
||||
xcb_generic_event_t *event)
|
||||
{
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
||||
WindowPtr pChild = WindowTable[pScreen->myNum];
|
||||
Window xWindow;
|
||||
|
||||
|
|
@ -394,6 +364,8 @@ dmxScreenEventCheckManageWindow (ScreenPtr pScreen,
|
|||
(xcb_map_request_event_t *) event;
|
||||
xcb_client_message_event_t *xclient =
|
||||
(xcb_client_message_event_t *) event;
|
||||
xcb_map_notify_event_t * xmap =
|
||||
(xcb_map_notify_event_t *) event;
|
||||
|
||||
switch (event->response_type & ~0x80) {
|
||||
case XCB_CIRCULATE_REQUEST:
|
||||
|
|
@ -408,6 +380,11 @@ dmxScreenEventCheckManageWindow (ScreenPtr pScreen,
|
|||
case XCB_CLIENT_MESSAGE:
|
||||
xWindow = xclient->window;
|
||||
break;
|
||||
case XCB_MAP_NOTIFY:
|
||||
if (xmap->window == dmxScreen->rootWin)
|
||||
return TRUE;
|
||||
|
||||
/* fall-through */
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -706,7 +683,8 @@ dmxBEDispatch (ScreenPtr pScreen)
|
|||
while ((event = xcb_poll_for_event (dmxScreen->connection)))
|
||||
{
|
||||
if (!dmxScreenEventCheckInput (pScreen, event) &&
|
||||
!dmxScreenEventCheckManageWindow (pScreen, event) &&
|
||||
!dmxScreenEventCheckOutputWindow (pScreen, event) &&
|
||||
!dmxScreenEventCheckManageRoot (pScreen, event) &&
|
||||
!dmxScreenEventCheckExpose (pScreen, event) &&
|
||||
|
||||
#ifdef MITSHM
|
||||
|
|
@ -773,7 +751,8 @@ dmxBEDispatch (ScreenPtr pScreen)
|
|||
free (head);
|
||||
}
|
||||
|
||||
if (xcb_connection_has_error (dmxScreen->connection))
|
||||
if (!dmxScreen->scrnWin ||
|
||||
xcb_connection_has_error (dmxScreen->connection))
|
||||
{
|
||||
if (!dmxScreen->broken)
|
||||
{
|
||||
|
|
@ -781,8 +760,10 @@ dmxBEDispatch (ScreenPtr pScreen)
|
|||
|
||||
dmxScreenEventCheckInput (pScreen, (xcb_generic_event_t *)
|
||||
&detached_error);
|
||||
dmxScreenEventCheckManageWindow (pScreen, (xcb_generic_event_t *)
|
||||
dmxScreenEventCheckOutputWindow (pScreen, (xcb_generic_event_t *)
|
||||
&detached_error);
|
||||
dmxScreenEventCheckManageRoot (pScreen, (xcb_generic_event_t *)
|
||||
&detached_error);
|
||||
dmxScreenEventCheckExpose (pScreen, (xcb_generic_event_t *)
|
||||
&detached_error);
|
||||
|
||||
|
|
@ -813,16 +794,20 @@ dmxScreenCheckForIOError (ScreenPtr pScreen)
|
|||
{
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
||||
|
||||
if (xcb_connection_has_error (dmxScreen->connection))
|
||||
if (!dmxScreen->scrnWin ||
|
||||
xcb_connection_has_error (dmxScreen->connection))
|
||||
{
|
||||
int i;
|
||||
|
||||
dmxScreen->alive = FALSE;
|
||||
if (dmxScreen->scrnWin)
|
||||
{
|
||||
dmxLogOutput (dmxScreen, "Detected broken connection\n");
|
||||
dmxScreen->alive = FALSE;
|
||||
}
|
||||
|
||||
if (!dmxScreen->broken)
|
||||
dmxBEDispatch (pScreen);
|
||||
|
||||
dmxLogOutput (dmxScreen, "Detected broken connection\n");
|
||||
dmxDetachScreen (pScreen->myNum);
|
||||
|
||||
for (i = 0; i < dmxNumScreens; i++)
|
||||
|
|
@ -1043,6 +1028,9 @@ Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
|
|||
dmxScreen->scrnWidth,
|
||||
dmxScreen->beBPP);
|
||||
|
||||
if (!dmxScreen->scrnWin && dmxScreen->beDisplay)
|
||||
dmxScreen->scrnWin = DefaultRootWindow (dmxScreen->beDisplay);
|
||||
|
||||
#ifdef MITSHM
|
||||
ShmRegisterDmxFuncs (pScreen);
|
||||
dmxScreen->beShm = dmxShmInit (pScreen);
|
||||
|
|
@ -1068,7 +1056,8 @@ Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
|
|||
#endif
|
||||
|
||||
#ifdef RANDR
|
||||
if (dmxScreen->beDisplay)
|
||||
if (dmxScreen->beDisplay &&
|
||||
dmxScreen->scrnWin == DefaultRootWindow (dmxScreen->beDisplay))
|
||||
{
|
||||
int major, minor, status = 0;
|
||||
|
||||
|
|
@ -1195,19 +1184,6 @@ void dmxBECloseScreen(ScreenPtr pScreen)
|
|||
dmxDPMSTerm(dmxScreen);
|
||||
|
||||
/* Free the screen resources */
|
||||
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
XFreeCursor(dmxScreen->beDisplay, dmxScreen->noCursor);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
dmxScreen->noCursor = (Cursor)0;
|
||||
|
||||
if (!dmxScreen->beUseRoot)
|
||||
{
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
XUnmapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
|
||||
XDestroyWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
}
|
||||
dmxScreen->scrnWin = (Window)0;
|
||||
|
||||
if (dmxShadowFB) {
|
||||
|
|
|
|||
|
|
@ -112,20 +112,7 @@ Window dmxCreateRootWindow(WindowPtr pWindow)
|
|||
mask |= pWinPriv->attribMask;
|
||||
}
|
||||
|
||||
if (dmxScreen->beUseRoot)
|
||||
{
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
XChangeWindowAttributes (dmxScreen->beDisplay,
|
||||
DefaultRootWindow (dmxScreen->beDisplay),
|
||||
mask, &attribs);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
dmxSync (dmxScreen, False);
|
||||
|
||||
return DefaultRootWindow (dmxScreen->beDisplay);
|
||||
}
|
||||
|
||||
/* Create root window */
|
||||
|
||||
parent = dmxScreen->scrnWin; /* This is our "Screen" window */
|
||||
visual = dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual;
|
||||
|
||||
|
|
@ -155,31 +142,6 @@ Window dmxCreateRootWindow(WindowPtr pWindow)
|
|||
return win;
|
||||
}
|
||||
|
||||
/** Change the location and size of the "screen" window. Called from
|
||||
* #dmxReconfigureScreenWindow(). */
|
||||
void dmxResizeScreenWindow(ScreenPtr pScreen,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
|
||||
unsigned int m;
|
||||
XWindowChanges c;
|
||||
|
||||
if (!dmxScreen->beDisplay || dmxScreen->beUseRoot)
|
||||
return;
|
||||
|
||||
/* Handle resizing on back-end server */
|
||||
m = CWX | CWY | CWWidth | CWHeight;
|
||||
c.x = x;
|
||||
c.y = y;
|
||||
c.width = w;
|
||||
c.height = h;
|
||||
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
XConfigureWindow(dmxScreen->beDisplay, dmxScreen->scrnWin, m, &c);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
dmxSync(dmxScreen, False);
|
||||
}
|
||||
|
||||
static void dmxSetIgnore (DMXScreenInfo *dmxScreen, unsigned int sequence)
|
||||
{
|
||||
dmxAddSequence (&dmxScreen->ignore, sequence);
|
||||
|
|
@ -199,7 +161,7 @@ void dmxResizeRootWindow(WindowPtr pRoot,
|
|||
return;
|
||||
|
||||
/* Handle resizing on back-end server */
|
||||
if (dmxScreen->beDisplay && !dmxScreen->beUseRoot) {
|
||||
if (dmxScreen->beDisplay) {
|
||||
m = CWX | CWY | CWWidth | CWHeight;
|
||||
c.x = x;
|
||||
c.y = y;
|
||||
|
|
@ -214,7 +176,7 @@ void dmxResizeRootWindow(WindowPtr pRoot,
|
|||
|
||||
if (w == 0 || h == 0) {
|
||||
if (pWinPriv->mapped) {
|
||||
if (dmxScreen->beDisplay && !dmxScreen->beUseRoot)
|
||||
if (dmxScreen->beDisplay)
|
||||
{
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
dmxSetIgnore (dmxScreen, NextRequest (dmxScreen->beDisplay));
|
||||
|
|
@ -224,7 +186,7 @@ void dmxResizeRootWindow(WindowPtr pRoot,
|
|||
pWinPriv->mapped = FALSE;
|
||||
}
|
||||
} else if (!pWinPriv->mapped) {
|
||||
if (dmxScreen->beDisplay && !dmxScreen->beUseRoot)
|
||||
if (dmxScreen->beDisplay)
|
||||
{
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
dmxSetIgnore (dmxScreen, NextRequest (dmxScreen->beDisplay));
|
||||
|
|
@ -423,25 +385,8 @@ Bool dmxCreateWindow(WindowPtr pWindow)
|
|||
/* Only create the root window at this stage -- non-root windows are
|
||||
created when they are mapped and are on-screen */
|
||||
if (!pWindow->parent) {
|
||||
dmxScreen->rootWin = pWinPriv->window
|
||||
= dmxCreateRootWindow(pWindow);
|
||||
if (dmxScreen->scrnX != dmxScreen->rootX
|
||||
|| dmxScreen->scrnY != dmxScreen->rootY
|
||||
|| dmxScreen->scrnWidth != dmxScreen->rootWidth
|
||||
|| dmxScreen->scrnHeight != dmxScreen->rootHeight) {
|
||||
dmxResizeRootWindow(pWindow,
|
||||
dmxScreen->rootX,
|
||||
dmxScreen->rootY,
|
||||
dmxScreen->rootWidth,
|
||||
dmxScreen->rootHeight);
|
||||
dmxUpdateScreenResources(screenInfo.screens[dmxScreen->index],
|
||||
dmxScreen->rootX,
|
||||
dmxScreen->rootY,
|
||||
dmxScreen->rootWidth,
|
||||
dmxScreen->rootHeight);
|
||||
pWindow->origin.x = dmxScreen->rootX;
|
||||
pWindow->origin.y = dmxScreen->rootY;
|
||||
}
|
||||
dmxScreen->rootWin = pWinPriv->window =
|
||||
dmxCreateRootWindow(pWindow);
|
||||
} else {
|
||||
dmxGetDefaultWindowAttributes(pWindow,
|
||||
&pWinPriv->cmap,
|
||||
|
|
@ -476,9 +421,12 @@ Bool dmxBEDestroyWindow(WindowPtr pWindow)
|
|||
pWinPriv->beRedirected = FALSE;
|
||||
|
||||
if (pWinPriv->window) {
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
XDestroyWindow(dmxScreen->beDisplay, pWinPriv->window);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
if (dmxScreen->scrnWin)
|
||||
{
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
XDestroyWindow(dmxScreen->beDisplay, pWinPriv->window);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
}
|
||||
pWinPriv->window = (Window)0;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -827,10 +827,10 @@ int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc)
|
|||
for (s=from_screen; s<=to_screen; s++) {
|
||||
DMXScreenInfo *dmxScreen = &dmxScreens[s];
|
||||
Display *dpy = GetBackEndDisplay(cl,s);
|
||||
int scr_x1 = dmxScreen->rootXOrigin;
|
||||
int scr_x2 = dmxScreen->rootXOrigin + dmxScreen->scrnWidth - 1;
|
||||
int scr_y1 = dmxScreen->rootYOrigin;
|
||||
int scr_y2 = dmxScreen->rootYOrigin + dmxScreen->scrnHeight - 1;
|
||||
int scr_x1 = 0;
|
||||
int scr_x2 = dmxScreen->scrnWidth - 1;
|
||||
int scr_y1 = 0;
|
||||
int scr_y2 = dmxScreen->scrnHeight - 1;
|
||||
int wx1, wx2, wy1, wy2;
|
||||
int sx, sy, sw, sh;
|
||||
int npixels;
|
||||
|
|
|
|||
|
|
@ -923,23 +923,6 @@ void dmxBackendUngrabPointer(DevicePtr pDev,
|
|||
}
|
||||
}
|
||||
|
||||
static void dmxBackendComputeCenter(myPrivate *priv)
|
||||
{
|
||||
int centerX;
|
||||
int centerY;
|
||||
|
||||
centerX = priv->be->rootWidth / 2 + priv->be->rootX;
|
||||
centerY = priv->be->rootHeight / 2 + priv->be->rootY;
|
||||
|
||||
if (centerX > priv->be->rootWidth) centerX = priv->be->rootWidth - 1;
|
||||
if (centerY > priv->be->rootHeight) centerY = priv->be->rootHeight - 1;
|
||||
if (centerX < 1) centerX = 1;
|
||||
if (centerY < 1) centerY = 1;
|
||||
|
||||
priv->centerX = centerX;
|
||||
priv->centerY = centerY;
|
||||
}
|
||||
|
||||
static DMXScreenInfo *dmxBackendInitPrivate(DevicePtr pDev)
|
||||
{
|
||||
GETPRIVFROMPDEV;
|
||||
|
|
@ -971,7 +954,6 @@ static DMXScreenInfo *dmxBackendInitPrivate(DevicePtr pDev)
|
|||
* reconfig). */
|
||||
void dmxBackendLateReInit(DevicePtr pDev)
|
||||
{
|
||||
GETPRIVFROMPDEV;
|
||||
int x, y;
|
||||
|
||||
DMXDBG1("dmxBackendLateReInit miPointerCurrentScreen() = %p\n",
|
||||
|
|
@ -979,7 +961,6 @@ void dmxBackendLateReInit(DevicePtr pDev)
|
|||
|
||||
dmxBackendSameDisplay(NULL, 0); /* Invalidate cache */
|
||||
dmxBackendInitPrivate(pDev);
|
||||
dmxBackendComputeCenter(priv);
|
||||
dmxGetGlobalPosition(&x, &y);
|
||||
dmxInvalidateGlobalPosition(); /* To force event processing */
|
||||
}
|
||||
|
|
@ -999,11 +980,10 @@ void dmxBackendInit(DevicePtr pDev)
|
|||
dmxScreen = dmxBackendInitPrivate(pDev);
|
||||
|
||||
/* Finish initialization using computed values or constants. */
|
||||
dmxBackendComputeCenter(priv);
|
||||
priv->eventMask = StructureNotifyMask | SubstructureRedirectMask;
|
||||
priv->eventMask = StructureNotifyMask;
|
||||
priv->myScreen = dmxScreen->index;
|
||||
priv->lastX = priv->centerX;
|
||||
priv->lastY = priv->centerY;
|
||||
priv->lastX = 0;
|
||||
priv->lastY = 0;
|
||||
priv->relative = 0;
|
||||
priv->newscreen = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,8 +265,8 @@ dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
|
|||
dmxGlobalY = dmxGlobalHeight + delta -1;
|
||||
|
||||
if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) {
|
||||
localX = dmxGlobalX - dmxScreen->rootXOrigin;
|
||||
localY = dmxGlobalY - dmxScreen->rootYOrigin;
|
||||
localX = dmxGlobalX;
|
||||
localY = dmxGlobalY;
|
||||
if ((pScreen = miPointerGetScreen(inputInfo.pointer))
|
||||
&& pScreen->myNum == dmxScreen->index) {
|
||||
/* Screen is old screen */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue