summaryrefslogtreecommitdiff
path: root/dix/main.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-03-21 12:55:09 -0700
committerKeith Packard <keithp@keithp.com>2012-03-21 13:54:42 -0700
commit9838b7032ea9792bec21af424c53c07078636d21 (patch)
treeb72d0827dac50f0f3b8eab29b3b7639546d735d7 /dix/main.c
parent75199129c603fc8567185ac31866c9518193cb78 (diff)
Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh' from util/modular. Compared to the patch that Daniel posted in January, I've added a few indent flags: -bap -psl -T PrivatePtr -T pmWait -T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT The typedefs were needed to make the output of sdksyms.sh match the previous output, otherwise, the code is formatted badly enough that sdksyms.sh generates incorrect output. The generated code was compared with the previous version and found to be essentially identical -- "assert" line numbers and BUILD_TIME were the only differences found. The comparison was done with this script: dir1=$1 dir2=$2 for dir in $dir1 $dir2; do (cd $dir && find . -name '*.o' | while read file; do dir=`dirname $file` base=`basename $file .o` dump=$dir/$base.dump objdump -d $file > $dump done) done find $dir1 -name '*.dump' | while read dump; do otherdump=`echo $dump | sed "s;$dir1;$dir2;"` diff -u $dump $otherdump done Signed-off-by: Keith Packard <keithp@keithp.com> Acked-by: Daniel Stone <daniel@fooishbar.org> Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'dix/main.c')
-rw-r--r--dix/main.c360
1 files changed, 179 insertions, 181 deletions
diff --git a/dix/main.c b/dix/main.c
index 16575ceba..70dcc946e 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
-
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
@@ -80,7 +79,7 @@ Equipment Corporation.
#endif
#include <X11/X.h>
-#include <X11/Xos.h> /* for unistd.h */
+#include <X11/Xos.h> /* for unistd.h */
#include <X11/Xproto.h>
#include <pixman.h>
#include "scrnintstr.h"
@@ -108,7 +107,7 @@ Equipment Corporation.
#ifdef PANORAMIX
#include "panoramiXsrv.h"
#else
-#include "dixevents.h" /* InitEvents() */
+#include "dixevents.h" /* InitEvents() */
#endif
#ifdef DPMSExtension
@@ -127,13 +126,15 @@ pthread_cond_t serverRunningCond = PTHREAD_COND_INITIALIZER;
int dix_main(int argc, char *argv[], char *envp[]);
-int dix_main(int argc, char *argv[], char *envp[])
+int
+dix_main(int argc, char *argv[], char *envp[])
#else
-int main(int argc, char *argv[], char *envp[])
+int
+main(int argc, char *argv[], char *envp[])
#endif
{
- int i;
- HWEventQueueType alwaysCheckForInput[2];
+ int i;
+ HWEventQueueType alwaysCheckForInput[2];
display = "0";
@@ -149,211 +150,208 @@ int main(int argc, char *argv[], char *envp[])
alwaysCheckForInput[0] = 0;
alwaysCheckForInput[1] = 1;
- while(1)
- {
- serverGeneration++;
- ScreenSaverTime = defaultScreenSaverTime;
- ScreenSaverInterval = defaultScreenSaverInterval;
- ScreenSaverBlanking = defaultScreenSaverBlanking;
- ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
+ while (1) {
+ serverGeneration++;
+ ScreenSaverTime = defaultScreenSaverTime;
+ ScreenSaverInterval = defaultScreenSaverInterval;
+ ScreenSaverBlanking = defaultScreenSaverBlanking;
+ ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
#ifdef DPMSExtension
- DPMSStandbyTime = DPMSSuspendTime = DPMSOffTime = ScreenSaverTime;
- DPMSEnabled = TRUE;
- DPMSPowerLevel = 0;
+ DPMSStandbyTime = DPMSSuspendTime = DPMSOffTime = ScreenSaverTime;
+ DPMSEnabled = TRUE;
+ DPMSPowerLevel = 0;
#endif
- InitBlockAndWakeupHandlers();
- /* Perform any operating system dependent initializations you'd like */
- OsInit();
- if(serverGeneration == 1)
- {
- CreateWellKnownSockets();
- for (i=1; i<MAXCLIENTS; i++)
- clients[i] = NullClient;
- serverClient = calloc(sizeof(ClientRec), 1);
- if (!serverClient)
- FatalError("couldn't create server client");
- InitClient(serverClient, 0, (pointer)NULL);
- }
- else
- ResetWellKnownSockets ();
- clients[0] = serverClient;
- currentMaxClients = 1;
-
- /* Initialize privates before first allocation */
- dixResetPrivates();
-
- /* Initialize server client devPrivates, to be reallocated as
- * more client privates are registered
- */
- if (!dixAllocatePrivates(&serverClient->devPrivates, PRIVATE_CLIENT))
- FatalError("failed to create server client privates");
-
- if (!InitClientResources(serverClient)) /* for root resources */
- FatalError("couldn't init server resources");
-
- SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]);
- screenInfo.numScreens = 0;
-
- InitAtoms();
- InitEvents();
- InitSelections();
- InitGlyphCaching();
- dixResetRegistry();
- ResetFontPrivateIndex();
- InitCallbackManager();
- InitOutput(&screenInfo, argc, argv);
-
- if (screenInfo.numScreens < 1)
- FatalError("no screens found");
- InitExtensions(argc, argv);
-
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- ScreenPtr pScreen = screenInfo.screens[i];
- if (!CreateScratchPixmapsForScreen(i))
- FatalError("failed to create scratch pixmaps");
- if (pScreen->CreateScreenResources &&
- !(*pScreen->CreateScreenResources)(pScreen))
- FatalError("failed to create screen resources");
- if (!CreateGCperDepth(i))
- FatalError("failed to create scratch GCs");
- if (!CreateDefaultStipple(i))
- FatalError("failed to create default stipple");
- if (!CreateRootWindow(pScreen))
- FatalError("failed to create root window");
- }
-
- InitFonts();
- if (SetDefaultFontPath(defaultFontPath) != Success) {
- ErrorF("[dix] failed to set default font path '%s'", defaultFontPath);
- }
- if (!SetDefaultFont(defaultTextFont)) {
- FatalError("could not open default font '%s'", defaultTextFont);
- }
-
- if (!(rootCursor = CreateRootCursor(NULL, 0))) {
- FatalError("could not open default cursor font '%s'",
- defaultCursorFont);
- }
+ InitBlockAndWakeupHandlers();
+ /* Perform any operating system dependent initializations you'd like */
+ OsInit();
+ if (serverGeneration == 1) {
+ CreateWellKnownSockets();
+ for (i = 1; i < MAXCLIENTS; i++)
+ clients[i] = NullClient;
+ serverClient = calloc(sizeof(ClientRec), 1);
+ if (!serverClient)
+ FatalError("couldn't create server client");
+ InitClient(serverClient, 0, (pointer) NULL);
+ }
+ else
+ ResetWellKnownSockets();
+ clients[0] = serverClient;
+ currentMaxClients = 1;
+
+ /* Initialize privates before first allocation */
+ dixResetPrivates();
+
+ /* Initialize server client devPrivates, to be reallocated as
+ * more client privates are registered
+ */
+ if (!dixAllocatePrivates(&serverClient->devPrivates, PRIVATE_CLIENT))
+ FatalError("failed to create server client privates");
+
+ if (!InitClientResources(serverClient)) /* for root resources */
+ FatalError("couldn't init server resources");
+
+ SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]);
+ screenInfo.numScreens = 0;
+
+ InitAtoms();
+ InitEvents();
+ InitSelections();
+ InitGlyphCaching();
+ dixResetRegistry();
+ ResetFontPrivateIndex();
+ InitCallbackManager();
+ InitOutput(&screenInfo, argc, argv);
+
+ if (screenInfo.numScreens < 1)
+ FatalError("no screens found");
+ InitExtensions(argc, argv);
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+
+ if (!CreateScratchPixmapsForScreen(i))
+ FatalError("failed to create scratch pixmaps");
+ if (pScreen->CreateScreenResources &&
+ !(*pScreen->CreateScreenResources) (pScreen))
+ FatalError("failed to create screen resources");
+ if (!CreateGCperDepth(i))
+ FatalError("failed to create scratch GCs");
+ if (!CreateDefaultStipple(i))
+ FatalError("failed to create default stipple");
+ if (!CreateRootWindow(pScreen))
+ FatalError("failed to create root window");
+ }
+
+ InitFonts();
+ if (SetDefaultFontPath(defaultFontPath) != Success) {
+ ErrorF("[dix] failed to set default font path '%s'",
+ defaultFontPath);
+ }
+ if (!SetDefaultFont(defaultTextFont)) {
+ FatalError("could not open default font '%s'", defaultTextFont);
+ }
+
+ if (!(rootCursor = CreateRootCursor(NULL, 0))) {
+ FatalError("could not open default cursor font '%s'",
+ defaultCursorFont);
+ }
#ifdef DPMSExtension
- /* check all screens, looking for DPMS Capabilities */
- DPMSCapableFlag = DPMSSupported();
- if (!DPMSCapableFlag)
- DPMSEnabled = FALSE;
+ /* check all screens, looking for DPMS Capabilities */
+ DPMSCapableFlag = DPMSSupported();
+ if (!DPMSCapableFlag)
+ DPMSEnabled = FALSE;
#endif
#ifdef PANORAMIX
- /*
- * Consolidate window and colourmap information for each screen
- */
- if (!noPanoramiXExtension)
- PanoramiXConsolidate();
+ /*
+ * Consolidate window and colourmap information for each screen
+ */
+ if (!noPanoramiXExtension)
+ PanoramiXConsolidate();
#endif
- for (i = 0; i < screenInfo.numScreens; i++)
- InitRootWindow(screenInfo.screens[i]->root);
+ for (i = 0; i < screenInfo.numScreens; i++)
+ InitRootWindow(screenInfo.screens[i]->root);
InitCoreDevices();
- InitInput(argc, argv);
- InitAndStartDevices();
- ReserveClientIds(serverClient);
+ InitInput(argc, argv);
+ InitAndStartDevices();
+ ReserveClientIds(serverClient);
- dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
+ dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- if (!PanoramiXCreateConnectionBlock()) {
- FatalError("could not create connection block info");
- }
- } else
+ if (!noPanoramiXExtension) {
+ if (!PanoramiXCreateConnectionBlock()) {
+ FatalError("could not create connection block info");
+ }
+ }
+ else
#endif
- {
- if (!CreateConnectionBlock()) {
- FatalError("could not create connection block info");
- }
- }
+ {
+ if (!CreateConnectionBlock()) {
+ FatalError("could not create connection block info");
+ }
+ }
#ifdef XQUARTZ
- /* Let the other threads know the server is done with its init */
- pthread_mutex_lock(&serverRunningMutex);
- serverRunning = TRUE;
- pthread_cond_broadcast(&serverRunningCond);
- pthread_mutex_unlock(&serverRunningMutex);
+ /* Let the other threads know the server is done with its init */
+ pthread_mutex_lock(&serverRunningMutex);
+ serverRunning = TRUE;
+ pthread_cond_broadcast(&serverRunningCond);
+ pthread_mutex_unlock(&serverRunningMutex);
#endif
-
- NotifyParentProcess();
- Dispatch();
+ NotifyParentProcess();
+
+ Dispatch();
#ifdef XQUARTZ
- /* Let the other threads know the server is no longer running */
- pthread_mutex_lock(&serverRunningMutex);
- serverRunning = FALSE;
- pthread_mutex_unlock(&serverRunningMutex);
+ /* Let the other threads know the server is no longer running */
+ pthread_mutex_lock(&serverRunningMutex);
+ serverRunning = FALSE;
+ pthread_mutex_unlock(&serverRunningMutex);
#endif
- UndisplayDevices();
+ UndisplayDevices();
- /* Now free up whatever must be freed */
- if (screenIsSaved == SCREEN_SAVER_ON)
- dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
- FreeScreenSaverTimer();
- CloseDownExtensions();
+ /* Now free up whatever must be freed */
+ if (screenIsSaved == SCREEN_SAVER_ON)
+ dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
+ FreeScreenSaverTimer();
+ CloseDownExtensions();
#ifdef PANORAMIX
- {
- Bool remember_it = noPanoramiXExtension;
- noPanoramiXExtension = TRUE;
- FreeAllResources();
- noPanoramiXExtension = remember_it;
- }
+ {
+ Bool remember_it = noPanoramiXExtension;
+
+ noPanoramiXExtension = TRUE;
+ FreeAllResources();
+ noPanoramiXExtension = remember_it;
+ }
#else
- FreeAllResources();
+ FreeAllResources();
#endif
CloseInput();
- for (i = 0; i < screenInfo.numScreens; i++)
- screenInfo.screens[i]->root = NullWindow;
- CloseDownDevices();
- CloseDownEvents();
-
- for (i = screenInfo.numScreens - 1; i >= 0; i--)
- {
- FreeScratchPixmapsForScreen(i);
- FreeGCperDepth(i);
- FreeDefaultStipple(i);
- (* screenInfo.screens[i]->CloseScreen)(i, screenInfo.screens[i]);
- dixFreePrivates(screenInfo.screens[i]->devPrivates, PRIVATE_SCREEN);
- free(screenInfo.screens[i]);
- screenInfo.numScreens = i;
- }
-
- ReleaseClientIds(serverClient);
- dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT);
- serverClient->devPrivates = NULL;
-
- FreeFonts();
-
- FreeAuditTimer();
-
- if (dispatchException & DE_TERMINATE)
- {
- CloseWellKnownConnections();
- }
-
- OsCleanup((dispatchException & DE_TERMINATE) != 0);
-
- if (dispatchException & DE_TERMINATE)
- {
- ddxGiveUp(EXIT_NO_ERROR);
- break;
- }
-
- free(ConnectionInfo);
- ConnectionInfo = NULL;
+ for (i = 0; i < screenInfo.numScreens; i++)
+ screenInfo.screens[i]->root = NullWindow;
+ CloseDownDevices();
+ CloseDownEvents();
+
+ for (i = screenInfo.numScreens - 1; i >= 0; i--) {
+ FreeScratchPixmapsForScreen(i);
+ FreeGCperDepth(i);
+ FreeDefaultStipple(i);
+ (*screenInfo.screens[i]->CloseScreen) (i, screenInfo.screens[i]);
+ dixFreePrivates(screenInfo.screens[i]->devPrivates, PRIVATE_SCREEN);
+ free(screenInfo.screens[i]);
+ screenInfo.numScreens = i;
+ }
+
+ ReleaseClientIds(serverClient);
+ dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT);
+ serverClient->devPrivates = NULL;
+
+ FreeFonts();
+
+ FreeAuditTimer();
+
+ if (dispatchException & DE_TERMINATE) {
+ CloseWellKnownConnections();
+ }
+
+ OsCleanup((dispatchException & DE_TERMINATE) != 0);
+
+ if (dispatchException & DE_TERMINATE) {
+ ddxGiveUp(EXIT_NO_ERROR);
+ break;
+ }
+
+ free(ConnectionInfo);
+ ConnectionInfo = NULL;
}
return 0;
}
-