2009-06-29 23:36:16 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-06-29 23:36:16 +04:00
|
|
|
|
2009-06-30 10:00:16 +04:00
|
|
|
/*
|
|
|
|
* nsWindowDbg - Debug related utilities for nsWindow.
|
|
|
|
*/
|
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
#include "nsWindowDbg.h"
|
2014-08-12 23:06:00 +04:00
|
|
|
#include "WinUtils.h"
|
|
|
|
|
|
|
|
using namespace mozilla::widget;
|
2009-06-29 23:36:16 +04:00
|
|
|
|
2011-08-16 23:30:44 +04:00
|
|
|
extern PRLogModuleInfo* gWindowsLog;
|
|
|
|
|
2009-06-29 23:36:16 +04:00
|
|
|
#if defined(POPUP_ROLLUP_DEBUG_OUTPUT)
|
|
|
|
MSGFEventMsgInfo gMSGFEvents[] = {
|
|
|
|
"MSGF_DIALOGBOX", 0,
|
|
|
|
"MSGF_MESSAGEBOX", 1,
|
|
|
|
"MSGF_MENU", 2,
|
|
|
|
"MSGF_SCROLLBAR", 5,
|
|
|
|
"MSGF_NEXTWINDOW", 6,
|
|
|
|
"MSGF_MAX", 8,
|
|
|
|
"MSGF_USER", 4096,
|
2013-10-08 22:48:20 +04:00
|
|
|
nullptr, 0};
|
2009-06-29 23:36:16 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
static long gEventCounter = 0;
|
|
|
|
static long gLastEventMsg = 0;
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
void PrintEvent(UINT msg, bool aShowAllEvents, bool aShowMouseMoves)
|
2009-06-29 23:36:16 +04:00
|
|
|
{
|
|
|
|
int inx = 0;
|
2015-02-23 14:15:53 +03:00
|
|
|
while (gAllEvents[inx].mId != msg && gAllEvents[inx].mStr != nullptr) {
|
2009-06-29 23:36:16 +04:00
|
|
|
inx++;
|
|
|
|
}
|
|
|
|
if (aShowAllEvents || (!aShowAllEvents && gLastEventMsg != (long)msg)) {
|
|
|
|
if (aShowMouseMoves || (!aShowMouseMoves && msg != 0x0020 && msg != 0x0200 && msg != 0x0084)) {
|
2015-05-21 23:22:04 +03:00
|
|
|
MOZ_LOG(gWindowsLog, PR_LOG_ALWAYS,
|
2011-08-16 23:30:44 +04:00
|
|
|
("%6d - 0x%04X %s\n", gEventCounter++, msg,
|
|
|
|
gAllEvents[inx].mStr ? gAllEvents[inx].mStr : "Unknown"));
|
2009-06-29 23:36:16 +04:00
|
|
|
gLastEventMsg = msg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
void DDError(const char *msg, HRESULT hr)
|
|
|
|
{
|
|
|
|
/*XXX make nicer */
|
2015-05-21 23:22:04 +03:00
|
|
|
MOZ_LOG(gWindowsLog, PR_LOG_ERROR,
|
2011-08-16 23:30:44 +04:00
|
|
|
("direct draw error %s: 0x%08lx\n", msg, hr));
|
2009-06-29 23:36:16 +04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG_VK
|
2011-09-29 10:19:26 +04:00
|
|
|
bool is_vk_down(int vk)
|
2009-06-29 23:36:16 +04:00
|
|
|
{
|
|
|
|
SHORT st = GetKeyState(vk);
|
|
|
|
#ifdef DEBUG
|
2015-05-21 23:22:04 +03:00
|
|
|
MOZ_LOG(gWindowsLog, PR_LOG_ALWAYS, ("is_vk_down vk=%x st=%x\n",vk, st));
|
2009-06-29 23:36:16 +04:00
|
|
|
#endif
|
|
|
|
return (st < 0);
|
|
|
|
}
|
2010-08-20 22:19:38 +04:00
|
|
|
#endif
|