summaryrefslogtreecommitdiff
diff options
-rw-r--r--dash/DashController.cpp6
-rw-r--r--hud/HudController.cpp7
-rw-r--r--launcher/Launcher.cpp4
-rw-r--r--panel/PanelView.cpp3
-rw-r--r--panel/PanelView.h1
-rw-r--r--tests/autopilot/unity/tests/test_switcher.py89
-rw-r--r--unity-shared/BackgroundEffectHelper.cpp11
-rw-r--r--unity-shared/BackgroundEffectHelper.h1
-rw-r--r--unity-shared/UnityWindowView.cpp3
9 files changed, 112 insertions, 13 deletions
diff --git a/dash/DashController.cpp b/dash/DashController.cpp
index eed8b41f6..89a2f9274 100644
--- a/dash/DashController.cpp
+++ b/dash/DashController.cpp
@@ -354,7 +354,11 @@ void Controller::HideDash()
window_->EnableInputWindow(false, dash::window_title, true, false);
visible_ = false;
- nux::GetWindowCompositor().SetKeyFocusArea(NULL, nux::KEY_NAV_NONE);
+ auto& wc = nux::GetWindowCompositor();
+ auto *key_focus_area = wc.GetKeyFocusArea();
+ if (key_focus_area && key_focus_area->IsChildOf(view_.GetPointer()))
+ wc.SetKeyFocusArea(nullptr, nux::KEY_NAV_NONE);
+
WindowManager::Default().RestoreInputFocus();
StartShowHideTimeline();
diff --git a/hud/HudController.cpp b/hud/HudController.cpp
index 13c499c6a..6178bb618 100644
--- a/hud/HudController.cpp
+++ b/hud/HudController.cpp
@@ -408,8 +408,13 @@ void Controller::HideHud()
window_->EnableInputWindow(false, "Hud", true, false);
visible_ = false;
+ auto& wc = nux::GetWindowCompositor();
+ auto *key_focus_area = wc.GetKeyFocusArea();
+ if (key_focus_area && key_focus_area->IsChildOf(view_))
+ wc.SetKeyFocusArea(nullptr, nux::KEY_NAV_NONE);
+
WindowManager::Default().RestoreInputFocus();
- nux::GetWindowCompositor().SetKeyFocusArea(NULL, nux::KEY_NAV_NONE);
+
StartShowHideTimeline();
hud_service_.CloseQuery();
diff --git a/launcher/Launcher.cpp b/launcher/Launcher.cpp
index d41247c41..72d3aead5 100644
--- a/launcher/Launcher.cpp
+++ b/launcher/Launcher.cpp
@@ -133,6 +133,7 @@ Launcher::Launcher(MockableBaseWindow* parent,
, drag_gesture_ongoing_(false)
, last_reveal_progress_(0.0f)
, drag_action_(nux::DNDACTION_NONE)
+ , bg_effect_helper_(this)
, auto_hide_animation_(ANIM_DURATION_SHORT)
, hover_animation_(ANIM_DURATION)
, drag_over_animation_(ANIM_DURATION_LONG)
@@ -144,9 +145,6 @@ Launcher::Launcher(MockableBaseWindow* parent,
icon_renderer_->monitor = monitor();
icon_renderer_->SetTargetSize(icon_size_, DEFAULT_ICON_SIZE, SPACE_BETWEEN_ICONS);
- bg_effect_helper_.owner = this;
- bg_effect_helper_.enabled = false;
-
CaptureMouseDownAnyWhereElse(true);
SetAcceptKeyNavFocusOnMouseDown(false);
SetAcceptMouseWheelEvent(true);
diff --git a/panel/PanelView.cpp b/panel/PanelView.cpp
index 22f2c6021..a7c221112 100644
--- a/panel/PanelView.cpp
+++ b/panel/PanelView.cpp
@@ -67,6 +67,7 @@ PanelView::PanelView(MockableBaseWindow* parent, indicator::DBusIndicators::Ptr
, monitor_(0)
, stored_dash_width_(0)
, launcher_width_(64)
+ , bg_effect_helper_(this)
{
panel::Style::Instance().changed.connect(sigc::mem_fun(this, &PanelView::ForceUpdateBackground));
WindowManager::Default().average_color.changed.connect(sigc::mem_fun(this, &PanelView::OnBackgroundUpdate));
@@ -125,8 +126,6 @@ PanelView::PanelView(MockableBaseWindow* parent, indicator::DBusIndicators::Ptr
QueueDraw();
});
- bg_effect_helper_.owner = this;
-
//FIXME (gord)- replace with async loading
TextureCache& cache = TextureCache::GetDefault();
panel_sheen_ = cache.FindTexture("dash_sheen.png");
diff --git a/panel/PanelView.h b/panel/PanelView.h
index af0c8a636..b26d74905 100644
--- a/panel/PanelView.h
+++ b/panel/PanelView.h
@@ -138,7 +138,6 @@ private:
int monitor_;
int stored_dash_width_;
int launcher_width_;
- bool refine_is_open_;
connection::Manager on_indicator_updated_connections_;
connection::Manager maximized_opacity_toggle_connections_;
diff --git a/tests/autopilot/unity/tests/test_switcher.py b/tests/autopilot/unity/tests/test_switcher.py
index 4100acce4..7f73daf0f 100644
--- a/tests/autopilot/unity/tests/test_switcher.py
+++ b/tests/autopilot/unity/tests/test_switcher.py
@@ -256,6 +256,12 @@ class SwitcherTests(SwitcherTestCase):
class SwitcherWindowsManagementTests(SwitcherTestCase):
"""Test the switcher window management."""
+ def setUp(self):
+ super(SwitcherTestCase, self).setUp()
+
+ def tearDown(self):
+ super(SwitcherTestCase, self).tearDown()
+
def test_switcher_raises_only_last_focused_window(self):
"""Tests that when we do an alt+tab only the previously focused window is raised.
@@ -305,6 +311,89 @@ class SwitcherWindowsManagementTests(SwitcherTestCase):
self.assertProperty(calc_win, is_focused=True)
+class SwitcherInteractionTests(SwitcherTestCase):
+ """Test the switcher interactions with the rest of the shell."""
+
+ def setUp(self):
+ super(SwitcherTestCase, self).setUp()
+
+ def tearDown(self):
+ super(SwitcherTestCase, self).tearDown()
+
+ def open_switcher_after_overlay(self, overlay):
+ self.start_applications()
+ self.addCleanup(overlay.ensure_hidden)
+ overlay.ensure_visible()
+
+ self.unity.switcher.initiate()
+ self.addCleanup(self.unity.switcher.terminate)
+
+ self.assertThat(overlay.visible, Eventually(Equals(False)))
+ self.assertThat(self.unity.switcher.visible, Eventually(Equals(True)))
+
+
+class SwitcherOverlaysInteractionTests(SwitcherInteractionTests):
+ """Test the switcher interactions with the shell overlays."""
+
+ scenarios = multiply_scenarios(SwitcherTestCase.scenarios,
+ [
+ ('Dash', {'overlay': "self.unity.dash"}),
+ ('Hud', {'overlay': "self.unity.hud"}),
+ ]
+ )
+
+ def setUp(self):
+ super(SwitcherOverlaysInteractionTests, self).setUp()
+ self.overlay = eval(self.overlay)
+
+ def tearDown(self):
+ super(SwitcherOverlaysInteractionTests, self).tearDown()
+
+ def test_switcher_shows_on_overlay_opened(self):
+ """Tests if switcher shows when overlay is opened"""
+ self.open_switcher_after_overlay(self.overlay)
+
+ def test_switcher_tab_key_work_after_overlay_is_closed(self):
+ """Tests that the switcher tab key work when initializing the
+ switcher after closing the overlay
+ """
+ self.open_switcher_after_overlay(self.overlay)
+
+ start = self.unity.switcher.selection_index
+ next_index = (start + 1) % len(self.unity.switcher.icons)
+ self.unity.switcher.next_icon()
+ self.assertThat(self.unity.switcher.selection_index, Eventually(Equals(next_index)))
+
+ self.unity.switcher.previous_icon()
+ self.assertThat(self.unity.switcher.selection_index, Eventually(Equals(start)))
+
+ def test_switcher_arrow_keys_work_after_overlay_is_closed(self):
+ """Tests that the switcher arrow keys work when initializing the
+ switcher after closing the overlay
+ """
+ self.open_switcher_after_overlay(self.overlay)
+
+ start = self.unity.switcher.selection_index
+ next_index = (start + 1) % len(self.unity.switcher.icons)
+ self.keyboard.press_and_release('Right')
+ self.assertThat(self.unity.switcher.selection_index, Eventually(Equals(next_index)))
+
+ self.keyboard.press_and_release('Left')
+ self.assertThat(self.unity.switcher.selection_index, Eventually(Equals(start)))
+
+ def test_switcher_detail_mode_works_after_overlay_is_closed(self):
+ """Tests that the switcher detail mode through the 'Down' arrow key
+ work when initializing the switcher after closing the overlay
+ """
+ self.open_switcher_after_overlay(self.overlay)
+
+ self.keyboard.press_and_release('Down')
+ self.assertProperty(self.unity.switcher, mode=SwitcherMode.DETAIL)
+
+ self.keyboard.press_and_release('Up')
+ self.assertProperty(self.unity.switcher, mode=SwitcherMode.NORMAL)
+
+
class SwitcherDetailsTests(SwitcherTestCase):
"""Test the details mode for the switcher."""
diff --git a/unity-shared/BackgroundEffectHelper.cpp b/unity-shared/BackgroundEffectHelper.cpp
index 1aba3f7b4..1c163c5b9 100644
--- a/unity-shared/BackgroundEffectHelper.cpp
+++ b/unity-shared/BackgroundEffectHelper.cpp
@@ -41,8 +41,9 @@ std::list<BackgroundEffectHelper*> BackgroundEffectHelper::registered_list_;
std::vector<nux::Geometry> BackgroundEffectHelper::blur_geometries_;
sigc::signal<void, nux::Geometry const&> BackgroundEffectHelper::blur_region_needs_update_;
-BackgroundEffectHelper::BackgroundEffectHelper()
- : enabled(false)
+BackgroundEffectHelper::BackgroundEffectHelper(nux::View* view)
+ : owner(view)
+ , enabled(false)
, cache_dirty(true)
{
enabled.changed.connect(sigc::mem_fun(this, &BackgroundEffectHelper::OnEnabledChanged));
@@ -53,6 +54,10 @@ BackgroundEffectHelper::BackgroundEffectHelper()
blur_type = BLUR_NONE;
}
+BackgroundEffectHelper::BackgroundEffectHelper()
+ : BackgroundEffectHelper(nullptr)
+{}
+
BackgroundEffectHelper::~BackgroundEffectHelper()
{
Unregister(this);
@@ -158,7 +163,7 @@ void BackgroundEffectHelper::ProcessDamage(nux::Geometry const& geo)
if (bg_effect_helper->cache_dirty)
continue;
- if (geo.IsIntersecting(bg_effect_helper->blur_geometry_))
+ if (geo.IsIntersecting(bg_effect_helper->requested_blur_geometry_))
{
bg_effect_helper->DirtyCache();
}
diff --git a/unity-shared/BackgroundEffectHelper.h b/unity-shared/BackgroundEffectHelper.h
index ae2f25202..6f6a5a441 100644
--- a/unity-shared/BackgroundEffectHelper.h
+++ b/unity-shared/BackgroundEffectHelper.h
@@ -40,6 +40,7 @@ class BackgroundEffectHelper
{
public:
BackgroundEffectHelper();
+ BackgroundEffectHelper(nux::View*);
~BackgroundEffectHelper();
nux::Property<nux::View*> owner;
diff --git a/unity-shared/UnityWindowView.cpp b/unity-shared/UnityWindowView.cpp
index 576c0ac3c..0ddf5cd07 100644
--- a/unity-shared/UnityWindowView.cpp
+++ b/unity-shared/UnityWindowView.cpp
@@ -33,9 +33,8 @@ UnityWindowView::UnityWindowView(NUX_FILE_LINE_DECL)
, style(UnityWindowStyle::Get())
, closable(false)
, internal_layout_(nullptr)
+ , bg_helper_(this)
{
- bg_helper_.owner = this;
-
live_background.SetGetterFunction([this] { return bg_helper_.enabled(); });
live_background.SetSetterFunction([this] (bool e) {
if (bg_helper_.enabled() != e)