summaryrefslogtreecommitdiff
diff options
-rw-r--r--launcher/LauncherIcon.cpp17
-rw-r--r--launcher/LauncherIcon.h2
-rw-r--r--tests/autopilot/unity/tests/test_quicklist.py38
3 files changed, 56 insertions, 1 deletions
diff --git a/launcher/LauncherIcon.cpp b/launcher/LauncherIcon.cpp
index 71f49acbc..236e3a38e 100644
--- a/launcher/LauncherIcon.cpp
+++ b/launcher/LauncherIcon.cpp
@@ -87,6 +87,7 @@ LauncherIcon::LauncherIcon()
, _last_stable(max_num_monitors)
, _parent_geo(max_num_monitors)
, _saved_center(max_num_monitors)
+ , _allow_quicklist_to_show(true)
{
for (unsigned i = 0; i < unsigned(Quirk::LAST); i++)
{
@@ -153,6 +154,11 @@ void LauncherIcon::LoadQuicklist()
_quicklist = new QuicklistView();
AddChild(_quicklist.GetPointer());
+ _quicklist->mouse_down_outside_pointer_grab_area.connect([&] (int x, int y, unsigned long button_flags, unsigned long key_flags)
+ {
+ _allow_quicklist_to_show = false;
+ });
+
QuicklistManager::Default()->RegisterQuicklist(_quicklist.GetPointer());
}
@@ -532,6 +538,7 @@ LauncherIcon::RecvMouseEnter(int monitor)
void LauncherIcon::RecvMouseLeave(int monitor)
{
_last_monitor = -1;
+ _allow_quicklist_to_show = true;
if (_tooltip)
_tooltip->ShowWindow(false);
@@ -624,16 +631,24 @@ bool LauncherIcon::OpenQuicklist(bool select_first_item, int monitor)
void LauncherIcon::RecvMouseDown(int button, int monitor, unsigned long key_flags)
{
if (button == 3)
- OpenQuicklist();
+ OpenQuicklist(false, monitor);
}
void LauncherIcon::RecvMouseUp(int button, int monitor, unsigned long key_flags)
{
if (button == 3)
{
+ if (_allow_quicklist_to_show)
+ {
+ OpenQuicklist(false, monitor);
+ }
+
if (_quicklist && _quicklist->IsVisible())
+ {
_quicklist->CaptureMouseDownAnyWhereElse(true);
+ }
}
+ _allow_quicklist_to_show = true;
}
void LauncherIcon::RecvMouseClick(int button, int monitor, unsigned long key_flags)
diff --git a/launcher/LauncherIcon.h b/launcher/LauncherIcon.h
index 651b04849..3544535ae 100644
--- a/launcher/LauncherIcon.h
+++ b/launcher/LauncherIcon.h
@@ -339,6 +339,8 @@ private:
bool _quirks[unsigned(Quirk::LAST)];
struct timespec _quirk_times[unsigned(Quirk::LAST)];
+ bool _allow_quicklist_to_show;
+
std::list<LauncherEntryRemote::Ptr> _entry_list;
protected:
diff --git a/tests/autopilot/unity/tests/test_quicklist.py b/tests/autopilot/unity/tests/test_quicklist.py
index 37b354fa2..b253fa071 100644
--- a/tests/autopilot/unity/tests/test_quicklist.py
+++ b/tests/autopilot/unity/tests/test_quicklist.py
@@ -155,6 +155,44 @@ class QuicklistActionTests(UnityTestCase):
self.addCleanup(self.dash.ensure_hidden)
self.assertThat(self.dash.visible, Eventually(Equals(True)))
+ def test_right_click_opens_quicklist_if_already_open(self):
+ """A right click to another icon in the launcher must
+ close the current open quicklist and open the other
+ icons quicklist.
+ lp:890991
+ """
+
+ calc_win = self.start_app_window("Calculator")
+ mahj_win = self.start_app_window("Mahjongg")
+
+ calc_icon = self.launcher.model.get_icon(
+ desktop_id=calc_win.application.desktop_file)
+ mahj_icon = self.launcher.model.get_icon(
+ desktop_id=mahj_win.application.desktop_file)
+
+ calc_ql = self.open_quicklist_for_icon(calc_icon)
+ self.assertThat(calc_ql.active, Eventually(Equals(True)))
+
+ mahj_ql = self.open_quicklist_for_icon(mahj_icon)
+ self.assertThat(mahj_ql.active, Eventually(Equals(True)))
+ self.assertThat(calc_ql.active, Eventually(Equals(False)))
+
+ def test_right_clicking_same_icon_doesnt_reopen_ql(self):
+ """A right click to the same icon in the launcher must
+ not re-open the quicklist if already open. It must hide.
+ """
+
+ calc_win = self.start_app_window("Calculator")
+
+ calc_icon = self.launcher.model.get_icon(
+ desktop_id=calc_win.application.desktop_file)
+
+ calc_ql = self.open_quicklist_for_icon(calc_icon)
+ self.assertThat(calc_ql.active, Eventually(Equals(True)))
+
+ calc_ql = self.open_quicklist_for_icon(calc_icon)
+ self.assertThat(calc_ql.active, Eventually(Equals(False)))
+
class QuicklistKeyNavigationTests(UnityTestCase):
"""Tests for the quicklist key navigation."""