diff options
Diffstat (limited to 'hw/xwin')
-rwxr-xr-x | hw/xwin/winmessages.h | 3 | ||||
-rw-r--r-- | hw/xwin/winmsg.c | 33 | ||||
-rw-r--r-- | hw/xwin/winmsg.h | 1 | ||||
-rwxr-xr-x | hw/xwin/winmultiwindowwndproc.c | 15 | ||||
-rwxr-xr-x | hw/xwin/winwin32rootlesswndproc.c | 19 | ||||
-rw-r--r-- | hw/xwin/winwndproc.c | 16 |
6 files changed, 45 insertions, 42 deletions
diff --git a/hw/xwin/winmessages.h b/hw/xwin/winmessages.h index 3896fb48c..ae50dc474 100755 --- a/hw/xwin/winmessages.h +++ b/hw/xwin/winmessages.h @@ -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 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 diff --git a/hw/xwin/winmsg.h b/hw/xwin/winmsg.h index a9eb3c7ac..367086c78 100644 --- a/hw/xwin/winmsg.h +++ b/hw/xwin/winmsg.h @@ -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 diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index 3ebd0be7d..a977b5b21 100755 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -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 */ diff --git a/hw/xwin/winwin32rootlesswndproc.c b/hw/xwin/winwin32rootlesswndproc.c index 7c34d0a4e..620c92e1c 100755 --- a/hw/xwin/winwin32rootlesswndproc.c +++ b/hw/xwin/winwin32rootlesswndproc.c @@ -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); diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c index 1c5fc2adf..771de0cb6 100644 --- a/hw/xwin/winwndproc.c +++ b/hw/xwin/winwndproc.c @@ -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 */ |