Merge remote branch 'vignatti/for-keith'

This commit is contained in:
Keith Packard 2010-04-30 12:27:51 -07:00
commit 0e91e19f78
23 changed files with 313 additions and 639 deletions

View File

@ -188,7 +188,6 @@ int main(int argc, char *argv[], char *envp[])
FatalError("couldn't init server resources"); FatalError("couldn't init server resources");
SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]); SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]);
screenInfo.arraySize = MAXSCREENS;
screenInfo.numScreens = 0; screenInfo.numScreens = 0;
InitAtoms(); InitAtoms();

View File

@ -36,16 +36,18 @@
#error "You should be compiling fbcmap_mi.c instead of fbcmap.c!" #error "You should be compiling fbcmap_mi.c instead of fbcmap.c!"
#endif #endif
static int cmapScrPrivateKeyIndex;
static DevPrivateKey cmapScrPrivateKey = &cmapScrPrivateKeyIndex;
#define GetInstalledColormap(s) ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, cmapScrPrivateKey))
ColormapPtr FbInstalledMaps[MAXSCREENS]; #define SetInstalledColormap(s,c) (dixSetPrivate(&(s)->devPrivates, cmapScrPrivateKey, c))
int int
fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps) fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
{ {
/* By the time we are processing requests, we can guarantee that there /* By the time we are processing requests, we can guarantee that there
* is always a colormap installed */ * is always a colormap installed */
*pmaps = FbInstalledMaps[pScreen->myNum]->mid; *pmaps = GetInstalledColormap(pScreen)->mid;
return (1); return (1);
} }
@ -53,8 +55,7 @@ fbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
void void
fbInstallColormap(ColormapPtr pmap) fbInstallColormap(ColormapPtr pmap)
{ {
int index = pmap->pScreen->myNum; ColormapPtr oldpmap = GetInstalledColormap(pmap->pScreen);
ColormapPtr oldpmap = FbInstalledMaps[index];
if(pmap != oldpmap) if(pmap != oldpmap)
{ {
@ -63,7 +64,7 @@ fbInstallColormap(ColormapPtr pmap)
if(oldpmap != (ColormapPtr)None) if(oldpmap != (ColormapPtr)None)
WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid); WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
/* Install pmap */ /* Install pmap */
FbInstalledMaps[index] = pmap; SetInstalledColormap(pmap->pScreen, pmap);
WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid); WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);
} }
} }
@ -71,8 +72,7 @@ fbInstallColormap(ColormapPtr pmap)
void void
fbUninstallColormap(ColormapPtr pmap) fbUninstallColormap(ColormapPtr pmap)
{ {
int index = pmap->pScreen->myNum; ColormapPtr curpmap = GetInstalledColormap(pmap->pScreen);
ColormapPtr curpmap = FbInstalledMaps[index];
if(pmap == curpmap) if(pmap == curpmap)
{ {

View File

@ -427,14 +427,18 @@ ddxProcessArgument(int argc, char *argv[], int i)
return 0; return 0;
} }
static ColormapPtr InstalledMaps[MAXSCREENS]; static int cmapScrPrivateKeyIndex;
static DevPrivateKey cmapScrPrivateKey = &cmapScrPrivateKeyIndex;
#define GetInstalledColormap(s) ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, cmapScrPrivateKey))
#define SetInstalledColormap(s,c) (dixSetPrivate(&(s)->devPrivates, cmapScrPrivateKey, c))
static int static int
vfbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps) vfbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
{ {
/* By the time we are processing requests, we can guarantee that there /* By the time we are processing requests, we can guarantee that there
* is always a colormap installed */ * is always a colormap installed */
*pmaps = InstalledMaps[pScreen->myNum]->mid; *pmaps = GetInstalledColormap(pScreen)->mid;
return (1); return (1);
} }
@ -442,8 +446,7 @@ vfbListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
static void static void
vfbInstallColormap(ColormapPtr pmap) vfbInstallColormap(ColormapPtr pmap)
{ {
int index = pmap->pScreen->myNum; ColormapPtr oldpmap = GetInstalledColormap(pmap->pScreen);
ColormapPtr oldpmap = InstalledMaps[index];
if (pmap != oldpmap) if (pmap != oldpmap)
{ {
@ -459,7 +462,7 @@ vfbInstallColormap(ColormapPtr pmap)
if(oldpmap != (ColormapPtr)None) if(oldpmap != (ColormapPtr)None)
WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid); WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
/* Install pmap */ /* Install pmap */
InstalledMaps[index] = pmap; SetInstalledColormap(pmap->pScreen, pmap);
WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid); WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);
entries = pmap->pVisual->ColormapEntries; entries = pmap->pVisual->ColormapEntries;
@ -500,7 +503,7 @@ vfbInstallColormap(ColormapPtr pmap)
static void static void
vfbUninstallColormap(ColormapPtr pmap) vfbUninstallColormap(ColormapPtr pmap)
{ {
ColormapPtr curpmap = InstalledMaps[pmap->pScreen->myNum]; ColormapPtr curpmap = GetInstalledColormap(pmap->pScreen);
if(pmap == curpmap) if(pmap == curpmap)
{ {
@ -521,7 +524,7 @@ vfbStoreColors(ColormapPtr pmap, int ndef, xColorItem *pdefs)
XWDColor *pXWDCmap; XWDColor *pXWDCmap;
int i; int i;
if (pmap != InstalledMaps[pmap->pScreen->myNum]) if (pmap != GetInstalledColormap(pmap->pScreen))
{ {
return; return;
} }
@ -830,10 +833,10 @@ vfbCloseScreen(int index, ScreenPtr pScreen)
/* /*
* XXX probably lots of stuff to clean. For now, * XXX probably lots of stuff to clean. For now,
* clear InstalledMaps[] so that server reset works correctly. * clear installed colormaps so that server reset works correctly.
*/ */
for (i = 0; i < MAXSCREENS; i++) for (i = 0; i < screenInfo.numScreens; i++)
InstalledMaps[i] = NULL; SetInstalledColormap(screenInfo.screens[i], NULL);
return pScreen->CloseScreen(index, pScreen); return pScreen->CloseScreen(index, pScreen);
} }

View File

@ -731,7 +731,7 @@ DGAInstallCmap(ColormapPtr cmap)
/* We rely on the extension to check that DGA is active */ /* We rely on the extension to check that DGA is active */
if(!pScreenPriv->dgaColormap) if(!pScreenPriv->dgaColormap)
pScreenPriv->savedColormap = miInstalledMaps[pScreen->myNum]; pScreenPriv->savedColormap = GetInstalledmiColormap(pScreen);
pScreenPriv->dgaColormap = cmap; pScreenPriv->dgaColormap = cmap;

View File

@ -552,9 +552,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
xf86Initialising = TRUE; xf86Initialising = TRUE;
if (serverGeneration == 1) { if (serverGeneration == 1) {
pScreenInfo->numScreens = 0;
if ((xf86ServerName = strrchr(argv[0], '/')) != 0) if ((xf86ServerName = strrchr(argv[0], '/')) != 0)
xf86ServerName++; xf86ServerName++;
else else

View File

@ -82,9 +82,9 @@ typedef enum {
* mask is 0xFFFF0000. * mask is 0xFFFF0000.
*/ */
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(7, 0) #define ABI_VIDEODRV_VERSION SET_ABI_VERSION(8, 0)
#define ABI_XINPUT_VERSION SET_ABI_VERSION(9, 0) #define ABI_XINPUT_VERSION SET_ABI_VERSION(10, 0)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(3, 0) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(4, 0)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 6) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 6)
#define MODINFOSTRING1 0xef23fdc5 #define MODINFOSTRING1 0xef23fdc5

View File

@ -63,10 +63,10 @@
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\ #define SCREEN_EPILOGUE(pScreen, field, wrapper)\
((pScreen)->field = wrapper) ((pScreen)->field = wrapper)
#define LOAD_PALETTE(pmap, index) \ #define LOAD_PALETTE(pmap) \
((pmap == miInstalledMaps[index]) && \ ((pmap == GetInstalledmiColormap(pmap->pScreen)) && \
((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || \ ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || \
xf86Screens[index]->vtSema || pScreenPriv->isDGAmode)) xf86Screens[pmap->pScreen->myNum]->vtSema || pScreenPriv->isDGAmode))
typedef struct _CMapLink { typedef struct _CMapLink {
@ -221,7 +221,7 @@ Bool xf86HandleColormaps(
} }
/* Force the initial map to be loaded */ /* Force the initial map to be loaded */
miInstalledMaps[pScreen->myNum] = NULL; SetInstalledmiColormap(pScreen, NULL);
CMapInstallColormap(pDefMap); CMapInstallColormap(pDefMap);
return TRUE; return TRUE;
} }
@ -425,11 +425,10 @@ static void
CMapInstallColormap(ColormapPtr pmap) CMapInstallColormap(ColormapPtr pmap)
{ {
ScreenPtr pScreen = pmap->pScreen; ScreenPtr pScreen = pmap->pScreen;
int index = pScreen->myNum;
CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate( CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
&pScreen->devPrivates, CMapScreenKey); &pScreen->devPrivates, CMapScreenKey);
if (pmap == miInstalledMaps[index]) if (pmap == GetInstalledmiColormap(pmap->pScreen))
return; return;
pScreen->InstallColormap = pScreenPriv->InstallColormap; pScreen->InstallColormap = pScreenPriv->InstallColormap;
@ -438,15 +437,15 @@ CMapInstallColormap(ColormapPtr pmap)
/* Important. We let the lower layers, namely DGA, /* Important. We let the lower layers, namely DGA,
overwrite the choice of Colormap to install */ overwrite the choice of Colormap to install */
if (miInstalledMaps[index]) if (GetInstalledmiColormap(pmap->pScreen))
pmap = miInstalledMaps[index]; pmap = GetInstalledmiColormap(pmap->pScreen);
if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) && if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
(pmap->pVisual->class == TrueColor) && (pmap->pVisual->class == TrueColor) &&
CMapColormapUseMax(pmap->pVisual, pScreenPriv)) CMapColormapUseMax(pmap->pVisual, pScreenPriv))
return; return;
if(LOAD_PALETTE(pmap, index)) if(LOAD_PALETTE(pmap))
CMapReinstallMap(pmap); CMapReinstallMap(pmap);
} }
@ -461,8 +460,8 @@ CMapEnterVT(int index, int flags)
&pScreen->devPrivates, CMapScreenKey); &pScreen->devPrivates, CMapScreenKey);
if((*pScreenPriv->EnterVT)(index, flags)) { if((*pScreenPriv->EnterVT)(index, flags)) {
if(miInstalledMaps[index]) if(GetInstalledmiColormap(pScreen))
CMapReinstallMap(miInstalledMaps[index]); CMapReinstallMap(GetInstalledmiColormap(pScreen));
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
@ -477,8 +476,8 @@ CMapSwitchMode(int index, DisplayModePtr mode, int flags)
&pScreen->devPrivates, CMapScreenKey); &pScreen->devPrivates, CMapScreenKey);
if((*pScreenPriv->SwitchMode)(index, mode, flags)) { if((*pScreenPriv->SwitchMode)(index, mode, flags)) {
if(miInstalledMaps[index]) if(GetInstalledmiColormap(pScreen))
CMapReinstallMap(miInstalledMaps[index]); CMapReinstallMap(GetInstalledmiColormap(pScreen));
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
@ -497,9 +496,9 @@ CMapSetDGAMode(int index, int num, DGADevicePtr dev)
pScreenPriv->isDGAmode = DGAActive(index); pScreenPriv->isDGAmode = DGAActive(index);
if(!pScreenPriv->isDGAmode && miInstalledMaps[index] if(!pScreenPriv->isDGAmode && GetInstalledmiColormap(pScreen)
&& xf86Screens[pScreen->myNum]->vtSema) && xf86Screens[pScreen->myNum]->vtSema)
CMapReinstallMap(miInstalledMaps[index]); CMapReinstallMap(GetInstalledmiColormap(pScreen));
return ret; return ret;
} }
@ -649,7 +648,7 @@ CMapRefreshColors(ColormapPtr pmap, int defs, int* indices)
} }
if(LOAD_PALETTE(pmap, pmap->pScreen->myNum)) if(LOAD_PALETTE(pmap))
(*pScrn->LoadPalette)(pScreenPriv->pScrn, defs, indices, (*pScrn->LoadPalette)(pScreenPriv->pScrn, defs, indices,
colors, pmap->pVisual); colors, pmap->pVisual);
@ -802,7 +801,7 @@ CMapSetOverscan(ColormapPtr pmap, int defs, int *indices)
} }
if (newOverscan) { if (newOverscan) {
pColPriv->overscan = overscan; pColPriv->overscan = overscan;
if (LOAD_PALETTE(pmap, pmap->pScreen->myNum)) { if (LOAD_PALETTE(pmap)) {
#ifdef DEBUGOVERSCAN #ifdef DEBUGOVERSCAN
ErrorF("SetOverscan() called from CmapSetOverscan\n"); ErrorF("SetOverscan() called from CmapSetOverscan\n");
#endif #endif
@ -929,10 +928,10 @@ CMapChangeGamma(
pLink = pLink->next; pLink = pLink->next;
} }
if(miInstalledMaps[pScreen->myNum] && if(GetInstalledmiColormap(pScreen) &&
((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) ||
pScrn->vtSema || pScreenPriv->isDGAmode)) { pScrn->vtSema || pScreenPriv->isDGAmode)) {
ColormapPtr pMap = miInstalledMaps[pScreen->myNum]; ColormapPtr pMap = GetInstalledmiColormap(pScreen);
if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) && if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
(pMap->pVisual->class == TrueColor) && (pMap->pVisual->class == TrueColor) &&
@ -951,9 +950,9 @@ CMapChangeGamma(
if(pLink) { if(pLink) {
/* need to trick CMapRefreshColors() into thinking /* need to trick CMapRefreshColors() into thinking
this is the currently installed map */ this is the currently installed map */
miInstalledMaps[pScreen->myNum] = pLink->cmap; SetInstalledmiColormap(pScreen, pLink->cmap);
CMapReinstallMap(pLink->cmap); CMapReinstallMap(pLink->cmap);
miInstalledMaps[pScreen->myNum] = pMap; SetInstalledmiColormap(pScreen, pMap);
} }
} else } else
CMapReinstallMap(pMap); CMapReinstallMap(pMap);
@ -1035,10 +1034,10 @@ xf86ChangeGammaRamp(
pLink = pLink->next; pLink = pLink->next;
} }
if(miInstalledMaps[pScreen->myNum] && if(GetInstalledmiColormap(pScreen) &&
((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) ||
pScrn->vtSema || pScreenPriv->isDGAmode)) { pScrn->vtSema || pScreenPriv->isDGAmode)) {
ColormapPtr pMap = miInstalledMaps[pScreen->myNum]; ColormapPtr pMap = GetInstalledmiColormap(pScreen);
if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) && if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
(pMap->pVisual->class == TrueColor) && (pMap->pVisual->class == TrueColor) &&
@ -1057,9 +1056,9 @@ xf86ChangeGammaRamp(
if(pLink) { if(pLink) {
/* need to trick CMapRefreshColors() into thinking /* need to trick CMapRefreshColors() into thinking
this is the currently installed map */ this is the currently installed map */
miInstalledMaps[pScreen->myNum] = pLink->cmap; SetInstalledmiColormap(pScreen, pLink->cmap);
CMapReinstallMap(pLink->cmap); CMapReinstallMap(pLink->cmap);
miInstalledMaps[pScreen->myNum] = pMap; SetInstalledmiColormap(pScreen, pMap);
} }
} else } else
CMapReinstallMap(pMap); CMapReinstallMap(pMap);

View File

@ -186,7 +186,9 @@ typedef struct {
int num; int num;
} OffscreenImageRec; } OffscreenImageRec;
static OffscreenImageRec OffscreenImages[MAXSCREENS]; static int OffscreenPrivateKeyIndex;
static DevPrivateKey OffscreenPrivateKey = &OffscreenPrivateKeyIndex;
#define GetOffscreenImage(pScreen) ((OffscreenImageRec *) dixLookupPrivate(&(pScreen)->devPrivates, OffscreenPrivateKey))
Bool Bool
xf86XVRegisterOffscreenImages( xf86XVRegisterOffscreenImages(
@ -194,9 +196,15 @@ xf86XVRegisterOffscreenImages(
XF86OffscreenImagePtr images, XF86OffscreenImagePtr images,
int num int num
){ ){
OffscreenImages[pScreen->myNum].num = num; OffscreenImageRec *OffscreenImage;
OffscreenImages[pScreen->myNum].images = images; if(!dixRequestPrivate(OffscreenPrivateKey, sizeof(OffscreenImageRec)) ||
!(OffscreenImage = GetOffscreenImage(pScreen)))
/* Every X.org driver assumes this function always succeeds, so
* just die on allocation failure. */
FatalError("Could not allocate private storage for XV offscreen images.\n");
OffscreenImage->num = num;
OffscreenImage->images = images;
return TRUE; return TRUE;
} }
@ -205,8 +213,9 @@ xf86XVQueryOffscreenImages(
ScreenPtr pScreen, ScreenPtr pScreen,
int *num int *num
){ ){
*num = OffscreenImages[pScreen->myNum].num; OffscreenImageRec *OffscreenImage = GetOffscreenImage(pScreen);
return OffscreenImages[pScreen->myNum].images; *num = OffscreenImage->num;
return OffscreenImage->images;
} }
@ -1177,9 +1186,6 @@ xf86XVCloseScreen(int i, ScreenPtr pScreen)
XvAdaptorPtr pa; XvAdaptorPtr pa;
int c; int c;
/* Clear offscreen images */
memset(&OffscreenImages[pScreen->myNum], 0, sizeof(OffscreenImages[0]));
if(!ScreenPriv) return TRUE; if(!ScreenPriv) return TRUE;
if(ScreenPriv->videoGC) { if(ScreenPriv->videoGC) {

View File

@ -57,12 +57,12 @@ static void XDGAResetProc(ExtensionEntry *extEntry);
static void DGAClientStateChange (CallbackListPtr*, pointer, pointer); static void DGAClientStateChange (CallbackListPtr*, pointer, pointer);
static ClientPtr DGAClients[MAXSCREENS];
unsigned char DGAReqCode = 0; unsigned char DGAReqCode = 0;
int DGAErrorBase; int DGAErrorBase;
int DGAEventBase; int DGAEventBase;
static int DGAScreenPrivateKeyIndex;
static DevPrivateKey DGAScreenPrivateKey = &DGAScreenPrivateKeyIndex;
static int DGAClientPrivateKeyIndex; static int DGAClientPrivateKeyIndex;
static DevPrivateKey DGAClientPrivateKey = &DGAClientPrivateKeyIndex; static DevPrivateKey DGAClientPrivateKey = &DGAClientPrivateKeyIndex;
static int DGACallbackRefCount = 0; static int DGACallbackRefCount = 0;
@ -73,6 +73,11 @@ typedef struct {
int minor; int minor;
} DGAPrivRec, *DGAPrivPtr; } DGAPrivRec, *DGAPrivPtr;
#define DGA_GETCLIENT(idx) ((ClientPtr) \
dixLookupPrivate(&screenInfo.screens[idx]->devPrivates, DGAScreenPrivateKey))
#define DGA_SETCLIENT(idx,p) \
dixSetPrivate(&screenInfo.screens[idx]->devPrivates, DGAScreenPrivateKey, p)
#define DGA_GETPRIV(c) ((DGAPrivPtr) \ #define DGA_GETPRIV(c) ((DGAPrivPtr) \
dixLookupPrivate(&(c)->devPrivates, DGAClientPrivateKey)) dixLookupPrivate(&(c)->devPrivates, DGAClientPrivateKey))
#define DGA_SETPRIV(c,p) \ #define DGA_SETPRIV(c,p) \
@ -93,9 +98,6 @@ XFree86DGAExtensionInit(INITARGS)
StandardMinorOpcode))) { StandardMinorOpcode))) {
int i; int i;
for(i = 0; i < MAXSCREENS; i++)
DGAClients[i] = NULL;
DGAReqCode = (unsigned char)extEntry->base; DGAReqCode = (unsigned char)extEntry->base;
DGAErrorBase = extEntry->errorBase; DGAErrorBase = extEntry->errorBase;
DGAEventBase = extEntry->eventBase; DGAEventBase = extEntry->eventBase;
@ -282,7 +284,7 @@ DGAClientStateChange (
int i; int i;
for(i = 0; i < screenInfo.numScreens; i++) { for(i = 0; i < screenInfo.numScreens; i++) {
if(DGAClients[i] == pci->client) { if(DGA_GETCLIENT(i) == pci->client) {
client = pci->client; client = pci->client;
break; break;
} }
@ -294,7 +296,7 @@ DGAClientStateChange (
XDGAModeRec mode; XDGAModeRec mode;
PixmapPtr pPix; PixmapPtr pPix;
DGAClients[i] = NULL; DGA_SETCLIENT(i, NULL);
DGASelectInput(i, NULL, 0); DGASelectInput(i, NULL, 0);
DGASetMode(i, 0, &mode, &pPix); DGASetMode(i, 0, &mode, &pPix);
@ -311,10 +313,12 @@ ProcXDGASetMode(ClientPtr client)
XDGAModeRec mode; XDGAModeRec mode;
xXDGAModeInfo info; xXDGAModeInfo info;
PixmapPtr pPix; PixmapPtr pPix;
ClientPtr owner;
int size; int size;
if (stuff->screen > screenInfo.numScreens) if (stuff->screen > screenInfo.numScreens)
return BadValue; return BadValue;
owner = DGA_GETCLIENT(stuff->screen);
REQUEST_SIZE_MATCH(xXDGASetModeReq); REQUEST_SIZE_MATCH(xXDGASetModeReq);
rep.type = X_Reply; rep.type = X_Reply;
@ -326,16 +330,15 @@ ProcXDGASetMode(ClientPtr client)
if (!DGAAvailable(stuff->screen)) if (!DGAAvailable(stuff->screen))
return DGAErrorBase + XF86DGANoDirectVideoMode; return DGAErrorBase + XF86DGANoDirectVideoMode;
if(DGAClients[stuff->screen] && if(owner && owner != client)
(DGAClients[stuff->screen] != client))
return DGAErrorBase + XF86DGANoDirectVideoMode; return DGAErrorBase + XF86DGANoDirectVideoMode;
if(!stuff->mode) { if(!stuff->mode) {
if(DGAClients[stuff->screen]) { if(owner) {
if(--DGACallbackRefCount == 0) if(--DGACallbackRefCount == 0)
DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL); DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
} }
DGAClients[stuff->screen] = NULL; DGA_SETCLIENT(stuff->screen, NULL);
DGASelectInput(stuff->screen, NULL, 0); DGASelectInput(stuff->screen, NULL, 0);
DGASetMode(stuff->screen, 0, &mode, &pPix); DGASetMode(stuff->screen, 0, &mode, &pPix);
WriteToClient(client, sz_xXDGASetModeReply, (char*)&rep); WriteToClient(client, sz_xXDGASetModeReply, (char*)&rep);
@ -345,12 +348,12 @@ ProcXDGASetMode(ClientPtr client)
if(Success != DGASetMode(stuff->screen, stuff->mode, &mode, &pPix)) if(Success != DGASetMode(stuff->screen, stuff->mode, &mode, &pPix))
return BadValue; return BadValue;
if(!DGAClients[stuff->screen]) { if(!owner) {
if(DGACallbackRefCount++ == 0) if(DGACallbackRefCount++ == 0)
AddCallback (&ClientStateCallback, DGAClientStateChange, NULL); AddCallback (&ClientStateCallback, DGAClientStateChange, NULL);
} }
DGAClients[stuff->screen] = client; DGA_SETCLIENT(stuff->screen, client);
if(pPix) { if(pPix) {
if(AddResource(stuff->pid, RT_PIXMAP, (pointer)(pPix))) { if(AddResource(stuff->pid, RT_PIXMAP, (pointer)(pPix))) {
@ -405,7 +408,7 @@ ProcXDGASetViewport(ClientPtr client)
if (stuff->screen > screenInfo.numScreens) if (stuff->screen > screenInfo.numScreens)
return BadValue; return BadValue;
if(DGAClients[stuff->screen] != client) if(DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGASetViewportReq); REQUEST_SIZE_MATCH(xXDGASetViewportReq);
@ -425,7 +428,7 @@ ProcXDGAInstallColormap(ClientPtr client)
if (stuff->screen > screenInfo.numScreens) if (stuff->screen > screenInfo.numScreens)
return BadValue; return BadValue;
if(DGAClients[stuff->screen] != client) if(DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGAInstallColormapReq); REQUEST_SIZE_MATCH(xXDGAInstallColormapReq);
@ -451,12 +454,12 @@ ProcXDGASelectInput(ClientPtr client)
if (stuff->screen > screenInfo.numScreens) if (stuff->screen > screenInfo.numScreens)
return BadValue; return BadValue;
if(DGAClients[stuff->screen] != client) if(DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGASelectInputReq); REQUEST_SIZE_MATCH(xXDGASelectInputReq);
if(DGAClients[stuff->screen] == client) if(DGA_GETCLIENT(stuff->screen) == client)
DGASelectInput(stuff->screen, client, stuff->mask); DGASelectInput(stuff->screen, client, stuff->mask);
return (client->noClientException); return (client->noClientException);
@ -471,7 +474,7 @@ ProcXDGAFillRectangle(ClientPtr client)
if (stuff->screen > screenInfo.numScreens) if (stuff->screen > screenInfo.numScreens)
return BadValue; return BadValue;
if(DGAClients[stuff->screen] != client) if(DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGAFillRectangleReq); REQUEST_SIZE_MATCH(xXDGAFillRectangleReq);
@ -491,7 +494,7 @@ ProcXDGACopyArea(ClientPtr client)
if (stuff->screen > screenInfo.numScreens) if (stuff->screen > screenInfo.numScreens)
return BadValue; return BadValue;
if(DGAClients[stuff->screen] != client) if(DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGACopyAreaReq); REQUEST_SIZE_MATCH(xXDGACopyAreaReq);
@ -512,7 +515,7 @@ ProcXDGACopyTransparentArea(ClientPtr client)
if (stuff->screen > screenInfo.numScreens) if (stuff->screen > screenInfo.numScreens)
return BadValue; return BadValue;
if(DGAClients[stuff->screen] != client) if(DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq); REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq);
@ -534,7 +537,7 @@ ProcXDGAGetViewportStatus(ClientPtr client)
if (stuff->screen > screenInfo.numScreens) if (stuff->screen > screenInfo.numScreens)
return BadValue; return BadValue;
if(DGAClients[stuff->screen] != client) if(DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq); REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq);
@ -557,7 +560,7 @@ ProcXDGASync(ClientPtr client)
if (stuff->screen > screenInfo.numScreens) if (stuff->screen > screenInfo.numScreens)
return BadValue; return BadValue;
if(DGAClients[stuff->screen] != client) if(DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGASyncReq); REQUEST_SIZE_MATCH(xXDGASyncReq);
@ -602,7 +605,7 @@ ProcXDGAChangePixmapMode(ClientPtr client)
if (stuff->screen > screenInfo.numScreens) if (stuff->screen > screenInfo.numScreens)
return BadValue; return BadValue;
if(DGAClients[stuff->screen] != client) if(DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq); REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq);
@ -633,7 +636,7 @@ ProcXDGACreateColormap(ClientPtr client)
if (stuff->screen > screenInfo.numScreens) if (stuff->screen > screenInfo.numScreens)
return BadValue; return BadValue;
if(DGAClients[stuff->screen] != client) if(DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXDGACreateColormapReq); REQUEST_SIZE_MATCH(xXDGACreateColormapReq);
@ -713,18 +716,19 @@ ProcXF86DGADirectVideo(ClientPtr client)
int num; int num;
PixmapPtr pix; PixmapPtr pix;
XDGAModeRec mode; XDGAModeRec mode;
ClientPtr owner;
REQUEST(xXF86DGADirectVideoReq); REQUEST(xXF86DGADirectVideoReq);
if (stuff->screen > screenInfo.numScreens) if (stuff->screen > screenInfo.numScreens)
return BadValue; return BadValue;
owner = DGA_GETCLIENT(stuff->screen);
REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq); REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq);
if (!DGAAvailable(stuff->screen)) if (!DGAAvailable(stuff->screen))
return DGAErrorBase + XF86DGANoDirectVideoMode; return DGAErrorBase + XF86DGANoDirectVideoMode;
if (DGAClients[stuff->screen] && if (owner && owner != client)
(DGAClients[stuff->screen] != client))
return DGAErrorBase + XF86DGANoDirectVideoMode; return DGAErrorBase + XF86DGANoDirectVideoMode;
if (stuff->enable & XF86DGADirectGraphics) { if (stuff->enable & XF86DGADirectGraphics) {
@ -743,19 +747,19 @@ ProcXF86DGADirectVideo(ClientPtr client)
/* We need to track the client and attach the teardown callback */ /* We need to track the client and attach the teardown callback */
if (stuff->enable & if (stuff->enable &
(XF86DGADirectGraphics | XF86DGADirectKeyb | XF86DGADirectMouse)) { (XF86DGADirectGraphics | XF86DGADirectKeyb | XF86DGADirectMouse)) {
if (!DGAClients[stuff->screen]) { if (!owner) {
if (DGACallbackRefCount++ == 0) if (DGACallbackRefCount++ == 0)
AddCallback (&ClientStateCallback, DGAClientStateChange, NULL); AddCallback (&ClientStateCallback, DGAClientStateChange, NULL);
} }
DGAClients[stuff->screen] = client; DGA_SETCLIENT(stuff->screen, client);
} else { } else {
if (DGAClients[stuff->screen]) { if (owner) {
if (--DGACallbackRefCount == 0) if (--DGACallbackRefCount == 0)
DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL); DeleteCallback(&ClientStateCallback, DGAClientStateChange, NULL);
} }
DGAClients[stuff->screen] = NULL; DGA_SETCLIENT(stuff->screen, NULL);
} }
return (client->noClientException); return (client->noClientException);
@ -800,7 +804,7 @@ ProcXF86DGASetViewPort(ClientPtr client)
if (stuff->screen > screenInfo.numScreens) if (stuff->screen > screenInfo.numScreens)
return BadValue; return BadValue;
if (DGAClients[stuff->screen] != client) if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq); REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq);
@ -864,7 +868,7 @@ ProcXF86DGAInstallColormap(ClientPtr client)
if (stuff->screen > screenInfo.numScreens) if (stuff->screen > screenInfo.numScreens)
return BadValue; return BadValue;
if (DGAClients[stuff->screen] != client) if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq); REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq);
@ -913,7 +917,7 @@ ProcXF86DGAViewPortChanged(ClientPtr client)
if (stuff->screen > screenInfo.numScreens) if (stuff->screen > screenInfo.numScreens)
return BadValue; return BadValue;
if (DGAClients[stuff->screen] != client) if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq); REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);

View File

@ -50,7 +50,7 @@ vgaListInstalledColormaps(pScreen, pmaps)
/* By the time we are processing requests, we can guarantee that there /* By the time we are processing requests, we can guarantee that there
* is always a colormap installed */ * is always a colormap installed */
*pmaps = miInstalledMaps[pScreen->myNum]->mid; *pmaps = GetInstalledmiColormap(pScreen)->mid;
return(1); return(1);
} }
@ -62,13 +62,13 @@ vgaGetInstalledColormaps(pScreen, pmaps)
/* By the time we are processing requests, we can guarantee that there /* By the time we are processing requests, we can guarantee that there
* is always a colormap installed */ * is always a colormap installed */
*pmaps = miInstalledMaps[pScreen->myNum]; *pmaps = GetInstalledmiColormap(pScreen);
return(1); return(1);
} }
int vgaCheckColorMap(ColormapPtr pmap) int vgaCheckColorMap(ColormapPtr pmap)
{ {
return (pmap != miInstalledMaps[pmap->pScreen->myNum]); return (pmap != GetInstalledmiColormap(pmap->pScreen));
} }
@ -217,7 +217,7 @@ void
vgaInstallColormap(pmap) vgaInstallColormap(pmap)
ColormapPtr pmap; ColormapPtr pmap;
{ {
ColormapPtr oldmap = miInstalledMaps[pmap->pScreen->myNum]; ColormapPtr oldmap = GetInstalledmiColormap(pmap->pScreen);
int entries; int entries;
Pixel * ppix; Pixel * ppix;
xrgb * prgb; xrgb * prgb;
@ -242,7 +242,7 @@ vgaInstallColormap(pmap)
if ( oldmap != NOMAPYET) if ( oldmap != NOMAPYET)
WalkTree( pmap->pScreen, TellLostMap, &oldmap->mid); WalkTree( pmap->pScreen, TellLostMap, &oldmap->mid);
miInstalledMaps[pmap->pScreen->myNum] = pmap; SetInstalledmiColormap(pmap->pScreen, pmap);
for ( i=0; i<entries; i++) ppix[i] = i; for ( i=0; i<entries; i++) ppix[i] = i;
@ -273,13 +273,13 @@ vgaUninstallColormap(pmap)
ColormapPtr defColormap; ColormapPtr defColormap;
if ( pmap != miInstalledMaps[pmap->pScreen->myNum] ) if ( pmap != GetInstalledmiColormap(pmap->pScreen))
return; return;
dixLookupResourceByType((pointer *)&defColormap, pmap->pScreen->defColormap, dixLookupResourceByType((pointer *)&defColormap, pmap->pScreen->defColormap,
RT_COLORMAP, serverClient, DixInstallAccess); RT_COLORMAP, serverClient, DixInstallAccess);
if (defColormap == miInstalledMaps[pmap->pScreen->myNum]) if (defColormap == GetInstalledmiColormap(pmap->pScreen))
return; return;
(*pmap->pScreen->InstallColormap) (defColormap); (*pmap->pScreen->InstallColormap) (defColormap);

View File

@ -34,7 +34,11 @@ is" without express or implied warranty.
#include "XNWindow.h" #include "XNWindow.h"
#include "Args.h" #include "Args.h"
static ColormapPtr InstalledMaps[MAXSCREENS]; static int cmapScrPrivateKeyIndex;
static DevPrivateKey cmapScrPrivateKey = &cmapScrPrivateKeyIndex;
#define GetInstalledColormap(s) ((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, cmapScrPrivateKey))
#define SetInstalledColormap(s,c) (dixSetPrivate(&(s)->devPrivates, cmapScrPrivateKey, c))
Bool Bool
xnestCreateColormap(ColormapPtr pCmap) xnestCreateColormap(ColormapPtr pCmap)
@ -332,11 +336,7 @@ xnestDirectUninstallColormaps(ScreenPtr pScreen)
void void
xnestInstallColormap(ColormapPtr pCmap) xnestInstallColormap(ColormapPtr pCmap)
{ {
int index; ColormapPtr pOldCmap = GetInstalledColormap(pCmap->pScreen);
ColormapPtr pOldCmap;
index = pCmap->pScreen->myNum;
pOldCmap = InstalledMaps[index];
if(pCmap != pOldCmap) if(pCmap != pOldCmap)
{ {
@ -346,7 +346,7 @@ xnestInstallColormap(ColormapPtr pCmap)
if(pOldCmap != (ColormapPtr)None) if(pOldCmap != (ColormapPtr)None)
WalkTree(pCmap->pScreen, TellLostMap, (pointer)&pOldCmap->mid); WalkTree(pCmap->pScreen, TellLostMap, (pointer)&pOldCmap->mid);
InstalledMaps[index] = pCmap; SetInstalledColormap(pCmap->pScreen, pCmap);
WalkTree(pCmap->pScreen, TellGainedMap, (pointer)&pCmap->mid); WalkTree(pCmap->pScreen, TellGainedMap, (pointer)&pCmap->mid);
xnestSetInstalledColormapWindows(pCmap->pScreen); xnestSetInstalledColormapWindows(pCmap->pScreen);
@ -357,11 +357,7 @@ xnestInstallColormap(ColormapPtr pCmap)
void void
xnestUninstallColormap(ColormapPtr pCmap) xnestUninstallColormap(ColormapPtr pCmap)
{ {
int index; ColormapPtr pCurCmap = GetInstalledColormap(pCmap->pScreen);
ColormapPtr pCurCmap;
index = pCmap->pScreen->myNum;
pCurCmap = InstalledMaps[index];
if(pCmap == pCurCmap) if(pCmap == pCurCmap)
{ {
@ -382,7 +378,7 @@ int
xnestListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIDs) xnestListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIDs)
{ {
if (xnestInstalledDefaultColormap) { if (xnestInstalledDefaultColormap) {
*pCmapIDs = InstalledMaps[pScreen->myNum]->mid; *pCmapIDs = GetInstalledColormap(pScreen)->mid;
return 1; return 1;
} }
else else

View File

@ -64,8 +64,7 @@ typedef HRESULT (*SHGETFOLDERPATHPROC)(
*/ */
extern int g_iNumScreens; extern int g_iNumScreens;
extern winScreenInfo g_ScreenInfo[]; extern winScreenInfo * g_ScreenInfo;
extern int g_iLastScreen;
extern char * g_pszCommandLine; extern char * g_pszCommandLine;
extern Bool g_fSilentFatalError; extern Bool g_fSilentFatalError;
@ -115,9 +114,6 @@ void
OsVendorVErrorF (const char *pszFormat, va_list va_args); OsVendorVErrorF (const char *pszFormat, va_list va_args);
#endif #endif
void
winInitializeDefaultScreens (void);
static Bool static Bool
winCheckDisplayNumber (void); winCheckDisplayNumber (void);
@ -727,22 +723,16 @@ OsVendorInit (void)
/* Add a default screen if no screens were specified */ /* Add a default screen if no screens were specified */
if (g_iNumScreens == 0) if (g_iNumScreens == 0)
{ {
winDebug ("OsVendorInit - Creating bogus screen 0\n"); winDebug ("OsVendorInit - Creating default screen 0\n");
/*
* We need to initialize default screens if no arguments
* were processed. Otherwise, the default screens would
* already have been initialized by ddxProcessArgument ().
*/
winInitializeDefaultScreens ();
/* /*
* Add a screen 0 using the defaults set by * We need to initialize the default screen 0 if no -screen
* winInitializeDefaultScreens () and any additional parameters * arguments were processed.
* processed by ddxProcessArgument (). *
* Add a screen 0 using the defaults set by winInitializeDefaultScreens()
* and any additional default screen parameters given
*/ */
g_iNumScreens = 1; winInitializeScreens(1);
g_iLastScreen = 0;
/* We have to flag this as an explicit screen, even though it isn't */ /* We have to flag this as an explicit screen, even though it isn't */
g_ScreenInfo[0].fExplicitScreen = TRUE; g_ScreenInfo[0].fExplicitScreen = TRUE;

View File

@ -622,7 +622,7 @@ typedef struct {
* Extern declares for general global variables * Extern declares for general global variables
*/ */
extern winScreenInfo g_ScreenInfo[]; extern winScreenInfo * g_ScreenInfo;
extern miPointerScreenFuncRec g_winPointerCursorFuncs; extern miPointerScreenFuncRec g_winPointerCursorFuncs;
extern DWORD g_dwEvents; extern DWORD g_dwEvents;
#ifdef HAS_DEVWINDOWS #ifdef HAS_DEVWINDOWS
@ -1450,6 +1450,12 @@ winWindowsWMExtensionInit (void);
Bool Bool
winInitCursor (ScreenPtr pScreen); winInitCursor (ScreenPtr pScreen);
/*
* winprocarg.c
*/
void
winInitializeScreens(int maxscreens);
/* /*
* END DDX and DIX Function Prototypes * END DDX and DIX Function Prototypes
*/ */

View File

@ -41,8 +41,7 @@
*/ */
int g_iNumScreens = 0; int g_iNumScreens = 0;
winScreenInfo g_ScreenInfo[MAXSCREENS]; winScreenInfo * g_ScreenInfo = 0;
int g_iLastScreen = -1;
#ifdef HAS_DEVWINDOWS #ifdef HAS_DEVWINDOWS
int g_fdMessageQueue = WIN_FD_INVALID; int g_fdMessageQueue = WIN_FD_INVALID;
#endif #endif
@ -57,7 +56,6 @@ DevPrivateKey g_iPixmapPrivateKey = &g_iPixmapPrivateKeyIndex;
static int g_iWindowPrivateKeyIndex; static int g_iWindowPrivateKeyIndex;
DevPrivateKey g_iWindowPrivateKey = &g_iWindowPrivateKeyIndex; DevPrivateKey g_iWindowPrivateKey = &g_iWindowPrivateKeyIndex;
unsigned long g_ulServerGeneration = 0; unsigned long g_ulServerGeneration = 0;
Bool g_fInitializedDefaultScreens = FALSE;
DWORD g_dwEnginesSupported = 0; DWORD g_dwEnginesSupported = 0;
HINSTANCE g_hInstance = 0; HINSTANCE g_hInstance = 0;
HWND g_hDlgDepthChange = NULL; HWND g_hDlgDepthChange = NULL;

View File

@ -45,9 +45,7 @@ from The Open Group.
*/ */
extern int g_iNumScreens; extern int g_iNumScreens;
extern winScreenInfo g_ScreenInfo[]; extern winScreenInfo * g_ScreenInfo;
extern int g_iLastScreen;
extern Bool g_fInitializedDefaultScreens;
#ifdef XWIN_CLIPBOARD #ifdef XWIN_CLIPBOARD
extern Bool g_fUnicodeClipboard; extern Bool g_fUnicodeClipboard;
extern Bool g_fClipboard; extern Bool g_fClipboard;
@ -130,25 +128,25 @@ winLogVersionInfo (void);
void OsVendorVErrorF (const char *pszFormat, va_list va_args); void OsVendorVErrorF (const char *pszFormat, va_list va_args);
#endif #endif
void
winInitializeDefaultScreens (void);
/* /*
* Process arguments on the command line * Process arguments on the command line
*/ */
void static int iLastScreen = -1;
winInitializeDefaultScreens (void) static winScreenInfo defaultScreenInfo;
{
int i;
DWORD dwWidth, dwHeight;
/* Bail out early if default screens have already been initialized */ static void
if (g_fInitializedDefaultScreens) winInitializeScreenDefaults(void)
{
DWORD dwWidth, dwHeight;
static Bool fInitializedScreenDefaults = FALSE;
/* Bail out early if default screen has already been initialized */
if (fInitializedScreenDefaults)
return; return;
/* Zero the memory used for storing the screen info */ /* Zero the memory used for storing the screen info */
ZeroMemory (g_ScreenInfo, MAXSCREENS * sizeof (winScreenInfo)); memset(&defaultScreenInfo, 0, sizeof(winScreenInfo));
/* Get default width and height */ /* Get default width and height */
/* /*
@ -158,62 +156,88 @@ winInitializeDefaultScreens (void)
dwWidth = GetSystemMetrics (SM_CXSCREEN); dwWidth = GetSystemMetrics (SM_CXSCREEN);
dwHeight = GetSystemMetrics (SM_CYSCREEN); dwHeight = GetSystemMetrics (SM_CYSCREEN);
winErrorFVerb (2, "winInitializeDefaultScreens - w %d h %d\n", winErrorFVerb (2, "winInitializeScreenDefaults - w %d h %d\n",
(int) dwWidth, (int) dwHeight); (int) dwWidth, (int) dwHeight);
/* Set a default DPI, if no parameter was passed */ /* Set a default DPI, if no parameter was passed */
if (monitorResolution == 0) if (monitorResolution == 0)
monitorResolution = WIN_DEFAULT_DPI; monitorResolution = WIN_DEFAULT_DPI;
for (i = 0; i < MAXSCREENS; ++i) defaultScreenInfo.dwWidth = dwWidth;
{ defaultScreenInfo.dwHeight = dwHeight;
g_ScreenInfo[i].dwScreen = i; defaultScreenInfo.dwUserWidth = dwWidth;
g_ScreenInfo[i].dwWidth = dwWidth; defaultScreenInfo.dwUserHeight = dwHeight;
g_ScreenInfo[i].dwHeight = dwHeight; defaultScreenInfo.fUserGaveHeightAndWidth = WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH;
g_ScreenInfo[i].dwUserWidth = dwWidth; defaultScreenInfo.fUserGavePosition = FALSE;
g_ScreenInfo[i].dwUserHeight = dwHeight; defaultScreenInfo.dwBPP = WIN_DEFAULT_BPP;
g_ScreenInfo[i].fUserGaveHeightAndWidth defaultScreenInfo.dwClipUpdatesNBoxes = WIN_DEFAULT_CLIP_UPDATES_NBOXES;
= WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH;
g_ScreenInfo[i].fUserGavePosition = FALSE;
g_ScreenInfo[i].dwBPP = WIN_DEFAULT_BPP;
g_ScreenInfo[i].dwClipUpdatesNBoxes = WIN_DEFAULT_CLIP_UPDATES_NBOXES;
#ifdef XWIN_EMULATEPSEUDO #ifdef XWIN_EMULATEPSEUDO
g_ScreenInfo[i].fEmulatePseudo = WIN_DEFAULT_EMULATE_PSEUDO; defaultScreenInfo.fEmulatePseudo = WIN_DEFAULT_EMULATE_PSEUDO;
#endif #endif
g_ScreenInfo[i].dwRefreshRate = WIN_DEFAULT_REFRESH; defaultScreenInfo.dwRefreshRate = WIN_DEFAULT_REFRESH;
g_ScreenInfo[i].pfb = NULL; defaultScreenInfo.pfb = NULL;
g_ScreenInfo[i].fFullScreen = FALSE; defaultScreenInfo.fFullScreen = FALSE;
g_ScreenInfo[i].fDecoration = TRUE; defaultScreenInfo.fDecoration = TRUE;
#ifdef XWIN_MULTIWINDOWEXTWM #ifdef XWIN_MULTIWINDOWEXTWM
g_ScreenInfo[i].fMWExtWM = FALSE; defaultScreenInfo.fMWExtWM = FALSE;
g_ScreenInfo[i].fInternalWM = FALSE; defaultScreenInfo.fInternalWM = FALSE;
#endif #endif
g_ScreenInfo[i].fRootless = FALSE; defaultScreenInfo.fRootless = FALSE;
#ifdef XWIN_MULTIWINDOW #ifdef XWIN_MULTIWINDOW
g_ScreenInfo[i].fMultiWindow = FALSE; defaultScreenInfo.fMultiWindow = FALSE;
#endif #endif
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) #if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
g_ScreenInfo[i].fMultiMonitorOverride = FALSE; defaultScreenInfo.fMultiMonitorOverride = FALSE;
#endif #endif
g_ScreenInfo[i].fMultipleMonitors = FALSE; defaultScreenInfo.fMultipleMonitors = FALSE;
g_ScreenInfo[i].fLessPointer = FALSE; defaultScreenInfo.fLessPointer = FALSE;
g_ScreenInfo[i].fScrollbars = FALSE; defaultScreenInfo.fScrollbars = FALSE;
g_ScreenInfo[i].fNoTrayIcon = FALSE; defaultScreenInfo.fNoTrayIcon = FALSE;
g_ScreenInfo[i].iE3BTimeout = WIN_E3B_OFF; defaultScreenInfo.iE3BTimeout = WIN_E3B_OFF;
g_ScreenInfo[i].dwWidth_mm = (dwWidth / WIN_DEFAULT_DPI) defaultScreenInfo.dwWidth_mm = (dwWidth / WIN_DEFAULT_DPI) * 25.4;
* 25.4; defaultScreenInfo.dwHeight_mm = (dwHeight / WIN_DEFAULT_DPI) * 25.4;
g_ScreenInfo[i].dwHeight_mm = (dwHeight / WIN_DEFAULT_DPI) defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL;
* 25.4; defaultScreenInfo.fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL;
g_ScreenInfo[i].fUseWinKillKey = WIN_DEFAULT_WIN_KILL; defaultScreenInfo.fIgnoreInput = FALSE;
g_ScreenInfo[i].fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL; defaultScreenInfo.fExplicitScreen = FALSE;
g_ScreenInfo[i].fIgnoreInput = FALSE;
g_ScreenInfo[i].fExplicitScreen = FALSE; /* Note that the default screen has been initialized */
fInitializedScreenDefaults = TRUE;
}
static void
winInitializeScreen(int i)
{
winErrorFVerb (2, "winInitializeScreen - %d\n",i);
/* Initialize default screen values, if needed */
winInitializeScreenDefaults();
/* Copy the default screen info */
g_ScreenInfo[i] = defaultScreenInfo;
/* Set the screen number */
g_ScreenInfo[i].dwScreen = i;
}
void
winInitializeScreens(int maxscreens)
{
int i;
winErrorFVerb (2, "winInitializeScreens - %i\n", maxscreens);
if (maxscreens > g_iNumScreens)
{
/* Reallocate the memory for DDX-specific screen info */
g_ScreenInfo = realloc(g_ScreenInfo, maxscreens * sizeof (winScreenInfo));
/* Set default values for any new screens */
for (i = g_iNumScreens; i < maxscreens ; i++)
winInitializeScreen(i);
/* Keep a count of the number of screens */
g_iNumScreens = maxscreens;
} }
/* Signal that the default screens have been initialized */
g_fInitializedDefaultScreens = TRUE;
winErrorFVerb (2, "winInitializeDefaultScreens - Returning\n");
} }
/* See Porting Layer Definition - p. 57 */ /* See Porting Layer Definition - p. 57 */
@ -245,6 +269,7 @@ int
ddxProcessArgument (int argc, char *argv[], int i) ddxProcessArgument (int argc, char *argv[], int i)
{ {
static Bool s_fBeenHere = FALSE; static Bool s_fBeenHere = FALSE;
winScreenInfo *screenInfoPtr = NULL;
/* Initialize once */ /* Initialize once */
if (!s_fBeenHere) if (!s_fBeenHere)
@ -277,7 +302,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/ */
winErrorFVerb (2, "ddxProcessArgument - Initializing default " winErrorFVerb (2, "ddxProcessArgument - Initializing default "
"screens\n"); "screens\n");
winInitializeDefaultScreens (); winInitializeScreenDefaults();
} }
} }
@ -332,7 +357,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
nScreenNum = atoi (argv[i + 1]); nScreenNum = atoi (argv[i + 1]);
/* Validate the specified screen number */ /* Validate the specified screen number */
if (nScreenNum < 0 || nScreenNum >= MAXSCREENS) if (nScreenNum < 0)
{ {
ErrorF ("ddxProcessArgument - screen - Invalid screen number %d\n", ErrorF ("ddxProcessArgument - screen - Invalid screen number %d\n",
nScreenNum); nScreenNum);
@ -340,6 +365,14 @@ ddxProcessArgument (int argc, char *argv[], int i)
return 0; return 0;
} }
/*
Initialize default values for any new screens
Note that default values can't change after a -screen option is
seen, so it's safe to do this for each screen as it is introduced
*/
winInitializeScreens(nScreenNum+1);
/* look for @m where m is monitor number */ /* look for @m where m is monitor number */
if (i + 2 < argc if (i + 2 < argc
&& 1 == sscanf(argv[i + 2], "@%d", (int *) &iMonitor)) && 1 == sscanf(argv[i + 2], "@%d", (int *) &iMonitor))
@ -506,14 +539,33 @@ ddxProcessArgument (int argc, char *argv[], int i)
* before a screen number apply to all screens, whereas parameters * before a screen number apply to all screens, whereas parameters
* seen after a screen number apply to that screen number only. * seen after a screen number apply to that screen number only.
*/ */
g_iLastScreen = nScreenNum; iLastScreen = nScreenNum;
/* Keep a count of the number of screens */
++g_iNumScreens;
return iArgsProcessed; return iArgsProcessed;
} }
/*
* Is this parameter attached to a screen or global?
*
* If the parameter is for all screens (appears before
* any -screen option), store it in the default screen
* info
*
* If the parameter is for a single screen (appears
* after a -screen option), store it in the screen info
* for that screen
*
*/
if (iLastScreen == -1)
{
screenInfoPtr = &defaultScreenInfo;
}
else
{
screenInfoPtr = &(g_ScreenInfo[iLastScreen]);
}
/* /*
* Look for the '-engine n' argument * Look for the '-engine n' argument
*/ */
@ -542,22 +594,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
return 0; return 0;
} }
/* Is this parameter attached to a screen or global? */ screenInfoPtr->dwEnginePreferred = dwEngine;
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
g_ScreenInfo[j].dwEnginePreferred = dwEngine;
}
}
else
{
/* Parameter is for a single screen */
g_ScreenInfo[g_iLastScreen].dwEnginePreferred = dwEngine;
}
/* Indicate that we have processed the argument */ /* Indicate that we have processed the argument */
return 2; return 2;
@ -568,30 +605,11 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/ */
if (IS_OPTION ("-fullscreen")) if (IS_OPTION ("-fullscreen"))
{ {
/* Is this parameter attached to a screen or is it global? */
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) #if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
if (!g_ScreenInfo[j].fMultiMonitorOverride) if (!screenInfoPtr->fMultiMonitorOverride)
g_ScreenInfo[j].fMultipleMonitors = FALSE; screenInfoPtr->fMultipleMonitors = FALSE;
#endif #endif
g_ScreenInfo[j].fFullScreen = TRUE; screenInfoPtr->fFullScreen = TRUE;
}
}
else
{
/* Parameter is for a single screen */
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride)
g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE;
#endif
g_ScreenInfo[g_iLastScreen].fFullScreen = TRUE;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return 1; return 1;
@ -602,22 +620,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/ */
if (IS_OPTION ("-lesspointer")) if (IS_OPTION ("-lesspointer"))
{ {
/* Is this parameter attached to a screen or is it global? */ screenInfoPtr->fLessPointer = TRUE;
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
g_ScreenInfo[j].fLessPointer = TRUE;
}
}
else
{
/* Parameter is for a single screen */
g_ScreenInfo[g_iLastScreen].fLessPointer = TRUE;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return 1; return 1;
@ -628,30 +631,11 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/ */
if (IS_OPTION ("-nodecoration")) if (IS_OPTION ("-nodecoration"))
{ {
/* Is this parameter attached to a screen or is it global? */
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) #if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
if (!g_ScreenInfo[j].fMultiMonitorOverride) if (!screenInfoPtr->fMultiMonitorOverride)
g_ScreenInfo[j].fMultipleMonitors = FALSE; screenInfoPtr->fMultipleMonitors = FALSE;
#endif #endif
g_ScreenInfo[j].fDecoration = FALSE; screenInfoPtr->fDecoration = FALSE;
}
}
else
{
/* Parameter is for a single screen */
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride)
g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE;
#endif
g_ScreenInfo[g_iLastScreen].fDecoration = FALSE;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return 1; return 1;
@ -663,26 +647,9 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/ */
if (IS_OPTION ("-mwextwm")) if (IS_OPTION ("-mwextwm"))
{ {
/* Is this parameter attached to a screen or is it global? */ if (!screenInfoPtr->fMultiMonitorOverride)
if (-1 == g_iLastScreen) screenInfoPtr->fMultipleMonitors = TRUE;
{ screenInfoPtr->fMWExtWM = TRUE;
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
if (!g_ScreenInfo[j].fMultiMonitorOverride)
g_ScreenInfo[j].fMultipleMonitors = TRUE;
g_ScreenInfo[j].fMWExtWM = TRUE;
}
}
else
{
/* Parameter is for a single screen */
if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride)
g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE;
g_ScreenInfo[g_iLastScreen].fMWExtWM = TRUE;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return 1; return 1;
@ -692,28 +659,10 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/ */
if (IS_OPTION ("-internalwm")) if (IS_OPTION ("-internalwm"))
{ {
/* Is this parameter attached to a screen or is it global? */ if (!screenInfoPtr->fMultiMonitorOverride)
if (-1 == g_iLastScreen) screenInfoPtr->fMultipleMonitors = TRUE;
{ screenInfoPtr->fMWExtWM = TRUE;
int j; screenInfoPtr->fInternalWM = TRUE;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
if (!g_ScreenInfo[j].fMultiMonitorOverride)
g_ScreenInfo[j].fMultipleMonitors = TRUE;
g_ScreenInfo[j].fMWExtWM = TRUE;
g_ScreenInfo[j].fInternalWM = TRUE;
}
}
else
{
/* Parameter is for a single screen */
if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride)
g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE;
g_ScreenInfo[g_iLastScreen].fMWExtWM = TRUE;
g_ScreenInfo[g_iLastScreen].fInternalWM = TRUE;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return 1; return 1;
@ -725,30 +674,11 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/ */
if (IS_OPTION ("-rootless")) if (IS_OPTION ("-rootless"))
{ {
/* Is this parameter attached to a screen or is it global? */
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) #if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
if (!g_ScreenInfo[j].fMultiMonitorOverride) if (!screenInfoPtr->fMultiMonitorOverride)
g_ScreenInfo[j].fMultipleMonitors = FALSE; screenInfoPtr->fMultipleMonitors = FALSE;
#endif #endif
g_ScreenInfo[j].fRootless = TRUE; screenInfoPtr->fRootless = TRUE;
}
}
else
{
/* Parameter is for a single screen */
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride)
g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE;
#endif
g_ScreenInfo[g_iLastScreen].fRootless = TRUE;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return 1; return 1;
@ -760,30 +690,11 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/ */
if (IS_OPTION ("-multiwindow")) if (IS_OPTION ("-multiwindow"))
{ {
/* Is this parameter attached to a screen or is it global? */
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) #if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
if (!g_ScreenInfo[j].fMultiMonitorOverride) if (!screenInfoPtr->fMultiMonitorOverride)
g_ScreenInfo[j].fMultipleMonitors = TRUE; screenInfoPtr->fMultipleMonitors = TRUE;
#endif #endif
g_ScreenInfo[j].fMultiWindow = TRUE; screenInfoPtr->fMultiWindow = TRUE;
}
}
else
{
/* Parameter is for a single screen */
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
if (!g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride)
g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE;
#endif
g_ScreenInfo[g_iLastScreen].fMultiWindow = TRUE;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return 1; return 1;
@ -796,28 +707,10 @@ ddxProcessArgument (int argc, char *argv[], int i)
if (IS_OPTION ("-multiplemonitors") if (IS_OPTION ("-multiplemonitors")
|| IS_OPTION ("-multimonitors")) || IS_OPTION ("-multimonitors"))
{ {
/* Is this parameter attached to a screen or is it global? */
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) #if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
g_ScreenInfo[j].fMultiMonitorOverride = TRUE; screenInfoPtr->fMultiMonitorOverride = TRUE;
#endif #endif
g_ScreenInfo[j].fMultipleMonitors = TRUE; screenInfoPtr->fMultipleMonitors = TRUE;
}
}
else
{
/* Parameter is for a single screen */
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride = TRUE;
#endif
g_ScreenInfo[g_iLastScreen].fMultipleMonitors = TRUE;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return 1; return 1;
@ -829,28 +722,10 @@ ddxProcessArgument (int argc, char *argv[], int i)
if (IS_OPTION ("-nomultiplemonitors") if (IS_OPTION ("-nomultiplemonitors")
|| IS_OPTION ("-nomultimonitors")) || IS_OPTION ("-nomultimonitors"))
{ {
/* Is this parameter attached to a screen or is it global? */
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) #if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
g_ScreenInfo[j].fMultiMonitorOverride = TRUE; screenInfoPtr->fMultiMonitorOverride = TRUE;
#endif #endif
g_ScreenInfo[j].fMultipleMonitors = FALSE; screenInfoPtr->fMultipleMonitors = FALSE;
}
}
else
{
/* Parameter is for a single screen */
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
g_ScreenInfo[g_iLastScreen].fMultiMonitorOverride = TRUE;
#endif
g_ScreenInfo[g_iLastScreen].fMultipleMonitors = FALSE;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return 1; return 1;
@ -862,22 +737,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/ */
if (IS_OPTION ("-scrollbars")) if (IS_OPTION ("-scrollbars"))
{ {
/* Is this parameter attached to a screen or is it global? */ screenInfoPtr->fScrollbars = TRUE;
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
g_ScreenInfo[j].fScrollbars = TRUE;
}
}
else
{
/* Parameter is for a single screen */
g_ScreenInfo[g_iLastScreen].fScrollbars = TRUE;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return 1; return 1;
@ -915,22 +775,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/ */
if (IS_OPTION ("-ignoreinput")) if (IS_OPTION ("-ignoreinput"))
{ {
/* Is this parameter attached to a screen or is it global? */ screenInfoPtr->fIgnoreInput = TRUE;
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
g_ScreenInfo[j].fIgnoreInput = TRUE;
}
}
else
{
/* Parameter is for a single screen */
g_ScreenInfo[g_iLastScreen].fIgnoreInput = TRUE;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return 1; return 1;
@ -963,22 +808,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
iE3BTimeout = WIN_DEFAULT_E3B_TIME; iE3BTimeout = WIN_DEFAULT_E3B_TIME;
} }
/* Is this parameter attached to a screen or is it global? */ screenInfoPtr->iE3BTimeout = iE3BTimeout;
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
g_ScreenInfo[j].iE3BTimeout = iE3BTimeout;
}
}
else
{
/* Parameter is for a single screen */
g_ScreenInfo[g_iLastScreen].iE3BTimeout = iE3BTimeout;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return iArgsProcessed; return iArgsProcessed;
@ -1001,23 +831,8 @@ ddxProcessArgument (int argc, char *argv[], int i)
/* Grab the argument */ /* Grab the argument */
dwBPP = atoi (argv[i]); dwBPP = atoi (argv[i]);
/* Is this parameter attached to a screen or global? */ screenInfoPtr->dwBPP = dwBPP;
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
g_ScreenInfo[j].dwBPP = dwBPP;
}
}
else
{
/* Parameter is for a single screen */
g_ScreenInfo[g_iLastScreen].dwBPP = dwBPP;
}
/* Indicate that we have processed the argument */ /* Indicate that we have processed the argument */
return 2; return 2;
} }
@ -1039,23 +854,8 @@ ddxProcessArgument (int argc, char *argv[], int i)
/* Grab the argument */ /* Grab the argument */
dwRefreshRate = atoi (argv[i]); dwRefreshRate = atoi (argv[i]);
/* Is this parameter attached to a screen or global? */ screenInfoPtr->dwRefreshRate = dwRefreshRate;
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
g_ScreenInfo[j].dwRefreshRate = dwRefreshRate;
}
}
else
{
/* Parameter is for a single screen */
g_ScreenInfo[g_iLastScreen].dwRefreshRate = dwRefreshRate;
}
/* Indicate that we have processed the argument */ /* Indicate that we have processed the argument */
return 2; return 2;
} }
@ -1077,23 +877,8 @@ ddxProcessArgument (int argc, char *argv[], int i)
/* Grab the argument */ /* Grab the argument */
dwNumBoxes = atoi (argv[i]); dwNumBoxes = atoi (argv[i]);
/* Is this parameter attached to a screen or global? */ screenInfoPtr->dwClipUpdatesNBoxes = dwNumBoxes;
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
g_ScreenInfo[j].dwClipUpdatesNBoxes = dwNumBoxes;
}
}
else
{
/* Parameter is for a single screen */
g_ScreenInfo[g_iLastScreen].dwClipUpdatesNBoxes = dwNumBoxes;
}
/* Indicate that we have processed the argument */ /* Indicate that we have processed the argument */
return 2; return 2;
} }
@ -1104,22 +889,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/ */
if (IS_OPTION ("-emulatepseudo")) if (IS_OPTION ("-emulatepseudo"))
{ {
/* Is this parameter attached to a screen or is it global? */ screenInfoPtr->fEmulatePseudo = TRUE;
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
g_ScreenInfo[j].fEmulatePseudo = TRUE;
}
}
else
{
/* Parameter is for a single screen */
g_ScreenInfo[g_iLastScreen].fEmulatePseudo = TRUE;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return 1; return 1;
@ -1131,22 +901,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/ */
if (IS_OPTION ("-nowinkill")) if (IS_OPTION ("-nowinkill"))
{ {
/* Is this parameter attached to a screen or is it global? */ screenInfoPtr->fUseWinKillKey = FALSE;
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
g_ScreenInfo[j].fUseWinKillKey = FALSE;
}
}
else
{
/* Parameter is for a single screen */
g_ScreenInfo[g_iLastScreen].fUseWinKillKey = FALSE;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return 1; return 1;
@ -1157,22 +912,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/ */
if (IS_OPTION ("-winkill")) if (IS_OPTION ("-winkill"))
{ {
/* Is this parameter attached to a screen or is it global? */ screenInfoPtr->fUseWinKillKey = TRUE;
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
g_ScreenInfo[j].fUseWinKillKey = TRUE;
}
}
else
{
/* Parameter is for a single screen */
g_ScreenInfo[g_iLastScreen].fUseWinKillKey = TRUE;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return 1; return 1;
@ -1183,22 +923,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/ */
if (IS_OPTION ("-nounixkill")) if (IS_OPTION ("-nounixkill"))
{ {
/* Is this parameter attached to a screen or is it global? */ screenInfoPtr->fUseUnixKillKey = FALSE;
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
g_ScreenInfo[j].fUseUnixKillKey = FALSE;
}
}
else
{
/* Parameter is for a single screen */
g_ScreenInfo[g_iLastScreen].fUseUnixKillKey = FALSE;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return 1; return 1;
@ -1209,22 +934,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/ */
if (IS_OPTION ("-unixkill")) if (IS_OPTION ("-unixkill"))
{ {
/* Is this parameter attached to a screen or is it global? */ screenInfoPtr->fUseUnixKillKey = TRUE;
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
g_ScreenInfo[j].fUseUnixKillKey = TRUE;
}
}
else
{
/* Parameter is for a single screen */
g_ScreenInfo[g_iLastScreen].fUseUnixKillKey = TRUE;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return 1; return 1;
@ -1235,22 +945,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/ */
if (IS_OPTION ("-notrayicon")) if (IS_OPTION ("-notrayicon"))
{ {
/* Is this parameter attached to a screen or is it global? */ screenInfoPtr->fNoTrayIcon = TRUE;
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
g_ScreenInfo[j].fNoTrayIcon = TRUE;
}
}
else
{
/* Parameter is for a single screen */
g_ScreenInfo[g_iLastScreen].fNoTrayIcon = TRUE;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return 1; return 1;
@ -1261,22 +956,7 @@ ddxProcessArgument (int argc, char *argv[], int i)
*/ */
if (IS_OPTION ("-trayicon")) if (IS_OPTION ("-trayicon"))
{ {
/* Is this parameter attached to a screen or is it global? */ screenInfoPtr->fNoTrayIcon = FALSE;
if (-1 == g_iLastScreen)
{
int j;
/* Parameter is for all screens */
for (j = 0; j < MAXSCREENS; j++)
{
g_ScreenInfo[j].fNoTrayIcon = FALSE;
}
}
else
{
/* Parameter is for a single screen */
g_ScreenInfo[g_iLastScreen].fNoTrayIcon = FALSE;
}
/* Indicate that we have processed this argument */ /* Indicate that we have processed this argument */
return 1; return 1;

View File

@ -196,7 +196,7 @@ winScreenInit (int index,
/* /*
* In this case, some of the defaults set in * In this case, some of the defaults set in
* winInitializeDefaultScreens () are not correct ... * winInitializeScreenDefaults() are not correct ...
*/ */
if (!pScreenInfo->fUserGaveHeightAndWidth) if (!pScreenInfo->fUserGaveHeightAndWidth)
{ {

View File

@ -40,17 +40,24 @@
*/ */
extern int g_iNumScreens; extern int g_iNumScreens;
extern winScreenInfo g_ScreenInfo[]; extern winScreenInfo * g_ScreenInfo;
extern Bool g_fXdmcpEnabled; extern Bool g_fXdmcpEnabled;
/* /*
* Prototypes * Verify all screens have been explicitly specified
*/ */
static BOOL
isEveryScreenExplicit(void)
{
int i;
Bool for (i = 0; i < g_iNumScreens; i++)
winValidateArgs (void); if (!g_ScreenInfo[i].fExplicitScreen)
return FALSE;
return TRUE;
}
/* /*
* winValidateArgs - Look for invalid argument combinations * winValidateArgs - Look for invalid argument combinations
@ -62,6 +69,7 @@ winValidateArgs (void)
int i; int i;
int iMaxConsecutiveScreen = 0; int iMaxConsecutiveScreen = 0;
BOOL fHasNormalScreen0 = FALSE; BOOL fHasNormalScreen0 = FALSE;
BOOL fImplicitScreenFound = FALSE;
/* /*
* Check for a malformed set of -screen parameters. * Check for a malformed set of -screen parameters.
@ -70,23 +78,14 @@ winValidateArgs (void)
* XWin -screen 0 -screen 2 * XWin -screen 0 -screen 2
* XWin -screen 1 -screen 2 * XWin -screen 1 -screen 2
*/ */
for (i = 0; i < MAXSCREENS; i++) if (!isEveryScreenExplicit())
{
if (g_ScreenInfo[i].fExplicitScreen)
iMaxConsecutiveScreen = i + 1;
}
winErrorFVerb (2, "winValidateArgs - g_iNumScreens: %d "
"iMaxConsecutiveScreen: %d\n",
g_iNumScreens, iMaxConsecutiveScreen);
if (g_iNumScreens < iMaxConsecutiveScreen)
{ {
ErrorF ("winValidateArgs - Malformed set of screen parameter(s). " ErrorF ("winValidateArgs - Malformed set of screen parameter(s). "
"Screens must be specified consecutively starting with " "Screens must be specified consecutively starting with "
"screen 0. That is, you cannot have only a screen 1, nor " "screen 0. That is, you cannot have only a screen 1, nor "
"could you have screen 0 and screen 2. You instead must " "could you have screen 0 and screen 2. You instead must "
"have screen 0, or screen 0 and screen 1, respectively. Of " "have screen 0, or screen 0 and screen 1, respectively. "
"you can specify as many screens as you want from 0 up to " "You can specify as many screens as you want.\n");
"%d.\n", MAXSCREENS - 1);
return FALSE; return FALSE;
} }

View File

@ -85,7 +85,6 @@ typedef struct _Window *SaveSetElt;
#define SaveSetAssignMap(ss,m) #define SaveSetAssignMap(ss,m)
#endif #endif
/* The unused_ members are ABI spacing. Please reuse them. */
typedef struct _Client { typedef struct _Client {
int index; int index;
Mask clientAsMask; Mask clientAsMask;
@ -101,7 +100,6 @@ typedef struct _Client {
* killed */ * killed */
SaveSetElt *saveSet; SaveSetElt *saveSet;
int numSaved; int numSaved;
void *unused_screenPrivate[16];
int (**requestVector) ( int (**requestVector) (
ClientPtr /* pClient */); ClientPtr /* pClient */);
CARD32 req_len; /* length of current request */ CARD32 req_len; /* length of current request */
@ -116,8 +114,6 @@ typedef struct _Client {
KeyCode minKC,maxKC; KeyCode minKC,maxKC;
unsigned long replyBytesRemaining; unsigned long replyBytesRemaining;
void *unused_appgroup;
void *unused_fontResFunc;
int smart_priority; int smart_priority;
long smart_start_tick; long smart_start_tick;
long smart_stop_tick; long smart_stop_tick;

View File

@ -615,10 +615,8 @@ typedef struct _ScreenInfo {
int numPixmapFormats; int numPixmapFormats;
PixmapFormatRec PixmapFormatRec
formats[MAXFORMATS]; formats[MAXFORMATS];
int arraySize;
int numScreens; int numScreens;
ScreenPtr screens[MAXSCREENS]; ScreenPtr screens[MAXSCREENS];
int unused;
} ScreenInfo; } ScreenInfo;
extern _X_EXPORT ScreenInfo screenInfo; extern _X_EXPORT ScreenInfo screenInfo;

View File

@ -40,13 +40,14 @@
#include "globals.h" #include "globals.h"
#include "micmap.h" #include "micmap.h"
ColormapPtr miInstalledMaps[MAXSCREENS]; static int micmapScrPrivateKeyIndex;
DevPrivateKey micmapScrPrivateKey = &micmapScrPrivateKeyIndex;
int int
miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps) miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
{ {
if (miInstalledMaps[pScreen->myNum]) { if (GetInstalledmiColormap(pScreen)) {
*pmaps = miInstalledMaps[pScreen->myNum]->mid; *pmaps = GetInstalledmiColormap(pScreen)->mid;
return (1); return (1);
} }
return 0; return 0;
@ -55,8 +56,7 @@ miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
void void
miInstallColormap(ColormapPtr pmap) miInstallColormap(ColormapPtr pmap)
{ {
int index = pmap->pScreen->myNum; ColormapPtr oldpmap = GetInstalledmiColormap(pmap->pScreen);
ColormapPtr oldpmap = miInstalledMaps[index];
if(pmap != oldpmap) if(pmap != oldpmap)
{ {
@ -65,7 +65,7 @@ miInstallColormap(ColormapPtr pmap)
if(oldpmap != (ColormapPtr)None) if(oldpmap != (ColormapPtr)None)
WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid); WalkTree(pmap->pScreen, TellLostMap, (char *)&oldpmap->mid);
/* Install pmap */ /* Install pmap */
miInstalledMaps[index] = pmap; SetInstalledmiColormap(pmap->pScreen, pmap);
WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid); WalkTree(pmap->pScreen, TellGainedMap, (char *)&pmap->mid);
} }
@ -74,8 +74,7 @@ miInstallColormap(ColormapPtr pmap)
void void
miUninstallColormap(ColormapPtr pmap) miUninstallColormap(ColormapPtr pmap)
{ {
int index = pmap->pScreen->myNum; ColormapPtr curpmap = GetInstalledmiColormap(pmap->pScreen);
ColormapPtr curpmap = miInstalledMaps[index];
if(pmap == curpmap) if(pmap == curpmap)
{ {

View File

@ -4,7 +4,13 @@
#ifndef _MICMAP_H_ #ifndef _MICMAP_H_
#define _MICMAP_H_ #define _MICMAP_H_
extern _X_EXPORT ColormapPtr miInstalledMaps[MAXSCREENS]; #define GetInstalledmiColormap(s) \
((ColormapPtr) dixLookupPrivate(&(s)->devPrivates, micmapScrPrivateKey))
#define SetInstalledmiColormap(s,c) \
(dixSetPrivate(&(s)->devPrivates, micmapScrPrivateKey, c))
extern _X_EXPORT DevPrivateKey micmapScrPrivateKey;
typedef Bool (* miInitVisualsProcPtr)(VisualPtr *, DepthPtr *, int *, int *, typedef Bool (* miInitVisualsProcPtr)(VisualPtr *, DepthPtr *, int *, int *,
int *, VisualID *, unsigned long, int, int *, VisualID *, unsigned long, int,

View File

@ -141,7 +141,6 @@ static Bool device_cursor_init(DeviceIntPtr dev, ScreenPtr screen) { return TRUE
static Bool set_cursor_pos(DeviceIntPtr dev, ScreenPtr screen, int x, int y, Bool event) { return TRUE; } static Bool set_cursor_pos(DeviceIntPtr dev, ScreenPtr screen, int x, int y, Bool event) { return TRUE; }
void init_simple(void) void init_simple(void)
{ {
screenInfo.arraySize = MAXSCREENS;
screenInfo.numScreens = 1; screenInfo.numScreens = 1;
screenInfo.screens[0] = &screen; screenInfo.screens[0] = &screen;

View File

@ -49,7 +49,6 @@ static void xtest_init_devices(void)
/* random stuff that needs initialization */ /* random stuff that needs initialization */
memset(&screen, 0, sizeof(screen)); memset(&screen, 0, sizeof(screen));
screenInfo.arraySize = MAXSCREENS;
screenInfo.numScreens = 1; screenInfo.numScreens = 1;
screenInfo.screens[0] = &screen; screenInfo.screens[0] = &screen;
screen.myNum = 0; screen.myNum = 0;