Merge lp:~3v1n0/unity/panel-menus-flickering-fix into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 4037
Proposed branch: lp:~3v1n0/unity/panel-menus-flickering-fix
Merge into: lp:unity
Diff against target: 97 lines (+23/-8)
4 files modified
lockscreen/LockScreenPanel.cpp (+6/-4)
panel/PanelMenuView.cpp (+7/-1)
panel/PanelMenuView.h (+2/-0)
panel/PanelView.cpp (+8/-3)
To merge this branch: bzr merge lp:~3v1n0/unity/panel-menus-flickering-fix
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+276766@code.launchpad.net

Commit message

PanelMenuView: ignore leave events when triggered by feeding nux manually

WindowManager::Default().UnGrabMousePointer uses ProcessForeignEvent to send
a ButtonRelease event, and this breaks the panel. So we need to ignore this.

Description of the change

PanelMenuView: ignore leave events when triggered by feeding nux manually

WindowManager::Default().UnGrabMousePointer uses ProcessForeignEvent to send
a ButtonRelease event, and this breaks the panel. So we need to ignore this.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lockscreen/LockScreenPanel.cpp'
2--- lockscreen/LockScreenPanel.cpp 2015-02-02 14:37:11 +0000
3+++ lockscreen/LockScreenPanel.cpp 2015-11-05 14:58:42 +0000
4@@ -165,10 +165,12 @@
5 if (!GetInputEventSensitivity())
6 return;
7
8- // This is ugly... But Nux fault!
9- WindowManager::Default().UnGrabMousePointer(CurrentTime, button, x, y);
10-
11- active = true;
12+ if (!active)
13+ {
14+ // This is ugly... But Nux fault!
15+ WindowManager::Default().UnGrabMousePointer(CurrentTime, button, x, y);
16+ active = true;
17+ }
18 }
19
20 void Panel::OnEntryActivateRequest(std::string const& entry_id)
21
22=== modified file 'panel/PanelMenuView.cpp'
23--- panel/PanelMenuView.cpp 2015-09-10 15:37:27 +0000
24+++ panel/PanelMenuView.cpp 2015-11-05 14:58:42 +0000
25@@ -102,6 +102,7 @@
26 , ignore_menu_visibility_(false)
27 , integrated_menus_(menu_manager_->integrated_menus())
28 , always_show_menus_(menu_manager_->always_show_menus())
29+ , ignore_leave_events_(false)
30 , desktop_name_(get_current_desktop())
31 {
32 if (ApplicationWindowPtr const& win = ApplicationManager::Default().GetActiveWindow())
33@@ -1814,9 +1815,14 @@
34 }
35 }
36
37+void PanelMenuView::IgnoreLeaveEvents(bool ignore)
38+{
39+ ignore_leave_events_ = ignore;
40+}
41+
42 void PanelMenuView::OnPanelViewMouseLeave(int x, int y, unsigned long mouse_button_state, unsigned long special_keys_state)
43 {
44- if (always_show_menus_)
45+ if (always_show_menus_ || ignore_leave_events_)
46 return;
47
48 if (is_inside_)
49
50=== modified file 'panel/PanelMenuView.h'
51--- panel/PanelMenuView.h 2015-09-10 15:37:27 +0000
52+++ panel/PanelMenuView.h 2015-11-05 14:58:42 +0000
53@@ -56,6 +56,7 @@
54 bool HasKeyActivableMenus() const;
55
56 void NotifyAllMenusClosed();
57+ void IgnoreLeaveEvents(bool);
58
59 virtual void AddIndicator(indicator::Indicator::Ptr const& indicator);
60
61@@ -191,6 +192,7 @@
62 bool ignore_menu_visibility_;
63 bool integrated_menus_;
64 bool always_show_menus_;
65+ bool ignore_leave_events_;
66
67 nux::Geometry monitor_geo_;
68 const std::string desktop_name_;
69
70=== modified file 'panel/PanelView.cpp'
71--- panel/PanelView.cpp 2015-09-21 09:25:58 +0000
72+++ panel/PanelView.cpp 2015-11-05 14:58:42 +0000
73@@ -682,7 +682,7 @@
74 tracked_pointer_pos_ = mouse;
75
76 double scale = Settings::Instance().em(monitor_)->DPIScale();
77- if (speed > 0 && PointInTriangle(mouse,
78+ if (speed > 0 && PointInTriangle(mouse,
79 nux::Point(triangle_top_corner_.x, std::max(triangle_top_corner_.y - TRIANGLE_THRESHOLD.CP(scale), 0)),
80 nux::Point(menu_geo_.x, menu_geo_.y),
81 nux::Point(menu_geo_.x + menu_geo_.width, menu_geo_.y)))
82@@ -738,8 +738,13 @@
83 void PanelView::OnEntryShowMenu(std::string const& entry_id, unsigned xid,
84 int x, int y, unsigned button)
85 {
86- // This is ugly... But Nux fault!
87- WindowManager::Default().UnGrabMousePointer(CurrentTime, button, x, y);
88+ if (!track_menu_pointer_timeout_)
89+ {
90+ // This is ugly... But Nux fault!
91+ menu_view_->IgnoreLeaveEvents(true);
92+ WindowManager::Default().UnGrabMousePointer(CurrentTime, button, x, y);
93+ menu_view_->IgnoreLeaveEvents(false);
94+ }
95 }
96
97 bool PanelView::ActivateFirstSensitive()