summaryrefslogtreecommitdiff
diff options
authorMarco Trevisan (TreviƱo) <mail@3v1n0.net>2011-12-08 00:51:01 -0500
committerTarmac <>2011-12-08 00:51:01 -0500
commitdad9c80fc9d282d06f007fedcd92f3120bbc0cbb (patch)
tree14af5dbbdb4e95b55620a5c51e962de3ee76913c
parentd227f30af1f683ba1651e873d5838e671b278128 (diff)
parent02f03c9d6a0d2dd24f7bc5f0ab97e32e75534ccc (diff)
Fixing bug #888650 and bug #890970 which caused the global menubar to not correctly react to mouse events when an indicator menu is open.
Since compiz can't get the mouse position when the unity-panel-service grabs the mouse, we need to manually update the mouse position and send it to the menubar to make it correctly draw also when the Nux events aren't emitted. Tests for this code will come as soon as possible (i.e when the autopilot will be completed).. Fixes: https://bugs.launchpad.net/bugs/888650, https://bugs.launchpad.net/bugs/890970. Appoved by Tim Penhey. (bzr r1771)
-rw-r--r--manual-tests/PanelIndicators.txt27
-rw-r--r--plugins/unityshell/src/PanelIndicatorsView.cpp17
-rw-r--r--plugins/unityshell/src/PanelIndicatorsView.h4
-rw-r--r--plugins/unityshell/src/PanelMenuView.cpp21
-rw-r--r--plugins/unityshell/src/PanelMenuView.h2
-rw-r--r--plugins/unityshell/src/PanelView.cpp12
6 files changed, 69 insertions, 14 deletions
diff --git a/manual-tests/PanelIndicators.txt b/manual-tests/PanelIndicators.txt
new file mode 100644
index 000000000..1b3c12f9e
--- /dev/null
+++ b/manual-tests/PanelIndicators.txt
@@ -0,0 +1,27 @@
+Menus and Active Indicators
+---------------------------
+This test shows the interaction between the global menu and open indicators.
+
+#. Start on a clean screen
+#. Open an application that has menus (i.e a gnome-terminal)
+#. Open an indicator Menu (i.e. indicator sound)
+#. Move the mouse pointer on the PanelMenuGrabArea (i.e the area between the
+ indicators and the global menu)
+
+Outcome
+ The menu should appear. This was happening only when going over the menus,
+ not over the empty panel area.
+
+
+Window Buttons and Active Indicators
+------------------------------------
+This test shows the interaction between the window buttons and open indicators.
+
+#. Start on a clean screen
+#. Open an application that has menus (i.e a gnome-terminal)
+#. Maximize it
+#. Open an indicator Menu (i.e. indicator sound)
+#. Move the mouse pointer on the top-left corner of the screen
+
+Outcome
+ Window buttons should appear.
diff --git a/plugins/unityshell/src/PanelIndicatorsView.cpp b/plugins/unityshell/src/PanelIndicatorsView.cpp
index 50a32a086..219b97a85 100644
--- a/plugins/unityshell/src/PanelIndicatorsView.cpp
+++ b/plugins/unityshell/src/PanelIndicatorsView.cpp
@@ -121,19 +121,20 @@ PanelIndicatorsView::QueueDraw()
entry.second->QueueDraw();
}
-bool
+PanelIndicatorEntryView*
PanelIndicatorsView::ActivateEntry(std::string const& entry_id)
{
auto entry = entries_.find(entry_id);
if (entry != entries_.end() && entry->second->IsEntryValid())
{
+ PanelIndicatorEntryView* view = entry->second;
LOG_DEBUG(logger) << "Activating: " << entry_id;
- entry->second->Activate();
- return true;
+ view->Activate();
+ return view;
}
- return false;
+ return nullptr;
}
bool
@@ -163,10 +164,10 @@ PanelIndicatorsView::GetGeometryForSync(indicator::EntryLocationMap& locations)
entry.second->GetGeometryForSync(locations);
}
-bool
-PanelIndicatorsView::OnPointerMoved(int x, int y)
+PanelIndicatorEntryView*
+PanelIndicatorsView::ActivateEntryAt(int x, int y)
{
- PanelIndicatorEntryView* target = NULL;
+ PanelIndicatorEntryView* target = nullptr;
bool found_old_active = false;
//
@@ -207,7 +208,7 @@ PanelIndicatorsView::OnPointerMoved(int x, int y)
}
}
- return (target != NULL);
+ return target;
}
void
diff --git a/plugins/unityshell/src/PanelIndicatorsView.h b/plugins/unityshell/src/PanelIndicatorsView.h
index b55c02670..f2b7baea4 100644
--- a/plugins/unityshell/src/PanelIndicatorsView.h
+++ b/plugins/unityshell/src/PanelIndicatorsView.h
@@ -56,8 +56,8 @@ public:
IndicatorEntryType type = IndicatorEntryType::INDICATOR);
void RemoveEntry(std::string const& entry_id);
- bool OnPointerMoved(int x, int y);
- bool ActivateEntry(std::string const& entry_id);
+ PanelIndicatorEntryView* ActivateEntryAt(int x, int y);
+ PanelIndicatorEntryView* ActivateEntry(std::string const& entry_id);
bool ActivateIfSensitive();
void GetGeometryForSync(indicator::EntryLocationMap& locations);
diff --git a/plugins/unityshell/src/PanelMenuView.cpp b/plugins/unityshell/src/PanelMenuView.cpp
index a89246d58..c1ecd1e06 100644
--- a/plugins/unityshell/src/PanelMenuView.cpp
+++ b/plugins/unityshell/src/PanelMenuView.cpp
@@ -1485,5 +1485,24 @@ PanelMenuView::OnPanelViewMouseLeave(int x, int y, unsigned long mouse_button_st
void PanelMenuView::OnPanelViewMouseMove(int x, int y, int dx, int dy, unsigned long mouse_button_state, unsigned long special_keys_state)
{}
-
+void PanelMenuView::SetMousePosition(int x, int y)
+{
+ if (_last_active_view ||
+ (x >= 0 && y >= 0 && GetAbsoluteGeometry().IsPointInside(x, y)))
+ {
+ if (!_is_inside)
+ {
+ _is_inside = true;
+ FullRedraw();
+ }
+ }
+ else
+ {
+ if (_is_inside)
+ {
+ _is_inside = false;
+ FullRedraw();
+ }
+ }
+}
} // namespace unity
diff --git a/plugins/unityshell/src/PanelMenuView.h b/plugins/unityshell/src/PanelMenuView.h
index 196d685f6..251f472bc 100644
--- a/plugins/unityshell/src/PanelMenuView.h
+++ b/plugins/unityshell/src/PanelMenuView.h
@@ -60,6 +60,8 @@ public:
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual long PostLayoutManagement(long LayoutResult);
+ void SetMousePosition(int x, int y);
+
void OnActiveChanged(PanelIndicatorEntryView* view, bool is_active);
void OnActiveWindowChanged(BamfView* old_view, BamfView* new_view);
void OnNameChanged(gchar* new_name, gchar* old_name);
diff --git a/plugins/unityshell/src/PanelView.cpp b/plugins/unityshell/src/PanelView.cpp
index fa6579ae1..a9fa7823f 100644
--- a/plugins/unityshell/src/PanelView.cpp
+++ b/plugins/unityshell/src/PanelView.cpp
@@ -480,12 +480,18 @@ void PanelView::OnMenuPointerMoved(int x, int y)
if (geo.IsPointInside(x, y))
{
- bool ret = false;
+ PanelIndicatorEntryView* view = nullptr;
if (!_menu_view->HasOurWindowFocused())
- ret = _menu_view->OnPointerMoved(x, y);
+ view = _menu_view->ActivateEntryAt(x, y);
- if (!ret) _indicators->OnPointerMoved(x, y);
+ if (!view) _indicators->ActivateEntryAt(x, y);
+
+ _menu_view->SetMousePosition(x, y);
+ }
+ else
+ {
+ _menu_view->SetMousePosition(-1, -1);
}
}