summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-10-10 12:52:58 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-10-10 12:54:17 +0100
commit3a03ee49e7cced375decefd336294632180414e4 (patch)
treeca9dc7ead0a0a24d6be8b291575840a7f7a9cf41 /vcl/source
parentb78d4c6503ff47177316685aae79cb5eaf55e33a (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/source')
-rw-r--r--vcl/source/app/svapp.cxx13
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;