Cleans up EnumChildWindows implementation. Implements IsIconic correctly. Breaks EnumThreadWindows. I stubbed out printf all together. I think that there is a bug in EVC's varargs which crash us. Fixes up ExtTextOut to correctly calculate length. Not part of normal build

This commit is contained in:
dougt%meer.net 2005-05-25 16:03:27 +00:00
Родитель 91a43508fc
Коммит 5e672d2868
5 изменённых файлов: 41 добавлений и 136 удалений

Просмотреть файл

@ -37,7 +37,7 @@
#ifndef MOZCE_DEFS
#define MOZCE_DEFS
#define USE_NC_LOGGING 1
//#define USE_NC_LOGGING 1
#define NOMINMAX
@ -284,4 +284,17 @@ typedef struct _BLENDFUNCTION
#define AC_SRC_OVER 0
#ifndef SM_CYVTHUMB
#define SM_CYVTHUMB 9
#endif
#ifndef SM_CXHTHUMB
#define SM_CXHTHUMB 10
#endif
#ifndef DFCS_SCROLLSIZEGRIP
#define DFCS_SCROLLSIZEGRIP 0x0008
#endif
#endif

Просмотреть файл

@ -689,6 +689,9 @@
// We use a method named CreateEvent. We do not want to map
// CreateEvent to CreateEventA
#ifdef CreateEvent
#undef CreateEvent
#endif
#define CreateEvent CreateEvent
#ifdef CreateEventA

Просмотреть файл

@ -144,31 +144,7 @@ MOZCE_SHUNT_API char* mozce_getcwd(char* buff, size_t size)
MOZCE_SHUNT_API int mozce_printf(const char * format, ...)
{
// DONT CALL IN PRINTF MOZCE_PRECHECK
va_list argp;
va_start(argp, format);
char buffer[1024];
int result = _snprintf(buffer, 1023, format, argp);
if (result<=0)
return result;
#ifdef USE_NC_LOGGING
nclograw(buffer, strlen(buffer));
#endif
unsigned short wBuffer[1024];
if(0 != a2w_buffer(buffer, -1, wBuffer, sizeof(wBuffer) / sizeof(unsigned short)))
{
OutputDebugString(wBuffer);
}
va_end(argp);
return result;
return 0;
}

Просмотреть файл

@ -529,48 +529,23 @@ MOZCE_SHUNT_API BOOL mozce_FlashWindow(HWND inWnd, BOOL inInvert)
}
#define ECW_SIZEBY 0x100
typedef struct __struct_ECWWindows
typedef struct ECWWindows
{
DWORD mCount;
DWORD mCapacity;
HWND* mArray;
}
ECWWindows;
LPARAM params;
WNDENUMPROC func;
HWND parent;
} ECWWindows;
static BOOL ECWHelper(HWND inParent, ECWWindows* inChildren, BOOL inRecurse)
static BOOL CALLBACK MyEnumWindowsProc(HWND hwnd, LPARAM lParam)
{
BOOL retval = TRUE;
ECWWindows *myParams = (ECWWindows*) lParam;
HWND child = GetWindow(inParent, GW_CHILD);
while(NULL != child && FALSE != retval)
if (IsChild(myParams->parent, hwnd))
{
if(inChildren->mCount >= inChildren->mCapacity)
{
void* moved = realloc(inChildren->mArray, sizeof(HWND) * (ECW_SIZEBY + inChildren->mCapacity));
if(NULL != moved)
{
inChildren->mCapacity += ECW_SIZEBY;
inChildren->mArray = (HWND*)moved;
}
else
{
retval = FALSE;
break;
}
}
inChildren->mArray[inChildren->mCount] = child;
inChildren->mCount++;
if(FALSE != inRecurse)
{
retval = ECWHelper(child, inChildren, inRecurse);
}
child = GetWindow(child, GW_HWNDNEXT);
return myParams->func(hwnd, myParams->params);
}
return retval;
return TRUE;
}
MOZCE_SHUNT_API BOOL mozce_EnumChildWindows(HWND inParent, WNDENUMPROC inFunc, LPARAM inParam)
@ -581,43 +556,12 @@ MOZCE_SHUNT_API BOOL mozce_EnumChildWindows(HWND inParent, WNDENUMPROC inFunc, L
mozce_printf("mozce_EnumChildWindows called\n");
#endif
BOOL retval = FALSE;
ECWWindows myParams;
myParams.params = inParam;
myParams.func = inFunc;
myParams.parent = inParent;
if(NULL != inFunc)
{
if(NULL == inParent)
{
inParent = GetDesktopWindow();
}
ECWWindows children;
memset(&children, 0, sizeof(children));
children.mArray = (HWND*)malloc(sizeof(HWND) * ECW_SIZEBY);
if(NULL != children.mArray)
{
children.mCapacity = ECW_SIZEBY;
BOOL helperRes = ECWHelper(inParent, &children, TRUE);
if(FALSE != helperRes)
{
DWORD loop = 0;
for(loop = 0; loop < children.mCount; loop++)
{
if(IsWindow(children.mArray[loop])) // validate
{
if(FALSE == inFunc(children.mArray[loop], inParam))
{
break;
}
}
}
}
free(children.mArray);
}
}
return retval;
return EnumWindows(MyEnumWindowsProc, (LPARAM) &myParams);
}
@ -626,41 +570,9 @@ MOZCE_SHUNT_API BOOL mozce_EnumThreadWindows(DWORD inThreadID, WNDENUMPROC inFun
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("mozce_EnumThreadWindows called\n");
mozce_printf("-- mozce_EnumThreadWindows called\n");
#endif
BOOL retval = FALSE;
if(NULL != inFunc)
{
ECWWindows children;
memset(&children, 0, sizeof(children));
children.mArray = (HWND*)malloc(sizeof(HWND) * ECW_SIZEBY);
if(NULL != children.mArray)
{
children.mCapacity = ECW_SIZEBY;
BOOL helperRes = ECWHelper(GetDesktopWindow(), &children, FALSE);
if(FALSE != helperRes)
{
DWORD loop = 0;
for(loop = 0; loop < children.mCount; loop++)
{
if(IsWindow(children.mArray[loop]) && inThreadID == GetWindowThreadProcessId(children.mArray[loop], NULL)) // validate
{
if(FALSE == inFunc(children.mArray[loop], inParam))
{
break;
}
}
}
}
free(children.mArray);
}
}
return retval;
return FALSE; // Stop Enumerating
}
@ -669,13 +581,10 @@ MOZCE_SHUNT_API BOOL mozce_IsIconic(HWND inWnd)
MOZCE_PRECHECK
#ifdef DEBUG
mozce_printf("-- mozce_IsIconic called\n");
mozce_printf("mozce_IsIconic called\n");
#endif
BOOL retval = FALSE;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return retval;
}

Просмотреть файл

@ -660,6 +660,9 @@ MOZCE_SHUNT_API BOOL mozce_ExtTextOutA(HDC inDC, int inX, int inY, UINT inOption
#endif
BOOL retval = false;
if (inCount == -1)
inCount = strlen(inString);
int wLen = 0;
LPTSTR wStr = a2w_malloc(inString, inCount, &wLen);
@ -667,7 +670,6 @@ MOZCE_SHUNT_API BOOL mozce_ExtTextOutA(HDC inDC, int inX, int inY, UINT inOption
if(NULL != wStr)
{
retval = ExtTextOutW(inDC, inX, inY, inOptions, inRect, wStr, wLen, inDx);
free(wStr);
wStr = NULL;
}
@ -1238,6 +1240,8 @@ MOZCE_SHUNT_API ATOM mozce_RegisterClassA(CONST WNDCLASSA *lpwc)
LPTSTR wClassName = a2w_malloc(lpwc->lpszClassName, -1, NULL);
memcpy(&wcW, lpwc, sizeof(WNDCLASSA));
wcW.lpszMenuName = NULL;
wcW.lpszClassName = wClassName;
return RegisterClassW(&wcW);