diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2013-02-05 03:14:32 +0100 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2013-02-05 03:14:32 +0100 |
| commit | 58fae9959fe2ba3b70a998fe23eeba613519923e (patch) | |
| tree | f4db615c5919597313d34b74aea6144a0d1de5ab | |
| parent | 6686aa8fa44ac1ecbc1e1abe57df6649a207728a (diff) | |
ApplicationLauncherIcon: add a custom implementation of GetQuirk for Quirk::ACTIVE
We need to make sure that an application is set as active also if the WindowManager active window is contained in the application windows list. (bzr r3092.2.14)
| -rw-r--r-- | launcher/ApplicationLauncherIcon.cpp | 25 | ||||
| -rw-r--r-- | launcher/ApplicationLauncherIcon.h | 2 | ||||
| -rw-r--r-- | unity-shared/BamfApplicationManager.cpp | 1 |
3 files changed, 27 insertions, 1 deletions
diff --git a/launcher/ApplicationLauncherIcon.cpp b/launcher/ApplicationLauncherIcon.cpp index 80144a04f..f4ae396bd 100644 --- a/launcher/ApplicationLauncherIcon.cpp +++ b/launcher/ApplicationLauncherIcon.cpp @@ -173,6 +173,31 @@ ApplicationLauncherIcon::~ApplicationLauncherIcon() } } +bool ApplicationLauncherIcon::GetQuirk(AbstractLauncherIcon::Quirk quirk) const +{ + if (quirk == Quirk::ACTIVE) + { + if (!SimpleLauncherIcon::GetQuirk(Quirk::ACTIVE)) + return false; + + if (app_->type() == "webapp") + return true; + + // Sometimes BAMF is not fast enough to update the active application + // while quickly switching between apps, so we double check that the + // real active window is part of the selection (see bug #1111620) + Window active = WindowManager::Default().GetActiveWindow(); + + for (auto& window : app_->GetWindows()) + if (window->window_id() == active) + return true; + + return false; + } + + return SimpleLauncherIcon::GetQuirk(quirk); +} + void ApplicationLauncherIcon::Remove() { /* Removing the unity-seen flag to the wrapped bamf application, on remove diff --git a/launcher/ApplicationLauncherIcon.h b/launcher/ApplicationLauncherIcon.h index f46e126a6..0a03f3e84 100644 --- a/launcher/ApplicationLauncherIcon.h +++ b/launcher/ApplicationLauncherIcon.h @@ -51,6 +51,8 @@ public: bool IsRunning() const; bool IsUrgent() const; + virtual bool GetQuirk(Quirk quirk) const; + virtual void Quit(); virtual void AboutToRemove(); diff --git a/unity-shared/BamfApplicationManager.cpp b/unity-shared/BamfApplicationManager.cpp index 8192265a8..ed8a0d881 100644 --- a/unity-shared/BamfApplicationManager.cpp +++ b/unity-shared/BamfApplicationManager.cpp @@ -68,7 +68,6 @@ bool View::GetVisible() const bool View::GetActive() const { return bamf_view_is_active(bamf_view_); - } bool View::GetRunning() const |
