From 978116d14ceab9740f6ca3c95c12c848541ecf84 Mon Sep 17 00:00:00 2001 From: Harold L Hunt II Date: Tue, 2 Mar 2004 04:14:05 +0000 Subject: [PATCH] Add enable/disable flags for MultiWindowExtWM mode. Fix bug for -help message not being saved to log file. --- hw/xwin/InitOutput.c | 29 +++++++++++++++++++---------- hw/xwin/win.h | 25 +++++++++++++++---------- hw/xwin/winblock.c | 2 ++ hw/xwin/wincreatewnd.c | 16 ++++++++++++++-- hw/xwin/winengine.c | 6 +++++- hw/xwin/winerror.c | 2 +- hw/xwin/winglobals.c | 4 +++- hw/xwin/winkeybd.c | 1 + hw/xwin/winprocarg.c | 8 ++++++-- hw/xwin/winscrinit.c | 21 +++++++++++++++------ hw/xwin/winwakeup.c | 4 +++- hw/xwin/winwindow.h | 1 - hw/xwin/winwndproc.c | 40 ++++++++++++++++++++++++++++++++++------ 13 files changed, 118 insertions(+), 41 deletions(-) diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 2681e77c4..ea7fe8ccd 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -44,17 +44,16 @@ from The Open Group. extern int g_iNumScreens; extern winScreenInfo g_ScreenInfo[]; extern int g_iLastScreen; -extern FILE *g_pfLog; + +extern char * g_pszLogFile; +extern int g_iLogVerbose; +Bool g_fLogInited; extern Bool g_fXdmcpEnabled; extern int g_fdMessageQueue; extern const char * g_pszQueryHost; extern HINSTANCE g_hInstance; -int g_iLogVerbose = 4; -char * g_pszLogFile = WIN_LOG_FNAME; -Bool g_fLogInited = FALSE; - #ifdef XWIN_CLIPBOARD extern Bool g_fUnicodeClipboard; extern Bool g_fClipboardLaunched; @@ -164,10 +163,10 @@ ddxGiveUp (void) } if (!g_fLogInited) { - LogInit(g_pszLogFile, NULL); + LogInit (g_pszLogFile, NULL); g_fLogInited = TRUE; } - LogClose(); + LogClose (); /* * At this point we aren't creating any new screens, so @@ -224,11 +223,11 @@ OsVendorInit (void) #endif if (!g_fLogInited) { - LogInit(g_pszLogFile, NULL); + LogInit (g_pszLogFile, NULL); g_fLogInited = TRUE; } - LogSetParameter(XLOG_FLUSH, 1); - LogSetParameter(XLOG_VERBOSITY, g_iLogVerbose); + LogSetParameter (XLOG_FLUSH, 1); + LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose); /* Add a default screen if no screens were specified */ if (g_iNumScreens == 0) @@ -298,8 +297,10 @@ ddxUseMsg (void) "\tDo not draw a window border, title bar, etc. Windowed\n" "\tmode only.\n"); +#ifdef XWIN_MULTIWINDOWEXTWM ErrorF ("-rootless\n" "\tRun the server in rootless mode.\n"); +#endif ErrorF ("-pseudorootless\n" "\tRun the server in pseudo-rootless mode.\n"); @@ -350,16 +351,24 @@ ddxUseMsg (void) ErrorF ("-[no]winkill\n" "\tAlt+F4 exits the X Server.\n"); +#ifdef XWIN_XF86CONFIG ErrorF ("-xf86config\n" "\tSpecify a configuration file.\n"); ErrorF ("-keyboard\n" "\tSpecify a keyboard device from the configuration file.\n"); +#endif #ifdef XWIN_CLIPBOARD ErrorF ("-nounicodeclipboard\n" "\tDo not use Unicode clipboard even if NT-based platform.\n"); #endif + + if (!g_fLogInited) { + LogInit (g_pszLogFile, NULL); + g_fLogInited = TRUE; + } + LogClose (); } diff --git a/hw/xwin/win.h b/hw/xwin/win.h index 24c2531fb..78ad38d25 100644 --- a/hw/xwin/win.h +++ b/hw/xwin/win.h @@ -202,13 +202,6 @@ #include "winwindow.h" -/* Cygwin's winuser.h does not define VK_KANA as of 28Mar2001 */ -/* NOTE: Cygwin's winuser.h was fixed shortly after 28Mar2001. */ -#ifndef VK_KANA -#define VK_KANA 15 -#endif - - /* * Debugging macros */ @@ -396,7 +389,9 @@ typedef struct #endif Bool fFullScreen; Bool fDecoration; +#ifdef XWIN_MULTIWINDOWEXTWM Bool fRootless; +#endif Bool fPseudoRootless; #ifdef XWIN_MULTIWINDOW Bool fMultiWindow; @@ -570,6 +565,7 @@ typedef struct _winPrivScreenRec } winPrivScreenRec; +#ifdef XWIN_MULTIWINDOWEXTWM typedef struct { RootlessWindowPtr pFrame; HWND hWnd; @@ -585,6 +581,7 @@ typedef struct { BOOL fDestroyed;//for debug char *pfb; } win32RootlessWindowRec, *win32RootlessWindowPtr; +#endif typedef struct { @@ -1526,9 +1523,6 @@ void winCopyWindowMultiWindow (WindowPtr pWin, DDXPointRec oldpt, RegionPtr oldRegion); -void -winWin32RootlessMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h); - XID winGetWindowID (WindowPtr pWin); @@ -1573,6 +1567,7 @@ winWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); +#ifdef XWIN_MULTIWINDOWEXTWM /* * winwin32rootless.c */ @@ -1635,8 +1630,10 @@ winWin32RootlessCompositePixels (unsigned int width, unsigned int height, unsign void winWin32RootlessCopyWindow (RootlessFrameID wid, int dstNrects, const BoxRec *dstRects, int dx, int dy); +#endif +#ifdef XWIN_MULTIWINDOWEXTWM /* * winwin32rootlesswindow.c */ @@ -1650,18 +1647,25 @@ winWin32RootlessMoveXWindow (WindowPtr pWin, int x, int y); void winWin32RootlessResizeXWindow (WindowPtr pWin, int w, int h); +void +winWin32RootlessMoveResizeXWindow (WindowPtr pWin, int x, int y, int w, int h); + void winWin32RootlessUpdateIcon (Window id); +#endif +#ifdef XWIN_MULTIWINDOWEXTWM /* * winwin32rootlesscursor.c */ Bool winWin32RootlessInitCursor (ScreenPtr pScreen); +#endif +#ifdef XWIN_MULTIWINDOWEXTWM /* * winwin32rootlesswndproc.c */ @@ -1669,6 +1673,7 @@ winWin32RootlessInitCursor (ScreenPtr pScreen); LRESULT CALLBACK winWin32RootlessWindowProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); +#endif /* diff --git a/hw/xwin/winblock.c b/hw/xwin/winblock.c index 9cfbe25ad..66aa602b9 100644 --- a/hw/xwin/winblock.c +++ b/hw/xwin/winblock.c @@ -93,6 +93,8 @@ winBlockHandler_ProcessMessages: winReorderWindowsMultiWindow ((ScreenPtr)pBlockData); #endif +#ifdef XWIN_MULTIWINDOWEXTWM if (pScreenPriv->pScreenInfo->fRootless) winWin32RootlessReorderWindows ((ScreenPtr)pBlockData); +#endif } diff --git a/hw/xwin/wincreatewnd.c b/hw/xwin/wincreatewnd.c index a72bea485..aef548af2 100644 --- a/hw/xwin/wincreatewnd.c +++ b/hw/xwin/wincreatewnd.c @@ -156,7 +156,9 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) /* Decorated or undecorated window */ if (pScreenInfo->fDecoration +#ifdef XWIN_MULTIWINDOWEXTWM && !pScreenInfo->fRootless +#endif && !pScreenInfo->fPseudoRootless #ifdef XWIN_MULTIWINDOW && !pScreenInfo->fMultiWindow @@ -200,7 +202,9 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) /* Adjust the window width and height for borders and title bar */ if (pScreenInfo->fDecoration +#ifdef XWIN_MULTIWINDOWEXTWM && !pScreenInfo->fRootless +#endif && !pScreenInfo->fPseudoRootless #ifdef XWIN_MULTIWINDOW && !pScreenInfo->fMultiWindow @@ -270,7 +274,9 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) /* Clean up the scrollbars flag, if necessary */ if ((!pScreenInfo->fDecoration +#ifdef XWIN_MULTIWINDOWEXTWM || pScreenInfo->fRootless +#endif || pScreenInfo->fPseudoRootless #ifdef XWIN_MULTIWINDOW || pScreenInfo->fMultiWindow @@ -410,7 +416,10 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) #endif /* Show the window */ - if (pScreenInfo->fRootless + if (FALSE +#ifdef XWIN_MULTIWINDOWEXTWM + || pScreenInfo->fRootless +#endif #ifdef XWIN_MULTIWINDOW || pScreenInfo->fMultiWindow #endif @@ -428,7 +437,10 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) } /* Attempt to bring our window to the top of the display */ - if (!pScreenInfo->fRootless + if (TRUE +#ifdef XWIN_MULTIWINDOWEXTWM + && !pScreenInfo->fRootless +#endif && !pScreenInfo->fPseudoRootless #ifdef XWIN_MULTIWINDOW && !pScreenInfo->fMultiWindow diff --git a/hw/xwin/winengine.c b/hw/xwin/winengine.c index bce4566ec..02455f201 100644 --- a/hw/xwin/winengine.c +++ b/hw/xwin/winengine.c @@ -30,6 +30,7 @@ /* $XFree86: xc/programs/Xserver/hw/xwin/winengine.c,v 1.5 2003/07/29 21:25:17 dawes Exp $ */ #include "win.h" +#include "winmsg.h" /* @@ -184,7 +185,10 @@ winSetEngine (ScreenPtr pScreen) } /* ShadowGDI is the only engine that supports Multi Window Mode */ - if (pScreenInfo->fRootless + if (TRUE +#ifdef XWIN_MULTIWINDOWEXTWM + || pScreenInfo->fRootless +#endif #ifdef XWIN_MULTIWINDOW || pScreenInfo->fMultiWindow #endif diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c index ec996b8eb..7745e2284 100644 --- a/hw/xwin/winerror.c +++ b/hw/xwin/winerror.c @@ -45,7 +45,7 @@ OsVendorVErrorF (const char *pszFormat, va_list va_args) pthread_mutex_lock (&s_pmPrinting); /* Print the error message to a log file, could be stderr */ - LogVWrite(0, pszFormat, va_args); + LogVWrite (0, pszFormat, va_args); /* Unlock the printing mutex */ pthread_mutex_unlock (&s_pmPrinting); diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c index d3d67f24d..429cca2b5 100644 --- a/hw/xwin/winglobals.c +++ b/hw/xwin/winglobals.c @@ -46,7 +46,6 @@ int g_iPixmapPrivateIndex = -1; int g_iWindowPrivateIndex = -1; unsigned long g_ulServerGeneration = 0; Bool g_fInitializedDefaultScreens = FALSE; -FILE *g_pfLog = NULL; DWORD g_dwEnginesSupported = 0; HINSTANCE g_hInstance = 0; HWND g_hDlgDepthChange = NULL; @@ -54,6 +53,9 @@ HWND g_hDlgExit = NULL; const char * g_pszQueryHost = NULL; Bool g_fXdmcpEnabled = FALSE; HICON g_hiconX = NULL; +char * g_pszLogFile = "/tmp/XWin.log"; +int g_iLogVerbose = 4; +Bool g_fLogInited = FALSE; /* diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c index 6ae3b6711..bef742a33 100644 --- a/hw/xwin/winkeybd.c +++ b/hw/xwin/winkeybd.c @@ -36,6 +36,7 @@ #include "win.h" #include "winkeybd.h" #include "winconfig.h" +#include "winmsg.h" #ifdef XKB #define XKB_IN_SERVER diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c index d45b94961..46dbdd5b1 100755 --- a/hw/xwin/winprocarg.c +++ b/hw/xwin/winprocarg.c @@ -107,7 +107,9 @@ winInitializeDefaultScreens (void) g_ScreenInfo[i].pfb = NULL; g_ScreenInfo[i].fFullScreen = FALSE; g_ScreenInfo[i].fDecoration = TRUE; +#ifdef XWIN_MULTIWINDOWEXTWM g_ScreenInfo[i].fRootless = FALSE; +#endif g_ScreenInfo[i].fPseudoRootless = FALSE; #ifdef XWIN_MULTIWINDOW g_ScreenInfo[i].fMultiWindow = FALSE; @@ -163,8 +165,8 @@ ddxProcessArgument (int argc, char *argv[], int i) { static Bool s_fBeenHere = FALSE; - /* Initialize once */ - if (!s_fBeenHere) + /* Initialize once - only if option is not -help */ + if (!s_fBeenHere && !IS_OPTION ("-help")) { #ifdef DDXOSVERRORF /* @@ -425,6 +427,7 @@ ddxProcessArgument (int argc, char *argv[], int i) return 1; } +#ifdef XWIN_MULTIWINDOWEXTWM /* * Look for the '-rootless' argument */ @@ -450,6 +453,7 @@ ddxProcessArgument (int argc, char *argv[], int i) /* Indicate that we have processed this argument */ return 1; } +#endif /* * Look for the '-pseudorootless' argument diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c index 0ca266657..145a82fd8 100644 --- a/hw/xwin/winscrinit.c +++ b/hw/xwin/winscrinit.c @@ -37,6 +37,7 @@ #include "safeAlpha.h" +#ifdef XWIN_MULTIWINDOWEXTWM static RootlessFrameProcsRec winWin32RootlessProcs = { winWin32RootlessCreateFrame, @@ -61,6 +62,7 @@ winWin32RootlessProcs = { NULL,//winWin32RootlessCompositePixels, winWin32RootlessCopyWindow }; +#endif /* @@ -100,9 +102,9 @@ winScreenInit (int index, pScreenInfo->dwWidth, pScreenInfo->dwHeight); #endif -#ifdef XWIN_MULTIWINDOW - /* Bail if -rootless and -multiwindow flags both present */ - if (pScreenInfo->fRootless && pScreenInfo->fMultiWindow) +#if defined(XWIN_MULTIWINDOW) + /* Bail if -pseudorootless and -multiwindow flags both present */ + if (pScreenInfo->fPseudoRootless && pScreenInfo->fMultiWindow) { ErrorF ("winScreenInit - The -rootless and -multiwindow parameters\n" "\tcannot be used together. Note that the -rootless parameter\n" @@ -452,7 +454,10 @@ winFinishScreenInitFB (int index, if ((pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL) - &&(!pScreenInfo->fRootless)) +#ifdef XWIN_MULTIWINDOWEXTWM + && !pScreenInfo->fRootless +#endif + ) { #if CYGDEBUG ErrorF ("winFinishScreenInitFB - Calling shadowInit ()\n"); @@ -467,7 +472,7 @@ winFinishScreenInitFB (int index, } #endif - +#ifdef XWIN_MULTIWINDOWEXTWM /* Handle rootless mode */ if (pScreenInfo->fRootless) { @@ -488,8 +493,10 @@ winFinishScreenInitFB (int index, } winWindowsWMExtensionInit (); } +#endif + /* Handle pseudo-rootless mode */ - else if (pScreenInfo->fPseudoRootless) + if (pScreenInfo->fPseudoRootless) { /* Define the WRAP macro temporarily for local use */ #define WRAP(a) \ @@ -525,6 +532,8 @@ winFinishScreenInitFB (int index, /* Undefine the WRAP macro, as it is not needed elsewhere */ #undef WRAP } + + #ifdef XWIN_MULTIWINDOW /* Handle multi window mode */ else if (pScreenInfo->fMultiWindow) diff --git a/hw/xwin/winwakeup.c b/hw/xwin/winwakeup.c index 00a750450..f87aa8f38 100644 --- a/hw/xwin/winwakeup.c +++ b/hw/xwin/winwakeup.c @@ -69,7 +69,9 @@ winWakeupHandler (int nScreen, if (pScreenPriv->pScreenInfo->fMultiWindow) winReorderWindowsMultiWindow ((ScreenPtr)pWakeupData); #endif - + +#ifdef XWIN_MULTIWINDOWEXTWM if (pScreenPriv->pScreenInfo->fRootless) winWin32RootlessReorderWindows ((ScreenPtr)pWakeupData); +#endif } diff --git a/hw/xwin/winwindow.h b/hw/xwin/winwindow.h index f8908caa0..99df6a032 100644 --- a/hw/xwin/winwindow.h +++ b/hw/xwin/winwindow.h @@ -47,7 +47,6 @@ #define WINDOW_TITLE_X "Cygwin/X X" #define WIN_WINDOW_PROP "cyg_window_prop_rl" #define WIN_MSG_QUEUE_FNAME "/dev/windows" -#define WIN_LOG_FNAME "/tmp/XWin.log" #define WIN_WID_PROP "cyg_wid_prop_rl" #define WIN_NEEDMANAGE_PROP "cyg_override_redirect_prop_rl" #define WIN_HWND_CACHE "cyg_privmap_rl" diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c index 865b18c47..9e98797fd 100644 --- a/hw/xwin/winwndproc.c +++ b/hw/xwin/winwndproc.c @@ -314,7 +314,9 @@ winWindowProc (HWND hwnd, UINT message, /* Break if we do not use scrollbars */ if (!s_pScreenInfo->fScrollbars || !s_pScreenInfo->fDecoration +#ifdef XWIN_MULTIWINDOWEXTWM || s_pScreenInfo->fRootless +#endif || s_pScreenInfo->fPseudoRootless #ifdef XWIN_MULTIWINDOW || s_pScreenInfo->fMultiWindow @@ -588,7 +590,9 @@ winWindowProc (HWND hwnd, UINT message, || !s_pScreenInfo->fScrollbars || s_pScreenInfo->fFullScreen || !s_pScreenInfo->fDecoration +#ifdef XWIN_MULTIWINDOWEXTWM || s_pScreenInfo->fRootless +#endif || s_pScreenInfo->fPseudoRootless #ifdef XWIN_MULTIWINDOW || s_pScreenInfo->fMultiWindow @@ -775,14 +779,22 @@ winWindowProc (HWND hwnd, UINT message, case WM_LBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; - if (s_pScreenInfo->fRootless || s_pScreenInfo->fPseudoRootless) + if (s_pScreenInfo->fPseudoRootless +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fRootless +#endif + ) SetCapture (hwnd); return winMouseButtonsHandle (s_pScreen, ButtonPress, Button1, wParam); case WM_LBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; - if (s_pScreenInfo->fRootless || s_pScreenInfo->fPseudoRootless) + if (s_pScreenInfo->fPseudoRootless +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fRootless +#endif + ) ReleaseCapture (); return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button1, wParam); @@ -790,14 +802,22 @@ winWindowProc (HWND hwnd, UINT message, case WM_MBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; - if (s_pScreenInfo->fRootless || s_pScreenInfo->fPseudoRootless) + if (s_pScreenInfo->fPseudoRootless +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fRootless +#endif + ) SetCapture (hwnd); return winMouseButtonsHandle (s_pScreen, ButtonPress, Button2, wParam); case WM_MBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; - if (s_pScreenInfo->fRootless || s_pScreenInfo->fPseudoRootless) + if (s_pScreenInfo->fPseudoRootless +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fRootless +#endif + ) ReleaseCapture (); return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button2, wParam); @@ -805,14 +825,22 @@ winWindowProc (HWND hwnd, UINT message, case WM_RBUTTONDOWN: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; - if (s_pScreenInfo->fRootless || s_pScreenInfo->fPseudoRootless) + if (s_pScreenInfo->fPseudoRootless +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fRootless +#endif + ) SetCapture (hwnd); return winMouseButtonsHandle (s_pScreen, ButtonPress, Button3, wParam); case WM_RBUTTONUP: if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput) break; - if (s_pScreenInfo->fRootless || s_pScreenInfo->fPseudoRootless) + if (s_pScreenInfo->fPseudoRootless +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fRootless +#endif + ) ReleaseCapture (); return winMouseButtonsHandle (s_pScreen, ButtonRelease, Button3, wParam);