Merge lp:~3v1n0/unity/input-monitor-menus-scrubbing-triangolation into lp:unity
- input-monitor-menus-scrubbing-triangolation
- Merge into trunk
Proposed by
Marco Trevisan (Treviño)
Status: | Merged |
---|---|
Approved by: | Andrea Azzarone |
Approved revision: | no longer in the source branch. |
Merged at revision: | 4187 |
Proposed branch: | lp:~3v1n0/unity/input-monitor-menus-scrubbing-triangolation |
Merge into: | lp:unity |
Prerequisite: | lp:~3v1n0/unity/input-monitor-lockscreen-panel |
Diff against target: |
1307 lines (+360/-246) 26 files modified
decorations/DecoratedWindow.cpp (+2/-9) decorations/DecorationsMenuLayout.cpp (+14/-10) decorations/DecorationsMenuLayout.h (+2/-1) decorations/DecorationsPriv.h (+0/-1) lockscreen/KylinLockScreenShield.cpp (+1/-1) lockscreen/LockScreenBaseShield.cpp (+0/-2) lockscreen/LockScreenBaseShield.h (+3/-4) lockscreen/LockScreenController.cpp (+3/-3) lockscreen/LockScreenController.h (+1/-2) lockscreen/LockScreenPanel.cpp (+19/-36) lockscreen/LockScreenPanel.h (+4/-5) lockscreen/LockScreenShield.cpp (+7/-6) lockscreen/LockScreenShield.h (+4/-3) lockscreen/LockScreenShieldFactory.cpp (+2/-2) lockscreen/LockScreenShieldFactory.h (+3/-3) panel/PanelIndicatorEntryView.cpp (+10/-0) panel/PanelMenuView.cpp (+1/-7) panel/PanelMenuView.h (+0/-2) panel/PanelView.cpp (+2/-105) panel/PanelView.h (+2/-9) tests/test_lockscreen_controller.cpp (+2/-2) unity-shared/InputMonitor.cpp (+39/-5) unity-shared/InputMonitor.h (+3/-27) unity-shared/MenuManager.cpp (+162/-1) unity-shared/MenuManager.h (+4/-0) unity-shared/SigcSlotHash.h (+70/-0) |
To merge this branch: | bzr merge lp:~3v1n0/unity/input-monitor-menus-scrubbing-triangolation |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrea Azzarone (community) | Approve | ||
Review via email: mp+304353@code.launchpad.net |
This proposal supersedes a proposal from 2016-08-30.
Commit message
MenuManager: add support for mouse trackers with triangle algorithm support
It allows to register pointer trackers with menu entries selection by using the triangle
technique which prevents menus items from being opened on quick menu scrubbing
Then use use menu::Manager pointer tracker for entries activation in PanelView, LockScreenPanel and DecorationsMenu
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'decorations/DecoratedWindow.cpp' | |||
2 | --- decorations/DecoratedWindow.cpp 2016-08-06 16:24:45 +0000 | |||
3 | +++ decorations/DecoratedWindow.cpp 2016-09-01 22:11:45 +0000 | |||
4 | @@ -37,7 +37,6 @@ | |||
5 | 37 | { | 37 | { |
6 | 38 | namespace | 38 | namespace |
7 | 39 | { | 39 | { |
8 | 40 | const std::string MENUS_PANEL_NAME = "WindowLIM"; | ||
9 | 41 | const int SHADOW_BLUR_MARGIN_FACTOR = 2; | 40 | const int SHADOW_BLUR_MARGIN_FACTOR = 2; |
10 | 42 | } | 41 | } |
11 | 43 | 42 | ||
12 | @@ -55,7 +54,6 @@ | |||
13 | 55 | , deco_elements_(cu::DecorationElement::NONE) | 54 | , deco_elements_(cu::DecorationElement::NONE) |
14 | 56 | , last_mwm_decor_(win_->mwmDecor()) | 55 | , last_mwm_decor_(win_->mwmDecor()) |
15 | 57 | , last_actions_(win_->actions()) | 56 | , last_actions_(win_->actions()) |
16 | 58 | , panel_id_(MENUS_PANEL_NAME + std::to_string(win_->id())) | ||
17 | 59 | , cv_(Settings::Instance().em()) | 57 | , cv_(Settings::Instance().em()) |
18 | 60 | { | 58 | { |
19 | 61 | active.changed.connect([this] (bool active) { | 59 | active.changed.connect([this] (bool active) { |
20 | @@ -932,18 +930,13 @@ | |||
21 | 932 | sliding_layout->mouse_owner = grab_edge_->mouse_owner(); | 930 | sliding_layout->mouse_owner = grab_edge_->mouse_owner(); |
22 | 933 | } | 931 | } |
23 | 934 | 932 | ||
24 | 935 | inline std::string const& Window::Impl::GetMenusPanelID() const | ||
25 | 936 | { | ||
26 | 937 | return panel_id_; | ||
27 | 938 | } | ||
28 | 939 | |||
29 | 940 | void Window::Impl::UnsetAppMenu() | 933 | void Window::Impl::UnsetAppMenu() |
30 | 941 | { | 934 | { |
31 | 942 | if (!menus_) | 935 | if (!menus_) |
32 | 943 | return; | 936 | return; |
33 | 944 | 937 | ||
34 | 945 | auto const& indicators = manager_->impl_->menu_manager_->Indicators(); | 938 | auto const& indicators = manager_->impl_->menu_manager_->Indicators(); |
36 | 946 | indicators->SyncGeometries(GetMenusPanelID(), indicator::EntryLocationMap()); | 939 | indicators->SyncGeometries(menus_->MenubarId(), indicator::EntryLocationMap()); |
37 | 947 | sliding_layout_->SetInputItem(nullptr); | 940 | sliding_layout_->SetInputItem(nullptr); |
38 | 948 | grab_mouse_changed_->disconnect(); | 941 | grab_mouse_changed_->disconnect(); |
39 | 949 | } | 942 | } |
40 | @@ -956,7 +949,7 @@ | |||
41 | 956 | auto const& indicators = manager_->impl_->menu_manager_->Indicators(); | 949 | auto const& indicators = manager_->impl_->menu_manager_->Indicators(); |
42 | 957 | indicator::EntryLocationMap map; | 950 | indicator::EntryLocationMap map; |
43 | 958 | menus_->ChildrenGeometries(map); | 951 | menus_->ChildrenGeometries(map); |
45 | 959 | indicators->SyncGeometries(GetMenusPanelID(), map); | 952 | indicators->SyncGeometries(menus_->MenubarId(), map); |
46 | 960 | } | 953 | } |
47 | 961 | 954 | ||
48 | 962 | bool Window::Impl::ActivateMenu(std::string const& entry_id) | 955 | bool Window::Impl::ActivateMenu(std::string const& entry_id) |
49 | 963 | 956 | ||
50 | === modified file 'decorations/DecorationsMenuLayout.cpp' | |||
51 | --- decorations/DecorationsMenuLayout.cpp 2016-09-01 22:11:44 +0000 | |||
52 | +++ decorations/DecorationsMenuLayout.cpp 2016-09-01 22:11:45 +0000 | |||
53 | @@ -20,12 +20,15 @@ | |||
54 | 20 | #include "DecorationsMenuLayout.h" | 20 | #include "DecorationsMenuLayout.h" |
55 | 21 | #include "DecorationsMenuEntry.h" | 21 | #include "DecorationsMenuEntry.h" |
56 | 22 | #include "DecorationsMenuDropdown.h" | 22 | #include "DecorationsMenuDropdown.h" |
57 | 23 | #include "InputMonitor.h" | ||
58 | 24 | 23 | ||
59 | 25 | namespace unity | 24 | namespace unity |
60 | 26 | { | 25 | { |
61 | 27 | namespace decoration | 26 | namespace decoration |
62 | 28 | { | 27 | { |
63 | 28 | namespace | ||
64 | 29 | { | ||
65 | 30 | const std::string MENUS_PANEL_NAME = "WindowLIM"; | ||
66 | 31 | } | ||
67 | 29 | 32 | ||
68 | 30 | using namespace indicator; | 33 | using namespace indicator; |
69 | 31 | 34 | ||
70 | @@ -35,6 +38,7 @@ | |||
71 | 35 | , menu_manager_(menu) | 38 | , menu_manager_(menu) |
72 | 36 | , win_(win) | 39 | , win_(win) |
73 | 37 | , dropdown_(std::make_shared<MenuDropdown>(menu_manager_->Indicators(), win)) | 40 | , dropdown_(std::make_shared<MenuDropdown>(menu_manager_->Indicators(), win)) |
74 | 41 | , menubar_id_(MENUS_PANEL_NAME + std::to_string(win_->id())) | ||
75 | 38 | { | 42 | { |
76 | 39 | visible = false; | 43 | visible = false; |
77 | 40 | } | 44 | } |
78 | @@ -91,6 +95,11 @@ | |||
79 | 91 | Relayout(); | 95 | Relayout(); |
80 | 92 | } | 96 | } |
81 | 93 | 97 | ||
82 | 98 | std::string const& MenuLayout::MenubarId() const | ||
83 | 99 | { | ||
84 | 100 | return menubar_id_; | ||
85 | 101 | } | ||
86 | 102 | |||
87 | 94 | bool MenuLayout::ActivateMenu(std::string const& entry_id) | 103 | bool MenuLayout::ActivateMenu(std::string const& entry_id) |
88 | 95 | { | 104 | { |
89 | 96 | MenuEntry::Ptr target; | 105 | MenuEntry::Ptr target; |
90 | @@ -169,21 +178,16 @@ | |||
91 | 169 | 178 | ||
92 | 170 | if (active && items_.size() > 1) | 179 | if (active && items_.size() > 1) |
93 | 171 | { | 180 | { |
96 | 172 | auto const& event_cb = sigc::mem_fun(this, &MenuLayout::OnEntryInputEvent); | 181 | menu_manager_->RegisterTracker(menubar_id_, (sigc::track_obj([this] (int x, int y, double speed) { |
97 | 173 | input::Monitor::Get().RegisterClient(input::Events::POINTER, event_cb); | 182 | ActivateMenu(CompPoint(x, y)); |
98 | 183 | }, *this))); | ||
99 | 174 | } | 184 | } |
100 | 175 | else if (!active) | 185 | else if (!active) |
101 | 176 | { | 186 | { |
103 | 177 | input::Monitor::Get().UnregisterClient(sigc::mem_fun(this, &MenuLayout::OnEntryInputEvent)); | 187 | menu_manager_->UnregisterTracker(menubar_id_); |
104 | 178 | } | 188 | } |
105 | 179 | } | 189 | } |
106 | 180 | 190 | ||
107 | 181 | void MenuLayout::OnEntryInputEvent(XEvent const& e) | ||
108 | 182 | { | ||
109 | 183 | if (e.type == MotionNotify) | ||
110 | 184 | ActivateMenu(CompPoint(e.xmotion.x_root, e.xmotion.y_root)); | ||
111 | 185 | } | ||
112 | 186 | |||
113 | 187 | void MenuLayout::ChildrenGeometries(EntryLocationMap& map) const | 191 | void MenuLayout::ChildrenGeometries(EntryLocationMap& map) const |
114 | 188 | { | 192 | { |
115 | 189 | for (auto const& item : items_) | 193 | for (auto const& item : items_) |
116 | 190 | 194 | ||
117 | === modified file 'decorations/DecorationsMenuLayout.h' | |||
118 | --- decorations/DecorationsMenuLayout.h 2016-09-01 22:11:44 +0000 | |||
119 | +++ decorations/DecorationsMenuLayout.h 2016-09-01 22:11:45 +0000 | |||
120 | @@ -44,6 +44,7 @@ | |||
121 | 44 | bool ActivateMenu(std::string const& entry_id); | 44 | bool ActivateMenu(std::string const& entry_id); |
122 | 45 | bool ActivateMenu(CompPoint const&); | 45 | bool ActivateMenu(CompPoint const&); |
123 | 46 | void ChildrenGeometries(indicator::EntryLocationMap&) const; | 46 | void ChildrenGeometries(indicator::EntryLocationMap&) const; |
124 | 47 | std::string const& MenubarId() const; | ||
125 | 47 | 48 | ||
126 | 48 | protected: | 49 | protected: |
127 | 49 | void DoRelayout() override; | 50 | void DoRelayout() override; |
128 | @@ -53,12 +54,12 @@ | |||
129 | 53 | void OnEntryMouseOwnershipChanged(bool); | 54 | void OnEntryMouseOwnershipChanged(bool); |
130 | 54 | void OnEntryActiveChanged(bool); | 55 | void OnEntryActiveChanged(bool); |
131 | 55 | void OnEntryShowNowChanged(bool); | 56 | void OnEntryShowNowChanged(bool); |
132 | 56 | void OnEntryInputEvent(XEvent const&); | ||
133 | 57 | 57 | ||
134 | 58 | menu::Manager::Ptr menu_manager_; | 58 | menu::Manager::Ptr menu_manager_; |
135 | 59 | CompWindow* win_; | 59 | CompWindow* win_; |
136 | 60 | glib::Source::UniquePtr show_now_timeout_; | 60 | glib::Source::UniquePtr show_now_timeout_; |
137 | 61 | std::shared_ptr<MenuDropdown> dropdown_; | 61 | std::shared_ptr<MenuDropdown> dropdown_; |
138 | 62 | std::string menubar_id_; | ||
139 | 62 | }; | 63 | }; |
140 | 63 | 64 | ||
141 | 64 | } // decoration namespace | 65 | } // decoration namespace |
142 | 65 | 66 | ||
143 | === modified file 'decorations/DecorationsPriv.h' | |||
144 | --- decorations/DecorationsPriv.h 2016-08-06 16:24:45 +0000 | |||
145 | +++ decorations/DecorationsPriv.h 2016-09-01 22:11:45 +0000 | |||
146 | @@ -162,7 +162,6 @@ | |||
147 | 162 | connection::Wrapper dpi_changed_; | 162 | connection::Wrapper dpi_changed_; |
148 | 163 | connection::Wrapper grab_mouse_changed_; | 163 | connection::Wrapper grab_mouse_changed_; |
149 | 164 | std::string last_title_; | 164 | std::string last_title_; |
150 | 165 | std::string panel_id_; | ||
151 | 166 | std::vector<cu::SimpleTextureQuad> bg_textures_; | 165 | std::vector<cu::SimpleTextureQuad> bg_textures_; |
152 | 167 | cu::PixmapTexture::Ptr shaped_shadow_pixmap_; | 166 | cu::PixmapTexture::Ptr shaped_shadow_pixmap_; |
153 | 168 | std::shared_ptr<ForceQuitDialog> force_quit_; | 167 | std::shared_ptr<ForceQuitDialog> force_quit_; |
154 | 169 | 168 | ||
155 | === modified file 'lockscreen/KylinLockScreenShield.cpp' | |||
156 | --- lockscreen/KylinLockScreenShield.cpp 2015-12-07 03:09:28 +0000 | |||
157 | +++ lockscreen/KylinLockScreenShield.cpp 2016-09-01 22:11:45 +0000 | |||
158 | @@ -37,7 +37,7 @@ | |||
159 | 37 | Accelerators::Ptr const& accelerators, | 37 | Accelerators::Ptr const& accelerators, |
160 | 38 | nux::ObjectPtr<AbstractUserPromptView> const& prompt_view, | 38 | nux::ObjectPtr<AbstractUserPromptView> const& prompt_view, |
161 | 39 | int monitor_num, bool is_primary) | 39 | int monitor_num, bool is_primary) |
163 | 40 | : BaseShield(session_manager, nullptr, accelerators, prompt_view, monitor_num, is_primary) | 40 | : BaseShield(session_manager, accelerators, prompt_view, monitor_num, is_primary) |
164 | 41 | { | 41 | { |
165 | 42 | is_primary ? ShowPrimaryView() : ShowSecondaryView(); | 42 | is_primary ? ShowPrimaryView() : ShowSecondaryView(); |
166 | 43 | EnableInputWindow(true); | 43 | EnableInputWindow(true); |
167 | 44 | 44 | ||
168 | === modified file 'lockscreen/LockScreenBaseShield.cpp' | |||
169 | --- lockscreen/LockScreenBaseShield.cpp 2015-12-03 14:13:10 +0000 | |||
170 | +++ lockscreen/LockScreenBaseShield.cpp 2016-09-01 22:11:45 +0000 | |||
171 | @@ -38,7 +38,6 @@ | |||
172 | 38 | } | 38 | } |
173 | 39 | 39 | ||
174 | 40 | BaseShield::BaseShield(session::Manager::Ptr const& session, | 40 | BaseShield::BaseShield(session::Manager::Ptr const& session, |
175 | 41 | indicator::Indicators::Ptr const& indicators, | ||
176 | 42 | Accelerators::Ptr const& accelerators, | 41 | Accelerators::Ptr const& accelerators, |
177 | 43 | nux::ObjectPtr<AbstractUserPromptView> const& prompt_view, | 42 | nux::ObjectPtr<AbstractUserPromptView> const& prompt_view, |
178 | 44 | int monitor_num, bool is_primary) | 43 | int monitor_num, bool is_primary) |
179 | @@ -47,7 +46,6 @@ | |||
180 | 47 | , monitor(monitor_num) | 46 | , monitor(monitor_num) |
181 | 48 | , scale(1.0) | 47 | , scale(1.0) |
182 | 49 | , session_manager_(session) | 48 | , session_manager_(session) |
183 | 50 | , indicators_(indicators) | ||
184 | 51 | , accelerators_(accelerators) | 49 | , accelerators_(accelerators) |
185 | 52 | , prompt_view_(prompt_view) | 50 | , prompt_view_(prompt_view) |
186 | 53 | , bg_settings_(std::make_shared<BackgroundSettings>()) | 51 | , bg_settings_(std::make_shared<BackgroundSettings>()) |
187 | 54 | 52 | ||
188 | === modified file 'lockscreen/LockScreenBaseShield.h' | |||
189 | --- lockscreen/LockScreenBaseShield.h 2016-03-31 09:51:33 +0000 | |||
190 | +++ lockscreen/LockScreenBaseShield.h 2016-09-01 22:11:45 +0000 | |||
191 | @@ -21,8 +21,8 @@ | |||
192 | 21 | #define UNITY_LOCKSCREEN_BASE_SHIELD_H | 21 | #define UNITY_LOCKSCREEN_BASE_SHIELD_H |
193 | 22 | 22 | ||
194 | 23 | #include <NuxCore/Property.h> | 23 | #include <NuxCore/Property.h> |
195 | 24 | #include "UnityCore/ConnectionManager.h" | ||
196 | 24 | #include "UnityCore/SessionManager.h" | 25 | #include "UnityCore/SessionManager.h" |
197 | 25 | #include "UnityCore/Indicators.h" | ||
198 | 26 | #include "UnityCore/GLibSource.h" | 26 | #include "UnityCore/GLibSource.h" |
199 | 27 | #include "unity-shared/MockableBaseWindow.h" | 27 | #include "unity-shared/MockableBaseWindow.h" |
200 | 28 | 28 | ||
201 | @@ -39,8 +39,8 @@ | |||
202 | 39 | class BaseShield : public MockableBaseWindow | 39 | class BaseShield : public MockableBaseWindow |
203 | 40 | { | 40 | { |
204 | 41 | public: | 41 | public: |
207 | 42 | BaseShield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&, | 42 | BaseShield(session::Manager::Ptr const&, Accelerators::Ptr const&, |
208 | 43 | Accelerators::Ptr const&, nux::ObjectPtr<AbstractUserPromptView> const&, | 43 | nux::ObjectPtr<AbstractUserPromptView> const&, |
209 | 44 | int monitor_num, bool is_primary); | 44 | int monitor_num, bool is_primary); |
210 | 45 | 45 | ||
211 | 46 | nux::Property<bool> primary; | 46 | nux::Property<bool> primary; |
212 | @@ -69,7 +69,6 @@ | |||
213 | 69 | void UpdateScale(); | 69 | void UpdateScale(); |
214 | 70 | 70 | ||
215 | 71 | session::Manager::Ptr session_manager_; | 71 | session::Manager::Ptr session_manager_; |
216 | 72 | indicator::Indicators::Ptr indicators_; | ||
217 | 73 | Accelerators::Ptr accelerators_; | 72 | Accelerators::Ptr accelerators_; |
218 | 74 | nux::ObjectPtr<AbstractUserPromptView> prompt_view_; | 73 | nux::ObjectPtr<AbstractUserPromptView> prompt_view_; |
219 | 75 | std::shared_ptr<BackgroundSettings> bg_settings_; | 74 | std::shared_ptr<BackgroundSettings> bg_settings_; |
220 | 76 | 75 | ||
221 | === modified file 'lockscreen/LockScreenController.cpp' | |||
222 | --- lockscreen/LockScreenController.cpp 2016-07-04 12:45:06 +0000 | |||
223 | +++ lockscreen/LockScreenController.cpp 2016-09-01 22:11:45 +0000 | |||
224 | @@ -130,7 +130,7 @@ | |||
225 | 130 | 130 | ||
226 | 131 | upstart_wrapper_->Emit("desktop-unlock"); | 131 | upstart_wrapper_->Emit("desktop-unlock"); |
227 | 132 | accelerator_controller_.reset(); | 132 | accelerator_controller_.reset(); |
229 | 133 | indicators_.reset(); | 133 | menu_manager_.reset(); |
230 | 134 | } | 134 | } |
231 | 135 | else if (!prompt_activation_) | 135 | else if (!prompt_activation_) |
232 | 136 | { | 136 | { |
233 | @@ -252,7 +252,7 @@ | |||
234 | 252 | 252 | ||
235 | 253 | if (i >= shields_size) | 253 | if (i >= shields_size) |
236 | 254 | { | 254 | { |
238 | 255 | shield = shield_factory_->CreateShield(session_manager_, indicators_, accelerator_controller_->GetAccelerators(), prompt_view, i, i == primary); | 255 | shield = shield_factory_->CreateShield(session_manager_, menu_manager_, accelerator_controller_->GetAccelerators(), prompt_view, i, i == primary); |
239 | 256 | is_new = true; | 256 | is_new = true; |
240 | 257 | } | 257 | } |
241 | 258 | 258 | ||
242 | @@ -462,7 +462,7 @@ | |||
243 | 462 | 462 | ||
244 | 463 | void Controller::LockScreen() | 463 | void Controller::LockScreen() |
245 | 464 | { | 464 | { |
247 | 465 | indicators_ = std::make_shared<indicator::LockScreenDBusIndicators>(); | 465 | menu_manager_ = std::make_shared<menu::Manager>(std::make_shared<indicator::LockScreenDBusIndicators>(), key_grabber_); |
248 | 466 | upstart_wrapper_->Emit("desktop-lock"); | 466 | upstart_wrapper_->Emit("desktop-lock"); |
249 | 467 | 467 | ||
250 | 468 | accelerator_controller_ = std::make_shared<AcceleratorController>(key_grabber_); | 468 | accelerator_controller_ = std::make_shared<AcceleratorController>(key_grabber_); |
251 | 469 | 469 | ||
252 | === modified file 'lockscreen/LockScreenController.h' | |||
253 | --- lockscreen/LockScreenController.h 2016-06-21 01:28:26 +0000 | |||
254 | +++ lockscreen/LockScreenController.h 2016-09-01 22:11:45 +0000 | |||
255 | @@ -30,7 +30,6 @@ | |||
256 | 30 | #include "SuspendInhibitorManager.h" | 30 | #include "SuspendInhibitorManager.h" |
257 | 31 | #include "ScreenSaverDBusManager.h" | 31 | #include "ScreenSaverDBusManager.h" |
258 | 32 | #include "unity-shared/BackgroundEffectHelper.h" | 32 | #include "unity-shared/BackgroundEffectHelper.h" |
259 | 33 | #include "unity-shared/KeyGrabber.h" | ||
260 | 34 | #include "unity-shared/UpstartWrapper.h" | 33 | #include "unity-shared/UpstartWrapper.h" |
261 | 35 | 34 | ||
262 | 36 | namespace unity | 35 | namespace unity |
263 | @@ -85,8 +84,8 @@ | |||
264 | 85 | 84 | ||
265 | 86 | DBusManager::Ptr dbus_manager_; | 85 | DBusManager::Ptr dbus_manager_; |
266 | 87 | session::Manager::Ptr session_manager_; | 86 | session::Manager::Ptr session_manager_; |
267 | 87 | menu::Manager::Ptr menu_manager_; | ||
268 | 88 | key::Grabber::Ptr key_grabber_; | 88 | key::Grabber::Ptr key_grabber_; |
269 | 89 | indicator::Indicators::Ptr indicators_; | ||
270 | 90 | AcceleratorController::Ptr accelerator_controller_; | 89 | AcceleratorController::Ptr accelerator_controller_; |
271 | 91 | UpstartWrapper::Ptr upstart_wrapper_; | 90 | UpstartWrapper::Ptr upstart_wrapper_; |
272 | 92 | ShieldFactoryInterface::Ptr shield_factory_; | 91 | ShieldFactoryInterface::Ptr shield_factory_; |
273 | 93 | 92 | ||
274 | === modified file 'lockscreen/LockScreenPanel.cpp' | |||
275 | --- lockscreen/LockScreenPanel.cpp 2016-09-01 22:11:44 +0000 | |||
276 | +++ lockscreen/LockScreenPanel.cpp 2016-09-01 22:11:45 +0000 | |||
277 | @@ -44,11 +44,11 @@ | |||
278 | 44 | using namespace indicator; | 44 | using namespace indicator; |
279 | 45 | using namespace panel; | 45 | using namespace panel; |
280 | 46 | 46 | ||
282 | 47 | Panel::Panel(int monitor_, Indicators::Ptr const& indicators, session::Manager::Ptr const& session_manager) | 47 | Panel::Panel(int monitor_, menu::Manager::Ptr const& menu_manager, session::Manager::Ptr const& session_manager) |
283 | 48 | : nux::View(NUX_TRACKER_LOCATION) | 48 | : nux::View(NUX_TRACKER_LOCATION) |
284 | 49 | , active(false) | 49 | , active(false) |
285 | 50 | , monitor(monitor_) | 50 | , monitor(monitor_) |
287 | 51 | , indicators_(indicators) | 51 | , menu_manager_(menu_manager) |
288 | 52 | , needs_geo_sync_(true) | 52 | , needs_geo_sync_(true) |
289 | 53 | { | 53 | { |
290 | 54 | double scale = unity::Settings::Instance().em(monitor)->DPIScale(); | 54 | double scale = unity::Settings::Instance().em(monitor)->DPIScale(); |
291 | @@ -72,14 +72,19 @@ | |||
292 | 72 | indicators_view_->on_indicator_updated.connect(sigc::mem_fun(this, &Panel::OnIndicatorViewUpdated)); | 72 | indicators_view_->on_indicator_updated.connect(sigc::mem_fun(this, &Panel::OnIndicatorViewUpdated)); |
293 | 73 | layout->AddView(indicators_view_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | 73 | layout->AddView(indicators_view_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
294 | 74 | 74 | ||
296 | 75 | for (auto const& indicator : indicators_->GetIndicators()) | 75 | auto indicators = menu_manager_->Indicators(); |
297 | 76 | menu_manager_->RegisterTracker(GetPanelName(), (sigc::track_obj([this] (int x, int y, double speed) { | ||
298 | 77 | indicators_view_->ActivateEntryAt(x, y); | ||
299 | 78 | }, *this))); | ||
300 | 79 | |||
301 | 80 | for (auto const& indicator : indicators->GetIndicators()) | ||
302 | 76 | AddIndicator(indicator); | 81 | AddIndicator(indicator); |
303 | 77 | 82 | ||
309 | 78 | indicators_->on_object_added.connect(sigc::mem_fun(this, &Panel::AddIndicator)); | 83 | indicators->on_object_added.connect(sigc::mem_fun(this, &Panel::AddIndicator)); |
310 | 79 | indicators_->on_object_removed.connect(sigc::mem_fun(this, &Panel::RemoveIndicator)); | 84 | indicators->on_object_removed.connect(sigc::mem_fun(this, &Panel::RemoveIndicator)); |
311 | 80 | indicators_->on_entry_show_menu.connect(sigc::mem_fun(this, &Panel::OnEntryShowMenu)); | 85 | indicators->on_entry_show_menu.connect(sigc::mem_fun(this, &Panel::OnEntryShowMenu)); |
312 | 81 | indicators_->on_entry_activated.connect(sigc::mem_fun(this, &Panel::OnEntryActivated)); | 86 | indicators->on_entry_activated.connect(sigc::mem_fun(this, &Panel::OnEntryActivated)); |
313 | 82 | indicators_->on_entry_activate_request.connect(sigc::mem_fun(this, &Panel::OnEntryActivateRequest)); | 87 | indicators->on_entry_activate_request.connect(sigc::mem_fun(this, &Panel::OnEntryActivateRequest)); |
314 | 83 | 88 | ||
315 | 84 | monitor.changed.connect([this, hostname] (int monitor) { | 89 | monitor.changed.connect([this, hostname] (int monitor) { |
316 | 85 | double scale = unity::Settings::Instance().em(monitor)->DPIScale(); | 90 | double scale = unity::Settings::Instance().em(monitor)->DPIScale(); |
317 | @@ -159,12 +164,7 @@ | |||
318 | 159 | if (!GetInputEventSensitivity()) | 164 | if (!GetInputEventSensitivity()) |
319 | 160 | return; | 165 | return; |
320 | 161 | 166 | ||
327 | 162 | if (!active) | 167 | active = true; |
322 | 163 | { | ||
323 | 164 | // This is ugly... But Nux fault! | ||
324 | 165 | WindowManager::Default().UnGrabMousePointer(CurrentTime, button, x, y); | ||
325 | 166 | active = true; | ||
326 | 167 | } | ||
328 | 168 | } | 168 | } |
329 | 169 | 169 | ||
330 | 170 | void Panel::OnEntryActivateRequest(std::string const& entry_id) | 170 | void Panel::OnEntryActivateRequest(std::string const& entry_id) |
331 | @@ -178,33 +178,16 @@ | |||
332 | 178 | if (!GetInputEventSensitivity() || (!panel.empty() && panel != GetPanelName())) | 178 | if (!GetInputEventSensitivity() || (!panel.empty() && panel != GetPanelName())) |
333 | 179 | return; | 179 | return; |
334 | 180 | 180 | ||
336 | 181 | bool active = !entry_id.empty(); | 181 | bool valid_entry = !entry_id.empty(); |
337 | 182 | 182 | ||
339 | 183 | if (active && !WindowManager::Default().IsScreenGrabbed()) | 183 | if (valid_entry && !WindowManager::Default().IsScreenGrabbed()) |
340 | 184 | { | 184 | { |
341 | 185 | // The menu didn't grab the keyboard, let's take it back. | 185 | // The menu didn't grab the keyboard, let's take it back. |
342 | 186 | nux::GetWindowCompositor().GrabKeyboardAdd(static_cast<nux::BaseWindow*>(GetTopLevelViewWindow())); | 186 | nux::GetWindowCompositor().GrabKeyboardAdd(static_cast<nux::BaseWindow*>(GetTopLevelViewWindow())); |
343 | 187 | } | 187 | } |
344 | 188 | 188 | ||
364 | 189 | auto& im = input::Monitor::Get(); | 189 | if (!valid_entry) |
365 | 190 | auto const& event_cb = sigc::mem_fun(this, &Panel::OnEntryEvent); | 190 | active = valid_entry; |
347 | 191 | |||
348 | 192 | if (active) | ||
349 | 193 | { | ||
350 | 194 | if (im.RegisterClient(input::Events::POINTER, event_cb)) | ||
351 | 195 | indicators_view_->ActivateEntry(entry_id); | ||
352 | 196 | } | ||
353 | 197 | else | ||
354 | 198 | { | ||
355 | 199 | im.UnregisterClient(event_cb); | ||
356 | 200 | this->active = active; | ||
357 | 201 | } | ||
358 | 202 | } | ||
359 | 203 | |||
360 | 204 | void Panel::OnEntryEvent(XEvent const& e) | ||
361 | 205 | { | ||
362 | 206 | if (e.type == MotionNotify && GetAbsoluteGeometry().IsPointInside(e.xmotion.x, e.xmotion.y)) | ||
363 | 207 | indicators_view_->ActivateEntryAt(e.xmotion.x, e.xmotion.y); | ||
366 | 208 | } | 191 | } |
367 | 209 | 192 | ||
368 | 210 | void Panel::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) | 193 | void Panel::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) |
369 | @@ -228,7 +211,7 @@ | |||
370 | 228 | { | 211 | { |
371 | 229 | EntryLocationMap locations; | 212 | EntryLocationMap locations; |
372 | 230 | indicators_view_->GetGeometryForSync(locations); | 213 | indicators_view_->GetGeometryForSync(locations); |
374 | 231 | indicators_->SyncGeometries(GetPanelName(), locations); | 214 | menu_manager_->Indicators()->SyncGeometries(GetPanelName(), locations); |
375 | 232 | needs_geo_sync_ = false; | 215 | needs_geo_sync_ = false; |
376 | 233 | } | 216 | } |
377 | 234 | } | 217 | } |
378 | 235 | 218 | ||
379 | === modified file 'lockscreen/LockScreenPanel.h' | |||
380 | --- lockscreen/LockScreenPanel.h 2016-09-01 22:11:44 +0000 | |||
381 | +++ lockscreen/LockScreenPanel.h 2016-09-01 22:11:45 +0000 | |||
382 | @@ -22,9 +22,9 @@ | |||
383 | 22 | 22 | ||
384 | 23 | #include <Nux/Nux.h> | 23 | #include <Nux/Nux.h> |
385 | 24 | #include <Nux/View.h> | 24 | #include <Nux/View.h> |
386 | 25 | #include "UnityCore/Indicators.h" | ||
387 | 26 | #include "UnityCore/GLibSource.h" | 25 | #include "UnityCore/GLibSource.h" |
388 | 27 | #include "UnityCore/SessionManager.h" | 26 | #include "UnityCore/SessionManager.h" |
389 | 27 | #include "unity-shared/MenuManager.h" | ||
390 | 28 | 28 | ||
391 | 29 | namespace unity | 29 | namespace unity |
392 | 30 | { | 30 | { |
393 | @@ -39,7 +39,7 @@ | |||
394 | 39 | class Panel : public nux::View | 39 | class Panel : public nux::View |
395 | 40 | { | 40 | { |
396 | 41 | public: | 41 | public: |
398 | 42 | Panel(int monitor, indicator::Indicators::Ptr const&, session::Manager::Ptr const&); | 42 | Panel(int monitor, menu::Manager::Ptr const&, session::Manager::Ptr const&); |
399 | 43 | 43 | ||
400 | 44 | nux::Property<bool> active; | 44 | nux::Property<bool> active; |
401 | 45 | nux::Property<int> monitor; | 45 | nux::Property<int> monitor; |
402 | @@ -55,15 +55,14 @@ | |||
403 | 55 | void AddIndicator(indicator::Indicator::Ptr const&); | 55 | void AddIndicator(indicator::Indicator::Ptr const&); |
404 | 56 | void RemoveIndicator(indicator::Indicator::Ptr const&); | 56 | void RemoveIndicator(indicator::Indicator::Ptr const&); |
405 | 57 | void OnIndicatorViewUpdated(); | 57 | void OnIndicatorViewUpdated(); |
407 | 58 | void OnEntryActivated(std::string const& panel, std::string const& entry_id, nux::Rect const& geo); | 58 | void OnEntryActivated(std::string const& panel, std::string const& entry_id, nux::Rect const&); |
408 | 59 | void OnEntryShowMenu(std::string const& entry_id, unsigned xid, int x, int y, unsigned button); | 59 | void OnEntryShowMenu(std::string const& entry_id, unsigned xid, int x, int y, unsigned button); |
409 | 60 | void OnEntryActivateRequest(std::string const& entry_id); | 60 | void OnEntryActivateRequest(std::string const& entry_id); |
410 | 61 | void OnEntryEvent(XEvent const&); | ||
411 | 62 | 61 | ||
412 | 63 | void UpdateSize(); | 62 | void UpdateSize(); |
413 | 64 | std::string GetPanelName() const; | 63 | std::string GetPanelName() const; |
414 | 65 | 64 | ||
416 | 66 | indicator::Indicators::Ptr indicators_; | 65 | menu::Manager::Ptr menu_manager_; |
417 | 67 | panel::PanelIndicatorsView* indicators_view_; | 66 | panel::PanelIndicatorsView* indicators_view_; |
418 | 68 | bool needs_geo_sync_; | 67 | bool needs_geo_sync_; |
419 | 69 | }; | 68 | }; |
420 | 70 | 69 | ||
421 | === modified file 'lockscreen/LockScreenShield.cpp' | |||
422 | --- lockscreen/LockScreenShield.cpp 2015-12-03 14:13:10 +0000 | |||
423 | +++ lockscreen/LockScreenShield.cpp 2016-09-01 22:11:45 +0000 | |||
424 | @@ -32,11 +32,12 @@ | |||
425 | 32 | { | 32 | { |
426 | 33 | 33 | ||
427 | 34 | Shield::Shield(session::Manager::Ptr const& session_manager, | 34 | Shield::Shield(session::Manager::Ptr const& session_manager, |
429 | 35 | indicator::Indicators::Ptr const& indicators, | 35 | menu::Manager::Ptr const& menu_manager, |
430 | 36 | Accelerators::Ptr const& accelerators, | 36 | Accelerators::Ptr const& accelerators, |
431 | 37 | nux::ObjectPtr<AbstractUserPromptView> const& prompt_view, | 37 | nux::ObjectPtr<AbstractUserPromptView> const& prompt_view, |
432 | 38 | int monitor_num, bool is_primary) | 38 | int monitor_num, bool is_primary) |
434 | 39 | : BaseShield(session_manager, indicators, accelerators, prompt_view, monitor_num, is_primary) | 39 | : BaseShield(session_manager, accelerators, prompt_view, monitor_num, is_primary) |
435 | 40 | , menu_manager_(menu_manager) | ||
436 | 40 | , panel_view_(nullptr) | 41 | , panel_view_(nullptr) |
437 | 41 | { | 42 | { |
438 | 42 | is_primary ? ShowPrimaryView() : ShowSecondaryView(); | 43 | is_primary ? ShowPrimaryView() : ShowSecondaryView(); |
439 | @@ -91,11 +92,11 @@ | |||
440 | 91 | 92 | ||
441 | 92 | Panel* Shield::CreatePanel() | 93 | Panel* Shield::CreatePanel() |
442 | 93 | { | 94 | { |
444 | 94 | if (!indicators_ || !session_manager_) | 95 | if (!menu_manager_ || !session_manager_) |
445 | 95 | return nullptr; | 96 | return nullptr; |
446 | 96 | 97 | ||
449 | 97 | panel_view_ = new Panel(monitor, indicators_, session_manager_); | 98 | panel_view_ = new Panel(monitor, menu_manager_, session_manager_); |
450 | 98 | panel_active_conn_ = panel_view_->active.changed.connect([this] (bool active) { | 99 | panel_view_->active.changed.connect(sigc::track_obj([this] (bool active) { |
451 | 99 | if (primary()) | 100 | if (primary()) |
452 | 100 | { | 101 | { |
453 | 101 | if (active) | 102 | if (active) |
454 | @@ -109,7 +110,7 @@ | |||
455 | 109 | GrabScreen(false); | 110 | GrabScreen(false); |
456 | 110 | } | 111 | } |
457 | 111 | } | 112 | } |
459 | 112 | }); | 113 | }, *this)); |
460 | 113 | 114 | ||
461 | 114 | return panel_view_; | 115 | return panel_view_; |
462 | 115 | } | 116 | } |
463 | 116 | 117 | ||
464 | === modified file 'lockscreen/LockScreenShield.h' | |||
465 | --- lockscreen/LockScreenShield.h 2015-12-03 14:13:10 +0000 | |||
466 | +++ lockscreen/LockScreenShield.h 2016-09-01 22:11:45 +0000 | |||
467 | @@ -20,8 +20,9 @@ | |||
468 | 20 | #ifndef UNITY_LOCKSCREEN_SHIELD_H | 20 | #ifndef UNITY_LOCKSCREEN_SHIELD_H |
469 | 21 | #define UNITY_LOCKSCREEN_SHIELD_H | 21 | #define UNITY_LOCKSCREEN_SHIELD_H |
470 | 22 | 22 | ||
471 | 23 | #include <UnityCore/ConnectionManager.h> | ||
472 | 24 | #include "LockScreenBaseShield.h" | 23 | #include "LockScreenBaseShield.h" |
473 | 24 | #include "unity-shared/MenuManager.h" | ||
474 | 25 | |||
475 | 25 | 26 | ||
476 | 26 | namespace unity | 27 | namespace unity |
477 | 27 | { | 28 | { |
478 | @@ -35,7 +36,7 @@ | |||
479 | 35 | { | 36 | { |
480 | 36 | public: | 37 | public: |
481 | 37 | Shield(session::Manager::Ptr const&, | 38 | Shield(session::Manager::Ptr const&, |
483 | 38 | indicator::Indicators::Ptr const&, | 39 | menu::Manager::Ptr const&, |
484 | 39 | Accelerators::Ptr const&, | 40 | Accelerators::Ptr const&, |
485 | 40 | nux::ObjectPtr<AbstractUserPromptView> const&, | 41 | nux::ObjectPtr<AbstractUserPromptView> const&, |
486 | 41 | int monitor, bool is_primary); | 42 | int monitor, bool is_primary); |
487 | @@ -50,7 +51,7 @@ | |||
488 | 50 | void ShowPrimaryView() override; | 51 | void ShowPrimaryView() override; |
489 | 51 | Panel* CreatePanel(); | 52 | Panel* CreatePanel(); |
490 | 52 | 53 | ||
492 | 53 | connection::Wrapper panel_active_conn_; | 54 | menu::Manager::Ptr menu_manager_; |
493 | 54 | Panel* panel_view_; | 55 | Panel* panel_view_; |
494 | 55 | }; | 56 | }; |
495 | 56 | 57 | ||
496 | 57 | 58 | ||
497 | === modified file 'lockscreen/LockScreenShieldFactory.cpp' | |||
498 | --- lockscreen/LockScreenShieldFactory.cpp 2015-12-04 08:17:46 +0000 | |||
499 | +++ lockscreen/LockScreenShieldFactory.cpp 2016-09-01 22:11:45 +0000 | |||
500 | @@ -28,7 +28,7 @@ | |||
501 | 28 | { | 28 | { |
502 | 29 | 29 | ||
503 | 30 | nux::ObjectPtr<BaseShield> ShieldFactory::CreateShield(session::Manager::Ptr const& session_manager, | 30 | nux::ObjectPtr<BaseShield> ShieldFactory::CreateShield(session::Manager::Ptr const& session_manager, |
505 | 31 | indicator::Indicators::Ptr const& indicators, | 31 | menu::Manager::Ptr const& menu_manager, |
506 | 32 | Accelerators::Ptr const& accelerators, | 32 | Accelerators::Ptr const& accelerators, |
507 | 33 | nux::ObjectPtr<AbstractUserPromptView> const& prompt_view, | 33 | nux::ObjectPtr<AbstractUserPromptView> const& prompt_view, |
508 | 34 | int monitor, bool is_primary) | 34 | int monitor, bool is_primary) |
509 | @@ -38,7 +38,7 @@ | |||
510 | 38 | if (Settings::Instance().desktop_type() == DesktopType::UBUNTUKYLIN) | 38 | if (Settings::Instance().desktop_type() == DesktopType::UBUNTUKYLIN) |
511 | 39 | shield = new KylinShield(session_manager, accelerators, prompt_view, monitor, is_primary); | 39 | shield = new KylinShield(session_manager, accelerators, prompt_view, monitor, is_primary); |
512 | 40 | else | 40 | else |
514 | 41 | shield = new Shield(session_manager, indicators, accelerators, prompt_view, monitor, is_primary); | 41 | shield = new Shield(session_manager, menu_manager, accelerators, prompt_view, monitor, is_primary); |
515 | 42 | 42 | ||
516 | 43 | return shield; | 43 | return shield; |
517 | 44 | } | 44 | } |
518 | 45 | 45 | ||
519 | === modified file 'lockscreen/LockScreenShieldFactory.h' | |||
520 | --- lockscreen/LockScreenShieldFactory.h 2016-03-31 09:51:33 +0000 | |||
521 | +++ lockscreen/LockScreenShieldFactory.h 2016-09-01 22:11:45 +0000 | |||
522 | @@ -22,7 +22,7 @@ | |||
523 | 22 | 22 | ||
524 | 23 | #include <NuxCore/NuxCore.h> | 23 | #include <NuxCore/NuxCore.h> |
525 | 24 | #include "UnityCore/SessionManager.h" | 24 | #include "UnityCore/SessionManager.h" |
527 | 25 | #include "UnityCore/Indicators.h" | 25 | #include "unity-shared/MenuManager.h" |
528 | 26 | #include "LockScreenAccelerators.h" | 26 | #include "LockScreenAccelerators.h" |
529 | 27 | 27 | ||
530 | 28 | namespace unity | 28 | namespace unity |
531 | @@ -41,7 +41,7 @@ | |||
532 | 41 | virtual ~ShieldFactoryInterface() = default; | 41 | virtual ~ShieldFactoryInterface() = default; |
533 | 42 | 42 | ||
534 | 43 | virtual nux::ObjectPtr<BaseShield> CreateShield(session::Manager::Ptr const&, | 43 | virtual nux::ObjectPtr<BaseShield> CreateShield(session::Manager::Ptr const&, |
536 | 44 | indicator::Indicators::Ptr const&, | 44 | menu::Manager::Ptr const&, |
537 | 45 | Accelerators::Ptr const&, | 45 | Accelerators::Ptr const&, |
538 | 46 | nux::ObjectPtr<AbstractUserPromptView> const&, | 46 | nux::ObjectPtr<AbstractUserPromptView> const&, |
539 | 47 | int monitor, bool is_primary) = 0; | 47 | int monitor, bool is_primary) = 0; |
540 | @@ -50,7 +50,7 @@ | |||
541 | 50 | struct ShieldFactory : ShieldFactoryInterface | 50 | struct ShieldFactory : ShieldFactoryInterface |
542 | 51 | { | 51 | { |
543 | 52 | nux::ObjectPtr<BaseShield> CreateShield(session::Manager::Ptr const&, | 52 | nux::ObjectPtr<BaseShield> CreateShield(session::Manager::Ptr const&, |
545 | 53 | indicator::Indicators::Ptr const&, | 53 | menu::Manager::Ptr const&, |
546 | 54 | Accelerators::Ptr const&, | 54 | Accelerators::Ptr const&, |
547 | 55 | nux::ObjectPtr<AbstractUserPromptView> const&, | 55 | nux::ObjectPtr<AbstractUserPromptView> const&, |
548 | 56 | int monitor, bool is_primary) override; | 56 | int monitor, bool is_primary) override; |
549 | 57 | 57 | ||
550 | === modified file 'panel/PanelIndicatorEntryView.cpp' | |||
551 | --- panel/PanelIndicatorEntryView.cpp 2016-02-17 13:14:37 +0000 | |||
552 | +++ panel/PanelIndicatorEntryView.cpp 2016-09-01 22:11:45 +0000 | |||
553 | @@ -33,6 +33,8 @@ | |||
554 | 33 | #include "unity-shared/RawPixel.h" | 33 | #include "unity-shared/RawPixel.h" |
555 | 34 | #include "unity-shared/WindowManager.h" | 34 | #include "unity-shared/WindowManager.h" |
556 | 35 | #include "unity-shared/ThemeSettings.h" | 35 | #include "unity-shared/ThemeSettings.h" |
557 | 36 | #include "unity-shared/UBusWrapper.h" | ||
558 | 37 | #include "unity-shared/UBusMessages.h" | ||
559 | 36 | #include "unity-shared/UnitySettings.h" | 38 | #include "unity-shared/UnitySettings.h" |
560 | 37 | 39 | ||
561 | 38 | namespace unity | 40 | namespace unity |
562 | @@ -117,6 +119,9 @@ | |||
563 | 117 | } | 119 | } |
564 | 118 | else | 120 | else |
565 | 119 | { | 121 | { |
566 | 122 | if (overlay_showing_) | ||
567 | 123 | UBusManager::SendMessage(UBUS_OVERLAY_CLOSE_REQUEST); | ||
568 | 124 | |||
569 | 120 | WindowManager& wm = WindowManager::Default(); | 125 | WindowManager& wm = WindowManager::Default(); |
570 | 121 | 126 | ||
571 | 122 | if (wm.IsExpoActive()) | 127 | if (wm.IsExpoActive()) |
572 | @@ -140,6 +145,11 @@ | |||
573 | 140 | wm.TerminateScale(); | 145 | wm.TerminateScale(); |
574 | 141 | } | 146 | } |
575 | 142 | 147 | ||
576 | 148 | // This is ugly... But Nux fault! | ||
577 | 149 | auto const& abs_geo = GetAbsoluteGeometry(); | ||
578 | 150 | guint64 timestamp = nux::GetGraphicsDisplay()->GetCurrentEvent().x11_timestamp; | ||
579 | 151 | WindowManager::Default().UnGrabMousePointer(timestamp, button, abs_geo.x, abs_geo.y); | ||
580 | 152 | |||
581 | 143 | Activate(button); | 153 | Activate(button); |
582 | 144 | } | 154 | } |
583 | 145 | } | 155 | } |
584 | 146 | 156 | ||
585 | === modified file 'panel/PanelMenuView.cpp' | |||
586 | --- panel/PanelMenuView.cpp 2015-12-16 15:12:05 +0000 | |||
587 | +++ panel/PanelMenuView.cpp 2016-09-01 22:11:45 +0000 | |||
588 | @@ -102,7 +102,6 @@ | |||
589 | 102 | , ignore_menu_visibility_(false) | 102 | , ignore_menu_visibility_(false) |
590 | 103 | , integrated_menus_(menu_manager_->integrated_menus()) | 103 | , integrated_menus_(menu_manager_->integrated_menus()) |
591 | 104 | , always_show_menus_(menu_manager_->always_show_menus()) | 104 | , always_show_menus_(menu_manager_->always_show_menus()) |
592 | 105 | , ignore_leave_events_(false) | ||
593 | 106 | , desktop_name_(get_current_desktop()) | 105 | , desktop_name_(get_current_desktop()) |
594 | 107 | { | 106 | { |
595 | 108 | if (ApplicationWindowPtr const& win = ApplicationManager::Default().GetActiveWindow()) | 107 | if (ApplicationWindowPtr const& win = ApplicationManager::Default().GetActiveWindow()) |
596 | @@ -1814,14 +1813,9 @@ | |||
597 | 1814 | } | 1813 | } |
598 | 1815 | } | 1814 | } |
599 | 1816 | 1815 | ||
600 | 1817 | void PanelMenuView::IgnoreLeaveEvents(bool ignore) | ||
601 | 1818 | { | ||
602 | 1819 | ignore_leave_events_ = ignore; | ||
603 | 1820 | } | ||
604 | 1821 | |||
605 | 1822 | void PanelMenuView::OnPanelViewMouseLeave(int x, int y, unsigned long mouse_button_state, unsigned long special_keys_state) | 1816 | void PanelMenuView::OnPanelViewMouseLeave(int x, int y, unsigned long mouse_button_state, unsigned long special_keys_state) |
606 | 1823 | { | 1817 | { |
608 | 1824 | if (always_show_menus_ || ignore_leave_events_) | 1818 | if (always_show_menus_) |
609 | 1825 | return; | 1819 | return; |
610 | 1826 | 1820 | ||
611 | 1827 | if (is_inside_) | 1821 | if (is_inside_) |
612 | 1828 | 1822 | ||
613 | === modified file 'panel/PanelMenuView.h' | |||
614 | --- panel/PanelMenuView.h 2015-11-05 14:54:13 +0000 | |||
615 | +++ panel/PanelMenuView.h 2016-09-01 22:11:45 +0000 | |||
616 | @@ -56,7 +56,6 @@ | |||
617 | 56 | bool HasKeyActivableMenus() const; | 56 | bool HasKeyActivableMenus() const; |
618 | 57 | 57 | ||
619 | 58 | void NotifyAllMenusClosed(); | 58 | void NotifyAllMenusClosed(); |
620 | 59 | void IgnoreLeaveEvents(bool); | ||
621 | 60 | 59 | ||
622 | 61 | virtual void AddIndicator(indicator::Indicator::Ptr const& indicator); | 60 | virtual void AddIndicator(indicator::Indicator::Ptr const& indicator); |
623 | 62 | 61 | ||
624 | @@ -192,7 +191,6 @@ | |||
625 | 192 | bool ignore_menu_visibility_; | 191 | bool ignore_menu_visibility_; |
626 | 193 | bool integrated_menus_; | 192 | bool integrated_menus_; |
627 | 194 | bool always_show_menus_; | 193 | bool always_show_menus_; |
628 | 195 | bool ignore_leave_events_; | ||
629 | 196 | 194 | ||
630 | 197 | nux::Geometry monitor_geo_; | 195 | nux::Geometry monitor_geo_; |
631 | 198 | const std::string desktop_name_; | 196 | const std::string desktop_name_; |
632 | 199 | 197 | ||
633 | === modified file 'panel/PanelView.cpp' | |||
634 | --- panel/PanelView.cpp 2016-09-01 22:11:44 +0000 | |||
635 | +++ panel/PanelView.cpp 2016-09-01 22:11:45 +0000 | |||
636 | @@ -23,7 +23,6 @@ | |||
637 | 23 | 23 | ||
638 | 24 | #include <UnityCore/GLibWrapper.h> | 24 | #include <UnityCore/GLibWrapper.h> |
639 | 25 | 25 | ||
640 | 26 | #include "unity-shared/InputMonitor.h" | ||
641 | 27 | #include "unity-shared/PanelStyle.h" | 26 | #include "unity-shared/PanelStyle.h" |
642 | 28 | #include "unity-shared/RawPixel.h" | 27 | #include "unity-shared/RawPixel.h" |
643 | 29 | #include "unity-shared/TextureCache.h" | 28 | #include "unity-shared/TextureCache.h" |
644 | @@ -54,7 +53,6 @@ | |||
645 | 54 | : View(NUX_FILE_LINE_PARAM) | 53 | : View(NUX_FILE_LINE_PARAM) |
646 | 55 | , parent_(parent) | 54 | , parent_(parent) |
647 | 56 | , remote_(menus->Indicators()) | 55 | , remote_(menus->Indicators()) |
648 | 57 | , last_pointer_time_(0) | ||
649 | 58 | , is_dirty_(true) | 56 | , is_dirty_(true) |
650 | 59 | , opacity_maximized_toggle_(false) | 57 | , opacity_maximized_toggle_(false) |
651 | 60 | , needs_geo_sync_(false) | 58 | , needs_geo_sync_(false) |
652 | @@ -116,10 +114,9 @@ | |||
653 | 116 | 114 | ||
654 | 117 | remote_->on_object_added.connect(sigc::mem_fun(this, &PanelView::OnObjectAdded)); | 115 | remote_->on_object_added.connect(sigc::mem_fun(this, &PanelView::OnObjectAdded)); |
655 | 118 | remote_->on_object_removed.connect(sigc::mem_fun(this, &PanelView::OnObjectRemoved)); | 116 | remote_->on_object_removed.connect(sigc::mem_fun(this, &PanelView::OnObjectRemoved)); |
656 | 119 | remote_->on_entry_activated.connect(sigc::mem_fun(this, &PanelView::OnEntryActivated)); | ||
657 | 120 | remote_->on_entry_show_menu.connect(sigc::mem_fun(this, &PanelView::OnEntryShowMenu)); | ||
658 | 121 | menus->key_activate_entry.connect(sigc::mem_fun(this, &PanelView::ActivateEntry)); | 117 | menus->key_activate_entry.connect(sigc::mem_fun(this, &PanelView::ActivateEntry)); |
659 | 122 | menus->open_first.connect(sigc::mem_fun(this, &PanelView::ActivateFirstSensitive)); | 118 | menus->open_first.connect(sigc::mem_fun(this, &PanelView::ActivateFirstSensitive)); |
660 | 119 | menus->RegisterTracker(GetPanelName(), sigc::mem_fun(this, &PanelView::OnMenuPointerMoved)); | ||
661 | 123 | 120 | ||
662 | 124 | ubus_manager_.RegisterInterest(UBUS_OVERLAY_HIDDEN, sigc::mem_fun(this, &PanelView::OnOverlayHidden)); | 121 | ubus_manager_.RegisterInterest(UBUS_OVERLAY_HIDDEN, sigc::mem_fun(this, &PanelView::OnOverlayHidden)); |
663 | 125 | ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, sigc::mem_fun(this, &PanelView::OnOverlayShown)); | 122 | ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, sigc::mem_fun(this, &PanelView::OnOverlayShown)); |
664 | @@ -630,7 +627,7 @@ | |||
665 | 630 | QueueDraw(); | 627 | QueueDraw(); |
666 | 631 | } | 628 | } |
667 | 632 | 629 | ||
669 | 633 | void PanelView::OnMenuPointerMoved(int x, int y) | 630 | void PanelView::OnMenuPointerMoved(int x, int y, double speed) |
670 | 634 | { | 631 | { |
671 | 635 | nux::Geometry const& geo = GetAbsoluteGeometry(); | 632 | nux::Geometry const& geo = GetAbsoluteGeometry(); |
672 | 636 | 633 | ||
673 | @@ -651,106 +648,6 @@ | |||
674 | 651 | } | 648 | } |
675 | 652 | } | 649 | } |
676 | 653 | 650 | ||
677 | 654 | namespace | ||
678 | 655 | { | ||
679 | 656 | bool PointInTriangle(nux::Point const& p, nux::Point const& t0, nux::Point const& t1, nux::Point const& t2) | ||
680 | 657 | { | ||
681 | 658 | int s = t0.y * t2.x - t0.x * t2.y + (t2.y - t0.y) * p.x + (t0.x - t2.x) * p.y; | ||
682 | 659 | int t = t0.x * t1.y - t0.y * t1.x + (t0.y - t1.y) * p.x + (t1.x - t0.x) * p.y; | ||
683 | 660 | |||
684 | 661 | if ((s < 0) != (t < 0)) | ||
685 | 662 | return false; | ||
686 | 663 | |||
687 | 664 | int A = -t1.y * t2.x + t0.y * (t2.x - t1.x) + t0.x * (t1.y - t2.y) + t1.x * t2.y; | ||
688 | 665 | if (A < 0) | ||
689 | 666 | { | ||
690 | 667 | s = -s; | ||
691 | 668 | t = -t; | ||
692 | 669 | A = -A; | ||
693 | 670 | } | ||
694 | 671 | |||
695 | 672 | return s > 0 && t > 0 && (s + t) < A; | ||
696 | 673 | } | ||
697 | 674 | |||
698 | 675 | double GetMouseVelocity(nux::Point const& p0, nux::Point const& p1, Time time_delta) | ||
699 | 676 | { | ||
700 | 677 | int dx, dy; | ||
701 | 678 | double speed; | ||
702 | 679 | |||
703 | 680 | if (time_delta == 0) | ||
704 | 681 | return 1; | ||
705 | 682 | |||
706 | 683 | dx = p0.x - p1.x; | ||
707 | 684 | dy = p0.y - p1.y; | ||
708 | 685 | |||
709 | 686 | speed = sqrt(dx * dx + dy * dy) / time_delta; | ||
710 | 687 | |||
711 | 688 | return speed; | ||
712 | 689 | } | ||
713 | 690 | } // anonymous namespace | ||
714 | 691 | |||
715 | 692 | void PanelView::OnActiveEntryEvent(XEvent const& e) | ||
716 | 693 | { | ||
717 | 694 | if (e.type != MotionNotify) | ||
718 | 695 | return; | ||
719 | 696 | |||
720 | 697 | double scale = Settings::Instance().em(monitor_)->DPIScale(); | ||
721 | 698 | nux::Point mouse(e.xmotion.x_root, e.xmotion.y_root); | ||
722 | 699 | double speed = GetMouseVelocity(mouse, tracked_pointer_pos_, e.xmotion.time - last_pointer_time_); | ||
723 | 700 | |||
724 | 701 | tracked_pointer_pos_ = mouse; | ||
725 | 702 | last_pointer_time_ = e.xmotion.time; | ||
726 | 703 | |||
727 | 704 | if (speed > SCRUB_VELOCITY_THRESHOLD && | ||
728 | 705 | PointInTriangle(mouse, {mouse.x, std::max(mouse.y - TRIANGLE_THRESHOLD.CP(scale), 0)}, | ||
729 | 706 | menu_geo_.GetPosition(), {menu_geo_.x + menu_geo_.width, menu_geo_.y})) | ||
730 | 707 | { | ||
731 | 708 | return; | ||
732 | 709 | } | ||
733 | 710 | |||
734 | 711 | OnMenuPointerMoved(mouse.x, mouse.y); | ||
735 | 712 | } | ||
736 | 713 | |||
737 | 714 | void PanelView::OnEntryActivated(std::string const& panel, std::string const& entry_id, nux::Rect const& menu_geo) | ||
738 | 715 | { | ||
739 | 716 | if (!panel.empty() && panel != GetPanelName()) | ||
740 | 717 | return; | ||
741 | 718 | |||
742 | 719 | bool active = !entry_id.empty(); | ||
743 | 720 | auto const& activation_cb = sigc::mem_fun(this, &PanelView::OnActiveEntryEvent); | ||
744 | 721 | menu_geo_ = menu_geo; | ||
745 | 722 | |||
746 | 723 | if (active) | ||
747 | 724 | { | ||
748 | 725 | auto& im = input::Monitor::Get(); | ||
749 | 726 | if (im.RegisterClient(input::Events::POINTER, activation_cb)) | ||
750 | 727 | { | ||
751 | 728 | last_pointer_time_ = 0; | ||
752 | 729 | ActivateEntry(entry_id); | ||
753 | 730 | } | ||
754 | 731 | |||
755 | 732 | if (overlay_is_open_) | ||
756 | 733 | ubus_manager_.SendMessage(UBUS_OVERLAY_CLOSE_REQUEST); | ||
757 | 734 | } | ||
758 | 735 | else | ||
759 | 736 | { | ||
760 | 737 | input::Monitor::Get().UnregisterClient(activation_cb); | ||
761 | 738 | menu_view_->NotifyAllMenusClosed(); | ||
762 | 739 | } | ||
763 | 740 | } | ||
764 | 741 | |||
765 | 742 | void PanelView::OnEntryShowMenu(std::string const& entry_id, unsigned xid, | ||
766 | 743 | int x, int y, unsigned button) | ||
767 | 744 | { | ||
768 | 745 | if (menu_geo_.IsNull()) | ||
769 | 746 | { | ||
770 | 747 | // This is ugly... But Nux fault! | ||
771 | 748 | menu_view_->IgnoreLeaveEvents(true); | ||
772 | 749 | WindowManager::Default().UnGrabMousePointer(CurrentTime, button, x, y); | ||
773 | 750 | menu_view_->IgnoreLeaveEvents(false); | ||
774 | 751 | } | ||
775 | 752 | } | ||
776 | 753 | |||
777 | 754 | bool PanelView::ActivateFirstSensitive() | 651 | bool PanelView::ActivateFirstSensitive() |
778 | 755 | { | 652 | { |
779 | 756 | if (!IsActive()) | 653 | if (!IsActive()) |
780 | 757 | 654 | ||
781 | === modified file 'panel/PanelView.h' | |||
782 | --- panel/PanelView.h 2016-09-01 22:11:44 +0000 | |||
783 | +++ panel/PanelView.h 2016-09-01 22:11:45 +0000 | |||
784 | @@ -87,8 +87,6 @@ | |||
785 | 87 | void OnObjectAdded(indicator::Indicator::Ptr const& proxy); | 87 | void OnObjectAdded(indicator::Indicator::Ptr const& proxy); |
786 | 88 | void OnObjectRemoved(indicator::Indicator::Ptr const& proxy); | 88 | void OnObjectRemoved(indicator::Indicator::Ptr const& proxy); |
787 | 89 | void OnIndicatorViewUpdated(); | 89 | void OnIndicatorViewUpdated(); |
788 | 90 | void OnEntryActivated(std::string const& panel, std::string const& entry_id, nux::Rect const& geo); | ||
789 | 91 | void OnEntryShowMenu(std::string const& entry_id, unsigned xid, int x, int y, unsigned button); | ||
790 | 92 | 90 | ||
791 | 93 | private: | 91 | private: |
792 | 94 | std::string GetPanelName() const; | 92 | std::string GetPanelName() const; |
793 | @@ -98,7 +96,7 @@ | |||
794 | 98 | void OnSpreadInitiate(); | 96 | void OnSpreadInitiate(); |
795 | 99 | void OnSpreadTerminate(); | 97 | void OnSpreadTerminate(); |
796 | 100 | void OnLowGfxChanged(); | 98 | void OnLowGfxChanged(); |
798 | 101 | void OnMenuPointerMoved(int x, int y); | 99 | void OnMenuPointerMoved(int x, int y, double speed); |
799 | 102 | void OnActiveEntryEvent(XEvent const&); | 100 | void OnActiveEntryEvent(XEvent const&); |
800 | 103 | void EnableOverlayMode(bool); | 101 | void EnableOverlayMode(bool); |
801 | 104 | void LoadTextures(); | 102 | void LoadTextures(); |
802 | @@ -132,10 +130,6 @@ | |||
803 | 132 | BaseTexturePtr bg_refine_single_column_tex_; | 130 | BaseTexturePtr bg_refine_single_column_tex_; |
804 | 133 | std::unique_ptr<nux::AbstractPaintLayer> bg_refine_single_column_layer_; | 131 | std::unique_ptr<nux::AbstractPaintLayer> bg_refine_single_column_layer_; |
805 | 134 | 132 | ||
806 | 135 | std::string active_overlay_; | ||
807 | 136 | nux::Point tracked_pointer_pos_; | ||
808 | 137 | Time last_pointer_time_; | ||
809 | 138 | |||
810 | 139 | bool is_dirty_; | 133 | bool is_dirty_; |
811 | 140 | bool opacity_maximized_toggle_; | 134 | bool opacity_maximized_toggle_; |
812 | 141 | bool needs_geo_sync_; | 135 | bool needs_geo_sync_; |
813 | @@ -143,8 +137,7 @@ | |||
814 | 143 | float opacity_; | 137 | float opacity_; |
815 | 144 | int monitor_; | 138 | int monitor_; |
816 | 145 | int stored_dash_width_; | 139 | int stored_dash_width_; |
819 | 146 | 140 | std::string active_overlay_; | |
818 | 147 | nux::Geometry menu_geo_; | ||
820 | 148 | 141 | ||
821 | 149 | connection::Manager on_indicator_updated_connections_; | 142 | connection::Manager on_indicator_updated_connections_; |
822 | 150 | connection::Manager maximized_opacity_toggle_connections_; | 143 | connection::Manager maximized_opacity_toggle_connections_; |
823 | 151 | 144 | ||
824 | === modified file 'tests/test_lockscreen_controller.cpp' | |||
825 | --- tests/test_lockscreen_controller.cpp 2016-06-21 14:40:26 +0000 | |||
826 | +++ tests/test_lockscreen_controller.cpp 2016-09-01 22:11:45 +0000 | |||
827 | @@ -55,7 +55,7 @@ | |||
828 | 55 | struct MockShield : BaseShield | 55 | struct MockShield : BaseShield |
829 | 56 | { | 56 | { |
830 | 57 | MockShield() | 57 | MockShield() |
832 | 58 | : BaseShield(nullptr, nullptr, nullptr, nux::ObjectPtr<AbstractUserPromptView>(), 0, false) | 58 | : BaseShield(nullptr, nullptr, nux::ObjectPtr<AbstractUserPromptView>(), 0, false) |
833 | 59 | {} | 59 | {} |
834 | 60 | 60 | ||
835 | 61 | MOCK_CONST_METHOD0(IsIndicatorOpen, bool()); | 61 | MOCK_CONST_METHOD0(IsIndicatorOpen, bool()); |
836 | @@ -67,7 +67,7 @@ | |||
837 | 67 | struct ShieldFactoryMock : ShieldFactoryInterface | 67 | struct ShieldFactoryMock : ShieldFactoryInterface |
838 | 68 | { | 68 | { |
839 | 69 | nux::ObjectPtr<BaseShield> CreateShield(session::Manager::Ptr const&, | 69 | nux::ObjectPtr<BaseShield> CreateShield(session::Manager::Ptr const&, |
841 | 70 | indicator::Indicators::Ptr const&, | 70 | menu::Manager::Ptr const&, |
842 | 71 | Accelerators::Ptr const&, | 71 | Accelerators::Ptr const&, |
843 | 72 | nux::ObjectPtr<AbstractUserPromptView> const&, | 72 | nux::ObjectPtr<AbstractUserPromptView> const&, |
844 | 73 | int, bool) override | 73 | int, bool) override |
845 | 74 | 74 | ||
846 | === modified file 'unity-shared/InputMonitor.cpp' | |||
847 | --- unity-shared/InputMonitor.cpp 2016-09-01 22:11:44 +0000 | |||
848 | +++ unity-shared/InputMonitor.cpp 2016-09-01 22:11:45 +0000 | |||
849 | @@ -18,6 +18,7 @@ | |||
850 | 18 | */ | 18 | */ |
851 | 19 | 19 | ||
852 | 20 | #include "InputMonitor.h" | 20 | #include "InputMonitor.h" |
853 | 21 | #include "SigcSlotHash.h" | ||
854 | 21 | 22 | ||
855 | 22 | #include <Nux/Nux.h> | 23 | #include <Nux/Nux.h> |
856 | 23 | #include <NuxCore/Logger.h> | 24 | #include <NuxCore/Logger.h> |
857 | @@ -46,6 +47,12 @@ | |||
858 | 46 | return static_cast<ut>(static_cast<ut>(l) & static_cast<ut>(r)); | 47 | return static_cast<ut>(static_cast<ut>(l) & static_cast<ut>(r)); |
859 | 47 | } | 48 | } |
860 | 48 | 49 | ||
861 | 50 | Events& operator|=(Events& l, Events r) | ||
862 | 51 | { | ||
863 | 52 | typedef std::underlying_type<Events>::type ut; | ||
864 | 53 | return l = static_cast<Events>(static_cast<ut>(l) | static_cast<ut>(r)); | ||
865 | 54 | } | ||
866 | 55 | |||
867 | 49 | template <typename EVENT> | 56 | template <typename EVENT> |
868 | 50 | void initialize_event_common(EVENT* ev, XIDeviceEvent* xiev) | 57 | void initialize_event_common(EVENT* ev, XIDeviceEvent* xiev) |
869 | 51 | { | 58 | { |
870 | @@ -118,6 +125,12 @@ | |||
871 | 118 | 125 | ||
872 | 119 | struct Monitor::Impl | 126 | struct Monitor::Impl |
873 | 120 | { | 127 | { |
874 | 128 | #if __GNUC__ < 6 | ||
875 | 129 | using EventCallbackSet = std::unordered_set<EventCallback>; | ||
876 | 130 | #else | ||
877 | 131 | using EventCallbackSet = std::unordered_set<EventCallback, std::hash<sigc::slot_base>>; | ||
878 | 132 | #endif | ||
879 | 133 | |||
880 | 121 | Impl() | 134 | Impl() |
881 | 122 | : xi_opcode_(0) | 135 | : xi_opcode_(0) |
882 | 123 | , event_filter_set_(false) | 136 | , event_filter_set_(false) |
883 | @@ -194,6 +207,22 @@ | |||
884 | 194 | return removed; | 207 | return removed; |
885 | 195 | } | 208 | } |
886 | 196 | 209 | ||
887 | 210 | Events RegisteredEvents(EventCallback const& cb) const | ||
888 | 211 | { | ||
889 | 212 | Events events = Events::NONE; | ||
890 | 213 | |||
891 | 214 | if (pointer_callbacks_.find(cb) != end(pointer_callbacks_)) | ||
892 | 215 | events |= Events::POINTER; | ||
893 | 216 | |||
894 | 217 | if (key_callbacks_.find(cb) != end(key_callbacks_)) | ||
895 | 218 | events |= Events::KEYS; | ||
896 | 219 | |||
897 | 220 | if (barrier_callbacks_.find(cb) != end(barrier_callbacks_)) | ||
898 | 221 | events |= Events::BARRIER; | ||
899 | 222 | |||
900 | 223 | return events; | ||
901 | 224 | } | ||
902 | 225 | |||
903 | 197 | void UpdateEventMonitor() | 226 | void UpdateEventMonitor() |
904 | 198 | { | 227 | { |
905 | 199 | auto* dpy = nux::GetGraphicsDisplay()->GetX11Display(); | 228 | auto* dpy = nux::GetGraphicsDisplay()->GetX11Display(); |
906 | @@ -276,7 +305,7 @@ | |||
907 | 276 | } | 305 | } |
908 | 277 | 306 | ||
909 | 278 | template <typename EVENT_TYPE, typename NATIVE_TYPE = XIDeviceEvent> | 307 | template <typename EVENT_TYPE, typename NATIVE_TYPE = XIDeviceEvent> |
911 | 279 | bool InvokeCallbacks(std::unordered_set<EventCallback>& callbacks, XEvent& xiev) | 308 | bool InvokeCallbacks(EventCallbackSet& callbacks, XEvent& xiev) |
912 | 280 | { | 309 | { |
913 | 281 | XGenericEventCookie *cookie = &xiev.xcookie; | 310 | XGenericEventCookie *cookie = &xiev.xcookie; |
914 | 282 | 311 | ||
915 | @@ -332,10 +361,10 @@ | |||
916 | 332 | bool event_filter_set_; | 361 | bool event_filter_set_; |
917 | 333 | bool invoking_callbacks_; | 362 | bool invoking_callbacks_; |
918 | 334 | glib::Source::UniquePtr idle_removal_; | 363 | glib::Source::UniquePtr idle_removal_; |
923 | 335 | std::unordered_set<EventCallback> pointer_callbacks_; | 364 | EventCallbackSet pointer_callbacks_; |
924 | 336 | std::unordered_set<EventCallback> key_callbacks_; | 365 | EventCallbackSet key_callbacks_; |
925 | 337 | std::unordered_set<EventCallback> barrier_callbacks_; | 366 | EventCallbackSet barrier_callbacks_; |
926 | 338 | std::unordered_set<EventCallback> removal_queue_; | 367 | EventCallbackSet removal_queue_; |
927 | 339 | }; | 368 | }; |
928 | 340 | 369 | ||
929 | 341 | Monitor::Monitor() | 370 | Monitor::Monitor() |
930 | @@ -376,5 +405,10 @@ | |||
931 | 376 | return impl_->UnregisterClient(cb); | 405 | return impl_->UnregisterClient(cb); |
932 | 377 | } | 406 | } |
933 | 378 | 407 | ||
934 | 408 | Events Monitor::RegisteredEvents(EventCallback const& cb) const | ||
935 | 409 | { | ||
936 | 410 | return impl_->RegisteredEvents(cb); | ||
937 | 411 | } | ||
938 | 412 | |||
939 | 379 | } // input namespace | 413 | } // input namespace |
940 | 380 | } // unity namespace | 414 | } // unity namespace |
941 | 381 | 415 | ||
942 | === modified file 'unity-shared/InputMonitor.h' | |||
943 | --- unity-shared/InputMonitor.h 2016-09-01 22:11:44 +0000 | |||
944 | +++ unity-shared/InputMonitor.h 2016-09-01 22:11:45 +0000 | |||
945 | @@ -30,6 +30,7 @@ | |||
946 | 30 | { | 30 | { |
947 | 31 | enum class Events : unsigned | 31 | enum class Events : unsigned |
948 | 32 | { | 32 | { |
949 | 33 | NONE = 0, | ||
950 | 33 | POINTER = (1 << 0), | 34 | POINTER = (1 << 0), |
951 | 34 | KEYS = (1 << 1), | 35 | KEYS = (1 << 1), |
952 | 35 | BARRIER = (1 << 2), | 36 | BARRIER = (1 << 2), |
953 | @@ -50,6 +51,8 @@ | |||
954 | 50 | bool RegisterClient(Events, EventCallback const&); | 51 | bool RegisterClient(Events, EventCallback const&); |
955 | 51 | bool UnregisterClient(EventCallback const&); | 52 | bool UnregisterClient(EventCallback const&); |
956 | 52 | 53 | ||
957 | 54 | Events RegisteredEvents(EventCallback const&) const; | ||
958 | 55 | |||
959 | 53 | private: | 56 | private: |
960 | 54 | Monitor(Monitor const&) = delete; | 57 | Monitor(Monitor const&) = delete; |
961 | 55 | Monitor& operator=(Monitor const&) = delete; | 58 | Monitor& operator=(Monitor const&) = delete; |
962 | @@ -61,31 +64,4 @@ | |||
963 | 61 | } // input namespace | 64 | } // input namespace |
964 | 62 | } // unity namespace | 65 | } // unity namespace |
965 | 63 | 66 | ||
966 | 64 | namespace std | ||
967 | 65 | { | ||
968 | 66 | template<> | ||
969 | 67 | struct hash<unity::input::Monitor::EventCallback> | ||
970 | 68 | { | ||
971 | 69 | size_t operator()(unity::input::Monitor::EventCallback const& cb) const | ||
972 | 70 | { | ||
973 | 71 | if (cb.rep_) | ||
974 | 72 | return std::hash<size_t>()(reinterpret_cast<size_t>(cb.rep_->call_)); | ||
975 | 73 | |||
976 | 74 | return std::hash<size_t>()(reinterpret_cast<size_t>(cb.rep_)); | ||
977 | 75 | } | ||
978 | 76 | }; | ||
979 | 77 | |||
980 | 78 | template<> | ||
981 | 79 | struct equal_to<unity::input::Monitor::EventCallback> | ||
982 | 80 | { | ||
983 | 81 | bool operator()(unity::input::Monitor::EventCallback const& lhs, unity::input::Monitor::EventCallback const& rhs) const | ||
984 | 82 | { | ||
985 | 83 | if (!lhs.rep_ || !rhs.rep_) | ||
986 | 84 | return (lhs.rep_ == rhs.rep_); | ||
987 | 85 | |||
988 | 86 | return (lhs.rep_->call_ == rhs.rep_->call_); | ||
989 | 87 | } | ||
990 | 88 | }; | ||
991 | 89 | } // std namespace | ||
992 | 90 | |||
993 | 91 | #endif // __UNITY_INPUT_MONITOR__ | 67 | #endif // __UNITY_INPUT_MONITOR__ |
994 | 92 | 68 | ||
995 | === modified file 'unity-shared/MenuManager.cpp' | |||
996 | --- unity-shared/MenuManager.cpp 2015-10-02 14:02:05 +0000 | |||
997 | +++ unity-shared/MenuManager.cpp 2016-09-01 22:11:45 +0000 | |||
998 | @@ -21,11 +21,17 @@ | |||
999 | 21 | #include <gtk/gtk.h> | 21 | #include <gtk/gtk.h> |
1000 | 22 | #include <NuxCore/Logger.h> | 22 | #include <NuxCore/Logger.h> |
1001 | 23 | #include <UnityCore/GLibSignal.h> | 23 | #include <UnityCore/GLibSignal.h> |
1002 | 24 | #include <UnityCore/GLibSource.h> | ||
1003 | 24 | #include <UnityCore/GLibWrapper.h> | 25 | #include <UnityCore/GLibWrapper.h> |
1004 | 25 | #include <UnityCore/DBusIndicators.h> | 26 | #include <UnityCore/DBusIndicators.h> |
1005 | 26 | #include <unordered_map> | 27 | #include <unordered_map> |
1006 | 27 | 28 | ||
1007 | 28 | #include "MenuManager.h" | 29 | #include "MenuManager.h" |
1008 | 30 | #include "InputMonitor.h" | ||
1009 | 31 | #include "RawPixel.h" | ||
1010 | 32 | #include "SigcSlotHash.h" | ||
1011 | 33 | #include "UnitySettings.h" | ||
1012 | 34 | #include "UScreen.h" | ||
1013 | 29 | #include "WindowManager.h" | 35 | #include "WindowManager.h" |
1014 | 30 | 36 | ||
1015 | 31 | namespace unity | 37 | namespace unity |
1016 | @@ -40,6 +46,10 @@ | |||
1017 | 40 | const std::string LIM_KEY = "integrated-menus"; | 46 | const std::string LIM_KEY = "integrated-menus"; |
1018 | 41 | const std::string SHOW_MENUS_NOW_DELAY = "show-menus-now-delay"; | 47 | const std::string SHOW_MENUS_NOW_DELAY = "show-menus-now-delay"; |
1019 | 42 | const std::string ALWAYS_SHOW_MENUS_KEY = "always-show-menus"; | 48 | const std::string ALWAYS_SHOW_MENUS_KEY = "always-show-menus"; |
1020 | 49 | |||
1021 | 50 | const RawPixel TRIANGLE_THRESHOLD = 5_em; | ||
1022 | 51 | const double SCRUB_VELOCITY_THRESHOLD = 0.05; | ||
1023 | 52 | const unsigned MENU_OPEN_MOUSE_WAIT = 150; | ||
1024 | 43 | } | 53 | } |
1025 | 44 | 54 | ||
1026 | 45 | using namespace indicator; | 55 | using namespace indicator; |
1027 | @@ -51,6 +61,7 @@ | |||
1028 | 51 | , indicators_(indicators) | 61 | , indicators_(indicators) |
1029 | 52 | , key_grabber_(grabber) | 62 | , key_grabber_(grabber) |
1030 | 53 | , show_now_window_(0) | 63 | , show_now_window_(0) |
1031 | 64 | , last_pointer_time_(0) | ||
1032 | 54 | , settings_(g_settings_new(SETTINGS_NAME.c_str())) | 65 | , settings_(g_settings_new(SETTINGS_NAME.c_str())) |
1033 | 55 | { | 66 | { |
1034 | 56 | for (auto const& indicator : indicators_->GetIndicators()) | 67 | for (auto const& indicator : indicators_->GetIndicators()) |
1035 | @@ -182,9 +193,15 @@ | |||
1036 | 182 | parent_->key_activate_entry.emit(entry_id); | 193 | parent_->key_activate_entry.emit(entry_id); |
1037 | 183 | } | 194 | } |
1038 | 184 | 195 | ||
1040 | 185 | void EntryActivated(std::string const&, std::string const&, nux::Rect const& geo) | 196 | void EntryActivated(std::string const& menubar, std::string const&, nux::Rect const& geo) |
1041 | 186 | { | 197 | { |
1042 | 187 | parent_->menu_open = !geo.IsNull(); | 198 | parent_->menu_open = !geo.IsNull(); |
1043 | 199 | |||
1044 | 200 | if (active_menubar_ != menubar) | ||
1045 | 201 | { | ||
1046 | 202 | active_menubar_ = menubar; | ||
1047 | 203 | UpdateActiveTracker(); | ||
1048 | 204 | } | ||
1049 | 188 | } | 205 | } |
1050 | 189 | 206 | ||
1051 | 190 | void SetShowNowForWindow(Window xid, bool show) | 207 | void SetShowNowForWindow(Window xid, bool show) |
1052 | @@ -231,15 +248,148 @@ | |||
1053 | 231 | gtk_icon_theme_set_search_path(gtk_icon_theme_get_default(), gicon_paths.data(), gicon_paths.size()); | 248 | gtk_icon_theme_set_search_path(gtk_icon_theme_get_default(), gicon_paths.data(), gicon_paths.size()); |
1054 | 232 | } | 249 | } |
1055 | 233 | 250 | ||
1056 | 251 | bool PointInTriangle(nux::Point const& p, nux::Point const& t0, nux::Point const& t1, nux::Point const& t2) | ||
1057 | 252 | { | ||
1058 | 253 | int s = t0.y * t2.x - t0.x * t2.y + (t2.y - t0.y) * p.x + (t0.x - t2.x) * p.y; | ||
1059 | 254 | int t = t0.x * t1.y - t0.y * t1.x + (t0.y - t1.y) * p.x + (t1.x - t0.x) * p.y; | ||
1060 | 255 | |||
1061 | 256 | if ((s < 0) != (t < 0)) | ||
1062 | 257 | return false; | ||
1063 | 258 | |||
1064 | 259 | int A = -t1.y * t2.x + t0.y * (t2.x - t1.x) + t0.x * (t1.y - t2.y) + t1.x * t2.y; | ||
1065 | 260 | if (A < 0) | ||
1066 | 261 | { | ||
1067 | 262 | s = -s; | ||
1068 | 263 | t = -t; | ||
1069 | 264 | A = -A; | ||
1070 | 265 | } | ||
1071 | 266 | |||
1072 | 267 | return s > 0 && t > 0 && (s + t) < A; | ||
1073 | 268 | } | ||
1074 | 269 | |||
1075 | 270 | double GetMouseVelocity(nux::Point const& p0, nux::Point const& p1, Time time_delta) | ||
1076 | 271 | { | ||
1077 | 272 | int dx, dy; | ||
1078 | 273 | double speed; | ||
1079 | 274 | |||
1080 | 275 | if (time_delta == 0) | ||
1081 | 276 | return 1; | ||
1082 | 277 | |||
1083 | 278 | dx = p0.x - p1.x; | ||
1084 | 279 | dy = p0.y - p1.y; | ||
1085 | 280 | |||
1086 | 281 | speed = sqrt(dx * dx + dy * dy) / time_delta; | ||
1087 | 282 | |||
1088 | 283 | return speed; | ||
1089 | 284 | } | ||
1090 | 285 | |||
1091 | 286 | void OnActiveEntryEvent(XEvent const& e) | ||
1092 | 287 | { | ||
1093 | 288 | if (e.type != MotionNotify) | ||
1094 | 289 | return; | ||
1095 | 290 | |||
1096 | 291 | auto const& active_entry = indicators_->GetActiveEntry(); | ||
1097 | 292 | |||
1098 | 293 | if (!active_entry) | ||
1099 | 294 | return; | ||
1100 | 295 | |||
1101 | 296 | nux::Point mouse(e.xmotion.x_root, e.xmotion.y_root); | ||
1102 | 297 | auto monitor = UScreen::GetDefault()->GetMonitorAtPosition(mouse.x, mouse.y); | ||
1103 | 298 | double scale = Settings::Instance().em(monitor)->DPIScale(); | ||
1104 | 299 | double speed = GetMouseVelocity(mouse, tracked_pointer_pos_, e.xmotion.time - last_pointer_time_); | ||
1105 | 300 | auto menu_geo = active_entry->geometry(); | ||
1106 | 301 | |||
1107 | 302 | tracked_pointer_pos_ = mouse; | ||
1108 | 303 | last_pointer_time_ = e.xmotion.time; | ||
1109 | 304 | |||
1110 | 305 | if (speed > SCRUB_VELOCITY_THRESHOLD && | ||
1111 | 306 | PointInTriangle(mouse, {mouse.x, std::max(mouse.y - TRIANGLE_THRESHOLD.CP(scale), 0)}, | ||
1112 | 307 | menu_geo.GetPosition(), {menu_geo.x + menu_geo.width, menu_geo.y})) | ||
1113 | 308 | { | ||
1114 | 309 | pointer_movement_timeout_ = std::make_shared<glib::Timeout>(MENU_OPEN_MOUSE_WAIT, [this, mouse, speed] { | ||
1115 | 310 | if (active_tracker_) | ||
1116 | 311 | active_tracker_(mouse.x, mouse.y, speed); | ||
1117 | 312 | |||
1118 | 313 | return false; | ||
1119 | 314 | }); | ||
1120 | 315 | |||
1121 | 316 | return; | ||
1122 | 317 | } | ||
1123 | 318 | |||
1124 | 319 | if (active_tracker_) | ||
1125 | 320 | { | ||
1126 | 321 | pointer_movement_timeout_.reset(); | ||
1127 | 322 | active_tracker_(mouse.x, mouse.y, speed); | ||
1128 | 323 | } | ||
1129 | 324 | } | ||
1130 | 325 | |||
1131 | 326 | bool RegisterTracker(std::string const& menubar, PositionTracker const& cb) | ||
1132 | 327 | { | ||
1133 | 328 | auto it = position_trackers_.find(menubar); | ||
1134 | 329 | |||
1135 | 330 | if (it != end(position_trackers_)) | ||
1136 | 331 | return false; | ||
1137 | 332 | |||
1138 | 333 | position_trackers_.insert({menubar, cb}); | ||
1139 | 334 | |||
1140 | 335 | if (active_menubar_ == menubar) | ||
1141 | 336 | UpdateActiveTracker(); | ||
1142 | 337 | |||
1143 | 338 | return true; | ||
1144 | 339 | } | ||
1145 | 340 | |||
1146 | 341 | bool UnregisterTracker(std::string const& menubar, PositionTracker const& cb) | ||
1147 | 342 | { | ||
1148 | 343 | auto it = position_trackers_.find(menubar); | ||
1149 | 344 | |||
1150 | 345 | if (it == end(position_trackers_)) | ||
1151 | 346 | return false; | ||
1152 | 347 | |||
1153 | 348 | if (!cb || (cb && it->second == cb)) | ||
1154 | 349 | { | ||
1155 | 350 | position_trackers_.erase(it); | ||
1156 | 351 | UpdateActiveTracker(); | ||
1157 | 352 | return true; | ||
1158 | 353 | } | ||
1159 | 354 | |||
1160 | 355 | return false; | ||
1161 | 356 | } | ||
1162 | 357 | |||
1163 | 358 | void UpdateActiveTracker() | ||
1164 | 359 | { | ||
1165 | 360 | auto it = position_trackers_.find(active_menubar_); | ||
1166 | 361 | active_tracker_ = (it != end(position_trackers_)) ? it->second : PositionTracker(); | ||
1167 | 362 | pointer_movement_timeout_.reset(); | ||
1168 | 363 | |||
1169 | 364 | if (active_tracker_) | ||
1170 | 365 | { | ||
1171 | 366 | if (input::Monitor::Get().RegisterClient(input::Events::POINTER, sigc::mem_fun(this, &Impl::OnActiveEntryEvent))) | ||
1172 | 367 | last_pointer_time_ = 0; | ||
1173 | 368 | } | ||
1174 | 369 | else | ||
1175 | 370 | { | ||
1176 | 371 | input::Monitor::Get().UnregisterClient(sigc::mem_fun(this, &Impl::OnActiveEntryEvent)); | ||
1177 | 372 | |||
1178 | 373 | if (it != end(position_trackers_)) | ||
1179 | 374 | position_trackers_.erase(it); | ||
1180 | 375 | } | ||
1181 | 376 | } | ||
1182 | 377 | |||
1183 | 234 | Manager* parent_; | 378 | Manager* parent_; |
1184 | 235 | Indicators::Ptr indicators_; | 379 | Indicators::Ptr indicators_; |
1185 | 236 | AppmenuIndicator::Ptr appmenu_; | 380 | AppmenuIndicator::Ptr appmenu_; |
1186 | 237 | key::Grabber::Ptr key_grabber_; | 381 | key::Grabber::Ptr key_grabber_; |
1187 | 238 | Window show_now_window_; | 382 | Window show_now_window_; |
1188 | 383 | std::string active_menubar_; | ||
1189 | 384 | PositionTracker active_tracker_; | ||
1190 | 385 | nux::Point tracked_pointer_pos_; | ||
1191 | 386 | Time last_pointer_time_; | ||
1192 | 387 | glib::Source::Ptr pointer_movement_timeout_; | ||
1193 | 239 | connection::Manager appmenu_connections_; | 388 | connection::Manager appmenu_connections_; |
1194 | 240 | connection::Wrapper active_win_conn_; | 389 | connection::Wrapper active_win_conn_; |
1195 | 241 | glib::Object<GSettings> settings_; | 390 | glib::Object<GSettings> settings_; |
1196 | 242 | glib::SignalManager signals_; | 391 | glib::SignalManager signals_; |
1197 | 392 | std::unordered_map<std::string, PositionTracker> position_trackers_; | ||
1198 | 243 | std::unordered_map<indicator::Entry::Ptr, uint32_t> entry_actions_; | 393 | std::unordered_map<indicator::Entry::Ptr, uint32_t> entry_actions_; |
1199 | 244 | }; | 394 | }; |
1200 | 245 | 395 | ||
1201 | @@ -278,5 +428,16 @@ | |||
1202 | 278 | return impl_->key_grabber_; | 428 | return impl_->key_grabber_; |
1203 | 279 | } | 429 | } |
1204 | 280 | 430 | ||
1205 | 431 | bool Manager::RegisterTracker(std::string const& menubar, PositionTracker const& cb) | ||
1206 | 432 | { | ||
1207 | 433 | return impl_->RegisterTracker(menubar, cb); | ||
1208 | 434 | } | ||
1209 | 435 | |||
1210 | 436 | bool Manager::UnregisterTracker(std::string const& menubar, PositionTracker const& cb) | ||
1211 | 437 | { | ||
1212 | 438 | return impl_->UnregisterTracker(menubar, cb); | ||
1213 | 439 | } | ||
1214 | 440 | |||
1215 | 441 | |||
1216 | 281 | } // menu namespace | 442 | } // menu namespace |
1217 | 282 | } // unity namespace | 443 | } // unity namespace |
1218 | 283 | 444 | ||
1219 | === modified file 'unity-shared/MenuManager.h' | |||
1220 | --- unity-shared/MenuManager.h 2015-06-05 14:28:27 +0000 | |||
1221 | +++ unity-shared/MenuManager.h 2016-09-01 22:11:45 +0000 | |||
1222 | @@ -67,6 +67,10 @@ | |||
1223 | 67 | 67 | ||
1224 | 68 | key::Grabber::Ptr const& KeyGrabber() const; | 68 | key::Grabber::Ptr const& KeyGrabber() const; |
1225 | 69 | 69 | ||
1226 | 70 | typedef sigc::slot<void, int /*x*/, int /*y*/, double /*speed*/> PositionTracker; | ||
1227 | 71 | bool RegisterTracker(std::string const& menubar, PositionTracker const&); | ||
1228 | 72 | bool UnregisterTracker(std::string const& menubar, PositionTracker const& = PositionTracker()); | ||
1229 | 73 | |||
1230 | 70 | sigc::signal<void> appmenu_added; | 74 | sigc::signal<void> appmenu_added; |
1231 | 71 | sigc::signal<void> appmenu_removed; | 75 | sigc::signal<void> appmenu_removed; |
1232 | 72 | sigc::signal<bool>::accumulated<any_true> open_first; | 76 | sigc::signal<bool>::accumulated<any_true> open_first; |
1233 | 73 | 77 | ||
1234 | === added file 'unity-shared/SigcSlotHash.h' | |||
1235 | --- unity-shared/SigcSlotHash.h 1970-01-01 00:00:00 +0000 | |||
1236 | +++ unity-shared/SigcSlotHash.h 2016-09-01 22:11:45 +0000 | |||
1237 | @@ -0,0 +1,70 @@ | |||
1238 | 1 | // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- | ||
1239 | 2 | /* | ||
1240 | 3 | * Copyright (C) 2016 Canonical Ltd | ||
1241 | 4 | * | ||
1242 | 5 | * This program is free software: you can redistribute it and/or modify | ||
1243 | 6 | * it under the terms of the GNU General Public License version 3 as | ||
1244 | 7 | * published by the Free Software Foundation. | ||
1245 | 8 | * | ||
1246 | 9 | * This program is distributed in the hope that it will be useful, | ||
1247 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1248 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1249 | 12 | * GNU General Public License for more details. | ||
1250 | 13 | * | ||
1251 | 14 | * You should have received a copy of the GNU General Public License | ||
1252 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1253 | 16 | * | ||
1254 | 17 | * Authored by: Marco Trevisan <marco.trevisan@canonical.com> | ||
1255 | 18 | */ | ||
1256 | 19 | |||
1257 | 20 | #ifndef __UNITY_SIGC_SLOT_HASHER__ | ||
1258 | 21 | #define __UNITY_SIGC_SLOT_HASHER__ | ||
1259 | 22 | |||
1260 | 23 | #include <sigc++/slot.h> | ||
1261 | 24 | |||
1262 | 25 | namespace sigc | ||
1263 | 26 | { | ||
1264 | 27 | inline bool operator==(slot_base const& lhs, slot_base const& rhs) | ||
1265 | 28 | { | ||
1266 | 29 | if (!lhs.rep_ || !rhs.rep_) | ||
1267 | 30 | return (lhs.rep_ == rhs.rep_); | ||
1268 | 31 | |||
1269 | 32 | return (lhs.rep_->call_ == rhs.rep_->call_); | ||
1270 | 33 | } | ||
1271 | 34 | |||
1272 | 35 | inline bool operator!=(slot_base const& lhs, slot_base const& rhs) | ||
1273 | 36 | { | ||
1274 | 37 | return !(lhs == rhs); | ||
1275 | 38 | } | ||
1276 | 39 | } // sigc namespace | ||
1277 | 40 | |||
1278 | 41 | namespace std | ||
1279 | 42 | { | ||
1280 | 43 | |||
1281 | 44 | template<> | ||
1282 | 45 | struct hash<sigc::slot_base> | ||
1283 | 46 | { | ||
1284 | 47 | size_t operator()(sigc::slot_base const& cb) const | ||
1285 | 48 | { | ||
1286 | 49 | if (cb.rep_) | ||
1287 | 50 | return hash<size_t>()(reinterpret_cast<size_t>(cb.rep_->call_)); | ||
1288 | 51 | |||
1289 | 52 | return hash<size_t>()(reinterpret_cast<size_t>(cb.rep_)); | ||
1290 | 53 | } | ||
1291 | 54 | }; | ||
1292 | 55 | |||
1293 | 56 | #if __GNUC__ < 6 | ||
1294 | 57 | template<class T> | ||
1295 | 58 | struct hash | ||
1296 | 59 | { | ||
1297 | 60 | size_t operator()(T const& cb) const | ||
1298 | 61 | { | ||
1299 | 62 | static_assert(std::is_base_of<sigc::slot_base, T>::value, "Type is not derived from sigc::slot_base"); | ||
1300 | 63 | return hash<sigc::slot_base>()(cb); | ||
1301 | 64 | } | ||
1302 | 65 | }; | ||
1303 | 66 | #endif | ||
1304 | 67 | |||
1305 | 68 | } // std namespace | ||
1306 | 69 | |||
1307 | 70 | #endif // __UNITY_SIGC_SLOT_HASHER__ |
+1