Index: Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/Imakefile,v retrieving revision 1.4 diff -u -r1.4 Imakefile --- Imakefile 28 Oct 2004 14:23:07 -0000 1.4 +++ Imakefile 9 Nov 2004 14:19:45 -0000 @@ -6,7 +6,9 @@ SHMDEF = -DHAS_SHM #endif +#ifdef cygwinArchitecture MMAPDEF = -DHAS_MMAP +#endif #if BuildXWinClipboard SRCS_CLIPBOARD = \ Index: InitInput.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/InitInput.c,v retrieving revision 1.3 diff -u -r1.3 InitInput.c --- InitInput.c 21 Jun 2004 13:19:32 -0000 1.3 +++ InitInput.c 9 Nov 2004 14:19:46 -0000 @@ -150,6 +150,7 @@ /* Initialize the mode key states */ winInitializeModeKeyStates (); +#ifdef __CYGWIN__ /* Only open the windows message queue device once */ if (g_fdMessageQueue == WIN_FD_INVALID) { @@ -165,6 +166,7 @@ /* Add the message queue as a device to wait for in WaitForSomething */ AddEnabledDevice (g_fdMessageQueue); } +#endif #if CYGDEBUG winDebug ("InitInput - returning\n"); Index: InitOutput.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/InitOutput.c,v retrieving revision 1.6 diff -u -r1.6 InitOutput.c --- InitOutput.c 4 Nov 2004 11:52:22 -0000 1.6 +++ InitOutput.c 9 Nov 2004 14:19:47 -0000 @@ -32,8 +32,12 @@ #include "winmsg.h" #include "winconfig.h" #include "winprefs.h" +#ifdef XWIN_CLIPBOARD #include "X11/Xlocale.h" +#endif +#ifdef __CYGWIN__ #include +#endif /* @@ -267,6 +271,7 @@ ddxGiveUp (); } +#ifdef __CYGWIN__ /* hasmntopt is currently not implemented for cygwin */ const char *winCheckMntOpt(const struct mntent *mnt, const char *opt) { @@ -349,6 +354,12 @@ if (!binary) winMsg(X_WARNING, "/tmp mounted int textmode\n"); } +#else +void +winCheckMount(void) +{ +} +#endif void Index: win.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/win.h,v retrieving revision 1.7 diff -u -r1.7 win.h --- win.h 4 Nov 2004 11:52:22 -0000 1.7 +++ win.h 9 Nov 2004 14:19:50 -0000 @@ -139,8 +139,16 @@ #include #include #include +#ifdef WIN32 +#define scprintf _scprintf +#else +extern int scprintf(const char *format, ...); +#endif + #include +#ifdef __CYGWIN__ #include +#endif #ifdef HAS_MMAP #include @@ -220,7 +228,7 @@ char *pszTemp; \ int iLength; \ \ - iLength = sprintf (NULL, str, ##__VA_ARGS__); \ + iLength = scprintf (str, ##__VA_ARGS__); \ \ pszTemp = malloc (iLength + 1); \ \ Index: winblock.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winblock.c,v retrieving revision 1.3 diff -u -r1.3 winblock.c --- winblock.c 21 Jun 2004 13:19:32 -0000 1.3 +++ winblock.c 9 Nov 2004 14:19:50 -0000 @@ -50,6 +50,11 @@ { winScreenPriv((ScreenPtr)pBlockData); MSG msg; +#ifdef WIN32 + struct timeval **tvp = pTimeout; + (*tvp)->tv_sec = 0; + (*tvp)->tv_usec = 100; +#endif #if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) /* Signal threaded modules to begin */ Index: wincreatewnd.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/wincreatewnd.c,v retrieving revision 1.5 diff -u -r1.5 wincreatewnd.c --- wincreatewnd.c 28 Oct 2004 14:23:08 -0000 1.5 +++ wincreatewnd.c 9 Nov 2004 14:19:52 -0000 @@ -419,7 +419,9 @@ #endif ) { +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) pScreenPriv->fRootWindowShown = FALSE; +#endif ShowWindow (*phwnd, SW_HIDE); } else Index: windialogs.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/windialogs.c,v retrieving revision 1.3 diff -u -r1.3 windialogs.c --- windialogs.c 21 Jun 2004 13:19:32 -0000 1.3 +++ windialogs.c 9 Nov 2004 14:19:53 -0000 @@ -30,7 +30,9 @@ */ #include "win.h" +#ifdef __CYGWIN__ #include +#endif #include #include "winprefs.h" @@ -44,7 +46,9 @@ extern HWND g_hDlgExit; extern HWND g_hDlgAbout; extern WINPREFS pref; +#ifdef XWIN_CLIPBOARD extern Bool g_fClipboardStarted; +#endif extern Bool g_fSoftwareCursor; @@ -217,11 +221,15 @@ for (i = 1; i < currentMaxClients; i++) if (clients[i] != NullClient) liveClients++; +#if defined(XWIN_MULTIWINDOW) /* Count down server internal clients */ if (pScreenPriv->pScreenInfo->fMultiWindow) liveClients -= 2; /* multiwindow window manager & XMsgProc */ +#endif +#if defined(XWIN_CLIPBOARD) if (g_fClipboardStarted) liveClients--; /* clipboard manager */ +#endif /* A user reported that this sometimes drops below zero. just eye-candy. */ if (liveClients < 0) @@ -314,14 +322,14 @@ MAKEINTRESOURCE(IDI_XWIN))); /* Format the connected clients string */ - iReturn = sprintf (NULL, CONNECTED_CLIENTS_FORMAT, + iReturn = scprintf (CONNECTED_CLIENTS_FORMAT, s_pScreenPriv->iConnectedClients); if (iReturn <= 0) return TRUE; pszConnectedClients = malloc (iReturn + 1); if (!pszConnectedClients) return TRUE; - snprintf (pszConnectedClients, iReturn + 1, CONNECTED_CLIENTS_FORMAT, + sprintf (pszConnectedClients, CONNECTED_CLIENTS_FORMAT, s_pScreenPriv->iConnectedClients); /* Set the number of connected clients */ @@ -669,13 +677,18 @@ case ID_ABOUT_CHANGELOG: { + int iReturn; +#ifndef WIN32 const char * pszCygPath = "/usr/X11R6/share/doc/" "xorg-x11-xwin/changelog.html"; char pszWinPath[MAX_PATH + 1]; - int iReturn; /* Convert the POSIX path to a Win32 path */ cygwin_conv_to_win32_path (pszCygPath, pszWinPath); +#else + const char * pszWinPath = "http://x.cygwin.com/" + "devel/server/changelog.html"; +#endif iReturn = (int) ShellExecute (NULL, "open", Index: winerror.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winerror.c,v retrieving revision 1.4 diff -u -r1.4 winerror.c --- winerror.c 27 Jul 2004 09:53:14 -0000 1.4 +++ winerror.c 9 Nov 2004 14:19:53 -0000 @@ -43,16 +43,20 @@ void OsVendorVErrorF (const char *pszFormat, va_list va_args) { +#ifdef CYGWIN static pthread_mutex_t s_pmPrinting = PTHREAD_MUTEX_INITIALIZER; /* Lock the printing mutex */ pthread_mutex_lock (&s_pmPrinting); +#endif /* Print the error message to a log file, could be stderr */ LogVWrite (0, pszFormat, va_args); +#ifdef __CYGWIN__ /* Unlock the printing mutex */ pthread_mutex_unlock (&s_pmPrinting); +#endif } #endif @@ -94,11 +98,11 @@ /* Get length of formatted error string */ va_start (args, uType); - i = sprintf (NULL, pszError, args); + i = scprintf (pszError, args); va_end (args); /* Allocate memory for formatted error string */ - pszErrorF = malloc (i); + pszErrorF = malloc (i + 1); if (!pszErrorF) goto winMessageBoxF_Cleanup; @@ -116,13 +120,13 @@ "%s\n" /* Get length of message box string */ - i = sprintf (NULL, MESSAGEBOXF, + i = scprintf (MESSAGEBOXF, pszErrorF, VENDOR_STRING, VERSION_STRING, VENDOR_CONTACT, g_pszCommandLine); /* Allocate memory for message box string */ - pszMsgBox = malloc (i); + pszMsgBox = malloc (i + 1); if (!pszMsgBox) goto winMessageBoxF_Cleanup; @@ -145,3 +149,14 @@ free (pszMsgBox); #undef MESSAGEBOXF } + +#ifndef WIN32 +extern int scprintf(const char *format, ...) +{ + int ret; + va_list va; + va_start(va, format); + ret = vsprintf(NULL, format, va); + va_end(va); +} +#endif Index: winglobals.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winglobals.c,v retrieving revision 1.3 diff -u -r1.3 winglobals.c --- winglobals.c 27 Jul 2004 09:53:14 -0000 1.3 +++ winglobals.c 9 Nov 2004 14:19:54 -0000 @@ -55,7 +55,11 @@ Bool g_fXdmcpEnabled = FALSE; HICON g_hIconX = NULL; HICON g_hSmallIconX = NULL; +#ifndef WIN32 char * g_pszLogFile = "/tmp/XWin.log"; +#else +char * g_pszLogFile = "XWin.log"; +#endif int g_iLogVerbose = 2; Bool g_fLogInited = FALSE; char * g_pszCommandLine = NULL; Index: winmultiwindowicons.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winmultiwindowicons.c,v retrieving revision 1.3 diff -u -r1.3 winmultiwindowicons.c --- winmultiwindowicons.c 21 Jun 2004 13:19:32 -0000 1.3 +++ winmultiwindowicons.c 9 Nov 2004 14:19:54 -0000 @@ -359,6 +359,7 @@ * Change the Windows window icon */ +#ifdef XWIN_MULTIWINDOW void winUpdateIcon (Window id) { @@ -471,3 +472,4 @@ !winIconIsOverride((unsigned long)hIcon)) DestroyIcon (hIcon); } +#endif Index: winprefs.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winprefs.c,v retrieving revision 1.3 diff -u -r1.3 winprefs.c --- winprefs.c 21 Jun 2004 13:19:32 -0000 1.3 +++ winprefs.c 9 Nov 2004 14:19:55 -0000 @@ -31,7 +31,9 @@ #include #include +#ifndef WIN32 #include +#endif #include "win.h" /* Fixups to prevent collisions between Windows and X headers */ @@ -281,7 +283,9 @@ g_hIconX = NULL; g_hSmallIconX = NULL; +#ifdef XWIN_MULTIWINDOW winInitGlobalIcons(); +#endif #ifdef XWIN_MULTIWINDOW /* Rebuild the icons and menus */ @@ -348,6 +352,7 @@ /* Match! */ switch(m->menuItem[j].cmd) { +#ifndef WIN32 case CMD_EXEC: if (fork()==0) { @@ -372,7 +377,7 @@ else return TRUE; break; - +#endif case CMD_ALWAYSONTOP: if (!hwnd) return FALSE; Index: winprocarg.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winprocarg.c,v retrieving revision 1.5 diff -u -r1.5 winprocarg.c --- winprocarg.c 4 Nov 2004 11:52:22 -0000 1.5 +++ winprocarg.c 9 Nov 2004 14:19:58 -0000 @@ -403,16 +403,20 @@ /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) if (!g_ScreenInfo[j].fMultiMonitorOverride) g_ScreenInfo[j].fMultipleMonitors = FALSE; +#endif g_ScreenInfo[j].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; } @@ -459,16 +463,20 @@ /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) if (!g_ScreenInfo[j].fMultiMonitorOverride) g_ScreenInfo[j].fMultipleMonitors = FALSE; +#endif g_ScreenInfo[j].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; } @@ -548,16 +556,20 @@ /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) if (!g_ScreenInfo[j].fMultiMonitorOverride) g_ScreenInfo[j].fMultipleMonitors = FALSE; +#endif g_ScreenInfo[j].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; } @@ -579,16 +591,20 @@ /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) if (!g_ScreenInfo[j].fMultiMonitorOverride) g_ScreenInfo[j].fMultipleMonitors = TRUE; +#endif g_ScreenInfo[j].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; } @@ -611,14 +627,18 @@ /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) g_ScreenInfo[j].fMultiMonitorOverride = TRUE; +#endif g_ScreenInfo[j].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; } @@ -640,14 +660,18 @@ /* Parameter is for all screens */ for (j = 0; j < MAXSCREENS; j++) { +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) g_ScreenInfo[j].fMultiMonitorOverride = TRUE; +#endif g_ScreenInfo[j].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; } Index: winwndproc.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winwndproc.c,v retrieving revision 1.7 diff -u -r1.7 winwndproc.c --- winwndproc.c 6 Nov 2004 11:56:57 -0000 1.7 +++ winwndproc.c 9 Nov 2004 14:19:59 -0000 @@ -1148,8 +1148,10 @@ ShowCursor (TRUE); } +#ifdef XWIN_CLIPBOARD /* Make sure the clipboard chain is ok. */ winFixClipboardChain (); +#endif /* Call engine specific screen activation/deactivation function */ (*s_pScreenPriv->pwinActivateApp) (s_pScreen);