diff options
| author | Brandon Schaefer <brandon.schaefer@canonical.com> | 2013-01-09 23:44:26 +0000 |
|---|---|---|
| committer | Tarmac <> | 2013-01-09 23:44:26 +0000 |
| commit | 3d98341d00a888bf261bfa82acaa0d8b12384c22 (patch) | |
| tree | 4636c6dfc9314da974c0b98337ec5d571e365c51 /unity-shared | |
| parent | a7bc07598aaa24d9d0c6ef5148d6e2a729fd4460 (diff) | |
| parent | 8ca6673b30012f18ef35ae71f5214d5dee9d3e85 (diff) | |
Check the window stack if the current XID is not a valid window. This fixes this AP test: unity.tests.test_hud.HudVisualTests.test_switch_hud_dash_does_not_break_the_focused_application_emblem.
Approved by Marco Trevisan (TreviƱo). (bzr r3029)
Diffstat (limited to 'unity-shared')
| -rw-r--r-- | unity-shared/BamfApplicationManager.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/unity-shared/BamfApplicationManager.cpp b/unity-shared/BamfApplicationManager.cpp index 5a2140327..8192265a8 100644 --- a/unity-shared/BamfApplicationManager.cpp +++ b/unity-shared/BamfApplicationManager.cpp @@ -538,20 +538,18 @@ ApplicationWindowPtr Manager::GetActiveWindow() // No transfer of ownership for bamf_matcher_get_active_window. BamfWindow* active_win = bamf_matcher_get_active_window(matcher_); - std::vector<Window> const& our_xids = nux::XInputWindow::NativeHandleList(); - Window xid = bamf_window_get_xid(active_win); - - // First check if the active window is not an Unity window - if (std::find(our_xids.begin(), our_xids.end(), xid) != our_xids.end()) - active_win = nullptr; + if (!active_win) + return result; // If the active window is a dock type, then we want the first visible, non-dock type. - if (active_win && - bamf_window_get_window_type(active_win) == BAMF_WINDOW_DOCK) + if (bamf_window_get_window_type(active_win) == BAMF_WINDOW_DOCK) { LOG_DEBUG(logger) << "Is a dock, looking at the window stack."; + std::shared_ptr<GList> windows(bamf_matcher_get_window_stack_for_monitor(matcher_, -1), g_list_free); WindowManager& wm = WindowManager::Default(); + active_win = nullptr; + for (GList *l = windows.get(); l; l = l->next) { if (!BAMF_IS_WINDOW(l->data)) @@ -562,13 +560,12 @@ ApplicationWindowPtr Manager::GetActiveWindow() auto win = static_cast<BamfWindow*>(l->data); auto view = static_cast<BamfView*>(l->data); - xid = bamf_window_get_xid(win); + auto xid = bamf_window_get_xid(win); if (bamf_view_is_user_visible(view) && bamf_window_get_window_type(win) != BAMF_WINDOW_DOCK && wm.IsWindowOnCurrentDesktop(xid) && - wm.IsWindowVisible(xid) && - std::find(our_xids.begin(), our_xids.end(), xid) == our_xids.end()) + wm.IsWindowVisible(xid)) { active_win = win; } |
