summaryrefslogtreecommitdiffstats
path: root/widget/windows/nsWindowDbg.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /widget/windows/nsWindowDbg.cpp
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'widget/windows/nsWindowDbg.cpp')
-rw-r--r--widget/windows/nsWindowDbg.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/widget/windows/nsWindowDbg.cpp b/widget/windows/nsWindowDbg.cpp
new file mode 100644
index 0000000000..c0880817d0
--- /dev/null
+++ b/widget/windows/nsWindowDbg.cpp
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* 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/. */
+
+/*
+ * nsWindowDbg - Debug related utilities for nsWindow.
+ */
+
+#include "mozilla/Logging.h"
+#include "nsWindowDbg.h"
+#include "WinUtils.h"
+
+using namespace mozilla;
+using namespace mozilla::widget;
+extern mozilla::LazyLogModule gWindowsLog;
+
+#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, nullptr, 0};
+#endif
+
+static long gEventCounter = 0;
+static long gLastEventMsg = 0;
+
+void PrintEvent(UINT msg, bool aShowAllEvents, bool aShowMouseMoves) {
+ int inx = 0;
+ while (gAllEvents[inx].mId != msg && gAllEvents[inx].mStr != nullptr) {
+ inx++;
+ }
+ if (aShowAllEvents || (!aShowAllEvents && gLastEventMsg != (long)msg)) {
+ if (aShowMouseMoves ||
+ (!aShowMouseMoves && msg != 0x0020 && msg != 0x0200 && msg != 0x0084)) {
+ MOZ_LOG(gWindowsLog, LogLevel::Info,
+ ("%6d - 0x%04X %s\n", gEventCounter++, msg,
+ gAllEvents[inx].mStr ? gAllEvents[inx].mStr : "Unknown"));
+ gLastEventMsg = msg;
+ }
+ }
+}
+
+#ifdef DEBUG
+void DDError(const char* msg, HRESULT hr) {
+ /*XXX make nicer */
+ MOZ_LOG(gWindowsLog, LogLevel::Error,
+ ("direct draw error %s: 0x%08lx\n", msg, hr));
+}
+#endif
+
+#ifdef DEBUG_VK
+bool is_vk_down(int vk) {
+ SHORT st = GetKeyState(vk);
+# ifdef DEBUG
+ MOZ_LOG(gWindowsLog, LogLevel::Info, ("is_vk_down vk=%x st=%x\n", vk, st));
+# endif
+ return (st < 0);
+}
+#endif