diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2022-07-27 14:02:48 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2022-07-28 16:22:34 +0200 |
commit | 7902e1bc3599e10830d18127a51f46b0d4e5151c (patch) | |
tree | 84242e2e504ef855c36fcb4153a85317b4650ee9 /vcl | |
parent | 84681c019ebbe358aa41deab73da902e44efee3d (diff) |
lok: add dumpState feature for better in-field diagnostics.
Always suspicious that some un-expected dialog / state can cause
strange behavior in a client. An initial cut at an API to make it
easier to unwind such problems by exposing the toolkit state.
Change-Id: If8f17943fa4837df4f9ca659a111dcdce5c23244
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137564
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/svapp.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index c925869a3daf..ec66f82d9de6 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -29,6 +29,7 @@ #include <tools/debug.hxx> #include <tools/time.hxx> #include <tools/stream.hxx> +#include <tools/json_writer.hxx> #include <unotools/configmgr.hxx> #include <unotools/resmgr.hxx> @@ -1796,6 +1797,28 @@ void numberOfViewsChanged(int count) rCache.setMaxSize(count * 10); } +void dumpState(rtl::OStringBuffer &rState) +{ + ImplSVData* pSVData = ImplGetSVData(); + if (!pSVData) + return; + + rState.append("\nWindows:\t"); + rState.append(static_cast<sal_Int32>(Application::GetTopWindowCount())); + + vcl::Window *pWin = Application::GetFirstTopLevelWindow(); + while (pWin) + { + tools::JsonWriter props; + pWin->DumpAsPropertyTree(props); + + rState.append("\n\tWindow: "); + rState.append(props.extractAsOString()); + + pWin = Application::GetNextTopLevelWindow( pWin ); + } +} + } // namespace lok, namespace vcl /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |