summaryrefslogtreecommitdiff
diff options
authorNick Dedekind <nicholas.dedekind@gmail.com>2012-09-11 10:59:25 +0100
committerNick Dedekind <nicholas.dedekind@gmail.com>2012-09-11 10:59:25 +0100
commit99501d7ee3e9471635947c54eb4e4bb7c21e6cbc (patch)
tree5ae299443978caefecb87fa6376212be38f3d08a
parented79fef1d0657c8fe8c9b5e4e8d2654f5a4a6397 (diff)
Merged with lp:~brandontschaefer/unity/dash-hud-is-dismissed-when-clicking-other-monitor. + a few fixes for focus changes.
(bzr r2676.3.1)
-rw-r--r--dash/DashController.cpp17
-rw-r--r--dash/DashController.h3
-rw-r--r--launcher/LauncherController.cpp2
-rw-r--r--manual-tests/Dash.txt16
-rw-r--r--plugins/unityshell/src/unityshell.cpp17
-rw-r--r--plugins/unityshell/src/unityshell.h2
-rw-r--r--tests/autopilot/unity/tests/test_dash.py22
7 files changed, 63 insertions, 16 deletions
diff --git a/dash/DashController.cpp b/dash/DashController.cpp
index 8593d7a20..6bdf8dd48 100644
--- a/dash/DashController.cpp
+++ b/dash/DashController.cpp
@@ -261,17 +261,8 @@ void Controller::ShowDash()
return;
}
- /* GetIdealMonitor must get called before visible_ is set */
monitor_ = GetIdealMonitor();
- // The launcher must receive UBUS_OVERLAY_SHOW before window_->EnableInputWindow().
- // Other wise the Launcher gets focus for X, which causes XIM to fail.
- sources_.AddIdle([this] {
- GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "dash", TRUE, monitor_);
- ubus_manager_.SendMessage(UBUS_OVERLAY_SHOWN, info);
- return false;
- });
-
view_->AboutToShow();
window_->ShowWindow(true);
@@ -288,6 +279,9 @@ void Controller::ShowDash()
visible_ = true;
StartShowHideTimeline();
+
+ GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "dash", TRUE, monitor_);
+ ubus_manager_.SendMessage(UBUS_OVERLAY_SHOWN, info);
}
void Controller::HideDash(bool restore)
@@ -377,6 +371,11 @@ void Controller::AddProperties(GVariantBuilder* builder)
.add("monitor", monitor_);
}
+bool Controller::IsVisible() const
+{
+ return visible_;
+}
+
}
}
diff --git a/dash/DashController.h b/dash/DashController.h
index a03745782..3bd6bf812 100644
--- a/dash/DashController.h
+++ b/dash/DashController.h
@@ -58,6 +58,8 @@ public:
void HideDash(bool restore_focus = true);
+ bool IsVisible() const;
+
protected:
std::string GetName() const;
void AddProperties(GVariantBuilder* builder);
@@ -97,7 +99,6 @@ private:
sigc::connection screen_ungrabbed_slot_;
glib::SignalManager sig_manager_;
glib::TimeoutSeconds ensure_timeout_;
- glib::SourceManager sources_;
Animator timeline_animator_;
UBusManager ubus_manager_;
};
diff --git a/launcher/LauncherController.cpp b/launcher/LauncherController.cpp
index bcc372fcb..bcc59bdca 100644
--- a/launcher/LauncherController.cpp
+++ b/launcher/LauncherController.cpp
@@ -244,7 +244,7 @@ void Controller::Impl::OnWindowFocusChanged (guint32 xid)
{
static bool keynav_first_focus = false;
- if (parent_->IsOverlayOpen())
+ if (parent_->IsOverlayOpen() || launcher_->GetParent()->GetInputWindowId() == xid)
keynav_first_focus = false;
if (keynav_first_focus)
diff --git a/manual-tests/Dash.txt b/manual-tests/Dash.txt
index 9ab7579ca..3cdd60499 100644
--- a/manual-tests/Dash.txt
+++ b/manual-tests/Dash.txt
@@ -100,6 +100,22 @@ Expected result:
* When a single row of results isn't enough to contain all returned search results, and there are no other category headers, the displayed category
header expands automatically
+
+Test the Panel does not lose track of when the Dash is opened then closed.
+--------------------------------------------------------------------------
+This tests shows the panel will not think the Dash is opened when it is closed.
+(see lp:1044086)
+
+Setup:
+#. ress Super twice (Quickly)
+
+Expected Result:
+ The panel should look the same as if you had never opened the dash.
+
+Wrong Result:
+ The panel still thinks the dash is open and is blured to match your background.
+
+
Filter Results Tests
========================
These tests show that the dash "All" button works well.
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 0ec87f497..7d0b45bd7 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -359,7 +359,7 @@ UnityScreen::UnityScreen(CompScreen* screen)
g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
&overlay_identity, &can_maximise, &overlay_monitor);
- dash_monitor_ = overlay_monitor;
+ overlay_monitor_ = overlay_monitor;
RaiseInputWindows();
});
@@ -571,7 +571,7 @@ void UnityScreen::paintPanelShadow(const GLMatrix& matrix)
i++;
}
- if (!(launcher_controller_->IsOverlayOpen() && current_monitor == dash_monitor_)
+ if (!(launcher_controller_->IsOverlayOpen() && current_monitor == overlay_monitor_)
&& panel_controller_->opacity() > 0.0f)
{
foreach(GLTexture * tex, _shadow_texture)
@@ -1417,7 +1417,15 @@ void UnityScreen::handleEvent(XEvent* event)
if (CompWindow *w = screen->findWindow(scale_highlighted_window_))
skip_other_plugins = UnityWindow::get(w)->handleEvent(event);
}
-
+ if (launcher_controller_->IsOverlayOpen())
+ {
+ int monitor_with_mouse = UScreen::GetDefault()->GetMonitorWithMouse();
+ if (overlay_monitor_ != monitor_with_mouse)
+ {
+ dash_controller_->HideDash(false);
+ hud_controller_->HideHud(false);
+ }
+ }
break;
case ButtonRelease:
if (switcher_controller_ && switcher_controller_->Visible())
@@ -2556,7 +2564,8 @@ void UnityWindow::windowNotify(CompWindowNotify n)
UnityScreen* us = UnityScreen::get(screen);
CompWindow *lw;
- if (us->launcher_controller_->IsOverlayOpen())
+ // can't rely on launcher->IsOverlayVisible on focus change (because ubus is async close on focus change.)
+ if (us && (us->dash_controller_->IsVisible() || us->hud_controller_->IsVisible()))
{
lw = screen->findWindow(us->launcher_controller_->LauncherWindowId(0));
lw->moveInputFocusTo();
diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h
index a1de06832..aad6e0761 100644
--- a/plugins/unityshell/src/unityshell.h
+++ b/plugins/unityshell/src/unityshell.h
@@ -312,7 +312,7 @@ private:
bool queryForShader ();
- int dash_monitor_;
+ int overlay_monitor_;
CompScreen::GrabHandle grab_index_;
CompWindowList fullscreen_windows_;
bool painting_tray_;
diff --git a/tests/autopilot/unity/tests/test_dash.py b/tests/autopilot/unity/tests/test_dash.py
index 305712c69..5abb2687e 100644
--- a/tests/autopilot/unity/tests/test_dash.py
+++ b/tests/autopilot/unity/tests/test_dash.py
@@ -847,3 +847,25 @@ class PreviewNavigateTests(DashTestCase):
self.assertThat(self.dash.preview_displaying, Eventually(Equals(False)))
+class DashCrossMonitorsTests(DashTestCase):
+ """Multimonitor dash tests."""
+
+ def setUp(self):
+ super(DashCrossMonitorsTests, self).setUp()
+ if self.screen_geo.get_num_monitors() < 2:
+ self.skipTest("This test requires a multimonitor setup")
+
+ def test_dash_close_on_cross_monitor_click(self):
+ """Dash must close when clicking on a window in a different screen."""
+
+ prev_monitor = None
+ for monitor in range(0, self.screen_geo.get_num_monitors()-1):
+
+ self.screen_geo.move_mouse_to_monitor(monitor)
+ self.dash.ensure_visible()
+
+ self.screen_geo.move_mouse_to_monitor(monitor+1)
+ sleep(.5)
+ self.mouse.click()
+
+ self.assertThat(self.dash.visible, Eventually(Equals(False)))