diff options
Diffstat (limited to 'hw/xfree86/common')
-rw-r--r-- | hw/xfree86/common/xf86.h | 3 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Globals.c | 4 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Helper.c | 61 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Init.c | 63 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Priv.h | 4 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Privstr.h | 12 |
6 files changed, 94 insertions, 53 deletions
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index e189e81d2..313d43015 100644 --- a/hw/xfree86/common/xf86.h +++ b/hw/xfree86/common/xf86.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.172 2003/09/24 02:43:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.173 2004/01/27 01:31:44 dawes Exp $ */ /* * Copyright (c) 1997-2003 by The XFree86 Project, Inc. @@ -57,7 +57,6 @@ extern int xf86PixmapIndex; extern Bool xf86ResAccessEnter; extern ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */ extern const unsigned char byte_reversed[256]; -extern PropertyPtr *xf86RegisteredPropertiesTable; extern ScrnInfoPtr xf86CurrentScreen; extern Bool pciSlotClaimed; extern Bool isaSlotClaimed; diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c index c6dee3731..a2bb3f504 100644 --- a/hw/xfree86/common/xf86Globals.c +++ b/hw/xfree86/common/xf86Globals.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.41 2003/08/24 17:36:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.42 2004/01/27 01:31:44 dawes Exp $ */ /* * Copyright (c) 1997-2003 by The XFree86 Project, Inc. @@ -236,7 +236,7 @@ Bool xf86VidModeAllowNonLocal = FALSE; Bool xf86MiscModInDevDisabled = FALSE; Bool xf86MiscModInDevAllowNonLocal = FALSE; #endif -PropertyPtr *xf86RegisteredPropertiesTable = NULL; +RootWinPropPtr *xf86RegisteredPropertiesTable = NULL; Bool xf86inSuspend = FALSE; #ifdef DLOPEN_HACK diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index 713e7861a..076a97f16 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.135 2003/10/08 14:58:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.136 2004/01/27 01:31:45 dawes Exp $ */ /* * Copyright (c) 1997-2003 by The XFree86 Project, Inc. @@ -2888,11 +2888,12 @@ int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type, int format, unsigned long len, pointer value ) { - PropertyPtr pNewProp, pRegProp; + RootWinPropPtr pNewProp = NULL, pRegProp; int i; + Bool existing = FALSE; #ifdef DEBUG - ErrorF("xf86RegisterRootWindowProperty(%d, %d, %d, %d, %d, %p)\n", + ErrorF("xf86RegisterRootWindowProperty(%d, %ld, %ld, %d, %ld, %p)\n", ScrnIndex, property, type, format, len, value); #endif @@ -2900,19 +2901,35 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type, return(BadMatch); } - if ( (pNewProp = (PropertyPtr)xalloc(sizeof(PropertyRec)))==NULL ) { - return(BadAlloc); + if (xf86RegisteredPropertiesTable && + xf86RegisteredPropertiesTable[ScrnIndex]) { + for (pNewProp = xf86RegisteredPropertiesTable[ScrnIndex]; + pNewProp; pNewProp = pNewProp->next) { + if (strcmp(pNewProp->name, NameForAtom(property)) == 0) + break; + } + } + + if (!pNewProp) { + if ((pNewProp = (RootWinPropPtr)xalloc(sizeof(RootWinProp))) == NULL) { + return(BadAlloc); + } + /* + * We will put this property at the end of the list so that + * the changes are made in the order they were requested. + */ + pNewProp->next = NULL; + } else { + if (pNewProp->name) + xfree(pNewProp->name); + existing = TRUE; } - pNewProp->propertyName = property; + pNewProp->name = xnfstrdup(NameForAtom(property)); pNewProp->type = type; pNewProp->format = format; pNewProp->size = len; pNewProp->data = value; - /* We will put this property at the end of the list so that - * the changes are made in the order they were requested. - */ - pNewProp->next = NULL; #ifdef DEBUG ErrorF("new property filled\n"); @@ -2923,7 +2940,7 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type, ErrorF("creating xf86RegisteredPropertiesTable[] size %d\n", xf86NumScreens); #endif - if ( NULL==(xf86RegisteredPropertiesTable=(PropertyPtr*)xnfcalloc(sizeof(PropertyPtr),xf86NumScreens) )) { + if ( NULL==(xf86RegisteredPropertiesTable=(RootWinPropPtr*)xnfcalloc(sizeof(RootWinProp),xf86NumScreens) )) { return(BadAlloc); } for (i=0; i<xf86NumScreens; i++) { @@ -2933,22 +2950,24 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type, #ifdef DEBUG ErrorF("xf86RegisteredPropertiesTable %p\n", - xf86RegisteredPropertiesTable); + (void *)xf86RegisteredPropertiesTable); ErrorF("xf86RegisteredPropertiesTable[%d] %p\n", - ScrnIndex, xf86RegisteredPropertiesTable[ScrnIndex]); + ScrnIndex, (void *)xf86RegisteredPropertiesTable[ScrnIndex]); #endif - if ( xf86RegisteredPropertiesTable[ScrnIndex] == NULL) { - xf86RegisteredPropertiesTable[ScrnIndex] = pNewProp; - } else { - pRegProp = xf86RegisteredPropertiesTable[ScrnIndex]; - while (pRegProp->next != NULL) { + if (!existing) { + if ( xf86RegisteredPropertiesTable[ScrnIndex] == NULL) { + xf86RegisteredPropertiesTable[ScrnIndex] = pNewProp; + } else { + pRegProp = xf86RegisteredPropertiesTable[ScrnIndex]; + while (pRegProp->next != NULL) { #ifdef DEBUG - ErrorF("- next %p\n", pRegProp); + ErrorF("- next %p\n", (void *)pRegProp); #endif - pRegProp = pRegProp->next; + pRegProp = pRegProp->next; + } + pRegProp->next = pNewProp; } - pRegProp->next = pNewProp; } #ifdef DEBUG ErrorF("xf86RegisterRootWindowProperty succeeded\n"); diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index ce8817096..979b655ee 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.211 2003/11/01 00:47:01 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.212 2004/01/27 01:31:45 dawes Exp $ */ /* * Loosely based on code bearing the following copyright: @@ -155,7 +155,7 @@ xf86CreateRootWindow(WindowPtr pWin) int ret = TRUE; int err = Success; ScreenPtr pScreen = pWin->drawable.pScreen; - PropertyPtr pRegProp, pOldRegProp; + RootWinPropPtr pProp; CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr)(pScreen->devPrivates[xf86CreateRootWindowIndex].ptr); @@ -181,25 +181,19 @@ xf86CreateRootWindow(WindowPtr pWin) } /* Now do our stuff */ - if (xf86RegisteredPropertiesTable != NULL) { if (pWin->parent == NULL && xf86RegisteredPropertiesTable != NULL) { - for (pRegProp = xf86RegisteredPropertiesTable[pScreen->myNum]; - pRegProp != NULL && err==Success; - pRegProp = pRegProp->next ) + for (pProp = xf86RegisteredPropertiesTable[pScreen->myNum]; + pProp != NULL && err==Success; + pProp = pProp->next ) { - Atom oldNameAtom = pRegProp->propertyName; - char *nameString; - /* propertyName was created before the screen existed, - * so the atom does not belong to any screen; - * we need to create a new atom with the same name. - */ - nameString = NameForAtom(oldNameAtom); - pRegProp->propertyName = MakeAtom(nameString, strlen(nameString), TRUE); + Atom prop; + + prop = MakeAtom(pProp->name, strlen(pProp->name), TRUE); err = ChangeWindowProperty(pWin, - pRegProp->propertyName, pRegProp->type, - pRegProp->format, PropModeReplace, - pRegProp->size, pRegProp->data, + prop, pProp->type, + pProp->format, PropModeReplace, + pProp->size, pProp->data, FALSE ); } @@ -207,14 +201,6 @@ xf86CreateRootWindow(WindowPtr pWin) /* Look at err */ ret &= (err==Success); - /* free memory */ - pOldRegProp = xf86RegisteredPropertiesTable[pScreen->myNum]; - while (pOldRegProp!=NULL) { - pRegProp = pOldRegProp->next; - xfree(pOldRegProp); - pOldRegProp = pRegProp; - } - xf86RegisteredPropertiesTable[pScreen->myNum] = NULL; } else { xf86Msg(X_ERROR, "xf86CreateRootWindow unexpectedly called with " "non-root window %p (parent %p)\n", @@ -303,7 +289,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) xf86ScreenIndex = AllocateScreenPrivateIndex(); xf86CreateRootWindowIndex = AllocateScreenPrivateIndex(); xf86PixmapIndex = AllocatePixmapPrivateIndex(); - xf86RegisteredPropertiesTable=NULL; generation = serverGeneration; } @@ -749,6 +734,32 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) } formatsDone = TRUE; + if (xf86Info.vtno >= 0 ) { +#define VT_ATOM_NAME "XFree86_VT" + Atom VTAtom=-1; + CARD32 *VT = NULL; + int ret; + + /* This memory needs to stay available until the screen has been + initialized, and we can create the property for real. + */ + if ( (VT = xalloc(sizeof(CARD32)))==NULL ) { + FatalError("Unable to make VT property - out of memory. Exiting...\n"); + } + *VT = xf86Info.vtno; + + VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME), TRUE); + + for (i = 0, ret = Success; i < xf86NumScreens && ret == Success; i++) { + ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex, + VTAtom, XA_INTEGER, 32, + 1, VT ); + if (ret != Success) + xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING, + "Failed to register VT property\n"); + } + } + /* If a screen uses depth 24, show what the pixmap format is */ for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->depth == 24) { diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h index a46bfc39b..82df2aead 100644 --- a/hw/xfree86/common/xf86Priv.h +++ b/hw/xfree86/common/xf86Priv.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.82 2003/09/09 03:20:36 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.83 2004/01/27 01:31:45 dawes Exp $ */ /* * Copyright (c) 1997-2002 by The XFree86 Project, Inc. @@ -113,6 +113,8 @@ extern int xf86LogVerbose; /* log file verbosity level */ extern Bool xf86ProbeOnly; extern Bool xf86DoProbe; +extern RootWinPropPtr *xf86RegisteredPropertiesTable; + #ifndef DEFAULT_VERBOSE #define DEFAULT_VERBOSE 0 #endif diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h index 8b0a0f4ce..93d64fd51 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.40 2003/10/17 20:02:12 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.41 2004/01/27 01:31:45 dawes Exp $ */ /* * Copyright (c) 1997-2003 by The XFree86 Project, Inc. @@ -198,6 +198,16 @@ typedef struct { } VidModeRec, *VidModePtr; #endif +/* Information for root window properties. */ +typedef struct _RootWinProp { + struct _RootWinProp * next; + char * name; + Atom type; + short format; + long size; + pointer data; +} RootWinProp, *RootWinPropPtr; + /* private resource types */ #define ResNoAvoid ResBios |