diff options
author | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2005-01-31 10:43:37 +0000 |
---|---|---|
committer | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2005-01-31 10:43:37 +0000 |
commit | 8d277ceb22929fcb44f2d4def8c5b70535eb087f (patch) | |
tree | 94105481c5e26aff3d4c8b1d5ac77030b78fb5da /hw/xwin/winmsg.c | |
parent | 2982d173cad762b801869b7ceacc237afdad88d6 (diff) |
winmessages.h
winmsg.h
winmsg.c
winmultiwindowwndproc.c
winwin32rootlesswndproc.c
Make logging of messages configurable with environment variables
Diffstat (limited to 'hw/xwin/winmsg.c')
-rw-r--r-- | hw/xwin/winmsg.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/hw/xwin/winmsg.c b/hw/xwin/winmsg.c index 2e5e28f59..b5d4e2e9c 100644 --- a/hw/xwin/winmsg.c +++ b/hw/xwin/winmsg.c @@ -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 |