diff options
author | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-11-15 15:06:51 +0000 |
---|---|---|
committer | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-11-15 15:06:51 +0000 |
commit | 9826b83826190e514ed115e15691ca015780f9bc (patch) | |
tree | e6ede7a76c2edc14ff3025fbc0fb65757327cde0 /hw/xwin | |
parent | cecb668149e1956fb29bc89855182349122e2f4e (diff) |
Bufzilla #1802, http://freedesktop.org/bugzilla/show_bug.cgi?id=1802 Added
mingw (Win32) port
Diffstat (limited to 'hw/xwin')
-rw-r--r-- | hw/xwin/ChangeLog | 36 | ||||
-rw-r--r-- | hw/xwin/InitInput.c | 4 | ||||
-rw-r--r-- | hw/xwin/InitOutput.c | 297 | ||||
-rw-r--r-- | hw/xwin/win.h | 23 | ||||
-rw-r--r-- | hw/xwin/winblock.c | 7 | ||||
-rw-r--r-- | hw/xwin/winclipboard.h | 13 | ||||
-rw-r--r-- | hw/xwin/winclipboardthread.c | 74 | ||||
-rw-r--r-- | hw/xwin/winclipboardwndproc.c | 2 | ||||
-rw-r--r-- | hw/xwin/winconfig.c | 115 | ||||
-rw-r--r-- | hw/xwin/wincreatewnd.c | 2 | ||||
-rwxr-xr-x | hw/xwin/windialogs.c | 18 | ||||
-rw-r--r-- | hw/xwin/winengine.c | 13 | ||||
-rw-r--r-- | hw/xwin/winerror.c | 32 | ||||
-rw-r--r-- | hw/xwin/winglobals.c | 9 | ||||
-rw-r--r-- | hw/xwin/winkeybd.c | 2 | ||||
-rwxr-xr-x | hw/xwin/winmultiwindowicons.c | 2 | ||||
-rw-r--r-- | hw/xwin/winmultiwindowwindow.c | 3 | ||||
-rw-r--r-- | hw/xwin/winmultiwindowwm.c | 4 | ||||
-rw-r--r-- | hw/xwin/winprefs.c | 7 | ||||
-rwxr-xr-x | hw/xwin/winprocarg.c | 24 | ||||
-rw-r--r-- | hw/xwin/winscrinit.c | 2 | ||||
-rw-r--r-- | hw/xwin/winshadddnl.c | 2 | ||||
-rwxr-xr-x | hw/xwin/wintrayicon.c | 2 | ||||
-rw-r--r-- | hw/xwin/winwakeup.c | 1 | ||||
-rwxr-xr-x | hw/xwin/winwin32rootless.c | 3 | ||||
-rw-r--r-- | hw/xwin/winwindow.c | 2 | ||||
-rw-r--r-- | hw/xwin/winwindow.h | 4 | ||||
-rw-r--r-- | hw/xwin/winwndproc.c | 2 |
28 files changed, 541 insertions, 164 deletions
diff --git a/hw/xwin/ChangeLog b/hw/xwin/ChangeLog index a4abd46c4..904c1f031 100644 --- a/hw/xwin/ChangeLog +++ b/hw/xwin/ChangeLog @@ -1,3 +1,39 @@ +2004-11-15 Alexander Gottwald <ago at freedesktop dot org> + + * Imakefile: + * InitInput.c: (InitInput): + * InitOutput.c: (winClipboardShutdown), (ddxGiveUp), + (winCheckMount), (winGetBaseDir), (winFixupPaths), (OsVendorInit), + (winCheckDisplayNumber): + * win.h: + * winblock.c: (winBlockHandler): + * winclipboard.h: + * winclipboardthread.c: (winClipboardProc): + * winclipboardwndproc.c: (winClipboardWindowProc): + * winconfig.c: (winConfigKeyboard), (winConfigFiles): + * wincreatewnd.c: (winCreateBoundingWindowWindowed): + * windialogs.c: (winDisplayExitDialog), (winExitDlgProc), + (winAboutDlgProc): + * winengine.c: (winSetEngine): + * winerror.c: (OsVendorVErrorF), (winMessageBoxF), (scprintf): + * winglobals.c: (winInitializeGlobals): + * winkeybd.c: (winKeybdReleaseKeys): + * winmultiwindowicons.c: + * winmultiwindowwindow.c: (winCreateWindowsWindow): + * winmultiwindowwm.c: + * winprefs.c: (ReloadPrefs), (HandleCustomWM_COMMAND): + * winprocarg.c: (ddxProcessArgument): + * winscrinit.c: (winFinishScreenInitFB): + * winshadddnl.c: + * wintrayicon.c: (winHandleIconMessage): + * winwakeup.c: (winWakeupHandler): + * winwin32rootless.c: (winMWExtWMCreateFrame): + * winwindow.c: (winReshapeRootless): + * winwindow.h: + * winwndproc.c: (winWindowProc): + Bufzilla #1802, http://freedesktop.org/bugzilla/show_bug.cgi?id=1802 + Added mingw (Win32) port + 2004-11-06 Alexander Gottwald <ago at freedesktop dot org> * winwndproc.c, wintrayicon.c, winscrinit.c: diff --git a/hw/xwin/InitInput.c b/hw/xwin/InitInput.c index 6219fa2b9..e2277e45f 100644 --- a/hw/xwin/InitInput.c +++ b/hw/xwin/InitInput.c @@ -57,7 +57,9 @@ CARD32 g_c32LastInputEventTime = 0; * References to external symbols */ +#ifdef HAS_DEVWINDOWS extern int g_fdMessageQueue; +#endif extern Bool g_fXdmcpEnabled; #ifdef XWIN_CLIPBOARD extern winDispatchProcPtr winProcEstablishConnectionOrig; @@ -150,6 +152,7 @@ InitInput (int argc, char *argv[]) /* Initialize the mode key states */ winInitializeModeKeyStates (); +#ifdef HAS_DEVWINDOWS /* Only open the windows message queue device once */ if (g_fdMessageQueue == WIN_FD_INVALID) { @@ -165,6 +168,7 @@ InitInput (int argc, char *argv[]) /* Add the message queue as a device to wait for in WaitForSomething */ AddEnabledDevice (g_fdMessageQueue); } +#endif #if CYGDEBUG winDebug ("InitInput - returning\n"); diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index dafd7e7fd..ad668720c 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -32,8 +32,15 @@ from The Open Group. #include "winmsg.h" #include "winconfig.h" #include "winprefs.h" +#ifdef XWIN_CLIPBOARD #include "X11/Xlocale.h" +#endif +#ifdef __CYGWIN__ #include <mntent.h> +#endif +#if defined(XKB) && defined(WIN32) +#include "XKBsrv.h" +#endif /* @@ -51,7 +58,9 @@ extern int g_iLogVerbose; Bool g_fLogInited; extern Bool g_fXdmcpEnabled; +#ifdef HAS_DEVWINDOWS extern int g_fdMessageQueue; +#endif extern const char * g_pszQueryHost; extern HINSTANCE g_hInstance; @@ -148,13 +157,7 @@ winClipboardShutdown (void) return; /* Wait for the clipboard thread to exit */ - if (g_ptClipboardProc) - { - pthread_join (g_ptClipboardProc, NULL); - g_ptClipboardProc = 0; - } - else - return; + pthread_join (g_ptClipboardProc, NULL); g_fClipboardLaunched = FALSE; g_fClipboardStarted = FALSE; @@ -206,6 +209,7 @@ ddxGiveUp (void) winDeinitMultiWindowWM (); #endif +#ifdef HAS_DEVWINDOWS /* Close our handle to our message queue */ if (g_fdMessageQueue != WIN_FD_INVALID) { @@ -215,6 +219,7 @@ ddxGiveUp (void) /* Set the file handle to invalid */ g_fdMessageQueue = WIN_FD_INVALID; } +#endif if (!g_fLogInited) { LogInit (g_pszLogFile, NULL); @@ -267,6 +272,7 @@ AbortDDX (void) ddxGiveUp (); } +#ifdef __CYGWIN__ /* hasmntopt is currently not implemented for cygwin */ const char *winCheckMntOpt(const struct mntent *mnt, const char *opt) { @@ -349,7 +355,278 @@ winCheckMount(void) if (!binary) winMsg(X_WARNING, "/tmp mounted int textmode\n"); } +#else +void +winCheckMount(void) +{ +} +#endif + +const char * +winGetBaseDir(void) +{ + static BOOL inited = FALSE; + static char buffer[MAX_PATH]; + if (!inited) + { + char *fendptr; + HMODULE module = GetModuleHandle(NULL); + DWORD size = GetModuleFileName(module, buffer, sizeof(buffer)); + if (sizeof(buffer) > 0) + buffer[sizeof(buffer)-1] = 0; + + fendptr = buffer + size; + while (fendptr > buffer) + { + if (*fendptr == '\\' || *fendptr == '/') + { + *fendptr = 0; + break; + } + fendptr--; + } + inited = TRUE; + } + return buffer; +} +static void +winFixupPaths (void) +{ + BOOL changed_fontpath = FALSE; + MessageType font_from = X_DEFAULT; +#ifdef RELOCATE_PROJECTROOT + const char *basedir = winGetBaseDir(); + size_t basedirlen = strlen(basedir); +#endif + +#ifdef READ_FONTDIRS + { + /* Open fontpath configuration file */ + FILE *fontdirs = fopen(ETCX11DIR "/font-dirs", "rt"); + if (fontdirs != NULL) + { + char buffer[256]; + int needs_sep = TRUE; + int comment_block = FALSE; + + /* get defautl fontpath */ + char *fontpath = xstrdup(defaultFontPath); + size_t size = strlen(fontpath); + + /* read all lines */ + while (!feof(fontdirs)) + { + size_t blen; + char *hashchar; + char *str; + int has_eol = FALSE; + + /* read one line */ + str = fgets(buffer, sizeof(buffer), fontdirs); + if (str == NULL) /* stop on error or eof */ + break; + + if (strchr(str, '\n') != NULL) + has_eol = TRUE; + + /* check if block is continued comment */ + if (comment_block) + { + /* ignore all input */ + *str = 0; + blen = 0; + if (has_eol) /* check if line ended in this block */ + comment_block = FALSE; + } + else + { + /* find comment character. ignore all trailing input */ + hashchar = strchr(str, '#'); + if (hashchar != NULL) + { + *hashchar = 0; + if (!has_eol) /* mark next block as continued comment */ + comment_block = TRUE; + } + } + + /* strip whitespaces from beginning */ + while (*str == ' ' || *str == '\t') + str++; + + /* get size, strip whitespaces from end */ + blen = strlen(str); + while (blen > 0 && (str[blen-1] == ' ' || + str[blen-1] == '\t' || str[blen-1] == '\n')) + { + str[--blen] = 0; + } + + /* still something left to add? */ + if (blen > 0) + { + size_t newsize = size + blen; + /* reserve one character more for ',' */ + if (needs_sep) + newsize++; + + /* allocate memory */ + if (fontpath == NULL) + fontpath = malloc(newsize+1); + else + fontpath = realloc(fontpath, newsize+1); + + /* add separator */ + if (needs_sep) + { + fontpath[size] = ','; + size++; + needs_sep = FALSE; + } + + /* mark next line as new entry */ + if (has_eol) + needs_sep = TRUE; + + /* add block */ + strncpy(fontpath + size, str, blen); + fontpath[newsize] = 0; + size = newsize; + } + } + + /* cleanup */ + fclose(fontdirs); + defaultFontPath = xstrdup(fontpath); + free(fontpath); + changed_fontpath = TRUE; + font_from = X_CONFIG; + } + } +#endif /* READ_FONTDIRS */ +#ifdef RELOCATE_PROJECTROOT + { + const char *libx11dir = PROJECTROOT "/lib/X11"; + size_t libx11dir_len = strlen(libx11dir); + char *newfp = NULL; + size_t newfp_len = 0; + const char *endptr, *ptr, *oldptr = defaultFontPath; + + endptr = oldptr + strlen(oldptr); + ptr = strchr(oldptr, ','); + if (ptr == NULL) + ptr = endptr; + while (ptr != NULL) + { + size_t oldfp_len = (ptr - oldptr); + size_t newsize = oldfp_len; + char *newpath = malloc(newsize + 1); + strncpy(newpath, oldptr, newsize); + newpath[newsize] = 0; + + + if (strncmp(libx11dir, newpath, libx11dir_len) == 0) + { + char *compose; + newsize = newsize - libx11dir_len + basedirlen; + compose = malloc(newsize + 1); + strcpy(compose, basedir); + strncat(compose, newpath + libx11dir_len, newsize - basedirlen); + compose[newsize] = 0; + free(newpath); + newpath = compose; + } + + oldfp_len = newfp_len; + if (oldfp_len > 0) + newfp_len ++; /* space for separator */ + newfp_len += newsize; + + if (newfp == NULL) + newfp = malloc(newfp_len + 1); + else + newfp = realloc(newfp, newfp_len + 1); + + if (oldfp_len > 0) + { + strcpy(newfp + oldfp_len, ","); + oldfp_len++; + } + strcpy(newfp + oldfp_len, newpath); + + free(newpath); + + if (*ptr == 0) + { + oldptr = ptr; + ptr = NULL; + } else + { + oldptr = ptr + 1; + ptr = strchr(oldptr, ','); + if (ptr == NULL) + ptr = endptr; + } + } + + defaultFontPath = xstrdup(newfp); + free(newfp); + changed_fontpath = TRUE; + } +#endif /* RELOCATE_PROJECTROOT */ + if (changed_fontpath) + winMsg (font_from, "FontPath set to \"%s\"\n", defaultFontPath); + +#ifdef RELOCATE_PROJECTROOT + if (1) { + const char *libx11dir = "/usr/X11R6/lib/X11"; + size_t libx11dir_len = strlen(libx11dir); + + if (strncmp(libx11dir, rgbPath, libx11dir_len) == 0) + { + size_t newsize = strlen(rgbPath) - libx11dir_len + basedirlen; + char *compose = malloc(newsize + 1); + strcpy(compose, basedir); + strcat(compose, rgbPath + libx11dir_len); + compose[newsize] = 0; + rgbPath = xstrdup (compose); + free (compose); + + winMsg (X_DEFAULT, "RgbPath set to \"%s\"\n", rgbPath); + } + } + + if (getenv("XKEYSYMDB") == NULL) + { + char buffer[MAX_PATH]; + snprintf(buffer, sizeof(buffer), "XKEYSYMDB=%s\\XKeysymDB", + basedir); + buffer[sizeof(buffer)-1] = 0; + putenv(buffer); + winDebug("%s\n", getenv("XKEYSYMDB")); + } + if (getenv("XLOCALEDIR") == NULL) + { + char buffer[MAX_PATH]; + snprintf(buffer, sizeof(buffer), "XLOCALEDIR=%s\\locale", + basedir); + buffer[sizeof(buffer)-1] = 0; + putenv(buffer); + winDebug("%s\n", getenv("XLOCALEDIR")); + } +#ifdef XKB + { + static char xkbbasedir[MAX_PATH]; + + snprintf(xkbbasedir, sizeof(xkbbasedir), "%s\\xkb", basedir); + if (sizeof(xkbbasedir) > 0) + xkbbasedir[sizeof(xkbbasedir)-1] = 0; + XkbBaseDirectory = xkbbasedir; + } +#endif /* XKB */ +#endif /* RELOCATE_PROJECTROOT */ +} void OsVendorInit (void) @@ -404,6 +681,10 @@ OsVendorInit (void) /* We have to flag this as an explicit screen, even though it isn't */ g_ScreenInfo[0].fExplicitScreen = TRUE; } + + winFixupPaths(); + + XSupportsLocale(); } @@ -760,7 +1041,7 @@ winCheckDisplayNumber () } /* Setup Cygwin/X specific part of name */ - sprintf (name, "%sCYGWINX_DISPLAY:%d", pszPrefix, nDisp); + snprintf (name, sizeof(name), "%sCYGWINX_DISPLAY:%d", pszPrefix, nDisp); /* Windows automatically releases the mutex when this process exits */ mutex = CreateMutex (NULL, FALSE, name); diff --git a/hw/xwin/win.h b/hw/xwin/win.h index 759d18657..06155508f 100644 --- a/hw/xwin/win.h +++ b/hw/xwin/win.h @@ -139,8 +139,22 @@ #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> +#ifndef HAS_SCPRINTF +extern int scprintf(const char *format, ...); +#else +#ifdef WIN32 +#define scprintf _scprintf +#endif +#endif + +#ifndef __CYGWIN__ +#define sleep(x) Sleep(1000 * (x)) +#endif + #include <errno.h> +#if defined(XWIN_MULTIWINDOWEXTWM) || defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) #include <pthread.h> +#endif #ifdef HAS_MMAP #include <sys/mman.h> @@ -220,11 +234,10 @@ if (fDebugProcMsg) \ char *pszTemp; \ int iLength; \ \ - iLength = sprintf (NULL, str, ##__VA_ARGS__); \ - \ + iLength = scprintf (str, ##__VA_ARGS__); \ pszTemp = malloc (iLength + 1); \ - \ - sprintf (pszTemp, str, ##__VA_ARGS__); \ + snprintf (pszTemp, iLength + 1, str, ##__VA_ARGS__); \ + pszTemp[iLength] = 0; \ \ MessageBox (NULL, pszTemp, szFunctionName, MB_OK); \ \ @@ -626,7 +639,9 @@ typedef struct { extern winScreenInfo g_ScreenInfo[]; extern miPointerScreenFuncRec g_winPointerCursorFuncs; extern DWORD g_dwEvents; +#ifdef HAS_DEVWINDOWS extern int g_fdMessageQueue; +#endif extern int g_iScreenPrivateIndex; extern int g_iCmapPrivateIndex; extern int g_iGCPrivateIndex; diff --git a/hw/xwin/winblock.c b/hw/xwin/winblock.c index a7ca230c5..37da595a7 100644 --- a/hw/xwin/winblock.c +++ b/hw/xwin/winblock.c @@ -48,8 +48,15 @@ winBlockHandler (int nScreen, pointer pTimeout, pointer pReadMask) { +#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) winScreenPriv((ScreenPtr)pBlockData); +#endif MSG msg; +#ifndef HAS_DEVWINDOWS + 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 */ diff --git a/hw/xwin/winclipboard.h b/hw/xwin/winclipboard.h index 225f50418..559409a81 100644 --- a/hw/xwin/winclipboard.h +++ b/hw/xwin/winclipboard.h @@ -35,7 +35,12 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#ifdef __CYGWIN__ #include <sys/select.h> +#else +#include "Xwinsock.h" +#define HAS_WINSOCK +#endif #include <fcntl.h> #include <setjmp.h> #include <pthread.h> @@ -54,6 +59,10 @@ /* Fixups to prevent collisions between Windows and X headers */ #define ATOM DWORD +#ifndef __CYGWIN__ +#define sleep(x) Sleep (1000 * (x)) +#endif + /* Windows headers */ #ifndef XFree86Server #define XFree86Server @@ -65,7 +74,9 @@ /* Clipboard module constants */ #define WIN_CLIPBOARD_WINDOW_CLASS "xwinclip" #define WIN_CLIPBOARD_WINDOW_TITLE "xwinclip" -#define WIN_MSG_QUEUE_FNAME "/dev/windows" +#ifdef HAS_DEVWINDOWS +# define WIN_MSG_QUEUE_FNAME "/dev/windows" +#endif #define WIN_CONNECT_RETRIES 40 #define WIN_CONNECT_DELAY 4 #define WIN_JMP_OKAY 0 diff --git a/hw/xwin/winclipboardthread.c b/hw/xwin/winclipboardthread.c index 4778d2a3b..a1f73ed82 100644 --- a/hw/xwin/winclipboardthread.c +++ b/hw/xwin/winclipboardthread.c @@ -29,6 +29,9 @@ */ #include "winclipboard.h" +#ifdef __CYGWIN__ +#include <errno.h> +#endif #include "X11/Xauth.h" @@ -86,7 +89,11 @@ winClipboardProc (void *pvNotUsed) int iReturn; HWND hwnd = NULL; int iConnectionNumber = 0; +#ifdef HAS_DEVWINDOWS int fdMessageQueue = 0; +#else + struct timeval tvTimeout; +#endif fd_set fdsRead; int iMaxDescriptor; Display *pDisplay = NULL; @@ -94,6 +101,7 @@ winClipboardProc (void *pvNotUsed) int iRetries; Bool fUseUnicode; char szDisplay[512]; + int iSelectError; ErrorF ("winClipboardProc - Hello\n"); @@ -204,6 +212,7 @@ winClipboardProc (void *pvNotUsed) /* Get our connection number */ iConnectionNumber = ConnectionNumber (pDisplay); +#ifdef HAS_DEVWINDOWS /* Open a file descriptor for the windows message queue */ fdMessageQueue = open (WIN_MSG_QUEUE_FNAME, O_RDONLY); if (fdMessageQueue == -1) @@ -214,6 +223,9 @@ winClipboardProc (void *pvNotUsed) /* Find max of our file descriptors */ iMaxDescriptor = max (fdMessageQueue, iConnectionNumber) + 1; +#else + iMaxDescriptor = iConnectionNumber + 1; +#endif /* Select event types to watch */ if (XSelectInput (pDisplay, @@ -242,10 +254,6 @@ winClipboardProc (void *pvNotUsed) pthread_exit (NULL); } -#if 0 - ErrorF ("winClipboardProc - iWindow: %d\n", iWindow); -#endif - /* Save the window in the screen privates */ g_iClipboardWindow = iWindow; @@ -255,17 +263,6 @@ winClipboardProc (void *pvNotUsed) /* Save copy of HWND in screen privates */ g_hwndClipboard = hwnd; -#if 0 - /* Assert ownership of CLIPBOARD_MANAGER */ - iReturn = XSetSelectionOwner (pDisplay, atomClipboardManager, - iWindow, CurrentTime); - if (iReturn == BadAtom || iReturn == BadWindow) - { - ErrorF ("winClipboardProc - Could not set CLIPBOARD_MANAGER owner\n"); - pthread_exit (NULL); - } -#endif - /* Assert ownership of selections if Win32 clipboard is owned */ if (NULL != GetClipboardOwner ()) { @@ -316,17 +313,41 @@ winClipboardProc (void *pvNotUsed) * which descriptors are ready. */ FD_ZERO (&fdsRead); - FD_SET (fdMessageQueue, &fdsRead); FD_SET (iConnectionNumber, &fdsRead); +#ifdef HAS_DEVWINDOWS + FD_SET (fdMessageQueue, &fdsRead); +#else + tvTimeout.tv_sec = 0; + tvTimeout.tv_usec = 100; +#endif /* Wait for a Windows event or an X event */ iReturn = select (iMaxDescriptor, /* Highest fds number */ &fdsRead, /* Read mask */ NULL, /* No write mask */ NULL, /* No exception mask */ - NULL); /* No timeout */ - if (iReturn <= 0) +#ifdef HAS_DEVWINDOWS + NULL /* No timeout */ +#else + &tvTimeout /* Set timeout */ +#endif + ); + +#ifndef HAS_WINSOCK + iSelectError = errno; +#else + iSelectError = WSAGetLastError(); +#endif + + if (iReturn < 0) { +#ifndef HAS_WINSOCK + if (iSelectError == EINTR) +#else + if (iSelectError == WSAEINTR) +#endif + continue; + ErrorF ("winClipboardProc - Call to select () failed: %d. " "Bailing.\n", iReturn); break; @@ -335,11 +356,6 @@ winClipboardProc (void *pvNotUsed) /* Branch on which descriptor became active */ if (FD_ISSET (iConnectionNumber, &fdsRead)) { - /* X event ready */ -#if 0 - ErrorF ("winClipboardProc - X event ready\n"); -#endif - /* Process X events */ /* Exit when we see that server is shutting down */ iReturn = winClipboardFlushXEvents (hwnd, @@ -354,14 +370,13 @@ winClipboardProc (void *pvNotUsed) } } +#ifdef HAS_DEVWINDOWS /* Check for Windows event ready */ if (FD_ISSET (fdMessageQueue, &fdsRead)) - { - /* Windows event ready */ -#if 0 - ErrorF ("winClipboardProc - Windows event ready\n"); +#else + if (1) #endif - + { /* Process Windows messages */ if (!winClipboardFlushWindowsMessageQueue (hwnd)) { @@ -383,9 +398,12 @@ winClipboardProc (void *pvNotUsed) ErrorF ("winClipboardProc - XDestroyWindow succeeded.\n"); } + +#ifdef HAS_DEVWINDOWS /* Close our Win32 message handle */ if (fdMessageQueue) close (fdMessageQueue); +#endif #if 0 /* diff --git a/hw/xwin/winclipboardwndproc.c b/hw/xwin/winclipboardwndproc.c index cfc97a51b..249f64b59 100644 --- a/hw/xwin/winclipboardwndproc.c +++ b/hw/xwin/winclipboardwndproc.c @@ -334,6 +334,8 @@ winClipboardWindowProc (HWND hwnd, UINT message, * previous XSetSelectionOwner messages. */ XSync (pDisplay, FALSE); + + winDebug("winClipboardWindowProc - XSync done.\n"); /* Release PRIMARY selection if owned */ iReturn = XGetSelectionOwner (pDisplay, XA_PRIMARY); diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c index b8c773268..40d8bd0a6 100644 --- a/hw/xwin/winconfig.c +++ b/hw/xwin/winconfig.c @@ -374,7 +374,7 @@ winConfigKeyboard (DeviceIntPtr pDevice) char lname[256]; DWORD namesize = sizeof(lname); - regpath = alloca(sizeof(regtempl) + KL_NAMELENGTH + 1); + regpath = malloc(sizeof(regtempl) + KL_NAMELENGTH + 1); strcpy(regpath, regtempl); strcat(regpath, layoutName); @@ -388,6 +388,7 @@ winConfigKeyboard (DeviceIntPtr pDevice) /* Close registry key */ if (regkey) RegCloseKey (regkey); + free(regpath); } } @@ -737,117 +738,19 @@ winConfigFiles () MessageType from; /* Fontpath */ - from = X_DEFAULT; - if (g_cmdline.fontPath) { - from = X_CMDLINE; defaultFontPath = g_cmdline.fontPath; + winMsg (X_CMDLINE, "FontPath set to \"%s\"\n", defaultFontPath); } - else - { - /* Open fontpath configuration file */ - FILE *fontdirs = fopen(ETCX11DIR "/font-dirs", "rt"); - if (fontdirs != NULL) - { - char buffer[256]; - int needs_sep = TRUE; - int comment_block = FALSE; - - /* get defautl fontpath */ - char *fontpath = xstrdup(defaultFontPath); - size_t size = strlen(fontpath); - - /* read all lines */ - while (!feof(fontdirs)) - { - size_t blen; - char *hashchar; - char *str; - int has_eol = FALSE; - - /* read one line */ - str = fgets(buffer, sizeof(buffer), fontdirs); - if (str == NULL) /* stop on error or eof */ - break; - - if (strchr(str, '\n') != NULL) - has_eol = TRUE; - - /* check if block is continued comment */ - if (comment_block) - { - /* ignore all input */ - *str = 0; - blen = 0; - if (has_eol) /* check if line ended in this block */ - comment_block = FALSE; - } - else - { - /* find comment character. ignore all trailing input */ - hashchar = strchr(str, '#'); - if (hashchar != NULL) - { - *hashchar = 0; - if (!has_eol) /* mark next block as continued comment */ - comment_block = TRUE; - } - } - - /* strip whitespaces from beginning */ - while (*str == ' ' || *str == '\t') - str++; - - /* get size, strip whitespaces from end */ - blen = strlen(str); - while (blen > 0 && (str[blen-1] == ' ' || - str[blen-1] == '\t' || str[blen-1] == '\n')) - { - str[--blen] = 0; - } - - /* still something left to add? */ - if (blen > 0) - { - size_t newsize = size + blen; - /* reserve one character more for ',' */ - if (needs_sep) - newsize++; - - /* allocate memory */ - if (fontpath == NULL) - fontpath = malloc(newsize+1); - else - fontpath = realloc(fontpath, newsize+1); - - /* add separator */ - if (needs_sep) - { - fontpath[size] = ','; - size++; - needs_sep = FALSE; - } - - /* mark next line as new entry */ - if (has_eol) - needs_sep = TRUE; - - /* add block */ - strncpy(fontpath + size, str, blen); - fontpath[newsize] = 0; - size = newsize; - } - } - /* cleanup */ - fclose(fontdirs); - from = X_CONFIG; - defaultFontPath = xstrdup(fontpath); - free(fontpath); - } + /* RGBPath */ + if (g_cmdline.rgbPath) + { + from = X_CMDLINE; + rgbPath = g_cmdline.rgbPath; + winMsg (X_CMDLINE, "RgbPath set to \"%s\"\n", rgbPath); } - winMsg (from, "FontPath set to \"%s\"\n", defaultFontPath); return TRUE; } diff --git a/hw/xwin/wincreatewnd.c b/hw/xwin/wincreatewnd.c index 4c74f89e2..310771809 100644 --- a/hw/xwin/wincreatewnd.c +++ b/hw/xwin/wincreatewnd.c @@ -419,7 +419,9 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) #endif ) { +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) pScreenPriv->fRootWindowShown = FALSE; +#endif ShowWindow (*phwnd, SW_HIDE); } else diff --git a/hw/xwin/windialogs.c b/hw/xwin/windialogs.c index af0e4d9b8..decbd8531 100755 --- a/hw/xwin/windialogs.c +++ b/hw/xwin/windialogs.c @@ -30,7 +30,9 @@ */ #include "win.h" +#ifdef __CYGWIN__ #include <sys/cygwin.h> +#endif #include <shellapi.h> #include "winprefs.h" @@ -44,7 +46,9 @@ extern HWND g_hDlgDepthChange; 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 @@ winDisplayExitDialog (winPrivScreenPtr pScreenPriv) 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,7 +322,7 @@ winExitDlgProc (HWND hDialog, UINT message, 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; @@ -323,6 +331,7 @@ winExitDlgProc (HWND hDialog, UINT message, return TRUE; snprintf (pszConnectedClients, iReturn + 1, CONNECTED_CLIENTS_FORMAT, s_pScreenPriv->iConnectedClients); + pszConnectedClients[iReturn] = 0; /* Set the number of connected clients */ SetWindowText (GetDlgItem (hDialog, IDC_CLIENTS_CONNECTED), @@ -669,13 +678,18 @@ winAboutDlgProc (HWND hwndDialog, UINT message, case ID_ABOUT_CHANGELOG: { + int iReturn; +#ifdef __CYGWIN__ 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", diff --git a/hw/xwin/winengine.c b/hw/xwin/winengine.c index c7eb1285b..87a1dd2e1 100644 --- a/hw/xwin/winengine.c +++ b/hw/xwin/winengine.c @@ -204,6 +204,19 @@ winSetEngine (ScreenPtr pScreen) winSetEngineFunctionsShadowGDI (pScreen); return TRUE; } +#ifdef WIN_PSEUDOCOLOR8BITPLANE + /* Edited by Sebastian Haby + ShadowGDI is the only engine that supports PseudoColor "emulation" */ + if (pScreenInfo->fEmulatePseudo) + { + winErrorFVerb (2, "winSetEngine - EMULATEPSEUDO => ShadowGDI\n"); + pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI; + + /* Set engine function pointers */ + winSetEngineFunctionsShadowGDI (pScreen); + return TRUE; + } +#endif /* If the user's choice is supported, we'll use that */ if (g_dwEnginesSupported & pScreenInfo->dwEnginePreferred) diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c index d5836b999..53730c7ed 100644 --- a/hw/xwin/winerror.c +++ b/hw/xwin/winerror.c @@ -43,16 +43,22 @@ OsVendorVErrorF (const char *pszFormat, va_list va_args); void OsVendorVErrorF (const char *pszFormat, va_list va_args) { +#if defined(XWIN_CLIPBOARD) || defined (XWIN_MULTIWINDOW) + /* make sure the clipboard and multiwindow threads do not interfere the + * main thread */ 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); +#if defined(XWIN_CLIPBOARD) || defined (XWIN_MULTIWINDOW) /* Unlock the printing mutex */ pthread_mutex_unlock (&s_pmPrinting); +#endif } #endif @@ -94,17 +100,18 @@ winMessageBoxF (const char *pszError, UINT uType, ...) /* 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; /* Create the formatted error string */ va_start (args, uType); - sprintf (pszErrorF, pszError, args); + snprintf (pszErrorF, i + 1, pszError, args); + pszErrorF[i] = 0; va_end (args); #define MESSAGEBOXF \ @@ -116,21 +123,22 @@ winMessageBoxF (const char *pszError, UINT uType, ...) "%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; /* Format the message box string */ - sprintf (pszMsgBox, MESSAGEBOXF, + snprintf (pszMsgBox, i + 1, MESSAGEBOXF, pszErrorF, VENDOR_STRING, VERSION_STRING, VENDOR_CONTACT, g_pszCommandLine); + pszMsgBox[i] = 0; /* Display the message box string */ MessageBox (NULL, @@ -145,3 +153,15 @@ winMessageBoxF (const char *pszError, UINT uType, ...) free (pszMsgBox); #undef MESSAGEBOXF } + +#ifndef HAS_SCPRINTF +extern int scprintf(const char *format, ...) +{ + int ret; + va_list va; + va_start(va, format); + ret = vsnprintf(NULL, 0, format, va); + va_end(va); + return ret; +} +#endif diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c index f38df68c5..0dc1af81e 100644 --- a/hw/xwin/winglobals.c +++ b/hw/xwin/winglobals.c @@ -38,7 +38,9 @@ int g_iNumScreens = 0; winScreenInfo g_ScreenInfo[MAXSCREENS]; int g_iLastScreen = -1; +#ifdef HAS_DEVWINDOWS int g_fdMessageQueue = WIN_FD_INVALID; +#endif int g_iScreenPrivateIndex = -1; int g_iCmapPrivateIndex = -1; int g_iGCPrivateIndex = -1; @@ -55,7 +57,11 @@ const char * g_pszQueryHost = NULL; Bool g_fXdmcpEnabled = FALSE; HICON g_hIconX = NULL; HICON g_hSmallIconX = NULL; +#ifndef RELOCATE_PROJECTROOT 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; @@ -99,7 +105,7 @@ Bool g_fUnicodeClipboard = TRUE; Bool g_fClipboard = FALSE; Bool g_fClipboardLaunched = FALSE; Bool g_fClipboardStarted = FALSE; -pthread_t g_ptClipboardProc = 0; +pthread_t g_ptClipboardProc; HWND g_hwndClipboard = NULL; void *g_pClipboardDisplay = NULL; Window g_iClipboardWindow = None; @@ -124,6 +130,5 @@ winInitializeGlobals (void) g_pClipboardDisplay = NULL; g_atomLastOwnedSelection = None; g_hwndClipboard = NULL; - g_ptClipboardProc = 0; #endif } diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c index 8fd9c49a6..c2d2f38c4 100644 --- a/hw/xwin/winkeybd.c +++ b/hw/xwin/winkeybd.c @@ -541,9 +541,11 @@ winKeybdReleaseKeys () { int i; +#ifdef HAS_DEVWINDOWS /* Verify that the mi input system has been initialized */ if (g_fdMessageQueue == WIN_FD_INVALID) return; +#endif /* Loop through all keys */ for (i = 0; i < NUM_KEYCODES; ++i) diff --git a/hw/xwin/winmultiwindowicons.c b/hw/xwin/winmultiwindowicons.c index 34151a46c..e57755f35 100755 --- a/hw/xwin/winmultiwindowicons.c +++ b/hw/xwin/winmultiwindowicons.c @@ -359,6 +359,7 @@ winXIconToHICON (WindowPtr pWin, int iconSize) * Change the Windows window icon */ +#ifdef XWIN_MULTIWINDOW void winUpdateIcon (Window id) { @@ -471,3 +472,4 @@ void winDestroyIcon(HICON hIcon) !winIconIsOverride((unsigned long)hIcon)) DestroyIcon (hIcon); } +#endif diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c index 7c369a4a4..f1c6e417a 100644 --- a/hw/xwin/winmultiwindowwindow.c +++ b/hw/xwin/winmultiwindowwindow.c @@ -524,7 +524,8 @@ winCreateWindowsWindow (WindowPtr pWin) } /* Add incrementing window ID to make unique class name */ - sprintf (pszWindowID, "-%x", s_iWindowID++); + snprintf (pszWindowID, sizeof(pszWindowID), "-%x", s_iWindowID++); + pszWindowID[sizeof(pszWindowID)-1] = 0; strcat (pszClass, pszWindowID); #if CYGMULTIWINDOW_DEBUG diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index 266448dc7..608cf361c 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -68,7 +68,9 @@ extern void winDebug(const char *format, ...); #define WIN_CONNECT_RETRIES 5 #define WIN_CONNECT_DELAY 5 -#define WIN_MSG_QUEUE_FNAME "/dev/windows" +#ifdef HAS_DEVWINDOWS +# define WIN_MSG_QUEUE_FNAME "/dev/windows" +#endif #define WIN_JMP_OKAY 0 #define WIN_JMP_ERROR_IO 2 diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c index ea36dd9b8..e59de037f 100644 --- a/hw/xwin/winprefs.c +++ b/hw/xwin/winprefs.c @@ -31,7 +31,9 @@ #include <stdio.h> #include <stdlib.h> +#ifdef __CYGWIN__ #include <sys/resource.h> +#endif #include "win.h" /* Fixups to prevent collisions between Windows and X headers */ @@ -281,7 +283,9 @@ ReloadPrefs (void) g_hIconX = NULL; g_hSmallIconX = NULL; +#ifdef XWIN_MULTIWINDOW winInitGlobalIcons(); +#endif #ifdef XWIN_MULTIWINDOW /* Rebuild the icons and menus */ @@ -348,6 +352,7 @@ HandleCustomWM_COMMAND (unsigned long hwndIn, /* Match! */ switch(m->menuItem[j].cmd) { +#ifdef __CYGWIN__ case CMD_EXEC: if (fork()==0) { @@ -372,7 +377,7 @@ HandleCustomWM_COMMAND (unsigned long hwndIn, else return TRUE; break; - +#endif case CMD_ALWAYSONTOP: if (!hwnd) return FALSE; diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c index 46d665013..7a1caf9e9 100755 --- a/hw/xwin/winprocarg.c +++ b/hw/xwin/winprocarg.c @@ -403,16 +403,20 @@ ddxProcessArgument (int argc, char *argv[], int i) /* 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 @@ ddxProcessArgument (int argc, char *argv[], int i) /* 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 @@ ddxProcessArgument (int argc, char *argv[], int i) /* 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 @@ ddxProcessArgument (int argc, char *argv[], int i) /* 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 @@ ddxProcessArgument (int argc, char *argv[], int i) /* 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 @@ ddxProcessArgument (int argc, char *argv[], int i) /* 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; } diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c index 07332dc51..50c329419 100644 --- a/hw/xwin/winscrinit.c +++ b/hw/xwin/winscrinit.c @@ -257,7 +257,9 @@ winFinishScreenInitFB (int index, winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; VisualPtr pVisual = NULL; char *pbits = NULL; +#if defined(XWIN_CLIPBOARD) || defined(XWIN_MULTIWINDOW) int iReturn; +#endif /* Create framebuffer */ if (!(*pScreenPriv->pwinAllocateFB) (pScreen)) diff --git a/hw/xwin/winshadddnl.c b/hw/xwin/winshadddnl.c index 2ec28c957..243579a84 100644 --- a/hw/xwin/winshadddnl.c +++ b/hw/xwin/winshadddnl.c @@ -523,6 +523,7 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen) } +#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) /* * Create a DirectDraw surface for the new multi-window window */ @@ -568,6 +569,7 @@ winFinishCreateWindowsWindowDDNL (WindowPtr pWin) } return TRUE; } +#endif /* diff --git a/hw/xwin/wintrayicon.c b/hw/xwin/wintrayicon.c index 2b8bc6c61..24cf9f90a 100755 --- a/hw/xwin/wintrayicon.c +++ b/hw/xwin/wintrayicon.c @@ -111,7 +111,9 @@ winHandleIconMessage (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, winPrivScreenPtr pScreenPriv) { +#ifdef XWIN_MULTIWINDOWEXTWM winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; +#endif switch (lParam) { diff --git a/hw/xwin/winwakeup.c b/hw/xwin/winwakeup.c index 4553a4636..0411d7c1a 100644 --- a/hw/xwin/winwakeup.c +++ b/hw/xwin/winwakeup.c @@ -51,7 +51,6 @@ winWakeupHandler (int nScreen, unsigned long ulResult, pointer pReadmask) { - winScreenPriv((ScreenPtr)pWakeupData); MSG msg; /* Process all messages on our queue */ diff --git a/hw/xwin/winwin32rootless.c b/hw/xwin/winwin32rootless.c index 04e940c02..ce0c2f948 100755 --- a/hw/xwin/winwin32rootless.c +++ b/hw/xwin/winwin32rootless.c @@ -276,7 +276,8 @@ winMWExtWMCreateFrame (RootlessWindowPtr pFrame, ScreenPtr pScreen, } /* Add incrementing window ID to make unique class name */ - sprintf (pszWindowID, "-%x", s_iWindowID++); + snprintf (pszWindowID, sizeof(pszWindowID), "-%x", s_iWindowID++); + pszWindowID[sizeof(pszWindowID)-1] = 0; strcat (pszClass, pszWindowID); #if CYGMULTIWINDOW_DEBUG diff --git a/hw/xwin/winwindow.c b/hw/xwin/winwindow.c index 86dd71178..e8067cb46 100644 --- a/hw/xwin/winwindow.c +++ b/hw/xwin/winwindow.c @@ -470,7 +470,7 @@ void winReshapeRootless (WindowPtr pWin) { int nRects; - ScreenPtr pScreen = pWin->drawable.pScreen; + /* ScreenPtr pScreen = pWin->drawable.pScreen;*/ RegionRec rrNewShape; BoxPtr pShape, pRects, pEnd; HRGN hRgn, hRgnRect; diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h index cea662a86..a94c3a754 100644 --- a/hw/xwin/winwindow.h +++ b/hw/xwin/winwindow.h @@ -46,7 +46,9 @@ #define WINDOW_CLASS_X "cygwin/x X rl" #define WINDOW_TITLE_X "Cygwin/X X" #define WIN_WINDOW_PROP "cyg_window_prop_rl" -#define WIN_MSG_QUEUE_FNAME "/dev/windows" +#ifdef HAS_DEVWINDOWS +# define WIN_MSG_QUEUE_FNAME "/dev/windows" +#endif #define WIN_WID_PROP "cyg_wid_prop_rl" #define WIN_NEEDMANAGE_PROP "cyg_override_redirect_prop_rl" #ifndef CYGMULTIWINDOW_DEBUG diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c index 2cfb78eaa..67fc8d356 100644 --- a/hw/xwin/winwndproc.c +++ b/hw/xwin/winwndproc.c @@ -1148,8 +1148,10 @@ winWindowProc (HWND hwnd, UINT message, 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); |