diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2013-10-22 01:55:00 +0200 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2013-10-22 01:55:00 +0200 |
| commit | a22dcdf3befe030e768d8617095c645efe557532 (patch) | |
| tree | 8ab3304e798b41e38f218f6fc88642b990401e1d /launcher | |
| parent | d3d3df8a9ff5df7fdef0d40c518b4e31ae5ddb56 (diff) | |
ApplicationLauncherIcon: Set the proper minimization icon when in multi-monitor
This is possible thanks to GetCenterForMonitor, that returns the monitor that is handling the current window. Fixes LP: #767752 (bzr r3566.5.7)
Diffstat (limited to 'launcher')
| -rw-r--r-- | launcher/ApplicationLauncherIcon.cpp | 30 | ||||
| -rw-r--r-- | launcher/ApplicationLauncherIcon.h | 4 |
2 files changed, 22 insertions, 12 deletions
diff --git a/launcher/ApplicationLauncherIcon.cpp b/launcher/ApplicationLauncherIcon.cpp index 6e13360be..753da1cc4 100644 --- a/launcher/ApplicationLauncherIcon.cpp +++ b/launcher/ApplicationLauncherIcon.cpp @@ -495,9 +495,14 @@ void ApplicationLauncherIcon::OnWindowMinimized(guint32 xid) { if (xid == window->window_id()) { - Present(0.5f, 600, window->monitor()); - FullyAnimateQuirkDelayed(300, Quirk::SHIMMER, window->monitor()); - break; + int monitor = GetCenterForMonitor(window->monitor()).first; + + if (monitor >= 0) + { + Present(0.5f, 600, monitor); + FullyAnimateQuirkDelayed(300, Quirk::SHIMMER, monitor); + break; + } } } } @@ -1078,7 +1083,7 @@ AbstractLauncherIcon::MenuItemsVector ApplicationLauncherIcon::GetMenus() return result; } -void ApplicationLauncherIcon::UpdateIconGeometries(std::vector<nux::Point3> center) +void ApplicationLauncherIcon::UpdateIconGeometries(std::vector<nux::Point3> const& centers) { if (app_->type() == "webapp") return; @@ -1088,18 +1093,23 @@ void ApplicationLauncherIcon::UpdateIconGeometries(std::vector<nux::Point3> cent for (auto& window : app_->GetWindows()) { Window xid = window->window_id(); - int monitor = window->monitor(); - monitor = std::max<int>(0, std::min<int>(center.size() - 1, monitor)); + int monitor = GetCenterForMonitor(window->monitor()).first; + + if (monitor < 0) + { + WindowManager::Default().SetWindowIconGeometry(xid, nux::Geometry()); + continue; + } - geo.x = center[monitor].x - icon_size / 2; - geo.y = center[monitor].y - icon_size / 2; + geo.x = centers[monitor].x - icon_size / 2; + geo.y = centers[monitor].y - icon_size / 2; WindowManager::Default().SetWindowIconGeometry(xid, geo); } } -void ApplicationLauncherIcon::OnCenterStabilized(std::vector<nux::Point3> center) +void ApplicationLauncherIcon::OnCenterStabilized(std::vector<nux::Point3> const& centers) { - UpdateIconGeometries(center); + UpdateIconGeometries(centers); } void ApplicationLauncherIcon::UpdateRemoteUri() diff --git a/launcher/ApplicationLauncherIcon.h b/launcher/ApplicationLauncherIcon.h index 60f811ef8..4aed11e48 100644 --- a/launcher/ApplicationLauncherIcon.h +++ b/launcher/ApplicationLauncherIcon.h @@ -77,8 +77,8 @@ protected: ApplicationPtr GetApplication() const; void Remove(); - void UpdateIconGeometries(std::vector<nux::Point3> center); - void OnCenterStabilized(std::vector<nux::Point3> center); + void UpdateIconGeometries(std::vector<nux::Point3> const& centers); + void OnCenterStabilized(std::vector<nux::Point3> const& centers); void AddProperties(GVariantBuilder* builder); void OnAcceptDrop(DndData const& dnd_data); void OnDndEnter(); |
