diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-01-12 09:01:52 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-01-12 11:07:56 +0100 |
commit | 6b8c0a50585bb637c5cd33ca8ffde0cb9c4e3664 (patch) | |
tree | 12647726671357a571e2b371b0e33199efb08156 /tests/manual | |
parent | 66d94ea30be9c4c8cc81a52134022eb662bedd77 (diff) | |
parent | ca7f1d2197f78ec3332cfd86ab9921730b6d4f23 (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: I5839bded07e23af65ced9491c4f50242f964dd31
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/diaglib/nativewindowdump_win.cpp | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/tests/manual/diaglib/nativewindowdump_win.cpp b/tests/manual/diaglib/nativewindowdump_win.cpp index e3885eb96d..b25f8aa864 100644 --- a/tests/manual/diaglib/nativewindowdump_win.cpp +++ b/tests/manual/diaglib/nativewindowdump_win.cpp @@ -48,9 +48,10 @@ namespace QtDiag { struct DumpContext { - DumpContext() : indentation(0) {} + DumpContext() : indentation(0), parent(0) {} int indentation; + HWND parent; QSharedPointer<QTextStream> stream; }; @@ -64,11 +65,19 @@ static void formatNativeWindow(HWND hwnd, QTextStream &str) RECT rect; if (GetWindowRect(hwnd, &rect)) { str << ' ' << (rect.right - rect.left) << 'x' << (rect.bottom - rect.top) - << '+' << rect.left << '+' << rect.top; + << forcesign << rect.left << rect.top << noforcesign; } if (IsWindowVisible(hwnd)) str << " [visible]"; + wchar_t buf[512]; + if (GetWindowText(hwnd, buf, sizeof(buf)/sizeof(buf[0])) && buf[0]) + str << " title=\"" << QString::fromWCharArray(buf) << "\"/"; + else + str << ' '; + if (GetClassName(hwnd, buf, sizeof(buf)/sizeof(buf[0]))) + str << '"' << QString::fromWCharArray(buf) << '"'; + str << hex << showbase; if (const LONG_PTR style = GetWindowLongPtr(hwnd, GWL_STYLE)) { str << " style=" << style; @@ -121,13 +130,31 @@ static void formatNativeWindow(HWND hwnd, QTextStream &str) debugWinStyle(str, exStyle, WS_EX_COMPOSITED) debugWinStyle(str, exStyle, WS_EX_NOACTIVATE) } + + if (const ULONG_PTR classStyle = GetClassLongPtr(hwnd, GCL_STYLE)) { + str << " classStyle=" << classStyle; + debugWinStyle(str, classStyle, CS_BYTEALIGNCLIENT) + debugWinStyle(str, classStyle, CS_BYTEALIGNWINDOW) + debugWinStyle(str, classStyle, CS_CLASSDC) + debugWinStyle(str, classStyle, CS_DBLCLKS) + debugWinStyle(str, classStyle, CS_DROPSHADOW) + debugWinStyle(str, classStyle, CS_GLOBALCLASS) + debugWinStyle(str, classStyle, CS_HREDRAW) + debugWinStyle(str, classStyle, CS_NOCLOSE) + debugWinStyle(str, classStyle, CS_OWNDC) + debugWinStyle(str, classStyle, CS_PARENTDC) + debugWinStyle(str, classStyle, CS_SAVEBITS) + debugWinStyle(str, classStyle, CS_VREDRAW) + } + + if (const ULONG_PTR wndProc = GetClassLongPtr(hwnd, GCLP_WNDPROC)) + str << " wndProc=" << wndProc; + str << noshowbase << dec; - wchar_t buf[512]; - if (GetWindowText(hwnd, buf, sizeof(buf)/sizeof(buf[0]))) - str << " title=\"" << QString::fromWCharArray(buf) << '"'; - if (GetClassName(hwnd, buf, sizeof(buf)/sizeof(buf[0]))) - str << " class=\"" << QString::fromWCharArray(buf) << '"'; + if (GetWindowModuleFileName(hwnd, buf, sizeof(buf)/sizeof(buf[0]))) + str << " module=\"" << QString::fromWCharArray(buf) << '"'; + str << '\n'; } @@ -135,7 +162,11 @@ static void dumpNativeWindowRecursion(HWND hwnd, DumpContext *dc); BOOL CALLBACK dumpWindowEnumChildProc(HWND hwnd, LPARAM lParam) { - dumpNativeWindowRecursion(hwnd, reinterpret_cast<DumpContext *>(lParam)); + DumpContext *dumpContext = reinterpret_cast<DumpContext *>(lParam); + // EnumChildWindows enumerates grand children as well, skip these to + // get the hierarchical formatting right. + if (GetAncestor(hwnd, GA_PARENT) == dumpContext->parent) + dumpNativeWindowRecursion(hwnd, dumpContext); return TRUE; } @@ -145,6 +176,7 @@ static void dumpNativeWindowRecursion(HWND hwnd, DumpContext *dc) formatNativeWindow(hwnd, *dc->stream); DumpContext nextLevel = *dc; nextLevel.indentation += 2; + nextLevel.parent = hwnd; EnumChildWindows(hwnd, dumpWindowEnumChildProc, reinterpret_cast<LPARAM>(&nextLevel)); } |