Replace all calls to EnumWindows by EnumThreadWindows since we need to

manipulate only Cygwin/X windows, which are in the same thread.
This commit is contained in:
Takuma Murakami 2004-03-09 15:41:32 +00:00
parent 83e4b95234
commit b9e4071433
3 changed files with 29 additions and 22 deletions

View file

@ -58,7 +58,10 @@ int g_iLogVerbose = 4;
Bool g_fLogInited = FALSE;
char * g_pszCommandLine = NULL;
Bool g_fUseMsg = FALSE;
#ifdef XWIN_MULTIWINDOW
DWORD g_dwCurrentProcessID = 0;
DWORD g_dwCurrentThreadID = 0;
#endif
/*
@ -107,7 +110,10 @@ Atom g_atomLastOwnedSelection;
void
winInitializeGlobals (void)
{
#ifdef XWIN_MULTIWINDOW
g_dwCurrentProcessID = GetCurrentProcessId ();
g_dwCurrentThreadID = GetCurrentThreadId ();
#endif
#ifdef XWIN_CLIPBOARD
g_fClipboardLaunched = FALSE;
g_fClipboardStarted = FALSE;

View file

@ -44,6 +44,11 @@
/* Where will the custom menu commands start counting from? */
#define STARTMENUID WM_USER
/* External global variables */
#ifdef XWIN_MULTIWINDOW
extern DWORD g_dwCurrentThreadID;
#endif
/* From winmultiwindowflex.l, the real parser */
extern void parse_file (FILE *fp);
@ -153,16 +158,8 @@ MakeMenu (char *name,
static BOOL CALLBACK
ReloadEnumWindowsProc (HWND hwnd, LPARAM lParam)
{
char szClassName[1024];
HICON hicon;
if (!GetClassName (hwnd, szClassName, 1024))
return TRUE;
if (strncmp (szClassName, WINDOW_CLASS_X, strlen (WINDOW_CLASS_X)))
/* Not one of our windows... */
return TRUE;
/* It's our baby, either clean or dirty it */
if (lParam==FALSE)
{
@ -210,7 +207,7 @@ ReloadPrefs (void)
#ifdef XWIN_MULTIWINDOW
/* First, iterate over all windows replacing their icon with system */
/* default one and deleting any custom system menus */
EnumWindows (ReloadEnumWindowsProc, FALSE);
EnumThreadWindows (g_dwCurrentThreadID, ReloadEnumWindowsProc, FALSE);
#endif
/* Now, free/clear all info from our prefs structure */
@ -254,7 +251,7 @@ ReloadPrefs (void)
#ifdef XWIN_MULTIWINDOW
/* Rebuild the icons and menus */
EnumWindows (ReloadEnumWindowsProc, TRUE);
EnumThreadWindows (g_dwCurrentThreadID, ReloadEnumWindowsProc, TRUE);
#endif
/* Whew, done */

View file

@ -34,7 +34,10 @@
/*
* External global variables
*/
#ifdef XWIN_MULTIWINDOW
extern DWORD g_dwCurrentProcessID;
extern DWORD g_dwCurrentThreadID;
#endif
/*
* Local function prototypes
@ -246,12 +249,7 @@ winRedrawDamagedWindowShadowGDI (HWND hwnd, LPARAM lParam)
BoxPtr pDamage = (BoxPtr)lParam;
RECT rcClient, rcDamage, rcRedraw;
POINT topLeft, bottomRight;
DWORD dwWindowProcessID;
GetWindowThreadProcessId (hwnd, &dwWindowProcessID);
if (dwWindowProcessID != g_dwCurrentProcessID)
return TRUE; /* This window is not ours */
if (IsIconic (hwnd))
return TRUE; /* Don't care minimized windows */
@ -431,7 +429,8 @@ winAllocateFBShadowGDI (ScreenPtr pScreen)
#ifdef XWIN_MULTIWINDOW
/* Redraw all windows */
if (pScreenInfo->fMultiWindow) EnumWindows(winRedrawAllProcShadowGDI, 0);
if (pScreenInfo->fMultiWindow)
EnumThreadWindows (g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0);
#endif
return fReturn;
@ -552,9 +551,11 @@ winShadowUpdateGDI (ScreenPtr pScreen,
}
#ifdef XWIN_MULTIWINDOW
/* Redraw all windows */
if (pScreenInfo->fMultiWindow) EnumWindows(winRedrawDamagedWindowShadowGDI,
(LPARAM)pBoxExtents);
/* Redraw all multiwindow windows */
if (pScreenInfo->fMultiWindow)
EnumThreadWindows (g_dwCurrentThreadID,
winRedrawDamagedWindowShadowGDI,
(LPARAM)pBoxExtents);
#endif
}
@ -861,7 +862,8 @@ winBltExposedRegionsShadowGDI (ScreenPtr pScreen)
#ifdef XWIN_MULTIWINDOW
/* Redraw all windows */
if (pScreenInfo->fMultiWindow) EnumWindows(winRedrawAllProcShadowGDI, 0);
if (pScreenInfo->fMultiWindow)
EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0);
#endif
return TRUE;
@ -933,7 +935,8 @@ winRedrawScreenShadowGDI (ScreenPtr pScreen)
#ifdef XWIN_MULTIWINDOW
/* Redraw all windows */
if (pScreenInfo->fMultiWindow) EnumWindows(winRedrawAllProcShadowGDI, 0);
if (pScreenInfo->fMultiWindow)
EnumThreadWindows(g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0);
#endif
return TRUE;
@ -1043,7 +1046,8 @@ winInstallColormapShadowGDI (ColormapPtr pColormap)
#ifdef XWIN_MULTIWINDOW
/* Redraw all windows */
if (pScreenInfo->fMultiWindow) EnumWindows(winRedrawAllProcShadowGDI, 0);
if (pScreenInfo->fMultiWindow)
EnumThreadWindows (g_dwCurrentThreadID, winRedrawAllProcShadowGDI, 0);
#endif
return TRUE;