winmessages.h

winmsg.h
winmsg.c
winmultiwindowwndproc.c
winwin32rootlesswndproc.c
Make logging of messages configurable with environment variables
This commit is contained in:
Alexander Gottwald 2005-01-31 10:43:37 +00:00
parent 2982d173ca
commit 8d277ceb22
6 changed files with 45 additions and 42 deletions

View File

@ -1,3 +1,5 @@
#ifndef __WINMESSAGES_H__
#define __WINMESSAGES_H__
static const unsigned MESSAGE_NAMES_LEN =1024;
static const char *MESSAGE_NAMES[1024] = {
"WM_NULL",
@ -1025,3 +1027,4 @@ static const char *MESSAGE_NAMES[1024] = {
"1022",
"1023"
};
#endif

View File

@ -31,6 +31,9 @@
#include "win.h"
#include "winmsg.h"
#if CYGDEBUG
#include "winmessages.h"
#endif
#include <stdarg.h>
void winVMsg (int, MessageType, int verb, const char *, va_list);
@ -140,3 +143,33 @@ winW32ErrorEx(int verb, const char *msg, DWORD errorcode)
LocalFree(buffer);
}
}
#if CYGDEBUG
void winDebugWin32Message(const char* function, HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if (message >= WM_USER)
{
if (getenv("WIN_DEBUG_MESSAGES") || getenv("WIN_DEBUG_WM_USER"))
{
winDebug("%s - Message WM_USER + %d", function, message - WM_USER);
winDebug("\twParam 0x%x lParam 0x%x\n", wParam, lParam);
}
}
else if (message < MESSAGE_NAMES_LEN && MESSAGE_NAMES[message])
{
const char *msgname = MESSAGE_NAMES[message];
char buffer[64];
snprintf(buffer, sizeof(buffer), "WIN_DEBUG_%s", msgname);
buffer[63] = 0;
if (getenv("WIN_DEBUG_MESSAGES") || getenv(buffer))
{
winDebug("%s - Message %s", function, MESSAGE_NAMES[message]);
winDebug("\twParam 0x%x lParam 0x%x\n", wParam, lParam);
}
}
}
#else
void winDebugWin32Message(const char* function, HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
}
#endif

View File

@ -47,5 +47,6 @@ void winTrace (const char *format, ...);
void winErrorFVerb (int verb, const char *format, ...);
void winW32Error(int verb, const char *message);
void winW32ErrorEx(int verb, const char *message, DWORD errorcode);
void winDebugWin32Message(const char* function, HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
#endif

View File

@ -35,9 +35,7 @@
#include "dixevents.h"
#include "winmultiwindowclass.h"
#include "winprefs.h"
#if CYGDEBUG
#include "winmessages.h"
#endif
#include "winmsg.h"
/*
* External global variables
@ -292,16 +290,7 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
static Bool s_fTracking = FALSE;
#if CYGDEBUG
if (message >= WM_USER)
{
winDebug("winTopLevelWindowProc - Message WM_USER + %d", message - WM_USER);
winDebug(" wParam 0x%x lParam 0x%x\n", wParam, lParam);
}
else if (message < MESSAGE_NAMES_LEN && MESSAGE_NAMES[message])
{
winDebug("winTopLevelWindowProc - Message %s", MESSAGE_NAMES[message]);
winDebug(" wParam 0x%x lParam 0x%x\n", wParam, lParam);
}
winDebugWin32Message("winTopLevelWindowProc", hwnd, message, wParam, lParam);
#endif
/* Check if the Windows window property for our X window pointer is valid */

View File

@ -37,9 +37,7 @@
#include "propertyst.h"
#include "Xatom.h"
#include "winmultiwindowclass.h"
#if CYGDEBUG
#include "winmessages.h"
#endif
#include "winmsg.h"
/*
@ -436,19 +434,8 @@ winMWExtWMWindowProc (HWND hwnd, UINT message,
wmMsg.iHeight = pRLWinPriv->pFrame->height;
fWMMsgInitialized = TRUE;
#if 0
if (message >= WM_USER)
{
winDebug("winMWExtWMWindowProc - Message WM_USER + %d",
message - WM_USER);
winDebug(" wParam 0x%x lParam 0x%x\n", wParam, lParam);
}
else if (message < MESSAGE_NAMES_LEN && MESSAGE_NAMES[message])
{
winDebug("winMWExtWMWindowProc - Message %s",
MESSAGE_NAMES[message]);
winDebug(" wParam 0x%x lParam 0x%x\n", wParam, lParam);
}
#if CYGDEBUG
winDebugWin32Message("winMWExtWMWindowProc", hwnd, message, wParam, lParam);
winDebug ("\thWnd %08X\n", hwnd);
winDebug ("\tpScreenPriv %08X\n", pScreenPriv);

View File

@ -37,9 +37,7 @@
#include <commctrl.h>
#include "winprefs.h"
#include "winconfig.h"
#if CYGDEBUG
#include "winmessages.h"
#endif
#include "winmsg.h"
/*
* Global variables
@ -59,6 +57,7 @@ extern HWND g_hwndKeyboardFocus;
extern Bool g_fSoftwareCursor;
extern DWORD g_dwCurrentThreadID;
/*
* Called by winWakeupHandler
* Processes current Windows message
@ -80,16 +79,7 @@ winWindowProc (HWND hwnd, UINT message,
int i;
#if CYGDEBUG
if (message >= WM_USER)
{
winDebug("winWindowProc - Message WM_USER + %d", message - WM_USER);
winDebug(" wParam 0x%x lParam 0x%x\n", wParam, lParam);
}
else if (message < MESSAGE_NAMES_LEN && MESSAGE_NAMES[message])
{
winDebug("winWindowProc - Message %s", MESSAGE_NAMES[message]);
winDebug(" wParam 0x%x lParam 0x%x\n", wParam, lParam);
}
winDebugWin32Message("winWindowProc", hwnd, message, wParam, lParam);
#endif
/* Watch for server regeneration */