Fix GUI windows not appearing on first key in viewer

After the last update to ImGui, windows delayed visibility for one
frame, to get properly sized. We would detect that no windows were
"active" (really, visible) and not re-paint, so we never got the second
frame when the window finally showed up.

Omar put a fix to the stats in ImGui for this, so that Active windows
are tracked separately from Visible. This pulls that change in, and
updates the test to correctly redraw when the GUI requires it.

Change-Id: Iaa61f11fcc226917e3e2b31039055a7fa1961e45
Reviewed-on: https://skia-review.googlesource.com/145361
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Brian Osman 2018-08-03 13:03:19 -04:00 committed by Skia Commit-Bot
parent 06e3c3c5b8
commit ffee60f859
2 changed files with 7 additions and 2 deletions

2
DEPS
View File

@ -15,7 +15,7 @@ deps = {
"third_party/externals/googletest" : "https://android.googlesource.com/platform/external/googletest@dd43b9998e9a44a579a7aba6c1309407d1a5ed95",
"third_party/externals/harfbuzz" : "https://skia.googlesource.com/third_party/harfbuzz.git@1.4.2",
"third_party/externals/icu" : "https://chromium.googlesource.com/chromium/deps/icu.git@ec9c1133693148470ffe2e5e53576998e3650c1d",
"third_party/externals/imgui" : "https://skia.googlesource.com/external/github.com/ocornut/imgui.git@00418d13e369bf53cc4b8f817eb10b8ce65f0904",
"third_party/externals/imgui" : "https://skia.googlesource.com/external/github.com/ocornut/imgui.git@bc6ac8b2aee0614debd940e45bc9cd0d9b355c86",
# TODO: remove jsoncpp after migrating clients to SkJSON
"third_party/externals/jsoncpp" : "https://chromium.googlesource.com/external/github.com/open-source-parsers/jsoncpp.git@1.0.0",
"third_party/externals/libjpeg-turbo" : "https://skia.googlesource.com/external/github.com/libjpeg-turbo/libjpeg-turbo.git@26f109290dc4ffc9c522d9f5d5a7d5d1ee2c0e0a",

View File

@ -1838,7 +1838,12 @@ void Viewer::onIdle() {
fStatsLayer.endTiming(fAnimateTimer);
ImGuiIO& io = ImGui::GetIO();
if (animateWantsInval || fStatsLayer.getActive() || fRefresh || io.MetricsActiveWindows) {
// ImGui always has at least one "active" window, which is the default "Debug" window. It may
// not be visible, though. So we need to redraw if there is at least one visible window, or
// more than one active window. Newly created windows are active but not visible for one frame
// while they determine their layout and sizing.
if (animateWantsInval || fStatsLayer.getActive() || fRefresh ||
io.MetricsActiveWindows > 1 || io.MetricsRenderWindows > 0) {
fWindow->inval();
}
}