aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/dix/main.c')
-rw-r--r--xorg-server/dix/main.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/xorg-server/dix/main.c b/xorg-server/dix/main.c
index bea1a8d5a..5eb5b70a2 100644
--- a/xorg-server/dix/main.c
+++ b/xorg-server/dix/main.c
@@ -116,6 +116,10 @@ Equipment Corporation.
#include "dpmsproc.h"
#endif
+#ifdef _DEBUG
+#include <crtdbg.h>
+#endif
+
extern void Dispatch(void);
#ifdef XQUARTZ
@@ -136,9 +140,50 @@ main(int argc, char *argv[], char *envp[])
{
int i;
HWEventQueueType alwaysCheckForInput[2];
-
+ #ifdef _DEBUG
+ //int TmpFlag=_CrtSetDbgFlag( _CRTDBG_REPORT_FLAG);
+
+ //TmpFlag|=_CRTDBG_ALLOC_MEM_DF;
+ //TmpFlag|=_CRTDBG_DELAY_FREE_MEM_DF;
+ //TmpFlag|=_CRTDBG_CHECK_ALWAYS_DF;
+ //TmpFlag|=_CRTDBG_CHECK_CRT_DF;
+ //TmpFlag|=_CRTDBG_LEAK_CHECK_DF;
+
+ //_CrtSetDbgFlag(TmpFlag);
+ #endif
+
+ ptw32_processInitialize();
display = "0";
+ #ifdef WIN32
+
+ if (InitWSA()<0)
+ {
+ printf("Error initialising WSA\n");
+ return -1;
+ }
+ /* In Win32 we have different threads call Xlib functions (depending
+ on the commandline options given).
+ XInitThreads has to be called before
+ any xlib function is called (aoccording to the man page) */
+ XInitThreads();
+ /* change the current directory to the directory where the vcxsrv.exe executable is installed.
+ This is needed because the font directories are relative to the current directory.
+ */
+ {
+ char ModuleFilename[MAX_PATH];
+ char *pSlash;
+ GetModuleFileName(NULL,ModuleFilename,sizeof(ModuleFilename));
+ pSlash=strrchr(ModuleFilename,'\\');
+ if (pSlash)
+ {
+ *pSlash='\0';
+ chdir(ModuleFilename);
+ }
+ }
+ OsVendorPreInit(argc, argv);
+ #endif
+
InitRegions();
CheckUserParameters(argc, argv, envp);
@@ -164,7 +209,6 @@ main(int argc, char *argv[], char *envp[])
#endif
InitBlockAndWakeupHandlers();
/* Perform any operating system dependent initializations you'd like */
- OsInit();
if (serverGeneration == 1) {
CreateWellKnownSockets();
for (i = 1; i < MAXCLIENTS; i++)
@@ -178,6 +222,7 @@ main(int argc, char *argv[], char *envp[])
ResetWellKnownSockets();
clients[0] = serverClient;
currentMaxClients = 1;
+ OsInit();
/* Initialize privates before first allocation */
dixResetPrivates();
@@ -292,6 +337,11 @@ main(int argc, char *argv[], char *envp[])
NotifyParentProcess();
+ #ifdef _MSC_VER
+ // initialise here because doing it in InitInput failes because keyboard device is not started yet then
+ winInitializeModeKeyStates ();
+ #endif
+
Dispatch();
#ifdef XQUARTZ