summaryrefslogtreecommitdiff
path: root/plugins/unityshell/src
diff options
authorNick Dedekind <nicholas.dedekind@gmail.com>2012-09-18 11:31:48 +0100
committerNick Dedekind <nicholas.dedekind@gmail.com>2012-09-18 11:31:48 +0100
commitfe06158407bd2bcbb51d4db61d038049f5888819 (patch)
treeedf58585b2e39cd499d74208cf1f40280520ea63 /plugins/unityshell/src
parent23c7ac838e0023f5441e360c25db23d833c870b3 (diff)
Added check for launcher/panel mouse click areas in dash hide logic.
(bzr r2684.7.7)
Diffstat (limited to 'plugins/unityshell/src')
-rw-r--r--plugins/unityshell/src/unityshell.cpp40
-rw-r--r--plugins/unityshell/src/unityshell.h2
2 files changed, 34 insertions, 8 deletions
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 67b7bd163..20b43267d 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -898,6 +898,33 @@ void UnityScreen::leaveShowDesktopMode (CompWindow *w)
}
}
+bool UnityScreen::DoesPointIntersectUnityGeos(nux::Point const& pt)
+{
+ auto launchers = launcher_controller_->launchers();
+ for (auto launcher : launchers)
+ {
+ nux::Geometry hud_geo = launcher->GetAbsoluteGeometry();
+
+ if (launcher->Hidden())
+ continue;
+
+ if (hud_geo.IsInside(pt))
+ {
+ return true;
+ }
+ }
+
+ for (nux::Geometry &panel_geo : panel_controller_->GetGeometries ())
+ {
+ if (panel_geo.IsInside(pt))
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
void UnityWindow::enterShowDesktop ()
{
if (!mShowdesktopHandler)
@@ -1424,12 +1451,10 @@ void UnityScreen::handleEvent(XEvent* event)
if (dash_controller_->IsVisible())
{
- int monitor_with_mouse = UScreen::GetDefault()->GetMonitorWithMouse();
nux::Point pt(event->xbutton.x_root, event->xbutton.y_root);
- nux::Geometry geo_dash = dash_controller_->GetInputWindowGeometry();
+ nux::Geometry dash_geo = dash_controller_->GetInputWindowGeometry();
- if (overlay_monitor_ != monitor_with_mouse ||
- !geo_dash.IsInside(pt))
+ if (!dash_geo.IsInside(pt) && !DoesPointIntersectUnityGeos(pt))
{
dash_controller_->HideDash(false);
}
@@ -1437,12 +1462,10 @@ void UnityScreen::handleEvent(XEvent* event)
if (hud_controller_->IsVisible())
{
- int monitor_with_mouse = UScreen::GetDefault()->GetMonitorWithMouse();
nux::Point pt(event->xbutton.x_root, event->xbutton.y_root);
- nux::Geometry geo_hud = hud_controller_->GetInputWindowGeometry();
+ nux::Geometry hud_geo = hud_controller_->GetInputWindowGeometry();
- if (overlay_monitor_ != monitor_with_mouse ||
- !geo_hud.IsInside(pt))
+ if (!hud_geo.IsInside(pt) && !DoesPointIntersectUnityGeos(pt))
{
hud_controller_->HideHud(false);
}
@@ -2685,6 +2708,7 @@ CompPoint UnityWindow::tryNotIntersectUI(CompPoint& pos)
return pos;
}
+
bool UnityWindow::place(CompPoint& pos)
{
bool was_maximized = PluginAdapter::Default ()->MaximizeIfBigEnough(window);
diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h
index b970a7567..052abe7f7 100644
--- a/plugins/unityshell/src/unityshell.h
+++ b/plugins/unityshell/src/unityshell.h
@@ -190,6 +190,8 @@ public:
switcher::Controller::Ptr switcher_controller();
launcher::Controller::Ptr launcher_controller();
+ bool DoesPointIntersectUnityGeos(nux::Point const& pt);
+
protected:
std::string GetName() const;
void AddProperties(GVariantBuilder* builder);