diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-10-10 12:52:58 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-10-10 12:54:17 +0100 |
commit | 3a03ee49e7cced375decefd336294632180414e4 (patch) | |
tree | ca9dc7ead0a0a24d6be8b291575840a7f7a9cf41 /vcl | |
parent | b78d4c6503ff47177316685aae79cb5eaf55e33a (diff) |
afl-eventtesting: there is no focused/active window in headless mode
so close all open frames, not just the active one
and send events to the first discovered visible window and not the focus
window
Change-Id: I7339bc6743cd3106ceddea049136796121819eb3
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/svapp.cxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index a58330710021..1d924699a9e6 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -347,9 +347,16 @@ namespace { bool InjectKeyEvent(SvStream& rStream) { - VclPtr<vcl::Window> xWin(Application::GetFocusWindow()); - if (!xWin) - xWin.reset(Application::GetActiveTopWindow()); + if (Application::AnyInput()) + return false; + + VclPtr<vcl::Window> xWin(Application::GetFirstTopLevelWindow()); + while (xWin) + { + if (xWin->IsVisible()) + break; + xWin.reset(Application::GetNextTopLevelWindow(xWin)); + } if (!xWin) return false; |