summaryrefslogtreecommitdiff
path: root/dix/main.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2008-01-03 17:04:54 +1030
committerPeter Hutterer <peter@cs.unisa.edu.au>2008-01-03 17:04:54 +1030
commit8da83836b60f7cdb75d08482f4311fa0e2ab4e1d (patch)
tree092efcfc39e3e293baaf04c4c84027ee453d3e13 /dix/main.c
parenteace88989c3b65d5c20e9f37ea9b23c7c8e19335 (diff)
parentae869fc7669764729e13fdd70149ed636753f2a3 (diff)
Merge branch 'master' into mpx
Conflicts: XTrap/xtrapddmi.c Xext/security.c Xext/xprint.c Xext/xtest.c Xext/xvdisp.c Xi/exevents.c Xi/grabdevb.c Xi/grabdevk.c Xi/opendev.c Xi/ungrdev.c Xi/ungrdevb.c Xi/ungrdevk.c dix/cursor.c dix/devices.c dix/dixutils.c dix/events.c dix/getevents.c dix/main.c dix/window.c hw/xfree86/ramdac/xf86Cursor.c include/dix.h include/input.h include/inputstr.h mi/midispcur.c mi/miinitext.c mi/misprite.c render/animcur.c xfixes/cursor.c xkb/xkbAccessX.c
Diffstat (limited to 'dix/main.c')
-rw-r--r--dix/main.c72
1 files changed, 21 insertions, 51 deletions
diff --git a/dix/main.c b/dix/main.c
index 0bb823d26..63e3273c6 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -100,6 +100,8 @@ Equipment Corporation.
#include "site.h"
#include "dixfont.h"
#include "extnsionst.h"
+#include "privates.h"
+#include "registry.h"
#ifdef XPRINT
#include "DiPrint.h"
#endif
@@ -116,15 +118,12 @@ Equipment Corporation.
#include "dpmsproc.h"
#endif
-extern int InitClientPrivates(ClientPtr client);
-
extern void Dispatch(void);
char *ConnectionInfo;
xConnSetupPrefix connSetupPrefix;
extern FontPtr defaultFont;
-extern int screenPrivateCount;
extern void InitProcVectors(void);
extern Bool CreateGCperDepthArray(void);
@@ -134,8 +133,6 @@ static
#endif
Bool CreateConnectionBlock(void);
-static void FreeScreen(ScreenPtr);
-
_X_EXPORT PaddingInfo PixmapWidthPaddingInfo[33];
int connBlockScreenStart;
@@ -241,6 +238,10 @@ static int indexForScanlinePad[ 65 ] = {
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
+#ifdef __APPLE__
+void DarwinHandleGUI(int argc, char **argv, char **envp);
+#endif
+
int
main(int argc, char *argv[], char *envp[])
{
@@ -256,10 +257,10 @@ main(int argc, char *argv[], char *envp[])
PrinterInitGlobals();
#endif
+#ifdef XQUARTZ
/* Quartz support on Mac OS X requires that the Cocoa event loop be in
* the main thread. This allows the X server main to be called again
* from another thread. */
-#if defined(__DARWIN__) && defined(DARWIN_WITH_QUARTZ)
DarwinHandleGUI(argc, argv, envp);
#endif
@@ -355,15 +356,10 @@ main(int argc, char *argv[], char *envp[])
InitAtoms();
InitEvents();
InitGlyphCaching();
- ResetExtensionPrivates();
- ResetClientPrivates();
- ResetScreenPrivates();
- ResetWindowPrivates();
- ResetGCPrivates();
- ResetPixmapPrivates();
- ResetColormapPrivates();
+ if (!dixResetPrivates())
+ FatalError("couldn't init private data storage");
+ dixResetRegistry();
ResetFontPrivateIndex();
- ResetDevicePrivateIndex();
InitCallbackManager();
InitVisualWrap();
InitOutput(&screenInfo, argc, argv);
@@ -376,8 +372,6 @@ main(int argc, char *argv[], char *envp[])
if (screenInfo.numVideoScreens < 0)
screenInfo.numVideoScreens = screenInfo.numScreens;
InitExtensions(argc, argv);
- if (!InitClientPrivates(serverClient))
- FatalError("failed to allocate serverClient devprivates");
for (i = 0; i < screenInfo.numScreens; i++)
{
ScreenPtr pScreen = screenInfo.screens[i];
@@ -397,9 +391,9 @@ main(int argc, char *argv[], char *envp[])
}
InitFonts();
- if (loadableFonts) {
- SetFontPath(0, 0, (unsigned char *)defaultFontPath, &error);
- }
+ if (loadableFonts)
+ SetFontPath(serverClient, 0, (unsigned char *)defaultFontPath,
+ &error);
else {
if (SetDefaultFontPath(defaultFontPath) != Success)
ErrorF("[dix] failed to set default font path '%s'",
@@ -438,7 +432,7 @@ main(int argc, char *argv[], char *envp[])
if (InitAndStartDevices(WindowTable[0]) != Success)
FatalError("failed to initialize core devices");
- SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
+ dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
@@ -461,7 +455,7 @@ main(int argc, char *argv[], char *envp[])
/* Now free up whatever must be freed */
if (screenIsSaved == SCREEN_SAVER_ON)
- SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset);
+ dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
FreeScreenSaverTimer();
CloseDownExtensions();
@@ -484,7 +478,8 @@ main(int argc, char *argv[], char *envp[])
FreeGCperDepth(i);
FreeDefaultStipple(i);
(* screenInfo.screens[i]->CloseScreen)(i, screenInfo.screens[i]);
- FreeScreen(screenInfo.screens[i]);
+ dixFreePrivates(screenInfo.screens[i]->devPrivates);
+ xfree(screenInfo.screens[i]);
screenInfo.numScreens = i;
}
xfree(WindowTable);
@@ -493,7 +488,7 @@ main(int argc, char *argv[], char *envp[])
FreeAuditTimer();
- xfree(serverClient->devPrivates);
+ dixFreePrivates(serverClient->devPrivates);
serverClient->devPrivates = NULL;
if (dispatchException & DE_TERMINATE)
@@ -705,24 +700,8 @@ AddScreen(
if (!pScreen)
return -1;
- pScreen->devPrivates = (DevUnion *)xcalloc(sizeof(DevUnion),
- screenPrivateCount);
- if (!pScreen->devPrivates && screenPrivateCount)
- {
- xfree(pScreen);
- return -1;
- }
+ pScreen->devPrivates = NULL;
pScreen->myNum = i;
- pScreen->WindowPrivateLen = 0;
- pScreen->WindowPrivateSizes = (unsigned *)NULL;
- pScreen->totalWindowSize =
- ((sizeof(WindowRec) + sizeof(long) - 1) / sizeof(long)) * sizeof(long);
- pScreen->GCPrivateLen = 0;
- pScreen->GCPrivateSizes = (unsigned *)NULL;
- pScreen->totalGCSize =
- ((sizeof(GC) + sizeof(long) - 1) / sizeof(long)) * sizeof(long);
- pScreen->PixmapPrivateLen = 0;
- pScreen->PixmapPrivateSizes = (unsigned *)NULL;
pScreen->totalPixmapSize = BitmapBytePad(sizeof(PixmapRec)*8);
pScreen->ClipNotify = 0; /* for R4 ddx compatibility */
pScreen->CreateScreenResources = 0;
@@ -775,19 +754,10 @@ AddScreen(
screenInfo.numScreens++;
if (!(*pfnInit)(i, pScreen, argc, argv))
{
- FreeScreen(pScreen);
+ dixFreePrivates(pScreen->devPrivates);
+ xfree(pScreen);
screenInfo.numScreens--;
return -1;
}
return i;
}
-
-static void
-FreeScreen(ScreenPtr pScreen)
-{
- xfree(pScreen->WindowPrivateSizes);
- xfree(pScreen->GCPrivateSizes);
- xfree(pScreen->PixmapPrivateSizes);
- xfree(pScreen->devPrivates);
- xfree(pScreen);
-}