From bdedd1f46262e7ec30dbbedaea1e4d51995bd9bb Mon Sep 17 00:00:00 2001 From: Brandon Schaefer Date: Wed, 9 Jan 2013 10:47:08 -0800 Subject: * If the dash is the current active window then check the window stack for the hud icon. (bzr r3024.1.1) --- unity-shared/BamfApplicationManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'unity-shared') diff --git a/unity-shared/BamfApplicationManager.cpp b/unity-shared/BamfApplicationManager.cpp index 5a2140327..5feda5c9b 100644 --- a/unity-shared/BamfApplicationManager.cpp +++ b/unity-shared/BamfApplicationManager.cpp @@ -546,8 +546,8 @@ ApplicationWindowPtr Manager::GetActiveWindow() active_win = nullptr; // 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 ((active_win && bamf_window_get_window_type(active_win) == BAMF_WINDOW_DOCK) || + std::find(our_xids.begin(), our_xids.end(), xid) != our_xids.end()) { LOG_DEBUG(logger) << "Is a dock, looking at the window stack."; std::shared_ptr windows(bamf_matcher_get_window_stack_for_monitor(matcher_, -1), g_list_free); -- cgit v1.2.3 From 08c0d1b65ca3f17e5877e0c79037f641c17f1f7d Mon Sep 17 00:00:00 2001 From: Brandon Schaefer Date: Wed, 9 Jan 2013 10:51:46 -0800 Subject: * Don't do the the std::find twice, if it was true once, then the active win is NULL (bzr r3024.1.2) --- unity-shared/BamfApplicationManager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'unity-shared') diff --git a/unity-shared/BamfApplicationManager.cpp b/unity-shared/BamfApplicationManager.cpp index 5feda5c9b..82ad37596 100644 --- a/unity-shared/BamfApplicationManager.cpp +++ b/unity-shared/BamfApplicationManager.cpp @@ -546,8 +546,7 @@ ApplicationWindowPtr Manager::GetActiveWindow() active_win = nullptr; // 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) || - std::find(our_xids.begin(), our_xids.end(), xid) != our_xids.end()) + if ((active_win && bamf_window_get_window_type(active_win) == BAMF_WINDOW_DOCK) || !active_win) { LOG_DEBUG(logger) << "Is a dock, looking at the window stack."; std::shared_ptr windows(bamf_matcher_get_window_stack_for_monitor(matcher_, -1), g_list_free); -- cgit v1.2.3 From b7f923bd91dae96aec5d5cb46a1f1a2008c727e0 Mon Sep 17 00:00:00 2001 From: Brandon Schaefer Date: Wed, 9 Jan 2013 11:04:59 -0800 Subject: * Fixed ifstatment (bzr r3024.1.3) --- unity-shared/BamfApplicationManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'unity-shared') diff --git a/unity-shared/BamfApplicationManager.cpp b/unity-shared/BamfApplicationManager.cpp index 82ad37596..0df09708e 100644 --- a/unity-shared/BamfApplicationManager.cpp +++ b/unity-shared/BamfApplicationManager.cpp @@ -542,11 +542,11 @@ ApplicationWindowPtr Manager::GetActiveWindow() 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()) + if (std::find(our_xids.begin(), our_xids.end(), xid) == our_xids.end()) active_win = nullptr; // 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) || !active_win) + if ((active_win && bamf_window_get_window_type(active_win) == BAMF_WINDOW_DOCK)) { LOG_DEBUG(logger) << "Is a dock, looking at the window stack."; std::shared_ptr windows(bamf_matcher_get_window_stack_for_monitor(matcher_, -1), g_list_free); -- cgit v1.2.3 From 74a531593721108f8413d8b2a0ef94df5896af0f Mon Sep 17 00:00:00 2001 From: Brandon Schaefer Date: Wed, 9 Jan 2013 11:23:39 -0800 Subject: * Remove the std::find, and add a check if no other window on the stack is found (bzr r3024.1.4) --- unity-shared/BamfApplicationManager.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'unity-shared') diff --git a/unity-shared/BamfApplicationManager.cpp b/unity-shared/BamfApplicationManager.cpp index 0df09708e..b45b2eb48 100644 --- a/unity-shared/BamfApplicationManager.cpp +++ b/unity-shared/BamfApplicationManager.cpp @@ -538,13 +538,12 @@ ApplicationWindowPtr Manager::GetActiveWindow() // No transfer of ownership for bamf_matcher_get_active_window. BamfWindow* active_win = bamf_matcher_get_active_window(matcher_); + if (!active_win) + return result; + std::vector 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 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)) { @@ -572,6 +571,9 @@ ApplicationWindowPtr Manager::GetActiveWindow() active_win = win; } } + + if (bamf_window_get_window_type(active_win) == BAMF_WINDOW_DOCK) + active_win = NULL; } auto view = reinterpret_cast(active_win); -- cgit v1.2.3 From 17df6c486669db119a192780aeba1a56f48ac8df Mon Sep 17 00:00:00 2001 From: Brandon Schaefer Date: Wed, 9 Jan 2013 11:25:21 -0800 Subject: * nullptr not NULL (bzr r3024.1.5) --- unity-shared/BamfApplicationManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'unity-shared') diff --git a/unity-shared/BamfApplicationManager.cpp b/unity-shared/BamfApplicationManager.cpp index b45b2eb48..b210c2b3e 100644 --- a/unity-shared/BamfApplicationManager.cpp +++ b/unity-shared/BamfApplicationManager.cpp @@ -573,7 +573,7 @@ ApplicationWindowPtr Manager::GetActiveWindow() } if (bamf_window_get_window_type(active_win) == BAMF_WINDOW_DOCK) - active_win = NULL; + active_win = nullptr; } auto view = reinterpret_cast(active_win); -- cgit v1.2.3 From 8ca6673b30012f18ef35ae71f5214d5dee9d3e85 Mon Sep 17 00:00:00 2001 From: Brandon Schaefer Date: Wed, 9 Jan 2013 11:41:24 -0800 Subject: * Better way to do this... (bzr r3024.1.6) --- unity-shared/BamfApplicationManager.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'unity-shared') diff --git a/unity-shared/BamfApplicationManager.cpp b/unity-shared/BamfApplicationManager.cpp index b210c2b3e..8192265a8 100644 --- a/unity-shared/BamfApplicationManager.cpp +++ b/unity-shared/BamfApplicationManager.cpp @@ -541,15 +541,15 @@ ApplicationWindowPtr Manager::GetActiveWindow() if (!active_win) return result; - std::vector const& our_xids = nux::XInputWindow::NativeHandleList(); - Window xid = bamf_window_get_xid(active_win); - // 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 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)) @@ -560,20 +560,16 @@ ApplicationWindowPtr Manager::GetActiveWindow() auto win = static_cast(l->data); auto view = static_cast(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; } } - - if (bamf_window_get_window_type(active_win) == BAMF_WINDOW_DOCK) - active_win = nullptr; } auto view = reinterpret_cast(active_win); -- cgit v1.2.3