Merge lp:~unity-team/unity/fix-lp1309778-trusty into lp:unity/7.2
- fix-lp1309778-trusty
- Merge into trusty
Status: | Needs review |
---|---|
Proposed branch: | lp:~unity-team/unity/fix-lp1309778-trusty |
Merge into: | lp:unity/7.2 |
Prerequisite: | lp:~unity-team/unity/fix-lp1351591-trusty |
Diff against target: |
5329 lines (+1369/-784) 71 files modified
UnityCore/AppmenuIndicator.cpp (+52/-12) UnityCore/AppmenuIndicator.h (+4/-3) UnityCore/CMakeLists.txt (+1/-0) UnityCore/DBusIndicators.cpp (+52/-40) UnityCore/GLibDBusServer.cpp (+3/-2) UnityCore/GLibSource.h (+2/-2) UnityCore/Indicator.cpp (+15/-30) UnityCore/Indicator.h (+3/-4) UnityCore/IndicatorEntry.cpp (+15/-5) UnityCore/IndicatorEntry.h (+4/-1) UnityCore/Indicators.cpp (+2/-1) UnityCore/pch/unitycore_pch.hh (+1/-0) com.canonical.Unity.gschema.xml (+6/-0) dash/DashView.h (+1/-1) dash/ScopeView.h (+2/-1) debian/control (+1/-1) decorations/DecoratedWindow.cpp (+13/-9) decorations/DecorationsManager.cpp (+12/-15) decorations/DecorationsMenuDropdown.cpp (+4/-3) decorations/DecorationsMenuEntry.cpp (+12/-2) decorations/DecorationsMenuEntry.h (+2/-1) decorations/DecorationsMenuLayout.cpp (+25/-3) decorations/DecorationsPriv.h (+3/-1) decorations/DecorationsSlidingLayout.cpp (+1/-1) decorations/DecorationsWidgets.cpp (+4/-9) launcher/LauncherEntryRemoteModel.h (+2/-2) launcher/XdndStartStopNotifierImp.h (+1/-1) lockscreen/LockScreenPanel.cpp (+1/-1) panel/PanelIndicatorEntryDropdownView.cpp (+6/-1) panel/PanelIndicatorEntryDropdownView.h (+1/-0) panel/PanelIndicatorEntryView.cpp (+7/-5) panel/PanelIndicatorEntryView.h (+2/-3) panel/PanelIndicatorsView.cpp (+43/-13) panel/PanelIndicatorsView.h (+6/-4) panel/PanelMenuView.cpp (+140/-112) panel/PanelMenuView.h (+8/-4) panel/PanelView.cpp (+3/-3) plugins/unityshell/src/unityshell.cpp (+34/-44) plugins/unityshell/src/unityshell.h (+2/-1) services/panel-main.c (+20/-20) services/panel-service-private.h (+22/-3) services/panel-service.c (+148/-60) services/panel-service.h (+0/-8) shortcuts/ShortcutModel.h (+3/-3) tests/autopilot/unity/emulators/panel.py (+4/-0) tests/autopilot/unity/tests/__init__.py (+12/-13) tests/autopilot/unity/tests/test_dash.py (+2/-2) tests/autopilot/unity/tests/test_hud.py (+2/-2) tests/autopilot/unity/tests/test_panel.py (+258/-211) tests/autopilot/unity/tests/test_wm_keybindings.py (+1/-6) tests/mock-application.h (+2/-2) tests/test_dbus_indicators.cpp (+3/-4) tests/test_indicator.cpp (+18/-21) tests/test_indicator_appmenu.cpp (+182/-21) tests/test_indicator_entry.cpp (+17/-14) tests/test_indicators.cpp (+11/-11) tests/test_panel_menu_view.cpp (+19/-3) tests/test_panel_service.cpp (+6/-2) tests/test_service_panel.cpp (+18/-15) unity-shared/IconLoader.cpp (+2/-2) unity-shared/MenuManager.cpp (+63/-8) unity-shared/NuxObjectPtrHash.h (+36/-0) unity-shared/PlacesVScrollBar.cpp (+1/-1) unity-shared/PluginAdapter.cpp (+11/-2) unity-shared/PluginAdapter.h (+2/-2) unity-shared/PreviewStyle.cpp (+1/-1) unity-shared/StandaloneWindowManager.cpp (+1/-0) unity-shared/UBusWrapper.cpp (+3/-4) unity-shared/UBusWrapper.h (+2/-2) unity-shared/UnitySettings.cpp (+2/-0) unity-shared/UnitySettings.h (+1/-0) |
To merge this branch: | bzr merge lp:~unity-team/unity/fix-lp1309778-trusty |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Unity Team | Pending | ||
Review via email: mp+264837@code.launchpad.net |
Commit message
Decorations, Panel: add menus for unfocused windows as well
Now the indicator-appmenu exports the menus for all the windows, then it's up to us to filter them based on their parent window and show on relevant place.
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3833
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Unmerged revisions
- 3833. By Christopher Townsend
-
Merge lp:unity/7.2.
- 3832. By Marco Trevisan (Treviño)
-
Decorations, Panel: add menus for unfocused windows as well
Now the indicator-appmenu exports the menus for all the windows,
then it's up to us to filter them based on their parent window and
show on relevant place.
Preview Diff
1 | === modified file 'UnityCore/AppmenuIndicator.cpp' | |||
2 | --- UnityCore/AppmenuIndicator.cpp 2015-03-12 00:57:05 +0000 | |||
3 | +++ UnityCore/AppmenuIndicator.cpp 2015-07-15 14:19:40 +0000 | |||
4 | @@ -17,41 +17,81 @@ | |||
5 | 17 | * Authored by: Marco Trevisan (Treviño) <3v1n0@ubuntu.com> | 17 | * Authored by: Marco Trevisan (Treviño) <3v1n0@ubuntu.com> |
6 | 18 | */ | 18 | */ |
7 | 19 | 19 | ||
9 | 20 | #include "GLibSource.h" | 20 | #include <unordered_set> |
10 | 21 | |||
11 | 21 | #include "AppmenuIndicator.h" | 22 | #include "AppmenuIndicator.h" |
12 | 23 | #include "ConnectionManager.h" | ||
13 | 22 | 24 | ||
14 | 23 | namespace unity | 25 | namespace unity |
15 | 24 | { | 26 | { |
16 | 25 | namespace indicator | 27 | namespace indicator |
17 | 26 | { | 28 | { |
18 | 29 | namespace | ||
19 | 30 | { | ||
20 | 31 | const Indicator::Entries empty_entries_; | ||
21 | 32 | } | ||
22 | 27 | 33 | ||
23 | 28 | struct AppmenuIndicator::Impl | 34 | struct AppmenuIndicator::Impl |
24 | 29 | { | 35 | { |
25 | 30 | Impl(AppmenuIndicator* parent) | 36 | Impl(AppmenuIndicator* parent) |
26 | 31 | { | 37 | { |
36 | 32 | // When the active window has changed we might need to emit an updated signal | 38 | connections_.Add(parent->on_entry_added.connect([this] (Entry::Ptr const& entry) { |
37 | 33 | parent->active_window.changed.connect([this, parent] (unsigned long) { | 39 | window_entries_[entry->parent_window()].push_back(entry); |
38 | 34 | update_wait_.reset(new glib::Timeout(250, [parent] { | 40 | })); |
39 | 35 | parent->updated.emit(); | 41 | |
40 | 36 | return false; | 42 | connections_.Add(parent->on_entry_removed.connect([this] (Entry::Ptr const& entry) { |
41 | 37 | })); | 43 | auto it = window_entries_.find(entry->parent_window()); |
42 | 38 | }); | 44 | |
43 | 39 | 45 | if (it != window_entries_.end()) | |
44 | 40 | parent->updated.connect([this] { update_wait_.reset(); }); | 46 | { |
45 | 47 | auto& entries = it->second; | ||
46 | 48 | entries.erase(std::remove(entries.begin(), entries.end(), entry), entries.end()); | ||
47 | 49 | |||
48 | 50 | if (entries.empty()) | ||
49 | 51 | window_entries_.erase(it); | ||
50 | 52 | } | ||
51 | 53 | })); | ||
52 | 41 | } | 54 | } |
53 | 42 | 55 | ||
55 | 43 | glib::Source::UniquePtr update_wait_; | 56 | connection::Manager connections_; |
56 | 57 | std::unordered_map<uint32_t, Indicator::Entries> window_entries_; | ||
57 | 44 | }; | 58 | }; |
58 | 45 | 59 | ||
59 | 46 | AppmenuIndicator::AppmenuIndicator(std::string const& name) | 60 | AppmenuIndicator::AppmenuIndicator(std::string const& name) |
60 | 47 | : Indicator(name) | 61 | : Indicator(name) |
61 | 48 | , active_window(0) | ||
62 | 49 | , impl_(new AppmenuIndicator::Impl(this)) | 62 | , impl_(new AppmenuIndicator::Impl(this)) |
63 | 50 | {} | 63 | {} |
64 | 51 | 64 | ||
65 | 52 | AppmenuIndicator::~AppmenuIndicator() | 65 | AppmenuIndicator::~AppmenuIndicator() |
66 | 53 | {} | 66 | {} |
67 | 54 | 67 | ||
68 | 68 | void AppmenuIndicator::Sync(Indicator::Entries const& entries) | ||
69 | 69 | { | ||
70 | 70 | std::unordered_set<uint32_t> changed_windows; | ||
71 | 71 | connection::Wrapper added_conn(on_entry_added.connect([this, &changed_windows] (Entry::Ptr const& entry) { | ||
72 | 72 | changed_windows.insert(entry->parent_window()); | ||
73 | 73 | })); | ||
74 | 74 | |||
75 | 75 | connection::Wrapper rm_conn(on_entry_removed.connect([this, &changed_windows] (Entry::Ptr const& entry) { | ||
76 | 76 | changed_windows.insert(entry->parent_window()); | ||
77 | 77 | })); | ||
78 | 78 | |||
79 | 79 | Indicator::Sync(entries); | ||
80 | 80 | |||
81 | 81 | for (uint32_t win : changed_windows) | ||
82 | 82 | updated_win.emit(win); | ||
83 | 83 | } | ||
84 | 84 | |||
85 | 85 | Indicator::Entries const& AppmenuIndicator::GetEntriesForWindow(uint32_t parent_window) const | ||
86 | 86 | { | ||
87 | 87 | auto it = impl_->window_entries_.find(parent_window); | ||
88 | 88 | |||
89 | 89 | if (it != impl_->window_entries_.end()) | ||
90 | 90 | return it->second; | ||
91 | 91 | |||
92 | 92 | return empty_entries_; | ||
93 | 93 | } | ||
94 | 94 | |||
95 | 55 | void AppmenuIndicator::ShowAppmenu(unsigned int xid, int x, int y) const | 95 | void AppmenuIndicator::ShowAppmenu(unsigned int xid, int x, int y) const |
96 | 56 | { | 96 | { |
97 | 57 | on_show_appmenu.emit(xid, x, y); | 97 | on_show_appmenu.emit(xid, x, y); |
98 | 58 | 98 | ||
99 | === modified file 'UnityCore/AppmenuIndicator.h' | |||
100 | --- UnityCore/AppmenuIndicator.h 2015-03-12 00:57:05 +0000 | |||
101 | +++ UnityCore/AppmenuIndicator.h 2015-07-15 14:19:40 +0000 | |||
102 | @@ -36,12 +36,13 @@ | |||
103 | 36 | AppmenuIndicator(std::string const& name); | 36 | AppmenuIndicator(std::string const& name); |
104 | 37 | ~AppmenuIndicator(); | 37 | ~AppmenuIndicator(); |
105 | 38 | 38 | ||
109 | 39 | nux::Property<unsigned> active_window; | 39 | bool IsAppmenu() const override { return true; } |
110 | 40 | 40 | void Sync(Entries const&) override; | |
111 | 41 | virtual bool IsAppmenu() const { return true; } | 41 | Entries const& GetEntriesForWindow(uint32_t parent_window) const; |
112 | 42 | 42 | ||
113 | 43 | void ShowAppmenu(unsigned xid, int x, int y) const; | 43 | void ShowAppmenu(unsigned xid, int x, int y) const; |
114 | 44 | 44 | ||
115 | 45 | sigc::signal<void, uint32_t> updated_win; | ||
116 | 45 | sigc::signal<void, unsigned, int, int> on_show_appmenu; | 46 | sigc::signal<void, unsigned, int, int> on_show_appmenu; |
117 | 46 | 47 | ||
118 | 47 | private: | 48 | private: |
119 | 48 | 49 | ||
120 | === modified file 'UnityCore/CMakeLists.txt' | |||
121 | --- UnityCore/CMakeLists.txt 2014-02-05 11:38:22 +0000 | |||
122 | +++ UnityCore/CMakeLists.txt 2015-07-15 14:19:40 +0000 | |||
123 | @@ -117,6 +117,7 @@ | |||
124 | 117 | # | 117 | # |
125 | 118 | include_directories(${CORE_DEPS_INCLUDE_DIRS}) | 118 | include_directories(${CORE_DEPS_INCLUDE_DIRS}) |
126 | 119 | include_directories(${CMAKE_BINARY_DIR}) | 119 | include_directories(${CMAKE_BINARY_DIR}) |
127 | 120 | include_directories(..) | ||
128 | 120 | 121 | ||
129 | 121 | set (LIBS ${CORE_DEPS_LDFLAGS} ${PRIVATE_CORE_DEPS_LDFLAGS}) | 122 | set (LIBS ${CORE_DEPS_LDFLAGS} ${PRIVATE_CORE_DEPS_LDFLAGS}) |
130 | 122 | 123 | ||
131 | 123 | 124 | ||
132 | === modified file 'UnityCore/DBusIndicators.cpp' | |||
133 | --- UnityCore/DBusIndicators.cpp 2014-12-09 15:41:53 +0000 | |||
134 | +++ UnityCore/DBusIndicators.cpp 2015-07-15 14:19:40 +0000 | |||
135 | @@ -27,19 +27,29 @@ | |||
136 | 27 | #include "GLibSource.h" | 27 | #include "GLibSource.h" |
137 | 28 | #include "Variant.h" | 28 | #include "Variant.h" |
138 | 29 | #include "DBusIndicators.h" | 29 | #include "DBusIndicators.h" |
139 | 30 | #include "services/panel-service-private.h" | ||
140 | 30 | 31 | ||
141 | 31 | namespace unity | 32 | namespace unity |
142 | 32 | { | 33 | { |
143 | 33 | namespace indicator | 34 | namespace indicator |
144 | 34 | { | 35 | { |
145 | 36 | |||
146 | 37 | namespace | ||
147 | 38 | { | ||
148 | 35 | DECLARE_LOGGER(logger, "unity.indicator.dbus"); | 39 | DECLARE_LOGGER(logger, "unity.indicator.dbus"); |
149 | 36 | 40 | ||
151 | 37 | namespace | 41 | inline bool verify_variant_type(GVariant* value, const gchar* type) |
152 | 38 | { | 42 | { |
157 | 39 | const std::string SERVICE_NAME_DESKTOP("com.canonical.Unity.Panel.Service.Desktop"); | 43 | if (!g_variant_is_of_type (value, G_VARIANT_TYPE(type))) |
158 | 40 | const std::string SERVICE_NAME_LOCKSCREEN("com.canonical.Unity.Panel.Service.LockScreen"); | 44 | { |
159 | 41 | const std::string SERVICE_PATH("/com/canonical/Unity/Panel/Service"); | 45 | LOG_ERROR(logger) << "Got invalid variant type: '" |
160 | 42 | const std::string SERVICE_IFACE("com.canonical.Unity.Panel.Service"); | 46 | << g_variant_get_type_string(value) << "' ('" |
161 | 47 | << type << "' was expected)"; | ||
162 | 48 | return false; | ||
163 | 49 | } | ||
164 | 50 | |||
165 | 51 | return true; | ||
166 | 52 | } | ||
167 | 43 | } // anonymous namespace | 53 | } // anonymous namespace |
168 | 44 | 54 | ||
169 | 45 | 55 | ||
170 | @@ -78,15 +88,15 @@ | |||
171 | 78 | glib::Source::UniquePtr show_entry_idle_; | 88 | glib::Source::UniquePtr show_entry_idle_; |
172 | 79 | glib::Source::UniquePtr show_appmenu_idle_; | 89 | glib::Source::UniquePtr show_appmenu_idle_; |
173 | 80 | std::vector<std::string> icon_paths_; | 90 | std::vector<std::string> icon_paths_; |
175 | 81 | std::map<std::string, EntryLocationMap> cached_locations_; | 91 | std::unordered_map<std::string, EntryLocationMap> cached_locations_; |
176 | 82 | }; | 92 | }; |
177 | 83 | 93 | ||
178 | 84 | 94 | ||
179 | 85 | // Public Methods | 95 | // Public Methods |
180 | 86 | DBusIndicators::Impl::Impl(std::string const& dbus_name, DBusIndicators* owner) | 96 | DBusIndicators::Impl::Impl(std::string const& dbus_name, DBusIndicators* owner) |
181 | 87 | : owner_(owner) | 97 | : owner_(owner) |
184 | 88 | , gproxy_(dbus_name, SERVICE_PATH, SERVICE_IFACE, | 98 | , gproxy_(dbus_name, UPS_PATH, UPS_IFACE, G_BUS_TYPE_SESSION, |
185 | 89 | G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES) | 99 | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES) |
186 | 90 | { | 100 | { |
187 | 91 | gproxy_.Connect("ReSync", sigc::mem_fun(this, &DBusIndicators::Impl::OnReSync)); | 101 | gproxy_.Connect("ReSync", sigc::mem_fun(this, &DBusIndicators::Impl::OnReSync)); |
188 | 92 | gproxy_.Connect("IconPathsChanged", sigc::mem_fun(this, &DBusIndicators::Impl::OnIconsPathChanged)); | 102 | gproxy_.Connect("IconPathsChanged", sigc::mem_fun(this, &DBusIndicators::Impl::OnIconsPathChanged)); |
189 | @@ -208,6 +218,9 @@ | |||
190 | 208 | 218 | ||
191 | 209 | void DBusIndicators::Impl::OnEntryActivated(GVariant* parameters) | 219 | void DBusIndicators::Impl::OnEntryActivated(GVariant* parameters) |
192 | 210 | { | 220 | { |
193 | 221 | if (!verify_variant_type(parameters, "(ss(iiuu))")) | ||
194 | 222 | return; | ||
195 | 223 | |||
196 | 211 | glib::String panel; | 224 | glib::String panel; |
197 | 212 | glib::String entry_id; | 225 | glib::String entry_id; |
198 | 213 | nux::Rect geo; | 226 | nux::Rect geo; |
199 | @@ -219,6 +232,9 @@ | |||
200 | 219 | 232 | ||
201 | 220 | void DBusIndicators::Impl::OnEntryActivatedRequest(GVariant* parameters) | 233 | void DBusIndicators::Impl::OnEntryActivatedRequest(GVariant* parameters) |
202 | 221 | { | 234 | { |
203 | 235 | if (!verify_variant_type(parameters, "(s)")) | ||
204 | 236 | return; | ||
205 | 237 | |||
206 | 222 | glib::String entry_name; | 238 | glib::String entry_name; |
207 | 223 | g_variant_get(parameters, "(s)", &entry_name); | 239 | g_variant_get(parameters, "(s)", &entry_name); |
208 | 224 | 240 | ||
209 | @@ -228,6 +244,9 @@ | |||
210 | 228 | 244 | ||
211 | 229 | void DBusIndicators::Impl::OnEntryShowNowChanged(GVariant* parameters) | 245 | void DBusIndicators::Impl::OnEntryShowNowChanged(GVariant* parameters) |
212 | 230 | { | 246 | { |
213 | 247 | if (!verify_variant_type(parameters, "(sb)")) | ||
214 | 248 | return; | ||
215 | 249 | |||
216 | 231 | glib::String entry_name; | 250 | glib::String entry_name; |
217 | 232 | gboolean show_now; | 251 | gboolean show_now; |
218 | 233 | g_variant_get(parameters, "(sb)", &entry_name, &show_now); | 252 | g_variant_get(parameters, "(sb)", &entry_name, &show_now); |
219 | @@ -325,9 +344,10 @@ | |||
220 | 325 | return; | 344 | return; |
221 | 326 | 345 | ||
222 | 327 | GVariantIter* iter = nullptr; | 346 | GVariantIter* iter = nullptr; |
223 | 328 | gchar* name_hint = nullptr; | ||
224 | 329 | gchar* indicator_id = nullptr; | 347 | gchar* indicator_id = nullptr; |
225 | 330 | gchar* entry_id = nullptr; | 348 | gchar* entry_id = nullptr; |
226 | 349 | gchar* name_hint = nullptr; | ||
227 | 350 | guint32 parent_window = 0; | ||
228 | 331 | gchar* label = nullptr; | 351 | gchar* label = nullptr; |
229 | 332 | gboolean label_sensitive = false; | 352 | gboolean label_sensitive = false; |
230 | 333 | gboolean label_visible = false; | 353 | gboolean label_visible = false; |
231 | @@ -337,15 +357,17 @@ | |||
232 | 337 | gboolean image_visible = false; | 357 | gboolean image_visible = false; |
233 | 338 | gint32 priority = -1; | 358 | gint32 priority = -1; |
234 | 339 | 359 | ||
241 | 340 | std::map<Indicator::Ptr, Indicator::Entries> indicators; | 360 | if (!verify_variant_type(args, "(" ENTRY_ARRAY_SIGNATURE ")")) |
242 | 341 | int wanted_idx = 0; | 361 | return; |
243 | 342 | bool any_different_idx = false; | 362 | |
244 | 343 | 363 | std::unordered_map<Indicator::Ptr, Indicator::Entries> indicators; | |
245 | 344 | g_variant_get(args, "(a(ssssbbusbbi))", &iter); | 364 | |
246 | 345 | while (g_variant_iter_loop(iter, "(ssssbbusbbi)", | 365 | g_variant_get(args, "(" ENTRY_ARRAY_SIGNATURE ")", &iter); |
247 | 366 | while (g_variant_iter_loop(iter, ENTRY_SIGNATURE, | ||
248 | 346 | &indicator_id, | 367 | &indicator_id, |
249 | 347 | &entry_id, | 368 | &entry_id, |
250 | 348 | &name_hint, | 369 | &name_hint, |
251 | 370 | &parent_window, | ||
252 | 349 | &label, | 371 | &label, |
253 | 350 | &label_sensitive, | 372 | &label_sensitive, |
254 | 351 | &label_visible, | 373 | &label_visible, |
255 | @@ -369,27 +391,20 @@ | |||
256 | 369 | // Empty entries are empty indicators. | 391 | // Empty entries are empty indicators. |
257 | 370 | if (!entry.empty()) | 392 | if (!entry.empty()) |
258 | 371 | { | 393 | { |
274 | 372 | Entry::Ptr e; | 394 | Entry::Ptr e = indicator->GetEntry(entry_id); |
275 | 373 | if (!any_different_idx) | 395 | int old_priority = e ? e->priority() : -1; |
276 | 374 | { | 396 | |
277 | 375 | // Indicators can only add or remove entries, so if | 397 | // Indicators can only add or remove entries, so if |
278 | 376 | // there is a index change we can't reuse the existing ones | 398 | // there is a priority change we can't reuse the existing ones |
279 | 377 | // after that index | 399 | if (old_priority != priority) |
280 | 378 | if (indicator->EntryIndex(entry_id) == wanted_idx) | 400 | e.reset(); |
266 | 379 | { | ||
267 | 380 | e = indicator->GetEntry(entry_id); | ||
268 | 381 | } | ||
269 | 382 | else | ||
270 | 383 | { | ||
271 | 384 | any_different_idx = true; | ||
272 | 385 | } | ||
273 | 386 | } | ||
281 | 387 | 401 | ||
282 | 388 | if (!e) | 402 | if (!e) |
283 | 389 | { | 403 | { |
287 | 390 | e = std::make_shared<Entry>(entry, name_hint, label, label_sensitive, | 404 | e = std::make_shared<Entry>(entry, name_hint, parent_window, |
288 | 391 | label_visible, image_type, image_data, | 405 | label, label_sensitive, label_visible, |
289 | 392 | image_sensitive, image_visible, priority); | 406 | image_type, image_data, image_sensitive, image_visible, |
290 | 407 | priority); | ||
291 | 393 | } | 408 | } |
292 | 394 | else | 409 | else |
293 | 395 | { | 410 | { |
294 | @@ -399,15 +414,12 @@ | |||
295 | 399 | } | 414 | } |
296 | 400 | 415 | ||
297 | 401 | entries.push_back(e); | 416 | entries.push_back(e); |
298 | 402 | ++wanted_idx; | ||
299 | 403 | } | 417 | } |
300 | 404 | } | 418 | } |
301 | 405 | g_variant_iter_free(iter); | 419 | g_variant_iter_free(iter); |
302 | 406 | 420 | ||
307 | 407 | for (auto i = indicators.begin(), end = indicators.end(); i != end; ++i) | 421 | for (auto const& i : indicators) |
308 | 408 | { | 422 | i.first->Sync(i.second); |
305 | 409 | i->first->Sync(indicators[i->first]); | ||
306 | 410 | } | ||
309 | 411 | } | 423 | } |
310 | 412 | 424 | ||
311 | 413 | void DBusIndicators::Impl::SyncGeometries(std::string const& name, | 425 | void DBusIndicators::Impl::SyncGeometries(std::string const& name, |
312 | @@ -463,7 +475,7 @@ | |||
313 | 463 | } | 475 | } |
314 | 464 | 476 | ||
315 | 465 | DBusIndicators::DBusIndicators() | 477 | DBusIndicators::DBusIndicators() |
317 | 466 | : pimpl(new Impl(SERVICE_NAME_DESKTOP, this)) | 478 | : pimpl(new Impl(UPS_NAME_DESKTOP, this)) |
318 | 467 | {} | 479 | {} |
319 | 468 | 480 | ||
320 | 469 | DBusIndicators::DBusIndicators(std::string const& dbus_name) | 481 | DBusIndicators::DBusIndicators(std::string const& dbus_name) |
321 | @@ -471,7 +483,7 @@ | |||
322 | 471 | {} | 483 | {} |
323 | 472 | 484 | ||
324 | 473 | LockScreenDBusIndicators::LockScreenDBusIndicators() | 485 | LockScreenDBusIndicators::LockScreenDBusIndicators() |
326 | 474 | : DBusIndicators(SERVICE_NAME_LOCKSCREEN) | 486 | : DBusIndicators(UPS_NAME_LOCKSCREEN) |
327 | 475 | {} | 487 | {} |
328 | 476 | 488 | ||
329 | 477 | DBusIndicators::~DBusIndicators() | 489 | DBusIndicators::~DBusIndicators() |
330 | 478 | 490 | ||
331 | === modified file 'UnityCore/GLibDBusServer.cpp' | |||
332 | --- UnityCore/GLibDBusServer.cpp 2014-04-09 13:19:33 +0000 | |||
333 | +++ UnityCore/GLibDBusServer.cpp 2015-07-15 14:19:40 +0000 | |||
334 | @@ -17,6 +17,7 @@ | |||
335 | 17 | * Authored by: Marco Trevisan (Treviño) <marco.trevisan@canonical.com> | 17 | * Authored by: Marco Trevisan (Treviño) <marco.trevisan@canonical.com> |
336 | 18 | */ | 18 | */ |
337 | 19 | 19 | ||
338 | 20 | #include <unordered_map> | ||
339 | 20 | #include <NuxCore/Logger.h> | 21 | #include <NuxCore/Logger.h> |
340 | 21 | 22 | ||
341 | 22 | #include "GLibDBusServer.h" | 23 | #include "GLibDBusServer.h" |
342 | @@ -406,8 +407,8 @@ | |||
343 | 406 | 407 | ||
344 | 407 | GDBusInterfaceVTable interface_vtable_; | 408 | GDBusInterfaceVTable interface_vtable_; |
345 | 408 | std::shared_ptr<GDBusInterfaceInfo> interface_info_; | 409 | std::shared_ptr<GDBusInterfaceInfo> interface_info_; |
348 | 409 | std::map<guint, std::string> registrations_; | 410 | std::unordered_map<guint, std::string> registrations_; |
349 | 410 | std::map<std::string, glib::Object<GDBusConnection>> connection_by_path_; | 411 | std::unordered_map<std::string, glib::Object<GDBusConnection>> connection_by_path_; |
350 | 411 | }; | 412 | }; |
351 | 412 | 413 | ||
352 | 413 | DBusObject::DBusObject(std::string const& introspection_xml, std::string const& interface_name) | 414 | DBusObject::DBusObject(std::string const& introspection_xml, std::string const& interface_name) |
353 | 414 | 415 | ||
354 | === modified file 'UnityCore/GLibSource.h' | |||
355 | --- UnityCore/GLibSource.h 2013-10-10 09:47:24 +0000 | |||
356 | +++ UnityCore/GLibSource.h 2015-07-15 14:19:40 +0000 | |||
357 | @@ -24,7 +24,7 @@ | |||
358 | 24 | #include <sigc++/sigc++.h> | 24 | #include <sigc++/sigc++.h> |
359 | 25 | #include <glib.h> | 25 | #include <glib.h> |
360 | 26 | #include <memory> | 26 | #include <memory> |
362 | 27 | #include <map> | 27 | #include <unordered_map> |
363 | 28 | 28 | ||
364 | 29 | namespace unity | 29 | namespace unity |
365 | 30 | { | 30 | { |
366 | @@ -223,7 +223,7 @@ | |||
367 | 223 | Source::Ptr GetSource(unsigned int id) const; | 223 | Source::Ptr GetSource(unsigned int id) const; |
368 | 224 | 224 | ||
369 | 225 | protected: // For testing purposes | 225 | protected: // For testing purposes |
371 | 226 | typedef std::map<std::string, Source::Ptr> SourcesMap; | 226 | typedef std::unordered_map<std::string, Source::Ptr> SourcesMap; |
372 | 227 | SourcesMap sources_; | 227 | SourcesMap sources_; |
373 | 228 | 228 | ||
374 | 229 | private: | 229 | private: |
375 | 230 | 230 | ||
376 | === modified file 'UnityCore/Indicator.cpp' | |||
377 | --- UnityCore/Indicator.cpp 2014-01-27 17:31:30 +0000 | |||
378 | +++ UnityCore/Indicator.cpp 2015-07-15 14:19:40 +0000 | |||
379 | @@ -36,7 +36,7 @@ | |||
380 | 36 | Indicator::~Indicator() | 36 | Indicator::~Indicator() |
381 | 37 | { | 37 | { |
382 | 38 | for (auto const& entry : entries_) | 38 | for (auto const& entry : entries_) |
384 | 39 | on_entry_removed.emit(entry->id()); | 39 | on_entry_removed.emit(entry); |
385 | 40 | } | 40 | } |
386 | 41 | 41 | ||
387 | 42 | std::string const& Indicator::name() const | 42 | std::string const& Indicator::name() const |
388 | @@ -51,23 +51,23 @@ | |||
389 | 51 | 51 | ||
390 | 52 | void Indicator::Sync(Indicator::Entries const& new_entries) | 52 | void Indicator::Sync(Indicator::Entries const& new_entries) |
391 | 53 | { | 53 | { |
394 | 54 | bool added = false; | 54 | bool changed = false; |
393 | 55 | Entries to_rm; | ||
395 | 56 | 55 | ||
397 | 57 | if (!entries_.empty()) | 56 | for (auto it = entries_.begin(); it != entries_.end();) |
398 | 58 | { | 57 | { |
400 | 59 | for (auto const& entry : entries_) | 58 | auto entry = *it; |
401 | 59 | |||
402 | 60 | if (std::find(new_entries.begin(), new_entries.end(), entry) == new_entries.end()) | ||
403 | 60 | { | 61 | { |
406 | 61 | if (std::find(new_entries.begin(), new_entries.end(), entry) == new_entries.end()) | 62 | auto entry_id = entry->id(); |
407 | 62 | to_rm.push_back(entry); | 63 | entries_connections_.erase(entry); |
408 | 64 | it = entries_.erase(it); | ||
409 | 65 | on_entry_removed.emit(entry); | ||
410 | 66 | changed = true; | ||
411 | 67 | continue; | ||
412 | 63 | } | 68 | } |
413 | 64 | } | ||
414 | 65 | 69 | ||
420 | 66 | for (auto const& entry : to_rm) | 70 | ++it; |
416 | 67 | { | ||
417 | 68 | entries_connections_.erase(entry); | ||
418 | 69 | on_entry_removed.emit(entry->id()); | ||
419 | 70 | entries_.remove(entry); | ||
421 | 71 | } | 71 | } |
422 | 72 | 72 | ||
423 | 73 | for (auto const& new_entry : new_entries) | 73 | for (auto const& new_entry : new_entries) |
424 | @@ -93,10 +93,10 @@ | |||
425 | 93 | entries_.push_back(new_entry); | 93 | entries_.push_back(new_entry); |
426 | 94 | on_entry_added.emit(new_entry); | 94 | on_entry_added.emit(new_entry); |
427 | 95 | 95 | ||
429 | 96 | added = true; | 96 | changed = true; |
430 | 97 | } | 97 | } |
431 | 98 | 98 | ||
433 | 99 | if (!to_rm.empty() || added) | 99 | if (changed) |
434 | 100 | updated.emit(); | 100 | updated.emit(); |
435 | 101 | } | 101 | } |
436 | 102 | 102 | ||
437 | @@ -109,21 +109,6 @@ | |||
438 | 109 | return Entry::Ptr(); | 109 | return Entry::Ptr(); |
439 | 110 | } | 110 | } |
440 | 111 | 111 | ||
441 | 112 | int Indicator::EntryIndex(std::string const& entry_id) const | ||
442 | 113 | { | ||
443 | 114 | int i = 0; | ||
444 | 115 | for (auto const& entry : entries_) | ||
445 | 116 | { | ||
446 | 117 | if (entry->id() == entry_id) | ||
447 | 118 | { | ||
448 | 119 | return i; | ||
449 | 120 | } | ||
450 | 121 | ++i; | ||
451 | 122 | } | ||
452 | 123 | |||
453 | 124 | return -1; | ||
454 | 125 | } | ||
455 | 126 | |||
456 | 127 | std::ostream& operator<<(std::ostream& out, Indicator const& i) | 112 | std::ostream& operator<<(std::ostream& out, Indicator const& i) |
457 | 128 | { | 113 | { |
458 | 129 | out << "<Indicator " << i.name() << std::endl; | 114 | out << "<Indicator " << i.name() << std::endl; |
459 | 130 | 115 | ||
460 | === modified file 'UnityCore/Indicator.h' | |||
461 | --- UnityCore/Indicator.h 2014-02-05 17:16:41 +0000 | |||
462 | +++ UnityCore/Indicator.h 2015-07-15 14:19:40 +0000 | |||
463 | @@ -38,7 +38,7 @@ | |||
464 | 38 | { | 38 | { |
465 | 39 | public: | 39 | public: |
466 | 40 | typedef std::shared_ptr<Indicator> Ptr; | 40 | typedef std::shared_ptr<Indicator> Ptr; |
468 | 41 | typedef std::list<Entry::Ptr> Entries; | 41 | typedef std::vector<Entry::Ptr> Entries; |
469 | 42 | 42 | ||
470 | 43 | Indicator(std::string const& name); | 43 | Indicator(std::string const& name); |
471 | 44 | virtual ~Indicator(); | 44 | virtual ~Indicator(); |
472 | @@ -47,15 +47,14 @@ | |||
473 | 47 | 47 | ||
474 | 48 | virtual bool IsAppmenu() const { return false; } | 48 | virtual bool IsAppmenu() const { return false; } |
475 | 49 | 49 | ||
477 | 50 | void Sync(Entries const& new_entries); | 50 | virtual void Sync(Entries const&); |
478 | 51 | Entry::Ptr GetEntry(std::string const& entry_id) const; | 51 | Entry::Ptr GetEntry(std::string const& entry_id) const; |
479 | 52 | int EntryIndex(std::string const& entry_id) const; | ||
480 | 53 | Entries const& GetEntries() const; | 52 | Entries const& GetEntries() const; |
481 | 54 | 53 | ||
482 | 55 | // Signals | 54 | // Signals |
483 | 56 | sigc::signal<void> updated; | 55 | sigc::signal<void> updated; |
484 | 57 | sigc::signal<void, Entry::Ptr const&> on_entry_added; | 56 | sigc::signal<void, Entry::Ptr const&> on_entry_added; |
486 | 58 | sigc::signal<void, std::string const&> on_entry_removed; | 57 | sigc::signal<void, Entry::Ptr const&> on_entry_removed; |
487 | 59 | sigc::signal<void, std::string const&, unsigned, int, int, unsigned> on_show_menu; | 58 | sigc::signal<void, std::string const&, unsigned, int, int, unsigned> on_show_menu; |
488 | 60 | sigc::signal<void, std::string const&> on_secondary_activate; | 59 | sigc::signal<void, std::string const&> on_secondary_activate; |
489 | 61 | sigc::signal<void, std::string const&, int> on_scroll; | 60 | sigc::signal<void, std::string const&, int> on_scroll; |
490 | 62 | 61 | ||
491 | === modified file 'UnityCore/IndicatorEntry.cpp' | |||
492 | --- UnityCore/IndicatorEntry.cpp 2014-02-07 23:54:15 +0000 | |||
493 | +++ UnityCore/IndicatorEntry.cpp 2015-07-15 14:19:40 +0000 | |||
494 | @@ -30,6 +30,7 @@ | |||
495 | 30 | 30 | ||
496 | 31 | Entry::Entry(std::string const& id, | 31 | Entry::Entry(std::string const& id, |
497 | 32 | std::string const& name_hint, | 32 | std::string const& name_hint, |
498 | 33 | uint32_t parent_window, | ||
499 | 33 | std::string const& label, | 34 | std::string const& label, |
500 | 34 | bool label_sensitive, | 35 | bool label_sensitive, |
501 | 35 | bool label_visible, | 36 | bool label_visible, |
502 | @@ -40,6 +41,7 @@ | |||
503 | 40 | int priority) | 41 | int priority) |
504 | 41 | : id_(id) | 42 | : id_(id) |
505 | 42 | , name_hint_(name_hint) | 43 | , name_hint_(name_hint) |
506 | 44 | , parent_window_(parent_window) | ||
507 | 43 | , label_(label) | 45 | , label_(label) |
508 | 44 | , label_visible_(label_visible) | 46 | , label_visible_(label_visible) |
509 | 45 | , label_sensitive_(label_sensitive) | 47 | , label_sensitive_(label_sensitive) |
510 | @@ -52,9 +54,10 @@ | |||
511 | 52 | , active_(false) | 54 | , active_(false) |
512 | 53 | {} | 55 | {} |
513 | 54 | 56 | ||
515 | 55 | Entry::Entry(std::string const& id, std::string const& name_hint) | 57 | Entry::Entry(std::string const& id, std::string const& name_hint, uint32_t parent_window) |
516 | 56 | : id_(id) | 58 | : id_(id) |
517 | 57 | , name_hint_(name_hint) | 59 | , name_hint_(name_hint) |
518 | 60 | , parent_window_(parent_window) | ||
519 | 58 | , label_visible_(false) | 61 | , label_visible_(false) |
520 | 59 | , label_sensitive_(false) | 62 | , label_sensitive_(false) |
521 | 60 | , image_type_(0) | 63 | , image_type_(0) |
522 | @@ -65,14 +68,19 @@ | |||
523 | 65 | , active_(false) | 68 | , active_(false) |
524 | 66 | {} | 69 | {} |
525 | 67 | 70 | ||
526 | 71 | std::string const& Entry::id() const | ||
527 | 72 | { | ||
528 | 73 | return id_; | ||
529 | 74 | } | ||
530 | 75 | |||
531 | 68 | std::string const& Entry::name_hint() const | 76 | std::string const& Entry::name_hint() const |
532 | 69 | { | 77 | { |
533 | 70 | return name_hint_; | 78 | return name_hint_; |
534 | 71 | } | 79 | } |
535 | 72 | 80 | ||
537 | 73 | std::string const& Entry::id() const | 81 | uint32_t Entry::parent_window() const |
538 | 74 | { | 82 | { |
540 | 75 | return id_; | 83 | return parent_window_; |
541 | 76 | } | 84 | } |
542 | 77 | 85 | ||
543 | 78 | std::string const& Entry::label() const | 86 | std::string const& Entry::label() const |
544 | @@ -199,6 +207,7 @@ | |||
545 | 199 | 207 | ||
546 | 200 | id_ = rhs.id_; | 208 | id_ = rhs.id_; |
547 | 201 | name_hint_ = rhs.name_hint_; | 209 | name_hint_ = rhs.name_hint_; |
548 | 210 | parent_window_ = rhs.parent_window_; | ||
549 | 202 | label_ = rhs.label_; | 211 | label_ = rhs.label_; |
550 | 203 | label_sensitive_ = rhs.label_sensitive_; | 212 | label_sensitive_ = rhs.label_sensitive_; |
551 | 204 | label_visible_ = rhs.label_visible_; | 213 | label_visible_ = rhs.label_visible_; |
552 | @@ -258,7 +267,7 @@ | |||
553 | 258 | 267 | ||
554 | 259 | void Entry::ShowMenu(int x, int y, unsigned button) | 268 | void Entry::ShowMenu(int x, int y, unsigned button) |
555 | 260 | { | 269 | { |
557 | 261 | ShowMenu(0, x, y, button); | 270 | ShowMenu(parent_window_, x, y, button); |
558 | 262 | } | 271 | } |
559 | 263 | 272 | ||
560 | 264 | void Entry::ShowMenu(unsigned int xid, int x, int y, unsigned button) | 273 | void Entry::ShowMenu(unsigned int xid, int x, int y, unsigned button) |
561 | @@ -278,7 +287,8 @@ | |||
562 | 278 | 287 | ||
563 | 279 | std::ostream& operator<<(std::ostream& out, Entry const& e) | 288 | std::ostream& operator<<(std::ostream& out, Entry const& e) |
564 | 280 | { | 289 | { |
566 | 281 | out << "<indicator::Entry " << e.id() << " hint: '" << e.name_hint() << "' " | 290 | out << "<indicator::Entry " << e.id() << " hint: '" << e.name_hint() << "'" |
567 | 291 | << " parent window: " << e.parent_window() | ||
568 | 282 | << std::boolalpha | 292 | << std::boolalpha |
569 | 283 | << " \"" << e.label() << "\" (" | 293 | << " \"" << e.label() << "\" (" |
570 | 284 | << e.label_sensitive() << ", " << e.label_visible() << ") image (" | 294 | << e.label_sensitive() << ", " << e.label_visible() << ") image (" |
571 | 285 | 295 | ||
572 | === modified file 'UnityCore/IndicatorEntry.h' | |||
573 | --- UnityCore/IndicatorEntry.h 2014-02-05 17:16:41 +0000 | |||
574 | +++ UnityCore/IndicatorEntry.h 2015-07-15 14:19:40 +0000 | |||
575 | @@ -44,9 +44,10 @@ | |||
576 | 44 | public: | 44 | public: |
577 | 45 | typedef std::shared_ptr<Entry> Ptr; | 45 | typedef std::shared_ptr<Entry> Ptr; |
578 | 46 | 46 | ||
580 | 47 | Entry(std::string const& id, std::string const& name_hint = ""); | 47 | Entry(std::string const& id, std::string const& name_hint = "", uint32_t parent_window = 0); |
581 | 48 | Entry(std::string const& id, | 48 | Entry(std::string const& id, |
582 | 49 | std::string const& name_hint, | 49 | std::string const& name_hint, |
583 | 50 | uint32_t parent_window, | ||
584 | 50 | std::string const& label, | 51 | std::string const& label, |
585 | 51 | bool label_sensitive, | 52 | bool label_sensitive, |
586 | 52 | bool label_visible, | 53 | bool label_visible, |
587 | @@ -61,6 +62,7 @@ | |||
588 | 61 | 62 | ||
589 | 62 | std::string const& id() const; | 63 | std::string const& id() const; |
590 | 63 | std::string const& name_hint() const; | 64 | std::string const& name_hint() const; |
591 | 65 | uint32_t parent_window() const; | ||
592 | 64 | 66 | ||
593 | 65 | void set_image(int type, std::string const& data, bool sensitive, bool visible); | 67 | void set_image(int type, std::string const& data, bool sensitive, bool visible); |
594 | 66 | bool image_visible() const; | 68 | bool image_visible() const; |
595 | @@ -114,6 +116,7 @@ | |||
596 | 114 | private: | 116 | private: |
597 | 115 | std::string id_; | 117 | std::string id_; |
598 | 116 | std::string name_hint_; | 118 | std::string name_hint_; |
599 | 119 | uint32_t parent_window_; | ||
600 | 117 | 120 | ||
601 | 118 | std::string label_; | 121 | std::string label_; |
602 | 119 | bool label_visible_; | 122 | bool label_visible_; |
603 | 120 | 123 | ||
604 | === modified file 'UnityCore/Indicators.cpp' | |||
605 | --- UnityCore/Indicators.cpp 2014-02-11 03:11:47 +0000 | |||
606 | +++ UnityCore/Indicators.cpp 2015-07-15 14:19:40 +0000 | |||
607 | @@ -20,6 +20,7 @@ | |||
608 | 20 | 20 | ||
609 | 21 | #include "Indicators.h" | 21 | #include "Indicators.h" |
610 | 22 | #include "AppmenuIndicator.h" | 22 | #include "AppmenuIndicator.h" |
611 | 23 | #include "services/panel-service-private.h" | ||
612 | 23 | 24 | ||
613 | 24 | namespace unity | 25 | namespace unity |
614 | 25 | { | 26 | { |
615 | @@ -143,7 +144,7 @@ | |||
616 | 143 | if (indicator) | 144 | if (indicator) |
617 | 144 | return indicator; | 145 | return indicator; |
618 | 145 | 146 | ||
620 | 146 | if (name == "libappmenu.so") | 147 | if (name == APPMENU_INDICATOR_NAME) |
621 | 147 | { | 148 | { |
622 | 148 | auto appmenu = std::make_shared<AppmenuIndicator>(name); | 149 | auto appmenu = std::make_shared<AppmenuIndicator>(name); |
623 | 149 | appmenu->on_show_appmenu.connect(sigc::mem_fun(owner_, &Indicators::OnShowAppMenu)); | 150 | appmenu->on_show_appmenu.connect(sigc::mem_fun(owner_, &Indicators::OnShowAppMenu)); |
624 | 150 | 151 | ||
625 | === modified file 'UnityCore/pch/unitycore_pch.hh' | |||
626 | --- UnityCore/pch/unitycore_pch.hh 2014-01-28 15:39:57 +0000 | |||
627 | +++ UnityCore/pch/unitycore_pch.hh 2015-07-15 14:19:40 +0000 | |||
628 | @@ -29,6 +29,7 @@ | |||
629 | 29 | #include <map> | 29 | #include <map> |
630 | 30 | #include <memory> | 30 | #include <memory> |
631 | 31 | #include <unordered_map> | 31 | #include <unordered_map> |
632 | 32 | #include <functional> | ||
633 | 32 | 33 | ||
634 | 33 | #include <boost/utility.hpp> | 34 | #include <boost/utility.hpp> |
635 | 34 | #include <dee.h> | 35 | #include <dee.h> |
636 | 35 | 36 | ||
637 | === modified file 'com.canonical.Unity.gschema.xml' | |||
638 | --- com.canonical.Unity.gschema.xml 2015-03-12 00:57:05 +0000 | |||
639 | +++ com.canonical.Unity.gschema.xml 2015-07-15 14:19:40 +0000 | |||
640 | @@ -158,5 +158,11 @@ | |||
641 | 158 | a window by double-clicking on its menus if the second click happens before the | 158 | a window by double-clicking on its menus if the second click happens before the |
642 | 159 | specified value of ms is elapsed</description> | 159 | specified value of ms is elapsed</description> |
643 | 160 | </key> | 160 | </key> |
644 | 161 | <key type="b" name="unfocused-windows-popup"> | ||
645 | 162 | <default>true</default> | ||
646 | 163 | <summary>Whether to pop-up a menu when clicking over unfocused windows entries</summary> | ||
647 | 164 | <description>By disabling this setting you can make unity to only focus a window | ||
648 | 165 | when clicking over unfocused menu entries</description> | ||
649 | 166 | </key> | ||
650 | 161 | </schema> | 167 | </schema> |
651 | 162 | </schemalist> | 168 | </schemalist> |
652 | 163 | 169 | ||
653 | === modified file 'dash/DashView.h' | |||
654 | --- dash/DashView.h 2014-07-24 13:49:53 +0000 | |||
655 | +++ dash/DashView.h 2015-07-15 14:19:40 +0000 | |||
656 | @@ -56,7 +56,7 @@ | |||
657 | 56 | class DashView : public nux::View, public unity::debug::Introspectable | 56 | class DashView : public nux::View, public unity::debug::Introspectable |
658 | 57 | { | 57 | { |
659 | 58 | NUX_DECLARE_OBJECT_TYPE(DashView, nux::View); | 58 | NUX_DECLARE_OBJECT_TYPE(DashView, nux::View); |
661 | 59 | typedef std::map<std::string, nux::ObjectPtr<ScopeView>> ScopeViews; | 59 | typedef std::unordered_map<std::string, nux::ObjectPtr<ScopeView>> ScopeViews; |
662 | 60 | 60 | ||
663 | 61 | public: | 61 | public: |
664 | 62 | DashView(Scopes::Ptr const& scopes, ApplicationStarter::Ptr const& application_starter); | 62 | DashView(Scopes::Ptr const& scopes, ApplicationStarter::Ptr const& application_starter); |
665 | 63 | 63 | ||
666 | === modified file 'dash/ScopeView.h' | |||
667 | --- dash/ScopeView.h 2014-08-06 14:09:30 +0000 | |||
668 | +++ dash/ScopeView.h 2015-07-15 14:19:40 +0000 | |||
669 | @@ -35,6 +35,7 @@ | |||
670 | 35 | #include "unity-shared/Introspectable.h" | 35 | #include "unity-shared/Introspectable.h" |
671 | 36 | #include "PlacesGroup.h" | 36 | #include "PlacesGroup.h" |
672 | 37 | #include "ResultViewGrid.h" | 37 | #include "ResultViewGrid.h" |
673 | 38 | #include "unity-shared/NuxObjectPtrHash.h" | ||
674 | 38 | #include "unity-shared/UBusWrapper.h" | 39 | #include "unity-shared/UBusWrapper.h" |
675 | 39 | 40 | ||
676 | 40 | namespace unity | 41 | namespace unity |
677 | @@ -48,7 +49,7 @@ | |||
678 | 48 | { | 49 | { |
679 | 49 | NUX_DECLARE_OBJECT_TYPE(ScopeView, nux::View); | 50 | NUX_DECLARE_OBJECT_TYPE(ScopeView, nux::View); |
680 | 50 | typedef std::vector<PlacesGroup::Ptr> CategoryGroups; | 51 | typedef std::vector<PlacesGroup::Ptr> CategoryGroups; |
682 | 51 | typedef std::map<PlacesGroup::Ptr, unsigned int> ResultCounts; | 52 | typedef std::unordered_map<PlacesGroup::Ptr, unsigned int> ResultCounts; |
683 | 52 | 53 | ||
684 | 53 | public: | 54 | public: |
685 | 54 | ScopeView(Scope::Ptr const& scope, nux::Area* show_filters); | 55 | ScopeView(Scope::Ptr const& scope, nux::Area* show_filters); |
686 | 55 | 56 | ||
687 | === modified file 'debian/control' | |||
688 | --- debian/control 2015-03-11 18:11:24 +0000 | |||
689 | +++ debian/control 2015-07-15 14:19:40 +0000 | |||
690 | @@ -80,7 +80,7 @@ | |||
691 | 80 | Provides: indicator-renderer | 80 | Provides: indicator-renderer |
692 | 81 | Recommends: unity-control-center, | 81 | Recommends: unity-control-center, |
693 | 82 | ${unity-default-masterscopes} | 82 | ${unity-default-masterscopes} |
695 | 83 | indicator-appmenu, | 83 | indicator-appmenu (>= 15.02.0), |
696 | 84 | indicator-application, | 84 | indicator-application, |
697 | 85 | indicator-sound, | 85 | indicator-sound, |
698 | 86 | indicator-bluetooth, | 86 | indicator-bluetooth, |
699 | 87 | 87 | ||
700 | === modified file 'decorations/DecoratedWindow.cpp' | |||
701 | --- decorations/DecoratedWindow.cpp 2015-03-12 00:57:05 +0000 | |||
702 | +++ decorations/DecoratedWindow.cpp 2015-07-15 14:19:40 +0000 | |||
703 | @@ -52,17 +52,13 @@ | |||
704 | 52 | , deco_elements_(cu::DecorationElement::NONE) | 52 | , deco_elements_(cu::DecorationElement::NONE) |
705 | 53 | , last_mwm_decor_(win_->mwmDecor()) | 53 | , last_mwm_decor_(win_->mwmDecor()) |
706 | 54 | , last_actions_(win_->actions()) | 54 | , last_actions_(win_->actions()) |
707 | 55 | , panel_id_(MENUS_PANEL_NAME + std::to_string(win_->id())) | ||
708 | 55 | , cv_(Settings::Instance().em()) | 56 | , cv_(Settings::Instance().em()) |
709 | 56 | { | 57 | { |
710 | 57 | active.changed.connect([this] (bool active) { | 58 | active.changed.connect([this] (bool active) { |
711 | 58 | bg_textures_.clear(); | 59 | bg_textures_.clear(); |
712 | 59 | if (top_layout_) | 60 | if (top_layout_) |
713 | 60 | { | ||
714 | 61 | top_layout_->focused = active; | 61 | top_layout_->focused = active; |
715 | 62 | |||
716 | 63 | if (!active) | ||
717 | 64 | UnsetAppMenu(); | ||
718 | 65 | } | ||
719 | 66 | RedrawDecorations(); | 62 | RedrawDecorations(); |
720 | 67 | }); | 63 | }); |
721 | 68 | 64 | ||
722 | @@ -703,7 +699,7 @@ | |||
723 | 703 | 699 | ||
724 | 704 | void Window::Impl::SetupAppMenu() | 700 | void Window::Impl::SetupAppMenu() |
725 | 705 | { | 701 | { |
727 | 706 | if (!active() || !top_layout_) | 702 | if (!top_layout_) |
728 | 707 | return; | 703 | return; |
729 | 708 | 704 | ||
730 | 709 | auto const& menu_manager = manager_->impl_->menu_manager_; | 705 | auto const& menu_manager = manager_->impl_->menu_manager_; |
731 | @@ -718,8 +714,11 @@ | |||
732 | 718 | 714 | ||
733 | 719 | auto menus = std::make_shared<MenuLayout>(menu_manager, win_); | 715 | auto menus = std::make_shared<MenuLayout>(menu_manager, win_); |
734 | 720 | menus->Setup(); | 716 | menus->Setup(); |
735 | 717 | |||
736 | 718 | if (menus->Items().empty()) | ||
737 | 719 | return; | ||
738 | 720 | |||
739 | 721 | menus_ = menus; | 721 | menus_ = menus; |
740 | 722 | |||
741 | 723 | auto const& grab_edge = grab_edge_.lock(); | 722 | auto const& grab_edge = grab_edge_.lock(); |
742 | 724 | sliding_layout->SetInputItem(menus); | 723 | sliding_layout->SetInputItem(menus); |
743 | 725 | sliding_layout->fadein = menu_manager->fadein(); | 724 | sliding_layout->fadein = menu_manager->fadein(); |
744 | @@ -761,13 +760,18 @@ | |||
745 | 761 | sliding_layout->mouse_owner = grab_edge_->mouse_owner(); | 760 | sliding_layout->mouse_owner = grab_edge_->mouse_owner(); |
746 | 762 | } | 761 | } |
747 | 763 | 762 | ||
748 | 763 | inline std::string const& Window::Impl::GetMenusPanelID() const | ||
749 | 764 | { | ||
750 | 765 | return panel_id_; | ||
751 | 766 | } | ||
752 | 767 | |||
753 | 764 | void Window::Impl::UnsetAppMenu() | 768 | void Window::Impl::UnsetAppMenu() |
754 | 765 | { | 769 | { |
755 | 766 | if (!menus_) | 770 | if (!menus_) |
756 | 767 | return; | 771 | return; |
757 | 768 | 772 | ||
758 | 769 | auto const& indicators = manager_->impl_->menu_manager_->Indicators(); | 773 | auto const& indicators = manager_->impl_->menu_manager_->Indicators(); |
760 | 770 | indicators->SyncGeometries(MENUS_PANEL_NAME, indicator::EntryLocationMap()); | 774 | indicators->SyncGeometries(GetMenusPanelID(), indicator::EntryLocationMap()); |
761 | 771 | sliding_layout_->SetInputItem(nullptr); | 775 | sliding_layout_->SetInputItem(nullptr); |
762 | 772 | grab_mouse_changed_->disconnect(); | 776 | grab_mouse_changed_->disconnect(); |
763 | 773 | } | 777 | } |
764 | @@ -780,7 +784,7 @@ | |||
765 | 780 | auto const& indicators = manager_->impl_->menu_manager_->Indicators(); | 784 | auto const& indicators = manager_->impl_->menu_manager_->Indicators(); |
766 | 781 | indicator::EntryLocationMap map; | 785 | indicator::EntryLocationMap map; |
767 | 782 | menus_->ChildrenGeometries(map); | 786 | menus_->ChildrenGeometries(map); |
769 | 783 | indicators->SyncGeometries(MENUS_PANEL_NAME, map); | 787 | indicators->SyncGeometries(GetMenusPanelID(), map); |
770 | 784 | } | 788 | } |
771 | 785 | 789 | ||
772 | 786 | bool Window::Impl::ActivateMenu(std::string const& entry_id) | 790 | bool Window::Impl::ActivateMenu(std::string const& entry_id) |
773 | 787 | 791 | ||
774 | === modified file 'decorations/DecorationsManager.cpp' | |||
775 | --- decorations/DecorationsManager.cpp 2015-03-12 00:57:05 +0000 | |||
776 | +++ decorations/DecorationsManager.cpp 2015-07-15 14:19:40 +0000 | |||
777 | @@ -144,27 +144,24 @@ | |||
778 | 144 | return; | 144 | return; |
779 | 145 | } | 145 | } |
780 | 146 | 146 | ||
787 | 147 | appmenu->active_window = screen->activeWindow(); | 147 | for (auto const& win : windows_) |
788 | 148 | 148 | win.second->impl_->SetupAppMenu(); | |
783 | 149 | auto setup_active_window = [this] { | ||
784 | 150 | if (Window::Ptr const& active_win = active_deco_win_.lock()) | ||
785 | 151 | active_win->impl_->SetupAppMenu(); | ||
786 | 152 | }; | ||
789 | 153 | 149 | ||
790 | 154 | menu_connections_.Remove(appmenu_connection_); | 150 | menu_connections_.Remove(appmenu_connection_); |
793 | 155 | appmenu_connection_ = menu_connections_.Add(appmenu->updated.connect(setup_active_window)); | 151 | appmenu_connection_ = menu_connections_.Add(appmenu->updated_win.connect([this] (uint32_t xid) { |
794 | 156 | setup_active_window(); | 152 | if (Window::Ptr const& win = GetWindowByXid(xid)) |
795 | 153 | win->impl_->SetupAppMenu(); | ||
796 | 154 | })); | ||
797 | 157 | } | 155 | } |
798 | 158 | 156 | ||
799 | 159 | void Manager::Impl::UnsetAppMenu() | 157 | void Manager::Impl::UnsetAppMenu() |
800 | 160 | { | 158 | { |
801 | 161 | menu_connections_.Remove(appmenu_connection_); | 159 | menu_connections_.Remove(appmenu_connection_); |
802 | 162 | auto const& active_win = active_deco_win_.lock(); | ||
803 | 163 | 160 | ||
805 | 164 | if (active_win) | 161 | for (auto const& win : windows_) |
806 | 165 | { | 162 | { |
809 | 166 | active_win->impl_->UnsetAppMenu(); | 163 | win.second->impl_->UnsetAppMenu(); |
810 | 167 | active_win->impl_->Damage(); | 164 | win.second->impl_->Damage(); |
811 | 168 | } | 165 | } |
812 | 169 | } | 166 | } |
813 | 170 | 167 | ||
814 | @@ -268,9 +265,6 @@ | |||
815 | 268 | 265 | ||
816 | 269 | if (new_active) | 266 | if (new_active) |
817 | 270 | new_active->impl_->active = true; | 267 | new_active->impl_->active = true; |
818 | 271 | |||
819 | 272 | if (indicator::AppmenuIndicator::Ptr const& appmenu = menu_manager_->AppMenu()) | ||
820 | 273 | appmenu->active_window = active_xid; | ||
821 | 274 | } | 268 | } |
822 | 275 | else if (event->xproperty.atom == Atoms::mwmHints || | 269 | else if (event->xproperty.atom == Atoms::mwmHints || |
823 | 276 | event->xproperty.atom == Atoms::wmAllowedActions) | 270 | event->xproperty.atom == Atoms::wmAllowedActions) |
824 | @@ -311,6 +305,9 @@ | |||
825 | 311 | 305 | ||
826 | 312 | bool Manager::Impl::HandleFrameEvent(XEvent* event) | 306 | bool Manager::Impl::HandleFrameEvent(XEvent* event) |
827 | 313 | { | 307 | { |
828 | 308 | if (WindowManager::Default().IsScaleActive()) | ||
829 | 309 | return false; | ||
830 | 310 | |||
831 | 314 | auto const& win = GetWindowByFrame(event->xany.window); | 311 | auto const& win = GetWindowByFrame(event->xany.window); |
832 | 315 | 312 | ||
833 | 316 | // ButtonRelease events might happen also outside the frame window, in this | 313 | // ButtonRelease events might happen also outside the frame window, in this |
834 | 317 | 314 | ||
835 | === modified file 'decorations/DecorationsMenuDropdown.cpp' | |||
836 | --- decorations/DecorationsMenuDropdown.cpp 2014-02-24 23:53:50 +0000 | |||
837 | +++ decorations/DecorationsMenuDropdown.cpp 2015-07-15 14:19:40 +0000 | |||
838 | @@ -33,7 +33,7 @@ | |||
839 | 33 | using namespace indicator; | 33 | using namespace indicator; |
840 | 34 | 34 | ||
841 | 35 | MenuDropdown::MenuDropdown(Indicators::Ptr const& indicators, CompWindow* win) | 35 | MenuDropdown::MenuDropdown(Indicators::Ptr const& indicators, CompWindow* win) |
843 | 36 | : MenuEntry(std::make_shared<Entry>("LIM-dropdown"), win) | 36 | : MenuEntry(std::make_shared<Entry>("LIM"+std::to_string(win->id())+"-dropdown"), win) |
844 | 37 | , indicators_(indicators) | 37 | , indicators_(indicators) |
845 | 38 | { | 38 | { |
846 | 39 | natural_.width = ICON_SIZE; | 39 | natural_.width = ICON_SIZE; |
847 | @@ -53,7 +53,7 @@ | |||
848 | 53 | for (auto const& child : children_) | 53 | for (auto const& child : children_) |
849 | 54 | entries.push_back(child->GetEntry()); | 54 | entries.push_back(child->GetEntry()); |
850 | 55 | 55 | ||
852 | 56 | indicators_->ShowEntriesDropdown(entries, active_, 0, geo.x(), geo.y2()); | 56 | indicators_->ShowEntriesDropdown(entries, active_, grab_.Window()->id(), geo.x(), geo.y2()); |
853 | 57 | } | 57 | } |
854 | 58 | 58 | ||
855 | 59 | bool MenuDropdown::ActivateChild(MenuEntry::Ptr const& child) | 59 | bool MenuDropdown::ActivateChild(MenuEntry::Ptr const& child) |
856 | @@ -118,7 +118,8 @@ | |||
857 | 118 | 118 | ||
858 | 119 | void MenuDropdown::RenderTexture() | 119 | void MenuDropdown::RenderTexture() |
859 | 120 | { | 120 | { |
861 | 121 | WidgetState state = active() ? WidgetState::PRELIGHT : WidgetState::NORMAL; | 121 | WidgetState normal_state = focused() ? WidgetState::NORMAL : WidgetState::BACKDROP; |
862 | 122 | WidgetState state = active() ? WidgetState::PRELIGHT : normal_state; | ||
863 | 122 | cu::CairoContext icon_ctx(GetNaturalWidth(), GetNaturalHeight(), scale()); | 123 | cu::CairoContext icon_ctx(GetNaturalWidth(), GetNaturalHeight(), scale()); |
864 | 123 | 124 | ||
865 | 124 | if (state == WidgetState::PRELIGHT) | 125 | if (state == WidgetState::PRELIGHT) |
866 | 125 | 126 | ||
867 | === modified file 'decorations/DecorationsMenuEntry.cpp' | |||
868 | --- decorations/DecorationsMenuEntry.cpp 2014-03-31 18:36:33 +0000 | |||
869 | +++ decorations/DecorationsMenuEntry.cpp 2015-07-15 14:19:40 +0000 | |||
870 | @@ -37,11 +37,13 @@ | |||
871 | 37 | , in_dropdown(false) | 37 | , in_dropdown(false) |
872 | 38 | , entry_(entry) | 38 | , entry_(entry) |
873 | 39 | , grab_(win, true) | 39 | , grab_(win, true) |
874 | 40 | , show_menu_enabled_(true) | ||
875 | 40 | { | 41 | { |
876 | 41 | entry_->updated.connect(sigc::mem_fun(this, &MenuEntry::EntryUpdated)); | 42 | entry_->updated.connect(sigc::mem_fun(this, &MenuEntry::EntryUpdated)); |
877 | 42 | horizontal_padding.changed.connect(sigc::hide(sigc::mem_fun(this, &MenuEntry::RenderTexture))); | 43 | horizontal_padding.changed.connect(sigc::hide(sigc::mem_fun(this, &MenuEntry::RenderTexture))); |
878 | 43 | vertical_padding.changed.connect(sigc::hide(sigc::mem_fun(this, &MenuEntry::RenderTexture))); | 44 | vertical_padding.changed.connect(sigc::hide(sigc::mem_fun(this, &MenuEntry::RenderTexture))); |
879 | 44 | scale.changed.connect(sigc::hide(sigc::mem_fun(this, &MenuEntry::RenderTexture))); | 45 | scale.changed.connect(sigc::hide(sigc::mem_fun(this, &MenuEntry::RenderTexture))); |
880 | 46 | focused.changed.connect(sigc::hide(sigc::mem_fun(this, &MenuEntry::RenderTexture))); | ||
881 | 45 | in_dropdown.changed.connect([this] (bool in) { visible = entry_->visible() && !in; }); | 47 | in_dropdown.changed.connect([this] (bool in) { visible = entry_->visible() && !in; }); |
882 | 46 | EntryUpdated(); | 48 | EntryUpdated(); |
883 | 47 | } | 49 | } |
884 | @@ -63,7 +65,7 @@ | |||
885 | 63 | 65 | ||
886 | 64 | void MenuEntry::RenderTexture() | 66 | void MenuEntry::RenderTexture() |
887 | 65 | { | 67 | { |
889 | 66 | WidgetState state = WidgetState::NORMAL; | 68 | WidgetState state = focused() ? WidgetState::NORMAL : WidgetState::BACKDROP; |
890 | 67 | 69 | ||
891 | 68 | if (show_now()) | 70 | if (show_now()) |
892 | 69 | state = WidgetState::PRESSED; | 71 | state = WidgetState::PRESSED; |
893 | @@ -120,10 +122,17 @@ | |||
894 | 120 | { | 122 | { |
895 | 121 | button_up_timer_.reset(); | 123 | button_up_timer_.reset(); |
896 | 122 | grab_.ButtonDownEvent(p, button, timestamp); | 124 | grab_.ButtonDownEvent(p, button, timestamp); |
897 | 125 | show_menu_enabled_ = (focused() || Settings::Instance().lim_unfocused_popup()); | ||
898 | 123 | } | 126 | } |
899 | 124 | 127 | ||
900 | 125 | void MenuEntry::ButtonUpEvent(CompPoint const& p, unsigned button, Time timestamp) | 128 | void MenuEntry::ButtonUpEvent(CompPoint const& p, unsigned button, Time timestamp) |
901 | 126 | { | 129 | { |
902 | 130 | if (!show_menu_enabled_) | ||
903 | 131 | { | ||
904 | 132 | grab_.ButtonUpEvent(p, button, timestamp); | ||
905 | 133 | return; | ||
906 | 134 | } | ||
907 | 135 | |||
908 | 127 | if (button == 1 && !grab_.IsGrabbed()) | 136 | if (button == 1 && !grab_.IsGrabbed()) |
909 | 128 | { | 137 | { |
910 | 129 | unsigned double_click_wait = Settings::Instance().lim_double_click_wait(); | 138 | unsigned double_click_wait = Settings::Instance().lim_double_click_wait(); |
911 | @@ -143,7 +152,8 @@ | |||
912 | 143 | 152 | ||
913 | 144 | if (button == 2 || button == 3) | 153 | if (button == 2 || button == 3) |
914 | 145 | { | 154 | { |
916 | 146 | ShowMenu(button); | 155 | if (Style::Get()->WindowManagerAction(WMEvent(button)) == WMAction::NONE) |
917 | 156 | ShowMenu(button); | ||
918 | 147 | } | 157 | } |
919 | 148 | 158 | ||
920 | 149 | grab_.ButtonUpEvent(p, button, timestamp); | 159 | grab_.ButtonUpEvent(p, button, timestamp); |
921 | 150 | 160 | ||
922 | === modified file 'decorations/DecorationsMenuEntry.h' | |||
923 | --- decorations/DecorationsMenuEntry.h 2014-02-27 07:10:31 +0000 | |||
924 | +++ decorations/DecorationsMenuEntry.h 2015-07-15 14:19:40 +0000 | |||
925 | @@ -63,10 +63,11 @@ | |||
926 | 63 | 63 | ||
927 | 64 | protected: | 64 | protected: |
928 | 65 | indicator::Entry::Ptr entry_; | 65 | indicator::Entry::Ptr entry_; |
929 | 66 | GrabEdge grab_; | ||
930 | 66 | 67 | ||
931 | 67 | private: | 68 | private: |
932 | 69 | bool show_menu_enabled_; | ||
933 | 68 | glib::Source::UniquePtr button_up_timer_; | 70 | glib::Source::UniquePtr button_up_timer_; |
934 | 69 | GrabEdge grab_; | ||
935 | 70 | }; | 71 | }; |
936 | 71 | 72 | ||
937 | 72 | } // decoration namespace | 73 | } // decoration namespace |
938 | 73 | 74 | ||
939 | === modified file 'decorations/DecorationsMenuLayout.cpp' | |||
940 | --- decorations/DecorationsMenuLayout.cpp 2014-02-26 00:14:46 +0000 | |||
941 | +++ decorations/DecorationsMenuLayout.cpp 2015-07-15 14:19:40 +0000 | |||
942 | @@ -35,7 +35,9 @@ | |||
943 | 35 | , win_(win) | 35 | , win_(win) |
944 | 36 | , last_pointer_(-1, -1) | 36 | , last_pointer_(-1, -1) |
945 | 37 | , dropdown_(std::make_shared<MenuDropdown>(menu_manager_->Indicators(), win)) | 37 | , dropdown_(std::make_shared<MenuDropdown>(menu_manager_->Indicators(), win)) |
947 | 38 | {} | 38 | { |
948 | 39 | visible = false; | ||
949 | 40 | } | ||
950 | 39 | 41 | ||
951 | 40 | void MenuLayout::Setup() | 42 | void MenuLayout::Setup() |
952 | 41 | { | 43 | { |
953 | @@ -56,7 +58,7 @@ | |||
954 | 56 | dropdown_->active.changed.connect(active_cb); | 58 | dropdown_->active.changed.connect(active_cb); |
955 | 57 | dropdown_->show_now.changed.connect(show_now_cb); | 59 | dropdown_->show_now.changed.connect(show_now_cb); |
956 | 58 | 60 | ||
958 | 59 | for (auto const& entry : menu_manager_->AppMenu()->GetEntries()) | 61 | for (auto const& entry : menu_manager_->AppMenu()->GetEntriesForWindow(win_->id())) |
959 | 60 | { | 62 | { |
960 | 61 | auto menu = std::make_shared<MenuEntry>(entry, win_); | 63 | auto menu = std::make_shared<MenuEntry>(entry, win_); |
961 | 62 | menu->mouse_owner.changed.connect(ownership_cb); | 64 | menu->mouse_owner.changed.connect(ownership_cb); |
962 | @@ -65,7 +67,24 @@ | |||
963 | 65 | menu->focused = focused(); | 67 | menu->focused = focused(); |
964 | 66 | menu->scale = scale(); | 68 | menu->scale = scale(); |
965 | 67 | menu->SetParent(shared_from_this()); | 69 | menu->SetParent(shared_from_this()); |
967 | 68 | items_.push_back(menu); | 70 | |
968 | 71 | if (items_.empty() || entry->priority() < 0) | ||
969 | 72 | { | ||
970 | 73 | items_.push_back(menu); | ||
971 | 74 | } | ||
972 | 75 | else | ||
973 | 76 | { | ||
974 | 77 | auto pos = items_.rbegin(); | ||
975 | 78 | |||
976 | 79 | for (; pos != items_.rend(); ++pos) | ||
977 | 80 | { | ||
978 | 81 | auto menu = std::static_pointer_cast<MenuEntry>(*pos); | ||
979 | 82 | if (entry->priority() >= menu->GetEntry()->priority()) | ||
980 | 83 | break; | ||
981 | 84 | } | ||
982 | 85 | |||
983 | 86 | items_.insert(pos.base(), menu); | ||
984 | 87 | } | ||
985 | 69 | } | 88 | } |
986 | 70 | 89 | ||
987 | 71 | if (!items_.empty()) | 90 | if (!items_.empty()) |
988 | @@ -195,12 +214,14 @@ | |||
989 | 195 | int accumolated_width = dropdown_width + left_padding + right_padding - inner_padding; | 214 | int accumolated_width = dropdown_width + left_padding + right_padding - inner_padding; |
990 | 196 | int max_width = max_.width; | 215 | int max_width = max_.width; |
991 | 197 | std::list<MenuEntry::Ptr> to_hide; | 216 | std::list<MenuEntry::Ptr> to_hide; |
992 | 217 | bool is_visible = visible(); | ||
993 | 198 | 218 | ||
994 | 199 | for (auto const& item : items_) | 219 | for (auto const& item : items_) |
995 | 200 | { | 220 | { |
996 | 201 | if (!item->visible() || item == dropdown_) | 221 | if (!item->visible() || item == dropdown_) |
997 | 202 | continue; | 222 | continue; |
998 | 203 | 223 | ||
999 | 224 | is_visible = true; | ||
1000 | 204 | accumolated_width += item->GetNaturalWidth() + inner_padding; | 225 | accumolated_width += item->GetNaturalWidth() + inner_padding; |
1001 | 205 | 226 | ||
1002 | 206 | if (accumolated_width > max_width) | 227 | if (accumolated_width > max_width) |
1003 | @@ -235,6 +256,7 @@ | |||
1004 | 235 | dropdown_->Push(hidden); | 256 | dropdown_->Push(hidden); |
1005 | 236 | } | 257 | } |
1006 | 237 | 258 | ||
1007 | 259 | visible = is_visible; | ||
1008 | 238 | Layout::DoRelayout(); | 260 | Layout::DoRelayout(); |
1009 | 239 | } | 261 | } |
1010 | 240 | 262 | ||
1011 | 241 | 263 | ||
1012 | === modified file 'decorations/DecorationsPriv.h' | |||
1013 | --- decorations/DecorationsPriv.h 2014-12-16 19:35:06 +0000 | |||
1014 | +++ decorations/DecorationsPriv.h 2015-07-15 14:19:40 +0000 | |||
1015 | @@ -111,6 +111,7 @@ | |||
1016 | 111 | bool ShouldBeDecorated() const; | 111 | bool ShouldBeDecorated() const; |
1017 | 112 | GLTexture* ShadowTexture() const; | 112 | GLTexture* ShadowTexture() const; |
1018 | 113 | unsigned ShadowRadius() const; | 113 | unsigned ShadowRadius() const; |
1019 | 114 | std::string const& GetMenusPanelID() const; | ||
1020 | 114 | 115 | ||
1021 | 115 | void ComputeShadowQuads(); | 116 | void ComputeShadowQuads(); |
1022 | 116 | void UpdateDecorationTextures(); | 117 | void UpdateDecorationTextures(); |
1023 | @@ -143,6 +144,7 @@ | |||
1024 | 143 | connection::Wrapper dpi_changed_; | 144 | connection::Wrapper dpi_changed_; |
1025 | 144 | connection::Wrapper grab_mouse_changed_; | 145 | connection::Wrapper grab_mouse_changed_; |
1026 | 145 | std::string last_title_; | 146 | std::string last_title_; |
1027 | 147 | std::string panel_id_; | ||
1028 | 146 | std::vector<cu::SimpleTextureQuad> bg_textures_; | 148 | std::vector<cu::SimpleTextureQuad> bg_textures_; |
1029 | 147 | std::shared_ptr<ForceQuitDialog> force_quit_; | 149 | std::shared_ptr<ForceQuitDialog> force_quit_; |
1030 | 148 | InputMixer::Ptr input_mixer_; | 150 | InputMixer::Ptr input_mixer_; |
1031 | @@ -194,7 +196,7 @@ | |||
1032 | 194 | 196 | ||
1033 | 195 | uweak_ptr<decoration::Window> active_deco_win_; | 197 | uweak_ptr<decoration::Window> active_deco_win_; |
1034 | 196 | uweak_ptr<InputMixer> last_mouse_owner_; | 198 | uweak_ptr<InputMixer> last_mouse_owner_; |
1036 | 197 | std::map<CompWindow*, decoration::Window::Ptr> windows_; | 199 | std::unordered_map<CompWindow*, decoration::Window::Ptr> windows_; |
1037 | 198 | std::unordered_map<::Window, std::weak_ptr<decoration::Window>> framed_windows_; | 200 | std::unordered_map<::Window, std::weak_ptr<decoration::Window>> framed_windows_; |
1038 | 199 | 201 | ||
1039 | 200 | menu::Manager::Ptr menu_manager_; | 202 | menu::Manager::Ptr menu_manager_; |
1040 | 201 | 203 | ||
1041 | === modified file 'decorations/DecorationsSlidingLayout.cpp' | |||
1042 | --- decorations/DecorationsSlidingLayout.cpp 2015-03-12 00:57:05 +0000 | |||
1043 | +++ decorations/DecorationsSlidingLayout.cpp 2015-07-15 14:19:40 +0000 | |||
1044 | @@ -137,7 +137,7 @@ | |||
1045 | 137 | auto& main_item_ = items_[ItemRole::MAIN]; | 137 | auto& main_item_ = items_[ItemRole::MAIN]; |
1046 | 138 | auto& input_item_ = items_[ItemRole::INPUT]; | 138 | auto& input_item_ = items_[ItemRole::INPUT]; |
1047 | 139 | 139 | ||
1049 | 140 | if (!input_item_) | 140 | if (!input_item_ || !input_item_->visible()) |
1050 | 141 | { | 141 | { |
1051 | 142 | if (main_item_) | 142 | if (main_item_) |
1052 | 143 | main_item_->Draw(ctx, transformation, attrib, clip, mask); | 143 | main_item_->Draw(ctx, transformation, attrib, clip, mask); |
1053 | 144 | 144 | ||
1054 | === modified file 'decorations/DecorationsWidgets.cpp' | |||
1055 | --- decorations/DecorationsWidgets.cpp 2014-12-08 22:38:02 +0000 | |||
1056 | +++ decorations/DecorationsWidgets.cpp 2015-07-15 14:19:40 +0000 | |||
1057 | @@ -192,15 +192,10 @@ | |||
1058 | 192 | 192 | ||
1059 | 193 | BasicContainer::Ptr Item::GetTopParent() const | 193 | BasicContainer::Ptr Item::GetTopParent() const |
1060 | 194 | { | 194 | { |
1070 | 195 | BasicContainer::Ptr parent = GetParent(); | 195 | BasicContainer::Ptr parent = parent_; |
1071 | 196 | 196 | ||
1072 | 197 | while (parent) | 197 | while (parent && parent->parent_) |
1073 | 198 | { | 198 | parent = parent->parent_; |
1065 | 199 | if (!parent->parent_) | ||
1066 | 200 | return parent; | ||
1067 | 201 | |||
1068 | 202 | parent = parent->GetParent(); | ||
1069 | 203 | } | ||
1074 | 204 | 199 | ||
1075 | 205 | return parent; | 200 | return parent; |
1076 | 206 | } | 201 | } |
1077 | 207 | 202 | ||
1078 | === modified file 'launcher/LauncherEntryRemoteModel.h' | |||
1079 | --- launcher/LauncherEntryRemoteModel.h 2012-05-07 19:52:54 +0000 | |||
1080 | +++ launcher/LauncherEntryRemoteModel.h 2015-07-15 14:19:40 +0000 | |||
1081 | @@ -22,7 +22,7 @@ | |||
1082 | 22 | 22 | ||
1083 | 23 | #include <gio/gio.h> | 23 | #include <gio/gio.h> |
1084 | 24 | #include <sigc++/sigc++.h> | 24 | #include <sigc++/sigc++.h> |
1086 | 25 | #include <map> | 25 | #include <unordered_map> |
1087 | 26 | 26 | ||
1088 | 27 | #include "LauncherEntryRemote.h" | 27 | #include "LauncherEntryRemote.h" |
1089 | 28 | 28 | ||
1090 | @@ -68,7 +68,7 @@ | |||
1091 | 68 | glib::Object<GDBusConnection> _conn; | 68 | glib::Object<GDBusConnection> _conn; |
1092 | 69 | unsigned int _launcher_entry_dbus_signal_id; | 69 | unsigned int _launcher_entry_dbus_signal_id; |
1093 | 70 | unsigned int _dbus_name_owner_changed_signal_id; | 70 | unsigned int _dbus_name_owner_changed_signal_id; |
1095 | 71 | std::map<std::string, LauncherEntryRemote::Ptr> _entries_by_uri; | 71 | std::unordered_map<std::string, LauncherEntryRemote::Ptr> _entries_by_uri; |
1096 | 72 | }; | 72 | }; |
1097 | 73 | 73 | ||
1098 | 74 | } // namespace | 74 | } // namespace |
1099 | 75 | 75 | ||
1100 | === modified file 'launcher/XdndStartStopNotifierImp.h' | |||
1101 | --- launcher/XdndStartStopNotifierImp.h 2012-11-15 16:05:35 +0000 | |||
1102 | +++ launcher/XdndStartStopNotifierImp.h 2015-07-15 14:19:40 +0000 | |||
1103 | @@ -27,7 +27,7 @@ | |||
1104 | 27 | 27 | ||
1105 | 28 | namespace unity { | 28 | namespace unity { |
1106 | 29 | 29 | ||
1108 | 30 | class XdndStartStopNotifierImp : public XdndStartStopNotifier { | 30 | class XdndStartStopNotifierImp : public XdndStartStopNotifier, public sigc::trackable { |
1109 | 31 | public: | 31 | public: |
1110 | 32 | XdndStartStopNotifierImp(); | 32 | XdndStartStopNotifierImp(); |
1111 | 33 | 33 | ||
1112 | 34 | 34 | ||
1113 | === modified file 'lockscreen/LockScreenPanel.cpp' | |||
1114 | --- lockscreen/LockScreenPanel.cpp 2014-12-15 19:12:07 +0000 | |||
1115 | +++ lockscreen/LockScreenPanel.cpp 2015-07-15 14:19:40 +0000 | |||
1116 | @@ -118,7 +118,7 @@ | |||
1117 | 118 | if (entry->active()) | 118 | if (entry->active()) |
1118 | 119 | { | 119 | { |
1119 | 120 | active = true; | 120 | active = true; |
1121 | 121 | indicators_view_->ActivateEntry(entry->id()); | 121 | indicators_view_->ActivateEntry(entry); |
1122 | 122 | OnEntryActivated(GetPanelName(), entry->id(), entry->geometry()); | 122 | OnEntryActivated(GetPanelName(), entry->id(), entry->geometry()); |
1123 | 123 | break; | 123 | break; |
1124 | 124 | } | 124 | } |
1125 | 125 | 125 | ||
1126 | === modified file 'panel/PanelIndicatorEntryDropdownView.cpp' | |||
1127 | --- panel/PanelIndicatorEntryDropdownView.cpp 2014-02-25 00:28:58 +0000 | |||
1128 | +++ panel/PanelIndicatorEntryDropdownView.cpp 2015-07-15 14:19:40 +0000 | |||
1129 | @@ -98,6 +98,11 @@ | |||
1130 | 98 | return child; | 98 | return child; |
1131 | 99 | } | 99 | } |
1132 | 100 | 100 | ||
1133 | 101 | void PanelIndicatorEntryDropdownView::Clear() | ||
1134 | 102 | { | ||
1135 | 103 | children_.clear(); | ||
1136 | 104 | } | ||
1137 | 105 | |||
1138 | 101 | std::deque<PanelIndicatorEntryView::Ptr> const& PanelIndicatorEntryDropdownView::Children() const | 106 | std::deque<PanelIndicatorEntryView::Ptr> const& PanelIndicatorEntryDropdownView::Children() const |
1139 | 102 | { | 107 | { |
1140 | 103 | return children_; | 108 | return children_; |
1141 | @@ -144,7 +149,7 @@ | |||
1142 | 144 | entries.push_back(entry->GetEntry()); | 149 | entries.push_back(entry->GetEntry()); |
1143 | 145 | 150 | ||
1144 | 146 | auto const& geo = GetAbsoluteGeometry(); | 151 | auto const& geo = GetAbsoluteGeometry(); |
1146 | 147 | indicators_->ShowEntriesDropdown(entries, active_entry_, 0, geo.x, geo.y + geo.height); | 152 | indicators_->ShowEntriesDropdown(entries, active_entry_, entries[0]->parent_window(), geo.x, geo.y + geo.height); |
1147 | 148 | } | 153 | } |
1148 | 149 | 154 | ||
1149 | 150 | bool PanelIndicatorEntryDropdownView::ActivateChild(PanelIndicatorEntryView::Ptr const& child) | 155 | bool PanelIndicatorEntryDropdownView::ActivateChild(PanelIndicatorEntryView::Ptr const& child) |
1150 | 151 | 156 | ||
1151 | === modified file 'panel/PanelIndicatorEntryDropdownView.h' | |||
1152 | --- panel/PanelIndicatorEntryDropdownView.h 2014-02-07 23:29:46 +0000 | |||
1153 | +++ panel/PanelIndicatorEntryDropdownView.h 2015-07-15 14:19:40 +0000 | |||
1154 | @@ -39,6 +39,7 @@ | |||
1155 | 39 | void Insert(PanelIndicatorEntryView::Ptr const&); | 39 | void Insert(PanelIndicatorEntryView::Ptr const&); |
1156 | 40 | void Remove(PanelIndicatorEntryView::Ptr const&); | 40 | void Remove(PanelIndicatorEntryView::Ptr const&); |
1157 | 41 | PanelIndicatorEntryView::Ptr Pop(); | 41 | PanelIndicatorEntryView::Ptr Pop(); |
1158 | 42 | void Clear(); | ||
1159 | 42 | 43 | ||
1160 | 43 | PanelIndicatorEntryView::Ptr Top() const; | 44 | PanelIndicatorEntryView::Ptr Top() const; |
1161 | 44 | std::deque<PanelIndicatorEntryView::Ptr> const& Children() const; | 45 | std::deque<PanelIndicatorEntryView::Ptr> const& Children() const; |
1162 | 45 | 46 | ||
1163 | === modified file 'panel/PanelIndicatorEntryView.cpp' | |||
1164 | --- panel/PanelIndicatorEntryView.cpp 2014-12-08 19:50:13 +0000 | |||
1165 | +++ panel/PanelIndicatorEntryView.cpp 2015-07-15 14:19:40 +0000 | |||
1166 | @@ -59,6 +59,7 @@ | |||
1167 | 59 | , cv_(unity::Settings::Instance().em(monitor_)) | 59 | , cv_(unity::Settings::Instance().em(monitor_)) |
1168 | 60 | { | 60 | { |
1169 | 61 | proxy_->active_changed.connect(sigc::mem_fun(this, &PanelIndicatorEntryView::OnActiveChanged)); | 61 | proxy_->active_changed.connect(sigc::mem_fun(this, &PanelIndicatorEntryView::OnActiveChanged)); |
1170 | 62 | proxy_->show_now_changed.connect(sigc::mem_fun(&show_now_changed, &sigc::signal<void, bool>::emit)); | ||
1171 | 62 | proxy_->updated.connect(sigc::mem_fun(this, &PanelIndicatorEntryView::Refresh)); | 63 | proxy_->updated.connect(sigc::mem_fun(this, &PanelIndicatorEntryView::Refresh)); |
1172 | 63 | 64 | ||
1173 | 64 | InputArea::mouse_down.connect(sigc::mem_fun(this, &PanelIndicatorEntryView::OnMouseDown)); | 65 | InputArea::mouse_down.connect(sigc::mem_fun(this, &PanelIndicatorEntryView::OnMouseDown)); |
1174 | @@ -84,11 +85,6 @@ | |||
1175 | 84 | Refresh(); | 85 | Refresh(); |
1176 | 85 | } | 86 | } |
1177 | 86 | 87 | ||
1178 | 87 | PanelIndicatorEntryView::~PanelIndicatorEntryView() | ||
1179 | 88 | { | ||
1180 | 89 | // Nothing to do... | ||
1181 | 90 | } | ||
1182 | 91 | |||
1183 | 92 | void PanelIndicatorEntryView::OnActiveChanged(bool is_active) | 88 | void PanelIndicatorEntryView::OnActiveChanged(bool is_active) |
1184 | 93 | { | 89 | { |
1185 | 94 | active_changed.emit(this, is_active); | 90 | active_changed.emit(this, is_active); |
1186 | @@ -114,10 +110,16 @@ | |||
1187 | 114 | }); | 110 | }); |
1188 | 115 | 111 | ||
1189 | 116 | wm.TerminateExpo(); | 112 | wm.TerminateExpo(); |
1190 | 113 | return; | ||
1191 | 117 | } | 114 | } |
1192 | 118 | 115 | ||
1193 | 119 | if (wm.IsScaleActive()) | 116 | if (wm.IsScaleActive()) |
1194 | 117 | { | ||
1195 | 118 | if (type_ == MENU) | ||
1196 | 119 | return; | ||
1197 | 120 | |||
1198 | 120 | wm.TerminateScale(); | 121 | wm.TerminateScale(); |
1199 | 122 | } | ||
1200 | 121 | 123 | ||
1201 | 122 | auto const& abs_geo = GetAbsoluteGeometry(); | 124 | auto const& abs_geo = GetAbsoluteGeometry(); |
1202 | 123 | proxy_->ShowMenu(abs_geo.x, abs_geo.y + abs_geo.height, button); | 125 | proxy_->ShowMenu(abs_geo.x, abs_geo.y + abs_geo.height, button); |
1203 | 124 | 126 | ||
1204 | === modified file 'panel/PanelIndicatorEntryView.h' | |||
1205 | --- panel/PanelIndicatorEntryView.h 2014-03-31 21:08:10 +0000 | |||
1206 | +++ panel/PanelIndicatorEntryView.h 2015-07-15 14:19:40 +0000 | |||
1207 | @@ -53,10 +53,8 @@ | |||
1208 | 53 | PanelIndicatorEntryView(indicator::Entry::Ptr const& proxy, int padding = 5, | 53 | PanelIndicatorEntryView(indicator::Entry::Ptr const& proxy, int padding = 5, |
1209 | 54 | IndicatorEntryType type = INDICATOR); | 54 | IndicatorEntryType type = INDICATOR); |
1210 | 55 | 55 | ||
1211 | 56 | virtual ~PanelIndicatorEntryView(); | ||
1212 | 57 | |||
1213 | 58 | IndicatorEntryType GetType() const; | 56 | IndicatorEntryType GetType() const; |
1215 | 59 | indicator::Entry::Ptr GetEntry() const { return proxy_; } | 57 | indicator::Entry::Ptr const& GetEntry() const { return proxy_; } |
1216 | 60 | std::string GetEntryID() const; | 58 | std::string GetEntryID() const; |
1217 | 61 | int GetEntryPriority() const; | 59 | int GetEntryPriority() const; |
1218 | 62 | 60 | ||
1219 | @@ -93,6 +91,7 @@ | |||
1220 | 93 | 91 | ||
1221 | 94 | sigc::signal<void, PanelIndicatorEntryView*, bool> active_changed; | 92 | sigc::signal<void, PanelIndicatorEntryView*, bool> active_changed; |
1222 | 95 | sigc::signal<void, PanelIndicatorEntryView*> refreshed; | 93 | sigc::signal<void, PanelIndicatorEntryView*> refreshed; |
1223 | 94 | sigc::signal<void, bool> show_now_changed; | ||
1224 | 96 | 95 | ||
1225 | 97 | protected: | 96 | protected: |
1226 | 98 | std::string GetName() const; | 97 | std::string GetName() const; |
1227 | 99 | 98 | ||
1228 | === modified file 'panel/PanelIndicatorsView.cpp' | |||
1229 | --- panel/PanelIndicatorsView.cpp 2014-03-06 09:26:03 +0000 | |||
1230 | +++ panel/PanelIndicatorsView.cpp 2015-07-15 14:19:40 +0000 | |||
1231 | @@ -71,7 +71,7 @@ | |||
1232 | 71 | indicators_.push_back(indicator); | 71 | indicators_.push_back(indicator); |
1233 | 72 | 72 | ||
1234 | 73 | for (auto const& entry : indicator->GetEntries()) | 73 | for (auto const& entry : indicator->GetEntries()) |
1236 | 74 | AddEntry(entry); | 74 | OnEntryAdded(entry); |
1237 | 75 | 75 | ||
1238 | 76 | auto& conn_manager = indicators_connections_[indicator]; | 76 | auto& conn_manager = indicators_connections_[indicator]; |
1239 | 77 | conn_manager.Add(indicator->on_entry_added.connect(sigc::mem_fun(this, &PanelIndicatorsView::OnEntryAdded))); | 77 | conn_manager.Add(indicator->on_entry_added.connect(sigc::mem_fun(this, &PanelIndicatorsView::OnEntryAdded))); |
1240 | @@ -83,7 +83,7 @@ | |||
1241 | 83 | indicators_connections_.erase(indicator); | 83 | indicators_connections_.erase(indicator); |
1242 | 84 | 84 | ||
1243 | 85 | for (auto const& entry : indicator->GetEntries()) | 85 | for (auto const& entry : indicator->GetEntries()) |
1245 | 86 | RemoveEntry(entry->id()); | 86 | RemoveEntry(entry); |
1246 | 87 | 87 | ||
1247 | 88 | for (auto i = indicators_.begin(); i != indicators_.end(); ++i) | 88 | for (auto i = indicators_.begin(); i != indicators_.end(); ++i) |
1248 | 89 | { | 89 | { |
1249 | @@ -158,13 +158,13 @@ | |||
1250 | 158 | } | 158 | } |
1251 | 159 | } | 159 | } |
1252 | 160 | 160 | ||
1254 | 161 | PanelIndicatorEntryView* PanelIndicatorsView::ActivateEntry(std::string const& entry_id, int button) | 161 | PanelIndicatorEntryView* PanelIndicatorsView::ActivateEntry(indicator::Entry::Ptr const& entry, int button) |
1255 | 162 | { | 162 | { |
1257 | 163 | auto entry = entries_.find(entry_id); | 163 | auto it = entries_.find(entry); |
1258 | 164 | 164 | ||
1260 | 165 | if (entry != entries_.end()) | 165 | if (it != entries_.end()) |
1261 | 166 | { | 166 | { |
1263 | 167 | PanelIndicatorEntryView* view = entry->second; | 167 | PanelIndicatorEntryView* view = it->second; |
1264 | 168 | 168 | ||
1265 | 169 | if (view->IsSensitive() && view->IsVisible()) | 169 | if (view->IsSensitive() && view->IsVisible()) |
1266 | 170 | { | 170 | { |
1267 | @@ -181,6 +181,17 @@ | |||
1268 | 181 | return nullptr; | 181 | return nullptr; |
1269 | 182 | } | 182 | } |
1270 | 183 | 183 | ||
1271 | 184 | PanelIndicatorEntryView* PanelIndicatorsView::ActivateEntry(std::string const& entry_id, int button) | ||
1272 | 185 | { | ||
1273 | 186 | for (auto const& it : entries_) | ||
1274 | 187 | { | ||
1275 | 188 | if (it.first->id() == entry_id) | ||
1276 | 189 | return ActivateEntry(it.first, button); | ||
1277 | 190 | } | ||
1278 | 191 | |||
1279 | 192 | return nullptr; | ||
1280 | 193 | } | ||
1281 | 194 | |||
1282 | 184 | bool PanelIndicatorsView::ActivateIfSensitive() | 195 | bool PanelIndicatorsView::ActivateIfSensitive() |
1283 | 185 | { | 196 | { |
1284 | 186 | for (auto* area : layout_->GetChildren()) | 197 | for (auto* area : layout_->GetChildren()) |
1285 | @@ -222,7 +233,7 @@ | |||
1286 | 222 | if (!view->IsVisible()) | 233 | if (!view->IsVisible()) |
1287 | 223 | continue; | 234 | continue; |
1288 | 224 | 235 | ||
1290 | 225 | if (!target && view->IsFocused() && | 236 | if (!target && |
1291 | 226 | view->IsSensitive() && | 237 | view->IsSensitive() && |
1292 | 227 | view->GetAbsoluteGeometry().IsPointInside(x, y)) | 238 | view->GetAbsoluteGeometry().IsPointInside(x, y)) |
1293 | 228 | { | 239 | { |
1294 | @@ -267,9 +278,8 @@ | |||
1295 | 267 | if (!view) | 278 | if (!view) |
1296 | 268 | return; | 279 | return; |
1297 | 269 | 280 | ||
1298 | 270 | auto const& entry_id = view->GetEntryID(); | ||
1299 | 271 | bool added_to_dropdown = false; | 281 | bool added_to_dropdown = false; |
1301 | 272 | bool known_entry = (entries_.find(entry_id) != entries_.end()); | 282 | bool known_entry = (entries_.find(view->GetEntry()) != entries_.end()); |
1302 | 273 | view->SetOpacity(opacity()); | 283 | view->SetOpacity(opacity()); |
1303 | 274 | 284 | ||
1304 | 275 | if (!known_entry && dropdown_ && !dropdown_->Empty()) | 285 | if (!known_entry && dropdown_ && !dropdown_->Empty()) |
1305 | @@ -317,7 +327,7 @@ | |||
1306 | 317 | { | 327 | { |
1307 | 318 | view->SetMonitor(monitor_); | 328 | view->SetMonitor(monitor_); |
1308 | 319 | view->refreshed.connect(sigc::mem_fun(this, &PanelIndicatorsView::OnEntryRefreshed)); | 329 | view->refreshed.connect(sigc::mem_fun(this, &PanelIndicatorsView::OnEntryRefreshed)); |
1310 | 320 | entries_.insert({entry_id, view}); | 330 | entries_.insert({view->GetEntry(), view}); |
1311 | 321 | on_indicator_updated.emit(); | 331 | on_indicator_updated.emit(); |
1312 | 322 | entry_added.emit(view); | 332 | entry_added.emit(view); |
1313 | 323 | } | 333 | } |
1314 | @@ -346,6 +356,23 @@ | |||
1315 | 346 | on_indicator_updated.emit(); | 356 | on_indicator_updated.emit(); |
1316 | 347 | } | 357 | } |
1317 | 348 | 358 | ||
1318 | 359 | void PanelIndicatorsView::ClearEntries() | ||
1319 | 360 | { | ||
1320 | 361 | for (auto it = entries_.begin(); it != entries_.end();) | ||
1321 | 362 | { | ||
1322 | 363 | auto* entry = it->second; | ||
1323 | 364 | ++it; | ||
1324 | 365 | |||
1325 | 366 | if (entry != dropdown_.GetPointer()) | ||
1326 | 367 | RemoveEntryView(entry); | ||
1327 | 368 | } | ||
1328 | 369 | |||
1329 | 370 | on_indicator_updated.emit(); | ||
1330 | 371 | |||
1331 | 372 | QueueRelayout(); | ||
1332 | 373 | QueueDraw(); | ||
1333 | 374 | } | ||
1334 | 375 | |||
1335 | 349 | void PanelIndicatorsView::RemoveEntryView(PanelIndicatorEntryView* view) | 376 | void PanelIndicatorsView::RemoveEntryView(PanelIndicatorEntryView* view) |
1336 | 350 | { | 377 | { |
1337 | 351 | if (!view) | 378 | if (!view) |
1338 | @@ -357,7 +384,7 @@ | |||
1339 | 357 | dropdown_->Remove(PanelIndicatorEntryView::Ptr(view)); | 384 | dropdown_->Remove(PanelIndicatorEntryView::Ptr(view)); |
1340 | 358 | 385 | ||
1341 | 359 | RemoveChild(view); | 386 | RemoveChild(view); |
1343 | 360 | entries_.erase(view->GetEntryID()); | 387 | entries_.erase(view->GetEntry()); |
1344 | 361 | layout_->RemoveChildObject(view); | 388 | layout_->RemoveChildObject(view); |
1345 | 362 | on_indicator_updated.emit(); | 389 | on_indicator_updated.emit(); |
1346 | 363 | 390 | ||
1347 | @@ -365,9 +392,12 @@ | |||
1348 | 365 | QueueDraw(); | 392 | QueueDraw(); |
1349 | 366 | } | 393 | } |
1350 | 367 | 394 | ||
1352 | 368 | void PanelIndicatorsView::RemoveEntry(std::string const& entry_id) | 395 | void PanelIndicatorsView::RemoveEntry(indicator::Entry::Ptr const& entry) |
1353 | 369 | { | 396 | { |
1355 | 370 | RemoveEntryView(entries_[entry_id]); | 397 | auto it = entries_.find(entry); |
1356 | 398 | |||
1357 | 399 | if (it != entries_.end()) | ||
1358 | 400 | RemoveEntryView(it->second); | ||
1359 | 371 | } | 401 | } |
1360 | 372 | 402 | ||
1361 | 373 | void PanelIndicatorsView::OverlayShown() | 403 | void PanelIndicatorsView::OverlayShown() |
1362 | 374 | 404 | ||
1363 | === modified file 'panel/PanelIndicatorsView.h' | |||
1364 | --- panel/PanelIndicatorsView.h 2014-03-06 09:26:03 +0000 | |||
1365 | +++ panel/PanelIndicatorsView.h 2015-07-15 14:19:40 +0000 | |||
1366 | @@ -55,9 +55,10 @@ | |||
1367 | 55 | int padding = 5, | 55 | int padding = 5, |
1368 | 56 | IndicatorEntryPosition pos = AUTO, | 56 | IndicatorEntryPosition pos = AUTO, |
1369 | 57 | IndicatorEntryType type = IndicatorEntryType::INDICATOR); | 57 | IndicatorEntryType type = IndicatorEntryType::INDICATOR); |
1371 | 58 | void RemoveEntry(std::string const& entry_id); | 58 | void RemoveEntry(indicator::Entry::Ptr const&); |
1372 | 59 | 59 | ||
1373 | 60 | PanelIndicatorEntryView* ActivateEntryAt(int x, int y, int button = 1); | 60 | PanelIndicatorEntryView* ActivateEntryAt(int x, int y, int button = 1); |
1374 | 61 | PanelIndicatorEntryView* ActivateEntry(indicator::Entry::Ptr const&, int button = 1); | ||
1375 | 61 | PanelIndicatorEntryView* ActivateEntry(std::string const& entry_id, int button = 1); | 62 | PanelIndicatorEntryView* ActivateEntry(std::string const& entry_id, int button = 1); |
1376 | 62 | bool ActivateIfSensitive(); | 63 | bool ActivateIfSensitive(); |
1377 | 63 | 64 | ||
1378 | @@ -84,18 +85,19 @@ | |||
1379 | 84 | typedef std::vector<indicator::Indicator::Ptr> Indicators; | 85 | typedef std::vector<indicator::Indicator::Ptr> Indicators; |
1380 | 85 | Indicators const& GetIndicators() const; | 86 | Indicators const& GetIndicators() const; |
1381 | 86 | 87 | ||
1382 | 88 | void ClearEntries(); | ||
1383 | 89 | |||
1384 | 87 | virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); | 90 | virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); |
1385 | 88 | virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); | 91 | virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); |
1386 | 89 | 92 | ||
1388 | 90 | virtual void OnEntryAdded(indicator::Entry::Ptr const& entry); | 93 | virtual void OnEntryAdded(indicator::Entry::Ptr const&); |
1389 | 91 | virtual void OnEntryRefreshed(PanelIndicatorEntryView* view); | 94 | virtual void OnEntryRefreshed(PanelIndicatorEntryView* view); |
1390 | 92 | 95 | ||
1391 | 93 | void AddEntryView(PanelIndicatorEntryView* view, IndicatorEntryPosition pos = AUTO); | 96 | void AddEntryView(PanelIndicatorEntryView* view, IndicatorEntryPosition pos = AUTO); |
1392 | 94 | void RemoveEntryView(PanelIndicatorEntryView* view); | 97 | void RemoveEntryView(PanelIndicatorEntryView* view); |
1393 | 95 | 98 | ||
1394 | 96 | nux::HLayout* layout_; | 99 | nux::HLayout* layout_; |
1397 | 97 | typedef std::map<std::string, PanelIndicatorEntryView*> Entries; | 100 | std::unordered_map<indicator::Entry::Ptr, PanelIndicatorEntryView*> entries_; |
1396 | 98 | Entries entries_; | ||
1398 | 99 | 101 | ||
1399 | 100 | int monitor_; | 102 | int monitor_; |
1400 | 101 | bool overlay_showing_; | 103 | bool overlay_showing_; |
1401 | 102 | 104 | ||
1402 | === modified file 'panel/PanelMenuView.cpp' | |||
1403 | --- panel/PanelMenuView.cpp 2015-03-12 00:57:05 +0000 | |||
1404 | +++ panel/PanelMenuView.cpp 2015-07-15 14:19:40 +0000 | |||
1405 | @@ -27,6 +27,7 @@ | |||
1406 | 27 | #include "unity-shared/CairoTexture.h" | 27 | #include "unity-shared/CairoTexture.h" |
1407 | 28 | #include "unity-shared/DecorationStyle.h" | 28 | #include "unity-shared/DecorationStyle.h" |
1408 | 29 | #include "unity-shared/PanelStyle.h" | 29 | #include "unity-shared/PanelStyle.h" |
1409 | 30 | #include "unity-shared/RawPixel.h" | ||
1410 | 30 | #include "unity-shared/UnitySettings.h" | 31 | #include "unity-shared/UnitySettings.h" |
1411 | 31 | #include "unity-shared/UBusMessages.h" | 32 | #include "unity-shared/UBusMessages.h" |
1412 | 32 | #include "unity-shared/UScreen.h" | 33 | #include "unity-shared/UScreen.h" |
1413 | @@ -43,15 +44,14 @@ | |||
1414 | 43 | 44 | ||
1415 | 44 | namespace | 45 | namespace |
1416 | 45 | { | 46 | { |
1420 | 46 | const int MAIN_LEFT_PADDING = 4; | 47 | const RawPixel MAIN_LEFT_PADDING = 4_em; |
1421 | 47 | const int TITLE_PADDING = 2; | 48 | const RawPixel TITLE_PADDING = 2_em; |
1422 | 48 | const int MENUBAR_PADDING = 4; | 49 | const RawPixel MENUBAR_PADDING = 4_em; |
1423 | 49 | const int MENU_ENTRIES_PADDING = 6; | 50 | const int MENU_ENTRIES_PADDING = 6; |
1424 | 50 | 51 | ||
1425 | 51 | const std::string NEW_APP_HIDE_TIMEOUT = "new-app-hide-timeout"; | 52 | const std::string NEW_APP_HIDE_TIMEOUT = "new-app-hide-timeout"; |
1426 | 52 | const std::string NEW_APP_SHOW_TIMEOUT = "new-app-show-timeout"; | 53 | const std::string NEW_APP_SHOW_TIMEOUT = "new-app-show-timeout"; |
1427 | 53 | const std::string WINDOW_MOVED_TIMEOUT = "window-moved-timeout"; | 54 | const std::string WINDOW_MOVED_TIMEOUT = "window-moved-timeout"; |
1428 | 54 | const std::string WINDOW_ACTIVATED_TIMEOUT = "window-activated-timeout"; | ||
1429 | 55 | const std::string UPDATE_SHOW_NOW_TIMEOUT = "update-show-now-timeout"; | 55 | const std::string UPDATE_SHOW_NOW_TIMEOUT = "update-show-now-timeout"; |
1430 | 56 | const std::string INTEGRATED_MENUS_DOUBLE_CLICK_TIMEOUT = "integrated-menus-double-click-timeout"; | 56 | const std::string INTEGRATED_MENUS_DOUBLE_CLICK_TIMEOUT = "integrated-menus-double-click-timeout"; |
1431 | 57 | 57 | ||
1432 | @@ -83,7 +83,10 @@ | |||
1433 | 83 | } | 83 | } |
1434 | 84 | 84 | ||
1435 | 85 | PanelMenuView::PanelMenuView(menu::Manager::Ptr const& menus) | 85 | PanelMenuView::PanelMenuView(menu::Manager::Ptr const& menus) |
1437 | 86 | : menu_manager_(menus) | 86 | : active_window(0) |
1438 | 87 | , maximized_window(0) | ||
1439 | 88 | , focused(true) | ||
1440 | 89 | , menu_manager_(menus) | ||
1441 | 87 | , matcher_(bamf_matcher_get_default()) | 90 | , matcher_(bamf_matcher_get_default()) |
1442 | 88 | , is_inside_(false) | 91 | , is_inside_(false) |
1443 | 89 | , is_grabbed_(false) | 92 | , is_grabbed_(false) |
1444 | @@ -100,16 +103,15 @@ | |||
1445 | 100 | , ignore_menu_visibility_(false) | 103 | , ignore_menu_visibility_(false) |
1446 | 101 | , integrated_menus_(menu_manager_->integrated_menus()) | 104 | , integrated_menus_(menu_manager_->integrated_menus()) |
1447 | 102 | , always_show_menus_(menu_manager_->always_show_menus()) | 105 | , always_show_menus_(menu_manager_->always_show_menus()) |
1448 | 103 | , active_xid_(0) | ||
1449 | 104 | , desktop_name_(get_current_desktop()) | 106 | , desktop_name_(get_current_desktop()) |
1450 | 105 | { | 107 | { |
1451 | 106 | BamfWindow* active_win = bamf_matcher_get_active_window(matcher_); | 108 | BamfWindow* active_win = bamf_matcher_get_active_window(matcher_); |
1452 | 107 | if (BAMF_IS_WINDOW(active_win)) | 109 | if (BAMF_IS_WINDOW(active_win)) |
1454 | 108 | active_xid_ = bamf_window_get_xid(active_win); | 110 | active_window = bamf_window_get_xid(active_win); |
1455 | 109 | 111 | ||
1456 | 110 | SetupPanelMenuViewSignals(); | ||
1457 | 111 | SetupWindowButtons(); | 112 | SetupWindowButtons(); |
1458 | 112 | SetupTitlebarGrabArea(); | 113 | SetupTitlebarGrabArea(); |
1459 | 114 | SetupPanelMenuViewSignals(); | ||
1460 | 113 | SetupWindowManagerSignals(); | 115 | SetupWindowManagerSignals(); |
1461 | 114 | SetupUBusManagerInterests(); | 116 | SetupUBusManagerInterests(); |
1462 | 115 | 117 | ||
1463 | @@ -128,8 +130,10 @@ | |||
1464 | 128 | void PanelMenuView::OnStyleChanged() | 130 | void PanelMenuView::OnStyleChanged() |
1465 | 129 | { | 131 | { |
1466 | 130 | int height = panel::Style::Instance().PanelHeight(monitor_); | 132 | int height = panel::Style::Instance().PanelHeight(monitor_); |
1467 | 133 | double scale = Settings::Instance().em(monitor_)->DPIScale(); | ||
1468 | 131 | window_buttons_->SetMinimumHeight(height); | 134 | window_buttons_->SetMinimumHeight(height); |
1469 | 132 | window_buttons_->SetMaximumHeight(height); | 135 | window_buttons_->SetMaximumHeight(height); |
1470 | 136 | window_buttons_->SetLeftAndRightPadding(MAIN_LEFT_PADDING.CP(scale), MENUBAR_PADDING.CP(scale)); | ||
1471 | 133 | window_buttons_->UpdateDPIChanged(); | 137 | window_buttons_->UpdateDPIChanged(); |
1472 | 134 | 138 | ||
1473 | 135 | layout_->SetLeftAndRightPadding(window_buttons_->GetContentWidth(), 0); | 139 | layout_->SetLeftAndRightPadding(window_buttons_->GetContentWidth(), 0); |
1474 | @@ -157,6 +161,20 @@ | |||
1475 | 157 | 161 | ||
1476 | 158 | menu_manager_->integrated_menus.changed.connect(sigc::mem_fun(this, &PanelMenuView::OnLIMChanged)); | 162 | menu_manager_->integrated_menus.changed.connect(sigc::mem_fun(this, &PanelMenuView::OnLIMChanged)); |
1477 | 159 | menu_manager_->always_show_menus.changed.connect(sigc::mem_fun(this, &PanelMenuView::OnAlwaysShowMenusChanged)); | 163 | menu_manager_->always_show_menus.changed.connect(sigc::mem_fun(this, &PanelMenuView::OnAlwaysShowMenusChanged)); |
1478 | 164 | |||
1479 | 165 | auto update_target_cb = sigc::hide(sigc::mem_fun(this, &PanelMenuView::UpdateTargetWindowItems)); | ||
1480 | 166 | maximized_window.changed.connect(update_target_cb); | ||
1481 | 167 | active_window.changed.connect(update_target_cb); | ||
1482 | 168 | |||
1483 | 169 | focused.changed.connect([this] (bool focused) { | ||
1484 | 170 | Refresh(true); | ||
1485 | 171 | window_buttons_->focused = focused; | ||
1486 | 172 | |||
1487 | 173 | for (auto const& entry : entries_) | ||
1488 | 174 | entry.second->SetFocusedState(focused); | ||
1489 | 175 | |||
1490 | 176 | FullRedraw(); | ||
1491 | 177 | }); | ||
1492 | 160 | } | 178 | } |
1493 | 161 | 179 | ||
1494 | 162 | void PanelMenuView::SetupWindowButtons() | 180 | void PanelMenuView::SetupWindowButtons() |
1495 | @@ -164,7 +182,7 @@ | |||
1496 | 164 | window_buttons_ = new WindowButtons(); | 182 | window_buttons_ = new WindowButtons(); |
1497 | 165 | window_buttons_->SetParentObject(this); | 183 | window_buttons_->SetParentObject(this); |
1498 | 166 | window_buttons_->monitor = monitor_; | 184 | window_buttons_->monitor = monitor_; |
1500 | 167 | window_buttons_->controlled_window = active_xid_; | 185 | window_buttons_->controlled_window = active_window(); |
1501 | 168 | window_buttons_->opacity = 0.0f; | 186 | window_buttons_->opacity = 0.0f; |
1502 | 169 | window_buttons_->SetLeftAndRightPadding(MAIN_LEFT_PADDING, MENUBAR_PADDING); | 187 | window_buttons_->SetLeftAndRightPadding(MAIN_LEFT_PADDING, MENUBAR_PADDING); |
1503 | 170 | window_buttons_->SetMaximumHeight(panel::Style::Instance().PanelHeight(monitor_)); | 188 | window_buttons_->SetMaximumHeight(panel::Style::Instance().PanelHeight(monitor_)); |
1504 | @@ -252,6 +270,27 @@ | |||
1505 | 252 | PanelIndicatorsView::AddIndicator(indicator); | 270 | PanelIndicatorsView::AddIndicator(indicator); |
1506 | 253 | } | 271 | } |
1507 | 254 | 272 | ||
1508 | 273 | void PanelMenuView::UpdateTargetWindowItems() | ||
1509 | 274 | { | ||
1510 | 275 | Window old_target = window_buttons_->controlled_window; | ||
1511 | 276 | Window target_window = integrated_menus_ ? maximized_window() : active_window(); | ||
1512 | 277 | |||
1513 | 278 | if (old_target != target_window) | ||
1514 | 279 | { | ||
1515 | 280 | window_buttons_->controlled_window = target_window; | ||
1516 | 281 | ClearEntries(); | ||
1517 | 282 | |||
1518 | 283 | if (indicator::AppmenuIndicator::Ptr appmenu = menu_manager_->AppMenu()) | ||
1519 | 284 | { | ||
1520 | 285 | for (auto const& entry : appmenu->GetEntriesForWindow(target_window)) | ||
1521 | 286 | OnEntryAdded(entry); | ||
1522 | 287 | } | ||
1523 | 288 | } | ||
1524 | 289 | |||
1525 | 290 | if (integrated_menus_) | ||
1526 | 291 | focused = (target_window == active_window()); | ||
1527 | 292 | } | ||
1528 | 293 | |||
1529 | 255 | void PanelMenuView::FullRedraw() | 294 | void PanelMenuView::FullRedraw() |
1530 | 256 | { | 295 | { |
1531 | 257 | QueueDraw(); | 296 | QueueDraw(); |
1532 | @@ -266,9 +305,11 @@ | |||
1533 | 266 | if (!integrated_menus_) | 305 | if (!integrated_menus_) |
1534 | 267 | { | 306 | { |
1535 | 268 | CheckMouseInside(); | 307 | CheckMouseInside(); |
1537 | 269 | window_buttons_->focused = true; | 308 | focused = true; |
1538 | 270 | } | 309 | } |
1539 | 271 | 310 | ||
1540 | 311 | UpdateTargetWindowItems(); | ||
1541 | 312 | |||
1542 | 272 | Refresh(true); | 313 | Refresh(true); |
1543 | 273 | FullRedraw(); | 314 | FullRedraw(); |
1544 | 274 | } | 315 | } |
1545 | @@ -302,7 +343,7 @@ | |||
1546 | 302 | return titlebar_grab_area_.GetPointer(); | 343 | return titlebar_grab_area_.GetPointer(); |
1547 | 303 | } | 344 | } |
1548 | 304 | 345 | ||
1550 | 305 | if (is_maximized_ || spread_showing_ || (integrated_menus_ && GetMaximizedWindow() != 0)) | 346 | if (is_maximized_ || spread_showing_ || (integrated_menus_ && maximized_window() != 0)) |
1551 | 306 | { | 347 | { |
1552 | 307 | found_area = window_buttons_->FindAreaUnderMouse(mouse_position, event_type); | 348 | found_area = window_buttons_->FindAreaUnderMouse(mouse_position, event_type); |
1553 | 308 | NUX_RETURN_VALUE_IF_NOTNULL(found_area, found_area); | 349 | NUX_RETURN_VALUE_IF_NOTNULL(found_area, found_area); |
1554 | @@ -313,7 +354,7 @@ | |||
1555 | 313 | found_area = titlebar_grab_area_->FindAreaUnderMouse(mouse_position, event_type); | 354 | found_area = titlebar_grab_area_->FindAreaUnderMouse(mouse_position, event_type); |
1556 | 314 | NUX_RETURN_VALUE_IF_NOTNULL(found_area, found_area); | 355 | NUX_RETURN_VALUE_IF_NOTNULL(found_area, found_area); |
1557 | 315 | 356 | ||
1559 | 316 | if (integrated_menus_ && GetMaximizedWindow() != 0) | 357 | if (integrated_menus_ && maximized_window() != 0) |
1560 | 317 | { | 358 | { |
1561 | 318 | /* When the integrated menus are enabled, that area must act both like an | 359 | /* When the integrated menus are enabled, that area must act both like an |
1562 | 319 | * indicator-entry view and like a panel-grab-area, so not to re-implement | 360 | * indicator-entry view and like a panel-grab-area, so not to re-implement |
1563 | @@ -382,10 +423,7 @@ | |||
1564 | 382 | 423 | ||
1565 | 383 | bool PanelMenuView::ShouldDrawMenus() const | 424 | bool PanelMenuView::ShouldDrawMenus() const |
1566 | 384 | { | 425 | { |
1571 | 385 | if (integrated_menus_ && !is_maximized_) | 426 | if ((we_control_active_ || integrated_menus_) && !switcher_showing_ && !launcher_keynav_ && !ignore_menu_visibility_ && HasVisibleMenus()) |
1568 | 386 | return false; | ||
1569 | 387 | |||
1570 | 388 | if (we_control_active_ && !switcher_showing_ && !launcher_keynav_ && !ignore_menu_visibility_ && !entries_.empty()) | ||
1572 | 389 | { | 427 | { |
1573 | 390 | WindowManager& wm = WindowManager::Default(); | 428 | WindowManager& wm = WindowManager::Default(); |
1574 | 391 | 429 | ||
1575 | @@ -410,7 +448,7 @@ | |||
1576 | 410 | if (integrated_menus_) | 448 | if (integrated_menus_) |
1577 | 411 | { | 449 | { |
1578 | 412 | if (!WindowManager::Default().IsExpoActive()) | 450 | if (!WindowManager::Default().IsExpoActive()) |
1580 | 413 | return (GetMaximizedWindow() != 0); | 451 | return (maximized_window() != 0); |
1581 | 414 | 452 | ||
1582 | 415 | return false; | 453 | return false; |
1583 | 416 | } | 454 | } |
1584 | @@ -796,7 +834,7 @@ | |||
1585 | 796 | 834 | ||
1586 | 797 | std::string PanelMenuView::GetMaximizedViewName(bool use_appname) const | 835 | std::string PanelMenuView::GetMaximizedViewName(bool use_appname) const |
1587 | 798 | { | 836 | { |
1589 | 799 | Window maximized = GetMaximizedWindow(); | 837 | Window maximized = maximized_window(); |
1590 | 800 | BamfWindow* window = nullptr; | 838 | BamfWindow* window = nullptr; |
1591 | 801 | std::string label; | 839 | std::string label; |
1592 | 802 | 840 | ||
1593 | @@ -830,18 +868,18 @@ | |||
1594 | 830 | auto const& style = decoration::Style::Get(); | 868 | auto const& style = decoration::Style::Get(); |
1595 | 831 | auto text_size = style->TitleNaturalSize(label); | 869 | auto text_size = style->TitleNaturalSize(label); |
1596 | 832 | auto state = WidgetState::NORMAL; | 870 | auto state = WidgetState::NORMAL; |
1598 | 833 | float dpi_scale = Settings::Instance().em(monitor_)->DPIScale(); | 871 | double dpi_scale = Settings::Instance().em(monitor_)->DPIScale(); |
1599 | 834 | 872 | ||
1600 | 835 | if (integrated_menus_ && !is_desktop_focused_ && !WindowManager::Default().IsExpoActive()) | 873 | if (integrated_menus_ && !is_desktop_focused_ && !WindowManager::Default().IsExpoActive()) |
1601 | 836 | { | 874 | { |
1602 | 837 | title_geo_.x = geo.x + window_buttons_->GetBaseWidth() + (style->TitleIndent() * dpi_scale); | 875 | title_geo_.x = geo.x + window_buttons_->GetBaseWidth() + (style->TitleIndent() * dpi_scale); |
1603 | 838 | 876 | ||
1605 | 839 | if (!window_buttons_->focused()) | 877 | if (!focused()) |
1606 | 840 | state = WidgetState::BACKDROP; | 878 | state = WidgetState::BACKDROP; |
1607 | 841 | } | 879 | } |
1608 | 842 | else | 880 | else |
1609 | 843 | { | 881 | { |
1611 | 844 | title_geo_.x = geo.x + (MAIN_LEFT_PADDING + TITLE_PADDING) * dpi_scale; | 882 | title_geo_.x = geo.x + MAIN_LEFT_PADDING.CP(dpi_scale) + TITLE_PADDING.CP(dpi_scale); |
1612 | 845 | } | 883 | } |
1613 | 846 | 884 | ||
1614 | 847 | title_geo_.y = geo.y + (geo.height - (text_size.height * dpi_scale)) / 2; | 885 | title_geo_.y = geo.y + (geo.height - (text_size.height * dpi_scale)) / 2; |
1615 | @@ -904,20 +942,9 @@ | |||
1616 | 904 | if (geo.width > monitor_geo_.width) | 942 | if (geo.width > monitor_geo_.width) |
1617 | 905 | return false; | 943 | return false; |
1618 | 906 | 944 | ||
1619 | 907 | if (integrated_menus_) | ||
1620 | 908 | { | ||
1621 | 909 | Window maximized = GetMaximizedWindow(); | ||
1622 | 910 | window_buttons_->controlled_window = maximized; | ||
1623 | 911 | window_buttons_->focused = (active_xid_ == maximized); | ||
1624 | 912 | } | ||
1625 | 913 | else | ||
1626 | 914 | { | ||
1627 | 915 | window_buttons_->controlled_window = active_xid_; | ||
1628 | 916 | } | ||
1629 | 917 | |||
1630 | 918 | std::string const& new_title = GetCurrentTitle(); | 945 | std::string const& new_title = GetCurrentTitle(); |
1631 | 919 | 946 | ||
1633 | 920 | if (new_title == panel_title_ && !force && last_geo_ == geo && title_texture_) | 947 | if (!force && new_title == panel_title_ && last_geo_ == geo && title_texture_) |
1634 | 921 | { | 948 | { |
1635 | 922 | // No need to redraw the title, let's save some CPU time! | 949 | // No need to redraw the title, let's save some CPU time! |
1636 | 923 | return false; | 950 | return false; |
1637 | @@ -956,18 +983,20 @@ | |||
1638 | 956 | 983 | ||
1639 | 957 | void PanelMenuView::OnEntryAdded(indicator::Entry::Ptr const& entry) | 984 | void PanelMenuView::OnEntryAdded(indicator::Entry::Ptr const& entry) |
1640 | 958 | { | 985 | { |
1642 | 959 | PanelIndicatorEntryView* view; | 986 | auto parent_window = entry->parent_window(); |
1643 | 987 | Window target = integrated_menus_ ? maximized_window() : active_window(); | ||
1644 | 960 | 988 | ||
1648 | 961 | view = new PanelIndicatorEntryView(entry, MENU_ENTRIES_PADDING, IndicatorEntryType::MENU); | 989 | if (!parent_window || parent_window == target) |
1649 | 962 | entry->show_now_changed.connect(sigc::mem_fun(this, &PanelMenuView::UpdateShowNow)); | 990 | AddEntryView(new PanelIndicatorEntryView(entry, MENU_ENTRIES_PADDING, IndicatorEntryType::MENU)); |
1647 | 963 | AddEntryView(view); | ||
1650 | 964 | } | 991 | } |
1651 | 965 | 992 | ||
1652 | 966 | void PanelMenuView::OnEntryViewAdded(PanelIndicatorEntryView* view) | 993 | void PanelMenuView::OnEntryViewAdded(PanelIndicatorEntryView* view) |
1653 | 967 | { | 994 | { |
1654 | 995 | view->SetFocusedState(focused()); | ||
1655 | 968 | view->mouse_enter.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseEnter)); | 996 | view->mouse_enter.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseEnter)); |
1656 | 969 | view->mouse_leave.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseLeave)); | 997 | view->mouse_leave.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseLeave)); |
1657 | 970 | view->active_changed.connect(sigc::mem_fun(this, &PanelMenuView::OnActiveChanged)); | 998 | view->active_changed.connect(sigc::mem_fun(this, &PanelMenuView::OnActiveChanged)); |
1658 | 999 | view->show_now_changed.connect(sigc::mem_fun(this, &PanelMenuView::UpdateShowNow)); | ||
1659 | 971 | } | 1000 | } |
1660 | 972 | 1001 | ||
1661 | 973 | void PanelMenuView::NotifyAllMenusClosed() | 1002 | void PanelMenuView::NotifyAllMenusClosed() |
1662 | @@ -1116,58 +1145,41 @@ | |||
1663 | 1116 | show_now_activated_ = false; | 1145 | show_now_activated_ = false; |
1664 | 1117 | is_maximized_ = false; | 1146 | is_maximized_ = false; |
1665 | 1118 | is_desktop_focused_ = false; | 1147 | is_desktop_focused_ = false; |
1668 | 1119 | active_xid_ = 0; | 1148 | Window active_xid = 0; |
1667 | 1120 | bool force_refresh = false; | ||
1669 | 1121 | 1149 | ||
1670 | 1122 | sources_.Remove(WINDOW_MOVED_TIMEOUT); | 1150 | sources_.Remove(WINDOW_MOVED_TIMEOUT); |
1671 | 1123 | 1151 | ||
1672 | 1124 | if (BAMF_IS_WINDOW(new_view)) | 1152 | if (BAMF_IS_WINDOW(new_view)) |
1673 | 1125 | { | 1153 | { |
1674 | 1126 | BamfWindow* window = reinterpret_cast<BamfWindow*>(new_view); | 1154 | BamfWindow* window = reinterpret_cast<BamfWindow*>(new_view); |
1676 | 1127 | active_xid_ = bamf_window_get_xid(window); | 1155 | active_xid = bamf_window_get_xid(window); |
1677 | 1128 | is_maximized_ = (bamf_window_maximized(window) == BAMF_WINDOW_MAXIMIZED); | 1156 | is_maximized_ = (bamf_window_maximized(window) == BAMF_WINDOW_MAXIMIZED); |
1678 | 1129 | 1157 | ||
1679 | 1130 | if (bamf_window_get_window_type(window) == BAMF_WINDOW_DESKTOP) | 1158 | if (bamf_window_get_window_type(window) == BAMF_WINDOW_DESKTOP) |
1680 | 1131 | { | 1159 | { |
1682 | 1132 | is_desktop_focused_ = !GetMaximizedWindow(); | 1160 | is_desktop_focused_ = !maximized_window(); |
1683 | 1133 | we_control_active_ = true; | 1161 | we_control_active_ = true; |
1684 | 1134 | } | 1162 | } |
1685 | 1135 | else | 1163 | else |
1686 | 1136 | { | 1164 | { |
1688 | 1137 | we_control_active_ = IsWindowUnderOurControl(active_xid_); | 1165 | we_control_active_ = IsWindowUnderOurControl(active_xid); |
1689 | 1138 | } | 1166 | } |
1690 | 1139 | 1167 | ||
1691 | 1140 | if (is_maximized_) | 1168 | if (is_maximized_) |
1692 | 1141 | { | 1169 | { |
1695 | 1142 | maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), active_xid_), maximized_wins_.end()); | 1170 | maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), active_xid), maximized_wins_.end()); |
1696 | 1143 | maximized_wins_.push_front(active_xid_); | 1171 | maximized_wins_.push_front(active_xid); |
1697 | 1172 | UpdateMaximizedWindow(); | ||
1698 | 1144 | } | 1173 | } |
1699 | 1145 | 1174 | ||
1700 | 1146 | // register callback for new view | 1175 | // register callback for new view |
1701 | 1147 | view_name_changed_signal_.Connect(new_view, "name-changed", | 1176 | view_name_changed_signal_.Connect(new_view, "name-changed", |
1702 | 1148 | sigc::mem_fun(this, &PanelMenuView::OnNameChanged)); | 1177 | sigc::mem_fun(this, &PanelMenuView::OnNameChanged)); |
1725 | 1149 | 1178 | } | |
1726 | 1150 | if (integrated_menus_) | 1179 | |
1727 | 1151 | force_refresh = is_maximized_; | 1180 | active_window = active_xid; |
1728 | 1152 | } | 1181 | |
1729 | 1153 | 1182 | if (Refresh()) | |
1708 | 1154 | if (!force_refresh && BAMF_IS_WINDOW(old_view) && integrated_menus_) | ||
1709 | 1155 | force_refresh = (bamf_window_maximized(reinterpret_cast<BamfWindow*>(old_view)) == BAMF_WINDOW_MAXIMIZED); | ||
1710 | 1156 | |||
1711 | 1157 | if (ShouldDrawMenus()) | ||
1712 | 1158 | { | ||
1713 | 1159 | // Wait 100ms before showing the menus again if we've just switched view | ||
1714 | 1160 | // this is done because the menus are updated by the indicator with some | ||
1715 | 1161 | // delay, and we don't want to see the previous menus and then the new ones | ||
1716 | 1162 | ignore_menu_visibility_ = true; | ||
1717 | 1163 | sources_.AddTimeout(100, [this] { | ||
1718 | 1164 | ignore_menu_visibility_ = false; | ||
1719 | 1165 | QueueDraw(); | ||
1720 | 1166 | return false; | ||
1721 | 1167 | }, WINDOW_ACTIVATED_TIMEOUT); | ||
1722 | 1168 | } | ||
1723 | 1169 | |||
1724 | 1170 | if (Refresh(force_refresh)) | ||
1730 | 1171 | FullRedraw(); | 1183 | FullRedraw(); |
1731 | 1172 | } | 1184 | } |
1732 | 1173 | 1185 | ||
1733 | @@ -1198,8 +1210,9 @@ | |||
1734 | 1198 | void PanelMenuView::OnWindowMinimized(Window xid) | 1210 | void PanelMenuView::OnWindowMinimized(Window xid) |
1735 | 1199 | { | 1211 | { |
1736 | 1200 | maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), xid), maximized_wins_.end()); | 1212 | maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), xid), maximized_wins_.end()); |
1737 | 1213 | UpdateMaximizedWindow(); | ||
1738 | 1201 | 1214 | ||
1740 | 1202 | if (xid == active_xid_) | 1215 | if (xid == active_window()) |
1741 | 1203 | { | 1216 | { |
1742 | 1204 | if (Refresh()) | 1217 | if (Refresh()) |
1743 | 1205 | QueueDraw(); | 1218 | QueueDraw(); |
1744 | @@ -1213,10 +1226,13 @@ | |||
1745 | 1213 | 1226 | ||
1746 | 1214 | void PanelMenuView::OnWindowUnminimized(Window xid) | 1227 | void PanelMenuView::OnWindowUnminimized(Window xid) |
1747 | 1215 | { | 1228 | { |
1749 | 1216 | if (xid == active_xid_) | 1229 | if (xid == active_window()) |
1750 | 1217 | { | 1230 | { |
1751 | 1218 | if (WindowManager::Default().IsWindowMaximized(xid)) | 1231 | if (WindowManager::Default().IsWindowMaximized(xid)) |
1752 | 1232 | { | ||
1753 | 1219 | maximized_wins_.push_front(xid); | 1233 | maximized_wins_.push_front(xid); |
1754 | 1234 | UpdateMaximizedWindow(); | ||
1755 | 1235 | } | ||
1756 | 1220 | 1236 | ||
1757 | 1221 | if (Refresh()) | 1237 | if (Refresh()) |
1758 | 1222 | QueueDraw(); | 1238 | QueueDraw(); |
1759 | @@ -1224,7 +1240,10 @@ | |||
1760 | 1224 | else | 1240 | else |
1761 | 1225 | { | 1241 | { |
1762 | 1226 | if (WindowManager::Default().IsWindowMaximized(xid)) | 1242 | if (WindowManager::Default().IsWindowMaximized(xid)) |
1763 | 1243 | { | ||
1764 | 1227 | maximized_wins_.push_back(xid); | 1244 | maximized_wins_.push_back(xid); |
1765 | 1245 | UpdateMaximizedWindow(); | ||
1766 | 1246 | } | ||
1767 | 1228 | 1247 | ||
1768 | 1229 | if (integrated_menus_ && IsWindowUnderOurControl(xid)) | 1248 | if (integrated_menus_ && IsWindowUnderOurControl(xid)) |
1769 | 1230 | { | 1249 | { |
1770 | @@ -1239,8 +1258,9 @@ | |||
1771 | 1239 | // FIXME: compiz doesn't give us a valid xid (is always 0 on unmap) | 1258 | // FIXME: compiz doesn't give us a valid xid (is always 0 on unmap) |
1772 | 1240 | // we need to do this again on BamfView closed signal. | 1259 | // we need to do this again on BamfView closed signal. |
1773 | 1241 | maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), xid), maximized_wins_.end()); | 1260 | maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), xid), maximized_wins_.end()); |
1774 | 1261 | UpdateMaximizedWindow(); | ||
1775 | 1242 | 1262 | ||
1777 | 1243 | if (xid == active_xid_) | 1263 | if (xid == active_window()) |
1778 | 1244 | { | 1264 | { |
1779 | 1245 | if (Refresh()) | 1265 | if (Refresh()) |
1780 | 1246 | QueueDraw(); | 1266 | QueueDraw(); |
1781 | @@ -1256,9 +1276,10 @@ | |||
1782 | 1256 | { | 1276 | { |
1783 | 1257 | if (WindowManager::Default().IsWindowMaximized(xid)) | 1277 | if (WindowManager::Default().IsWindowMaximized(xid)) |
1784 | 1258 | { | 1278 | { |
1786 | 1259 | if (xid == active_xid_) | 1279 | if (xid == active_window()) |
1787 | 1260 | { | 1280 | { |
1788 | 1261 | maximized_wins_.push_front(xid); | 1281 | maximized_wins_.push_front(xid); |
1789 | 1282 | UpdateMaximizedWindow(); | ||
1790 | 1262 | 1283 | ||
1791 | 1263 | if (Refresh()) | 1284 | if (Refresh()) |
1792 | 1264 | QueueDraw(); | 1285 | QueueDraw(); |
1793 | @@ -1266,15 +1287,17 @@ | |||
1794 | 1266 | else | 1287 | else |
1795 | 1267 | { | 1288 | { |
1796 | 1268 | maximized_wins_.push_back(xid); | 1289 | maximized_wins_.push_back(xid); |
1797 | 1290 | UpdateMaximizedWindow(); | ||
1798 | 1269 | } | 1291 | } |
1799 | 1270 | } | 1292 | } |
1800 | 1271 | } | 1293 | } |
1801 | 1272 | 1294 | ||
1802 | 1273 | void PanelMenuView::OnWindowMaximized(Window xid) | 1295 | void PanelMenuView::OnWindowMaximized(Window xid) |
1803 | 1274 | { | 1296 | { |
1805 | 1275 | if (xid == active_xid_) | 1297 | if (xid == active_window()) |
1806 | 1276 | { | 1298 | { |
1807 | 1277 | maximized_wins_.push_front(xid); | 1299 | maximized_wins_.push_front(xid); |
1808 | 1300 | UpdateMaximizedWindow(); | ||
1809 | 1278 | 1301 | ||
1810 | 1279 | // We need to update the is_inside_ state in the case of maximization by grab | 1302 | // We need to update the is_inside_ state in the case of maximization by grab |
1811 | 1280 | CheckMouseInside(); | 1303 | CheckMouseInside(); |
1812 | @@ -1286,6 +1309,7 @@ | |||
1813 | 1286 | else | 1309 | else |
1814 | 1287 | { | 1310 | { |
1815 | 1288 | maximized_wins_.push_back(xid); | 1311 | maximized_wins_.push_back(xid); |
1816 | 1312 | UpdateMaximizedWindow(); | ||
1817 | 1289 | 1313 | ||
1818 | 1290 | if (integrated_menus_ && IsWindowUnderOurControl(xid)) | 1314 | if (integrated_menus_ && IsWindowUnderOurControl(xid)) |
1819 | 1291 | { | 1315 | { |
1820 | @@ -1298,8 +1322,9 @@ | |||
1821 | 1298 | void PanelMenuView::OnWindowRestored(Window xid) | 1322 | void PanelMenuView::OnWindowRestored(Window xid) |
1822 | 1299 | { | 1323 | { |
1823 | 1300 | maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), xid), maximized_wins_.end()); | 1324 | maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), xid), maximized_wins_.end()); |
1824 | 1325 | UpdateMaximizedWindow(); | ||
1825 | 1301 | 1326 | ||
1827 | 1302 | if (active_xid_ == xid) | 1327 | if (active_window() == xid) |
1828 | 1303 | { | 1328 | { |
1829 | 1304 | is_maximized_ = false; | 1329 | is_maximized_ = false; |
1830 | 1305 | is_grabbed_ = false; | 1330 | is_grabbed_ = false; |
1831 | @@ -1316,13 +1341,13 @@ | |||
1832 | 1316 | 1341 | ||
1833 | 1317 | bool PanelMenuView::UpdateActiveWindowPosition() | 1342 | bool PanelMenuView::UpdateActiveWindowPosition() |
1834 | 1318 | { | 1343 | { |
1836 | 1319 | bool we_control_window = IsWindowUnderOurControl(active_xid_); | 1344 | bool we_control_window = IsWindowUnderOurControl(active_window); |
1837 | 1320 | 1345 | ||
1838 | 1321 | if (we_control_window != we_control_active_) | 1346 | if (we_control_window != we_control_active_) |
1839 | 1322 | { | 1347 | { |
1840 | 1323 | we_control_active_ = we_control_window; | 1348 | we_control_active_ = we_control_window; |
1841 | 1324 | 1349 | ||
1843 | 1325 | if (!entries_.empty()) | 1350 | if (HasVisibleMenus()) |
1844 | 1326 | on_indicator_updated.emit(); | 1351 | on_indicator_updated.emit(); |
1845 | 1327 | 1352 | ||
1846 | 1328 | if (Refresh()) | 1353 | if (Refresh()) |
1847 | @@ -1334,21 +1359,17 @@ | |||
1848 | 1334 | 1359 | ||
1849 | 1335 | void PanelMenuView::OnWindowMoved(Window xid) | 1360 | void PanelMenuView::OnWindowMoved(Window xid) |
1850 | 1336 | { | 1361 | { |
1852 | 1337 | if (active_xid_ == xid) | 1362 | if (!integrated_menus_ && active_window() == xid && UScreen::GetDefault()->GetMonitors().size() > 1) |
1853 | 1338 | { | 1363 | { |
1854 | 1339 | /* When moving the active window, if the current panel is controlling | 1364 | /* When moving the active window, if the current panel is controlling |
1855 | 1340 | * the active window, then we postpone the timeout function every movement | 1365 | * the active window, then we postpone the timeout function every movement |
1856 | 1341 | * that we have, setting a longer timeout. | 1366 | * that we have, setting a longer timeout. |
1858 | 1342 | * Otherwise, if the moved window is not controlled by the current panel | 1367 | * Otherwise, if the movedPanelMenuView::OnWindowMovedPanelMenuView::OnWindowMoved window is not controlled by the current panel |
1859 | 1343 | * every few millisecond we check the new window position */ | 1368 | * every few millisecond we check the new window position */ |
1860 | 1344 | 1369 | ||
1861 | 1345 | unsigned int timeout_length = 250; | 1370 | unsigned int timeout_length = 250; |
1862 | 1346 | 1371 | ||
1868 | 1347 | if (we_control_active_) | 1372 | if (!we_control_active_) |
1864 | 1348 | { | ||
1865 | 1349 | sources_.Remove(WINDOW_MOVED_TIMEOUT); | ||
1866 | 1350 | } | ||
1867 | 1351 | else | ||
1869 | 1352 | { | 1373 | { |
1870 | 1353 | if (sources_.GetSource(WINDOW_MOVED_TIMEOUT)) | 1374 | if (sources_.GetSource(WINDOW_MOVED_TIMEOUT)) |
1871 | 1354 | return; | 1375 | return; |
1872 | @@ -1359,6 +1380,9 @@ | |||
1873 | 1359 | auto cb_func = sigc::mem_fun(this, &PanelMenuView::UpdateActiveWindowPosition); | 1380 | auto cb_func = sigc::mem_fun(this, &PanelMenuView::UpdateActiveWindowPosition); |
1874 | 1360 | sources_.AddTimeout(timeout_length, cb_func, WINDOW_MOVED_TIMEOUT); | 1381 | sources_.AddTimeout(timeout_length, cb_func, WINDOW_MOVED_TIMEOUT); |
1875 | 1361 | } | 1382 | } |
1876 | 1383 | |||
1877 | 1384 | if (std::find(maximized_wins_.begin(), maximized_wins_.end(), xid) != maximized_wins_.end()) | ||
1878 | 1385 | UpdateMaximizedWindow(); | ||
1879 | 1362 | } | 1386 | } |
1880 | 1363 | 1387 | ||
1881 | 1364 | bool PanelMenuView::IsWindowUnderOurControl(Window xid) const | 1388 | bool PanelMenuView::IsWindowUnderOurControl(Window xid) const |
1882 | @@ -1391,7 +1415,7 @@ | |||
1883 | 1391 | return false; | 1415 | return false; |
1884 | 1392 | } | 1416 | } |
1885 | 1393 | 1417 | ||
1887 | 1394 | Window PanelMenuView::GetMaximizedWindow() const | 1418 | void PanelMenuView::UpdateMaximizedWindow() |
1888 | 1395 | { | 1419 | { |
1889 | 1396 | Window window_xid = 0; | 1420 | Window window_xid = 0; |
1890 | 1397 | 1421 | ||
1891 | @@ -1406,7 +1430,7 @@ | |||
1892 | 1406 | } | 1430 | } |
1893 | 1407 | } | 1431 | } |
1894 | 1408 | 1432 | ||
1896 | 1409 | return window_xid; | 1433 | maximized_window = window_xid; |
1897 | 1410 | } | 1434 | } |
1898 | 1411 | 1435 | ||
1899 | 1412 | Window PanelMenuView::GetTopWindow() const | 1436 | Window PanelMenuView::GetTopWindow() const |
1900 | @@ -1466,11 +1490,14 @@ | |||
1901 | 1466 | if (!layout_->GetAbsoluteGeometry().IsInside(click)) | 1490 | if (!layout_->GetAbsoluteGeometry().IsInside(click)) |
1902 | 1467 | return; | 1491 | return; |
1903 | 1468 | 1492 | ||
1907 | 1469 | unsigned double_click_wait = Settings::Instance().lim_double_click_wait(); | 1493 | auto& settings = Settings::Instance(); |
1908 | 1470 | 1494 | ||
1909 | 1471 | if (double_click_wait > 0) | 1495 | if (!focused && !settings.lim_unfocused_popup()) |
1910 | 1496 | return; | ||
1911 | 1497 | |||
1912 | 1498 | if (settings.lim_double_click_wait() > 0) | ||
1913 | 1472 | { | 1499 | { |
1915 | 1473 | sources_.AddTimeout(double_click_wait, [this, click] { | 1500 | sources_.AddTimeout(settings.lim_double_click_wait(), [this, click] { |
1916 | 1474 | ActivateEntryAt(click.x, click.y); | 1501 | ActivateEntryAt(click.x, click.y); |
1917 | 1475 | return false; | 1502 | return false; |
1918 | 1476 | }, INTEGRATED_MENUS_DOUBLE_CLICK_TIMEOUT); | 1503 | }, INTEGRATED_MENUS_DOUBLE_CLICK_TIMEOUT); |
1919 | @@ -1489,15 +1516,18 @@ | |||
1920 | 1489 | 1516 | ||
1921 | 1490 | void PanelMenuView::OnMaximizedActivate(int x, int y) | 1517 | void PanelMenuView::OnMaximizedActivate(int x, int y) |
1922 | 1491 | { | 1518 | { |
1924 | 1492 | Window maximized = GetMaximizedWindow(); | 1519 | Window maximized = maximized_window(); |
1925 | 1493 | 1520 | ||
1926 | 1494 | if (maximized != 0) | 1521 | if (maximized != 0) |
1927 | 1495 | { | 1522 | { |
1929 | 1496 | if (maximized != active_xid_) | 1523 | if (maximized != active_window()) |
1930 | 1497 | { | 1524 | { |
1932 | 1498 | WindowManager::Default().Activate(maximized); | 1525 | auto& wm = WindowManager::Default(); |
1933 | 1526 | wm.Raise(maximized); | ||
1934 | 1527 | wm.Activate(maximized); | ||
1935 | 1499 | } | 1528 | } |
1937 | 1500 | else if (integrated_menus_) | 1529 | |
1938 | 1530 | if (integrated_menus_) | ||
1939 | 1501 | { | 1531 | { |
1940 | 1502 | // Adjusting the click coordinates to be absolute. | 1532 | // Adjusting the click coordinates to be absolute. |
1941 | 1503 | auto const& grab_geo = titlebar_grab_area_->GetAbsoluteGeometry(); | 1533 | auto const& grab_geo = titlebar_grab_area_->GetAbsoluteGeometry(); |
1942 | @@ -1509,7 +1539,7 @@ | |||
1943 | 1509 | 1539 | ||
1944 | 1510 | void PanelMenuView::MaximizedWindowWMAction(int x, int y, unsigned button) | 1540 | void PanelMenuView::MaximizedWindowWMAction(int x, int y, unsigned button) |
1945 | 1511 | { | 1541 | { |
1947 | 1512 | Window maximized = GetMaximizedWindow(); | 1542 | Window maximized = maximized_window(); |
1948 | 1513 | 1543 | ||
1949 | 1514 | if (!maximized) | 1544 | if (!maximized) |
1950 | 1515 | return; | 1545 | return; |
1951 | @@ -1590,7 +1620,7 @@ | |||
1952 | 1590 | * This is a workaround to avoid that the grid plugin would be fired | 1620 | * This is a workaround to avoid that the grid plugin would be fired |
1953 | 1591 | * showing the window shape preview effect. See bug #838923 */ | 1621 | * showing the window shape preview effect. See bug #838923 */ |
1954 | 1592 | 1622 | ||
1956 | 1593 | Window maximized = GetMaximizedWindow(); | 1623 | Window maximized = maximized_window(); |
1957 | 1594 | 1624 | ||
1958 | 1595 | if (maximized != 0) | 1625 | if (maximized != 0) |
1959 | 1596 | { | 1626 | { |
1960 | @@ -1611,7 +1641,7 @@ | |||
1961 | 1611 | x += titlebar_grab_area_->GetAbsoluteX(); | 1641 | x += titlebar_grab_area_->GetAbsoluteX(); |
1962 | 1612 | y += titlebar_grab_area_->GetAbsoluteY(); | 1642 | y += titlebar_grab_area_->GetAbsoluteY(); |
1963 | 1613 | 1643 | ||
1965 | 1614 | Window maximized = GetMaximizedWindow(); | 1644 | Window maximized = maximized_window(); |
1966 | 1615 | 1645 | ||
1967 | 1616 | /* When the drag goes out from the Panel, start the real movement. | 1646 | /* When the drag goes out from the Panel, start the real movement. |
1968 | 1617 | * | 1647 | * |
1969 | @@ -1686,6 +1716,8 @@ | |||
1970 | 1686 | PanelIndicatorsView::AddProperties(introspection); | 1716 | PanelIndicatorsView::AddProperties(introspection); |
1971 | 1687 | 1717 | ||
1972 | 1688 | introspection | 1718 | introspection |
1973 | 1719 | .add("focused", focused()) | ||
1974 | 1720 | .add("integrated_menus", integrated_menus_) | ||
1975 | 1689 | .add("mouse_inside", is_inside_) | 1721 | .add("mouse_inside", is_inside_) |
1976 | 1690 | .add("always_show_menus", always_show_menus_) | 1722 | .add("always_show_menus", always_show_menus_) |
1977 | 1691 | .add("grabbed", is_grabbed_) | 1723 | .add("grabbed", is_grabbed_) |
1978 | @@ -1694,7 +1726,8 @@ | |||
1979 | 1694 | .add("panel_title", panel_title_) | 1726 | .add("panel_title", panel_title_) |
1980 | 1695 | .add("desktop_active", (panel_title_ == desktop_name_)) | 1727 | .add("desktop_active", (panel_title_ == desktop_name_)) |
1981 | 1696 | .add("monitor", monitor_) | 1728 | .add("monitor", monitor_) |
1983 | 1697 | .add("active_window", active_xid_) | 1729 | .add("active_window", active_window()) |
1984 | 1730 | .add("maximized_window", maximized_window()) | ||
1985 | 1698 | .add("draw_menus", ShouldDrawMenus()) | 1731 | .add("draw_menus", ShouldDrawMenus()) |
1986 | 1699 | .add("draw_window_buttons", ShouldDrawButtons()) | 1732 | .add("draw_window_buttons", ShouldDrawButtons()) |
1987 | 1700 | .add("controls_active_window", we_control_active_) | 1733 | .add("controls_active_window", we_control_active_) |
1988 | @@ -1833,32 +1866,19 @@ | |||
1989 | 1833 | auto xid = bamf_window_get_xid(window); | 1866 | auto xid = bamf_window_get_xid(window); |
1990 | 1834 | 1867 | ||
1991 | 1835 | if (bamf_view_is_active(view)) | 1868 | if (bamf_view_is_active(view)) |
1993 | 1836 | active_xid_ = xid; | 1869 | active_window = xid; |
1994 | 1837 | 1870 | ||
1995 | 1838 | if (bamf_window_maximized(window) == BAMF_WINDOW_MAXIMIZED) | 1871 | if (bamf_window_maximized(window) == BAMF_WINDOW_MAXIMIZED) |
1996 | 1839 | { | 1872 | { |
1998 | 1840 | if (xid == active_xid_) | 1873 | if (xid == active_window()) |
1999 | 1841 | maximized_wins_.push_front(xid); | 1874 | maximized_wins_.push_front(xid); |
2000 | 1842 | else | 1875 | else |
2001 | 1843 | maximized_wins_.push_back(xid); | 1876 | maximized_wins_.push_back(xid); |
2002 | 1844 | } | 1877 | } |
2003 | 1845 | } | 1878 | } |
2004 | 1846 | 1879 | ||
2005 | 1847 | Window maximized = GetMaximizedWindow(); | ||
2006 | 1848 | Window buttons_win = 0; | ||
2007 | 1849 | |||
2008 | 1850 | if (integrated_menus_) | ||
2009 | 1851 | { | ||
2010 | 1852 | buttons_win = maximized; | ||
2011 | 1853 | window_buttons_->focused = (maximized == active_xid_); | ||
2012 | 1854 | } | ||
2013 | 1855 | else | ||
2014 | 1856 | { | ||
2015 | 1857 | buttons_win = (maximized == active_xid_) ? maximized : 0; | ||
2016 | 1858 | } | ||
2017 | 1859 | |||
2018 | 1860 | window_buttons_->monitor = monitor_; | 1880 | window_buttons_->monitor = monitor_; |
2020 | 1861 | window_buttons_->controlled_window = buttons_win; | 1881 | UpdateMaximizedWindow(); |
2021 | 1862 | 1882 | ||
2022 | 1863 | OnStyleChanged(); | 1883 | OnStyleChanged(); |
2023 | 1864 | g_list_free(windows); | 1884 | g_list_free(windows); |
2024 | @@ -1866,7 +1886,15 @@ | |||
2025 | 1866 | 1886 | ||
2026 | 1867 | bool PanelMenuView::HasMenus() const | 1887 | bool PanelMenuView::HasMenus() const |
2027 | 1868 | { | 1888 | { |
2029 | 1869 | if (entries_.empty()) | 1889 | if (!HasVisibleMenus()) |
2030 | 1890 | return false; | ||
2031 | 1891 | |||
2032 | 1892 | return integrated_menus_ || we_control_active_; | ||
2033 | 1893 | } | ||
2034 | 1894 | |||
2035 | 1895 | bool PanelMenuView::HasKeyActivableMenus() const | ||
2036 | 1896 | { | ||
2037 | 1897 | if (!HasVisibleMenus()) | ||
2038 | 1870 | return false; | 1898 | return false; |
2039 | 1871 | 1899 | ||
2040 | 1872 | return integrated_menus_ ? is_maximized_ : we_control_active_; | 1900 | return integrated_menus_ ? is_maximized_ : we_control_active_; |
2041 | 1873 | 1901 | ||
2042 | === modified file 'panel/PanelMenuView.h' | |||
2043 | --- panel/PanelMenuView.h 2015-03-12 00:57:05 +0000 | |||
2044 | +++ panel/PanelMenuView.h 2015-07-15 14:19:40 +0000 | |||
2045 | @@ -44,13 +44,17 @@ | |||
2046 | 44 | PanelMenuView(menu::Manager::Ptr const&); | 44 | PanelMenuView(menu::Manager::Ptr const&); |
2047 | 45 | ~PanelMenuView(); | 45 | ~PanelMenuView(); |
2048 | 46 | 46 | ||
2049 | 47 | nux::Property<Window> active_window; | ||
2050 | 48 | nux::Property<Window> maximized_window; | ||
2051 | 49 | nux::Property<bool> focused; | ||
2052 | 50 | |||
2053 | 47 | void SetMousePosition(int x, int y); | 51 | void SetMousePosition(int x, int y); |
2054 | 48 | void SetMonitor(int monitor) override; | 52 | void SetMonitor(int monitor) override; |
2055 | 49 | 53 | ||
2056 | 50 | Window GetTopWindow() const; | 54 | Window GetTopWindow() const; |
2057 | 51 | Window GetMaximizedWindow() const; | ||
2058 | 52 | bool GetControlsActive() const; | 55 | bool GetControlsActive() const; |
2059 | 53 | bool HasMenus() const; | 56 | bool HasMenus() const; |
2060 | 57 | bool HasKeyActivableMenus() const; | ||
2061 | 54 | 58 | ||
2062 | 55 | void NotifyAllMenusClosed(); | 59 | void NotifyAllMenusClosed(); |
2063 | 56 | 60 | ||
2064 | @@ -120,9 +124,9 @@ | |||
2065 | 120 | bool Refresh(bool force = false); | 124 | bool Refresh(bool force = false); |
2066 | 121 | 125 | ||
2067 | 122 | void UpdateTitleTexture(nux::Geometry const&, std::string const& label); | 126 | void UpdateTitleTexture(nux::Geometry const&, std::string const& label); |
2068 | 123 | |||
2069 | 124 | void UpdateLastGeometry(nux::Geometry const& geo); | 127 | void UpdateLastGeometry(nux::Geometry const& geo); |
2070 | 125 | void UpdateTitleGradientTexture(); | 128 | void UpdateTitleGradientTexture(); |
2071 | 129 | void UpdateMaximizedWindow(); | ||
2072 | 126 | 130 | ||
2073 | 127 | void OnPanelViewMouseEnter(int x, int y, unsigned long mouse_button_state, unsigned long special_keys_state); | 131 | void OnPanelViewMouseEnter(int x, int y, unsigned long mouse_button_state, unsigned long special_keys_state); |
2074 | 128 | void OnPanelViewMouseLeave(int x, int y, unsigned long mouse_button_state, unsigned long special_keys_state); | 132 | void OnPanelViewMouseLeave(int x, int y, unsigned long mouse_button_state, unsigned long special_keys_state); |
2075 | @@ -134,6 +138,7 @@ | |||
2076 | 134 | void OnLauncherKeyNavEnded(GVariant* data); | 138 | void OnLauncherKeyNavEnded(GVariant* data); |
2077 | 135 | void OnLauncherSelectionChanged(GVariant* data); | 139 | void OnLauncherSelectionChanged(GVariant* data); |
2078 | 136 | 140 | ||
2079 | 141 | void UpdateTargetWindowItems(); | ||
2080 | 137 | void UpdateShowNow(bool ignore); | 142 | void UpdateShowNow(bool ignore); |
2081 | 138 | bool CheckMouseInside(); | 143 | bool CheckMouseInside(); |
2082 | 139 | 144 | ||
2083 | @@ -158,7 +163,7 @@ | |||
2084 | 158 | 163 | ||
2085 | 159 | void ActivateIntegratedMenus(nux::Point const&); | 164 | void ActivateIntegratedMenus(nux::Point const&); |
2086 | 160 | 165 | ||
2088 | 161 | menu::Manager::Ptr const& menu_manager_; | 166 | menu::Manager::Ptr menu_manager_; |
2089 | 162 | glib::Object<BamfMatcher> matcher_; | 167 | glib::Object<BamfMatcher> matcher_; |
2090 | 163 | 168 | ||
2091 | 164 | nux::TextureLayer* title_layer_; | 169 | nux::TextureLayer* title_layer_; |
2092 | @@ -190,7 +195,6 @@ | |||
2093 | 190 | bool integrated_menus_; | 195 | bool integrated_menus_; |
2094 | 191 | bool always_show_menus_; | 196 | bool always_show_menus_; |
2095 | 192 | 197 | ||
2096 | 193 | Window active_xid_; | ||
2097 | 194 | nux::Geometry monitor_geo_; | 198 | nux::Geometry monitor_geo_; |
2098 | 195 | const std::string desktop_name_; | 199 | const std::string desktop_name_; |
2099 | 196 | 200 | ||
2100 | 197 | 201 | ||
2101 | === modified file 'panel/PanelView.cpp' | |||
2102 | --- panel/PanelView.cpp 2014-03-06 16:26:34 +0000 | |||
2103 | +++ panel/PanelView.cpp 2015-07-15 14:19:40 +0000 | |||
2104 | @@ -519,7 +519,7 @@ | |||
2105 | 519 | 519 | ||
2106 | 520 | if (opacity_maximized_toggle_) | 520 | if (opacity_maximized_toggle_) |
2107 | 521 | { | 521 | { |
2109 | 522 | Window maximized_win = menu_view_->GetMaximizedWindow(); | 522 | Window maximized_win = menu_view_->maximized_window(); |
2110 | 523 | 523 | ||
2111 | 524 | if (wm.IsExpoActive() || (maximized_win != 0 && !wm.IsWindowObscured(maximized_win))) | 524 | if (wm.IsExpoActive() || (maximized_win != 0 && !wm.IsWindowObscured(maximized_win))) |
2112 | 525 | opacity = 1.0f; | 525 | opacity = 1.0f; |
2113 | @@ -676,7 +676,7 @@ | |||
2114 | 676 | if (!IsActive()) | 676 | if (!IsActive()) |
2115 | 677 | return false; | 677 | return false; |
2116 | 678 | 678 | ||
2118 | 679 | if ((menu_view_->HasMenus() && menu_view_->ActivateIfSensitive()) || | 679 | if ((menu_view_->HasKeyActivableMenus() && menu_view_->ActivateIfSensitive()) || |
2119 | 680 | indicators_->ActivateIfSensitive()) | 680 | indicators_->ActivateIfSensitive()) |
2120 | 681 | { | 681 | { |
2121 | 682 | // Since this only happens on keyboard events, we need to prevent that the | 682 | // Since this only happens on keyboard events, we need to prevent that the |
2122 | @@ -693,7 +693,7 @@ | |||
2123 | 693 | if (!IsActive()) | 693 | if (!IsActive()) |
2124 | 694 | return false; | 694 | return false; |
2125 | 695 | 695 | ||
2127 | 696 | if ((menu_view_->HasMenus() && menu_view_->ActivateEntry(entry_id, 0)) || | 696 | if ((menu_view_->HasKeyActivableMenus() && menu_view_->ActivateEntry(entry_id, 0)) || |
2128 | 697 | indicators_->ActivateEntry(entry_id, 0)) | 697 | indicators_->ActivateEntry(entry_id, 0)) |
2129 | 698 | { | 698 | { |
2130 | 699 | // Since this only happens on keyboard events, we need to prevent that the | 699 | // Since this only happens on keyboard events, we need to prevent that the |
2131 | 700 | 700 | ||
2132 | === modified file 'plugins/unityshell/src/unityshell.cpp' | |||
2133 | --- plugins/unityshell/src/unityshell.cpp 2015-06-03 12:46:12 +0000 | |||
2134 | +++ plugins/unityshell/src/unityshell.cpp 2015-07-15 14:19:40 +0000 | |||
2135 | @@ -156,6 +156,7 @@ | |||
2136 | 156 | , cScreen(CompositeScreen::get(screen)) | 156 | , cScreen(CompositeScreen::get(screen)) |
2137 | 157 | , gScreen(GLScreen::get(screen)) | 157 | , gScreen(GLScreen::get(screen)) |
2138 | 158 | , sScreen(ScaleScreen::get(screen)) | 158 | , sScreen(ScaleScreen::get(screen)) |
2139 | 159 | , WM(PluginAdapter::Initialize(screen)) | ||
2140 | 159 | , menus_(std::make_shared<menu::Manager>(std::make_shared<indicator::DBusIndicators>(), std::make_shared<key::GnomeGrabber>())) | 160 | , menus_(std::make_shared<menu::Manager>(std::make_shared<indicator::DBusIndicators>(), std::make_shared<key::GnomeGrabber>())) |
2141 | 160 | , deco_manager_(std::make_shared<decoration::Manager>(menus_)) | 161 | , deco_manager_(std::make_shared<decoration::Manager>(menus_)) |
2142 | 161 | , debugger_(this) | 162 | , debugger_(this) |
2143 | @@ -278,9 +279,6 @@ | |||
2144 | 278 | ScaleScreenInterface::setHandler(sScreen); | 279 | ScaleScreenInterface::setHandler(sScreen); |
2145 | 279 | screen->updateSupportedWmHints(); | 280 | screen->updateSupportedWmHints(); |
2146 | 280 | 281 | ||
2147 | 281 | PluginAdapter::Initialize(screen); | ||
2148 | 282 | AddChild(&WindowManager::Default()); | ||
2149 | 283 | |||
2150 | 284 | StartupNotifyService::Default()->SetSnDisplay(screen->snDisplay(), screen->screenNum()); | 282 | StartupNotifyService::Default()->SetSnDisplay(screen->snDisplay(), screen->screenNum()); |
2151 | 285 | 283 | ||
2152 | 286 | nux::NuxInitialize(0); | 284 | nux::NuxInitialize(0); |
2153 | @@ -441,13 +439,13 @@ | |||
2154 | 441 | sigc::mem_fun(this, &UnityScreen::OnMinimizeDurationChanged) | 439 | sigc::mem_fun(this, &UnityScreen::OnMinimizeDurationChanged) |
2155 | 442 | ); | 440 | ); |
2156 | 443 | 441 | ||
2162 | 444 | WindowManager& wm = WindowManager::Default(); | 442 | WM.initiate_spread.connect(sigc::mem_fun(this, &UnityScreen::OnInitiateSpread)); |
2163 | 445 | wm.initiate_spread.connect(sigc::mem_fun(this, &UnityScreen::OnInitiateSpread)); | 443 | WM.terminate_spread.connect(sigc::mem_fun(this, &UnityScreen::OnTerminateSpread)); |
2164 | 446 | wm.terminate_spread.connect(sigc::mem_fun(this, &UnityScreen::OnTerminateSpread)); | 444 | WM.initiate_expo.connect(sigc::mem_fun(this, &UnityScreen::DamagePanelShadow)); |
2165 | 447 | wm.initiate_expo.connect(sigc::mem_fun(this, &UnityScreen::DamagePanelShadow)); | 445 | WM.terminate_expo.connect(sigc::mem_fun(this, &UnityScreen::DamagePanelShadow)); |
2161 | 448 | wm.terminate_expo.connect(sigc::mem_fun(this, &UnityScreen::DamagePanelShadow)); | ||
2166 | 449 | 446 | ||
2168 | 450 | AddChild(&screen_introspection_); | 447 | Introspectable::AddChild(&WM); |
2169 | 448 | Introspectable::AddChild(&screen_introspection_); | ||
2170 | 451 | 449 | ||
2171 | 452 | /* Create blur backup texture */ | 450 | /* Create blur backup texture */ |
2172 | 453 | auto gpu_device = nux::GetGraphicsDisplay()->GetGpuDevice(); | 451 | auto gpu_device = nux::GetGraphicsDisplay()->GetGpuDevice(); |
2173 | @@ -686,7 +684,7 @@ | |||
2174 | 686 | if (sources_.GetSource(local::RELAYOUT_TIMEOUT)) | 684 | if (sources_.GetSource(local::RELAYOUT_TIMEOUT)) |
2175 | 687 | return; | 685 | return; |
2176 | 688 | 686 | ||
2178 | 689 | if (WindowManager::Default().IsExpoActive()) | 687 | if (WM.IsExpoActive()) |
2179 | 690 | return; | 688 | return; |
2180 | 691 | 689 | ||
2181 | 692 | CompOutput* output = _last_output; | 690 | CompOutput* output = _last_output; |
2182 | @@ -947,7 +945,7 @@ | |||
2183 | 947 | nux::TexCoordXForm texxform; | 945 | nux::TexCoordXForm texxform; |
2184 | 948 | texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_CLAMP); | 946 | texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_CLAMP); |
2185 | 949 | 947 | ||
2187 | 950 | int monitor = WindowManager::Default().MonitorGeometryIn(NuxGeometryFromCompRect(output_dev)); | 948 | int monitor = WM.MonitorGeometryIn(NuxGeometryFromCompRect(output_dev)); |
2188 | 951 | auto const& texture = panel_style_.GetBackground(monitor)->GetDeviceTexture(); | 949 | auto const& texture = panel_style_.GetBackground(monitor)->GetDeviceTexture(); |
2189 | 952 | graphics_engine->QRP_GLSL_1Tex(0, 0, output_dev.width(), texture->GetHeight(), texture, texxform, nux::color::White); | 950 | graphics_engine->QRP_GLSL_1Tex(0, 0, output_dev.width(), texture->GetHeight(), texture, texxform, nux::color::White); |
2190 | 953 | } | 951 | } |
2191 | @@ -960,7 +958,7 @@ | |||
2192 | 960 | hud_controller_->IsVisible() || | 958 | hud_controller_->IsVisible() || |
2193 | 961 | session_controller_->Visible() || | 959 | session_controller_->Visible() || |
2194 | 962 | ((switcher_controller_->Visible() || | 960 | ((switcher_controller_->Visible() || |
2196 | 963 | WindowManager::Default().IsExpoActive()) | 961 | WM.IsExpoActive()) |
2197 | 964 | && !fullscreen_windows_.empty () && (!(screen->grabbed () && !screen->otherGrabExist (NULL)))); | 962 | && !fullscreen_windows_.empty () && (!(screen->grabbed () && !screen->otherGrabExist (NULL)))); |
2198 | 965 | } | 963 | } |
2199 | 966 | 964 | ||
2200 | @@ -2218,7 +2216,7 @@ | |||
2201 | 2218 | CompAction::State state, | 2216 | CompAction::State state, |
2202 | 2219 | CompOption::Vector& options) | 2217 | CompOption::Vector& options) |
2203 | 2220 | { | 2218 | { |
2205 | 2221 | WindowManager::Default().ShowDesktop(); | 2219 | WM.ShowDesktop(); |
2206 | 2222 | return true; | 2220 | return true; |
2207 | 2223 | } | 2221 | } |
2208 | 2224 | 2222 | ||
2209 | @@ -2322,7 +2320,7 @@ | |||
2210 | 2322 | CompAction::State state, | 2320 | CompAction::State state, |
2211 | 2323 | CompOption::Vector& options) | 2321 | CompOption::Vector& options) |
2212 | 2324 | { | 2322 | { |
2214 | 2325 | if (WindowManager::Default().IsWallActive()) | 2323 | if (WM.IsWallActive()) |
2215 | 2326 | return false; | 2324 | return false; |
2216 | 2327 | else if (switcher_controller_->Visible()) | 2325 | else if (switcher_controller_->Visible()) |
2217 | 2328 | switcher_controller_->Next(); | 2326 | switcher_controller_->Next(); |
2218 | @@ -2520,11 +2518,9 @@ | |||
2219 | 2520 | } | 2518 | } |
2220 | 2521 | else | 2519 | else |
2221 | 2522 | { | 2520 | { |
2225 | 2523 | auto& wm = WindowManager::Default(); | 2521 | if (WM.IsScreenGrabbed()) |
2223 | 2524 | |||
2224 | 2525 | if (wm.IsScreenGrabbed()) | ||
2226 | 2526 | { | 2522 | { |
2228 | 2527 | hud_ungrab_slot_ = wm.screen_ungrabbed.connect([this] { ShowHud(); }); | 2523 | hud_ungrab_slot_ = WM.screen_ungrabbed.connect([this] { ShowHud(); }); |
2229 | 2528 | 2524 | ||
2230 | 2529 | // Let's wait ungrab event for maximum a couple of seconds... | 2525 | // Let's wait ungrab event for maximum a couple of seconds... |
2231 | 2530 | sources_.AddTimeoutSeconds(2, [this] { | 2526 | sources_.AddTimeoutSeconds(2, [this] { |
2232 | @@ -2663,7 +2659,7 @@ | |||
2233 | 2663 | KeySym keysym = XkbKeycodeToKeysym(screen->dpy(), keybind.keycode(), 0, 0); | 2659 | KeySym keysym = XkbKeycodeToKeysym(screen->dpy(), keybind.keycode(), 0, 0); |
2234 | 2664 | unsigned modifiers = CompizModifiersToNux(keybind.modifiers()); | 2660 | unsigned modifiers = CompizModifiersToNux(keybind.modifiers()); |
2235 | 2665 | 2661 | ||
2237 | 2666 | WindowManager::Default().close_window_key = std::make_pair(modifiers, keysym); | 2662 | WM.close_window_key = std::make_pair(modifiers, keysym); |
2238 | 2667 | } | 2663 | } |
2239 | 2668 | 2664 | ||
2240 | 2669 | void UnityScreen::UpdateActivateIndicatorsKey() | 2665 | void UnityScreen::UpdateActivateIndicatorsKey() |
2241 | @@ -2672,7 +2668,7 @@ | |||
2242 | 2672 | KeySym keysym = XkbKeycodeToKeysym(screen->dpy(), keybind.keycode(), 0, 0); | 2668 | KeySym keysym = XkbKeycodeToKeysym(screen->dpy(), keybind.keycode(), 0, 0); |
2243 | 2673 | unsigned modifiers = CompizModifiersToNux(keybind.modifiers()); | 2669 | unsigned modifiers = CompizModifiersToNux(keybind.modifiers()); |
2244 | 2674 | 2670 | ||
2246 | 2675 | WindowManager::Default().activate_indicators_key = std::make_pair(modifiers, keysym); | 2671 | WM.activate_indicators_key = std::make_pair(modifiers, keysym); |
2247 | 2676 | } | 2672 | } |
2248 | 2677 | 2673 | ||
2249 | 2678 | bool UnityScreen::initPluginActions() | 2674 | bool UnityScreen::initPluginActions() |
2250 | @@ -2925,7 +2921,7 @@ | |||
2251 | 2925 | } | 2921 | } |
2252 | 2926 | } | 2922 | } |
2253 | 2927 | 2923 | ||
2255 | 2928 | if (WindowManager::Default().IsScaleActive() && | 2924 | if (uScreen->WM.IsScaleActive() && |
2256 | 2929 | uScreen->sScreen->getSelectedWindow() == window->id()) | 2925 | uScreen->sScreen->getSelectedWindow() == window->id()) |
2257 | 2930 | { | 2926 | { |
2258 | 2931 | nux::Geometry const& scaled_geo = GetScaledGeometry(); | 2927 | nux::Geometry const& scaled_geo = GetScaledGeometry(); |
2259 | @@ -3030,9 +3026,8 @@ | |||
2260 | 3030 | !(window_state & CompWindowStateFullscreenMask) && | 3026 | !(window_state & CompWindowStateFullscreenMask) && |
2261 | 3031 | !(window_type & CompWindowTypeFullscreenMask)) | 3027 | !(window_type & CompWindowTypeFullscreenMask)) |
2262 | 3032 | { | 3028 | { |
2263 | 3033 | WindowManager& wm = WindowManager::Default(); | ||
2264 | 3034 | auto const& output = uScreen->screen->currentOutputDev(); | 3029 | auto const& output = uScreen->screen->currentOutputDev(); |
2266 | 3035 | int monitor = wm.MonitorGeometryIn(NuxGeometryFromCompRect(output)); | 3030 | int monitor = uScreen->WM.MonitorGeometryIn(NuxGeometryFromCompRect(output)); |
2267 | 3036 | 3031 | ||
2268 | 3037 | if (window->y() - window->border().top < output.y() + uScreen->panel_style_.PanelHeight(monitor)) | 3032 | if (window->y() - window->border().top < output.y() + uScreen->panel_style_.PanelHeight(monitor)) |
2269 | 3038 | { | 3033 | { |
2270 | @@ -3670,8 +3665,7 @@ | |||
2271 | 3670 | { | 3665 | { |
2272 | 3671 | if (strcmp(name, "hsize") == 0 || strcmp(name, "vsize") == 0) | 3666 | if (strcmp(name, "hsize") == 0 || strcmp(name, "vsize") == 0) |
2273 | 3672 | { | 3667 | { |
2276 | 3673 | WindowManager& wm = WindowManager::Default(); | 3668 | WM.viewport_layout_changed.emit(screen->vpSize().width(), screen->vpSize().height()); |
2275 | 3674 | wm.viewport_layout_changed.emit(screen->vpSize().width(), screen->vpSize().height()); | ||
2277 | 3675 | } | 3669 | } |
2278 | 3676 | else if (strcmp(name, "close_window_key") == 0) | 3670 | else if (strcmp(name, "close_window_key") == 0) |
2279 | 3677 | { | 3671 | { |
2280 | @@ -3787,13 +3781,11 @@ | |||
2281 | 3787 | if (QuicklistManager::Default()->Current()) | 3781 | if (QuicklistManager::Default()->Current()) |
2282 | 3788 | QuicklistManager::Default()->Current()->Hide(); | 3782 | QuicklistManager::Default()->Current()->Hide(); |
2283 | 3789 | 3783 | ||
2291 | 3790 | auto& wm = WindowManager::Default(); | 3784 | if (WM.IsScaleActive()) |
2292 | 3791 | 3785 | WM.TerminateScale(); | |
2293 | 3792 | if (wm.IsScaleActive()) | 3786 | |
2294 | 3793 | wm.TerminateScale(); | 3787 | if (WM.IsExpoActive()) |
2295 | 3794 | 3788 | WM.TerminateExpo(); | |
2289 | 3795 | if (wm.IsExpoActive()) | ||
2290 | 3796 | wm.TerminateExpo(); | ||
2296 | 3797 | 3789 | ||
2297 | 3798 | RaiseOSK(); | 3790 | RaiseOSK(); |
2298 | 3799 | } | 3791 | } |
2299 | @@ -3892,24 +3884,24 @@ | |||
2300 | 3892 | auto edge_barriers = std::make_shared<ui::EdgeBarrierController>(); | 3884 | auto edge_barriers = std::make_shared<ui::EdgeBarrierController>(); |
2301 | 3893 | 3885 | ||
2302 | 3894 | launcher_controller_ = std::make_shared<launcher::Controller>(xdnd_manager, edge_barriers); | 3886 | launcher_controller_ = std::make_shared<launcher::Controller>(xdnd_manager, edge_barriers); |
2304 | 3895 | AddChild(launcher_controller_.get()); | 3887 | Introspectable::AddChild(launcher_controller_.get()); |
2305 | 3896 | 3888 | ||
2306 | 3897 | switcher_controller_ = std::make_shared<switcher::Controller>(); | 3889 | switcher_controller_ = std::make_shared<switcher::Controller>(); |
2307 | 3898 | switcher_controller_->detail.changed.connect(sigc::mem_fun(this, &UnityScreen::OnSwitcherDetailChanged)); | 3890 | switcher_controller_->detail.changed.connect(sigc::mem_fun(this, &UnityScreen::OnSwitcherDetailChanged)); |
2309 | 3899 | AddChild(switcher_controller_.get()); | 3891 | Introspectable::AddChild(switcher_controller_.get()); |
2310 | 3900 | 3892 | ||
2311 | 3901 | LOG_INFO(logger) << "initLauncher-Launcher " << timer.ElapsedSeconds() << "s"; | 3893 | LOG_INFO(logger) << "initLauncher-Launcher " << timer.ElapsedSeconds() << "s"; |
2312 | 3902 | 3894 | ||
2313 | 3903 | /* Setup panel */ | 3895 | /* Setup panel */ |
2314 | 3904 | timer.Reset(); | 3896 | timer.Reset(); |
2315 | 3905 | panel_controller_ = std::make_shared<panel::Controller>(menus_, edge_barriers); | 3897 | panel_controller_ = std::make_shared<panel::Controller>(menus_, edge_barriers); |
2317 | 3906 | AddChild(panel_controller_.get()); | 3898 | Introspectable::AddChild(panel_controller_.get()); |
2318 | 3907 | LOG_INFO(logger) << "initLauncher-Panel " << timer.ElapsedSeconds() << "s"; | 3899 | LOG_INFO(logger) << "initLauncher-Panel " << timer.ElapsedSeconds() << "s"; |
2319 | 3908 | 3900 | ||
2320 | 3909 | /* Setup Places */ | 3901 | /* Setup Places */ |
2321 | 3910 | dash_controller_ = std::make_shared<dash::Controller>(); | 3902 | dash_controller_ = std::make_shared<dash::Controller>(); |
2322 | 3911 | dash_controller_->on_realize.connect(sigc::mem_fun(this, &UnityScreen::OnDashRealized)); | 3903 | dash_controller_->on_realize.connect(sigc::mem_fun(this, &UnityScreen::OnDashRealized)); |
2324 | 3912 | AddChild(dash_controller_.get()); | 3904 | Introspectable::AddChild(dash_controller_.get()); |
2325 | 3913 | 3905 | ||
2326 | 3914 | /* Setup Hud */ | 3906 | /* Setup Hud */ |
2327 | 3915 | hud_controller_ = std::make_shared<hud::Controller>(); | 3907 | hud_controller_ = std::make_shared<hud::Controller>(); |
2328 | @@ -3918,14 +3910,14 @@ | |||
2329 | 3918 | hud_controller_->multiple_launchers = (optionGetNumLaunchers() == 0); | 3910 | hud_controller_->multiple_launchers = (optionGetNumLaunchers() == 0); |
2330 | 3919 | hud_controller_->icon_size = launcher_controller_->options()->icon_size(); | 3911 | hud_controller_->icon_size = launcher_controller_->options()->icon_size(); |
2331 | 3920 | hud_controller_->tile_size = launcher_controller_->options()->tile_size(); | 3912 | hud_controller_->tile_size = launcher_controller_->options()->tile_size(); |
2333 | 3921 | AddChild(hud_controller_.get()); | 3913 | Introspectable::AddChild(hud_controller_.get()); |
2334 | 3922 | LOG_INFO(logger) << "initLauncher-hud " << timer.ElapsedSeconds() << "s"; | 3914 | LOG_INFO(logger) << "initLauncher-hud " << timer.ElapsedSeconds() << "s"; |
2335 | 3923 | 3915 | ||
2336 | 3924 | // Setup Shortcut Hint | 3916 | // Setup Shortcut Hint |
2337 | 3925 | auto base_window_raiser = std::make_shared<shortcut::BaseWindowRaiserImp>(); | 3917 | auto base_window_raiser = std::make_shared<shortcut::BaseWindowRaiserImp>(); |
2338 | 3926 | auto shortcuts_modeller = std::make_shared<shortcut::CompizModeller>(); | 3918 | auto shortcuts_modeller = std::make_shared<shortcut::CompizModeller>(); |
2339 | 3927 | shortcut_controller_ = std::make_shared<shortcut::Controller>(base_window_raiser, shortcuts_modeller); | 3919 | shortcut_controller_ = std::make_shared<shortcut::Controller>(base_window_raiser, shortcuts_modeller); |
2341 | 3928 | AddChild(shortcut_controller_.get()); | 3920 | Introspectable::AddChild(shortcut_controller_.get()); |
2342 | 3929 | ShowFirstRunHints(); | 3921 | ShowFirstRunHints(); |
2343 | 3930 | 3922 | ||
2344 | 3931 | // Setup Session Controller | 3923 | // Setup Session Controller |
2345 | @@ -3936,7 +3928,7 @@ | |||
2346 | 3936 | manager->unlocked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenUnlocked)); | 3928 | manager->unlocked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenUnlocked)); |
2347 | 3937 | session_dbus_manager_ = std::make_shared<session::DBusManager>(manager); | 3929 | session_dbus_manager_ = std::make_shared<session::DBusManager>(manager); |
2348 | 3938 | session_controller_ = std::make_shared<session::Controller>(manager); | 3930 | session_controller_ = std::make_shared<session::Controller>(manager); |
2350 | 3939 | AddChild(session_controller_.get()); | 3931 | Introspectable::AddChild(session_controller_.get()); |
2351 | 3940 | 3932 | ||
2352 | 3941 | // Setup Lockscreen Controller | 3933 | // Setup Lockscreen Controller |
2353 | 3942 | screensaver_dbus_manager_ = std::make_shared<lockscreen::DBusManager>(manager); | 3934 | screensaver_dbus_manager_ = std::make_shared<lockscreen::DBusManager>(manager); |
2354 | @@ -4122,7 +4114,7 @@ | |||
2355 | 4122 | window->minimizedSetEnabled (this, false); | 4114 | window->minimizedSetEnabled (this, false); |
2356 | 4123 | } | 4115 | } |
2357 | 4124 | 4116 | ||
2359 | 4125 | /* Keep this after the optionGetShowMinimizedWindows branch */ | 4117 | /* Keep this after the optionGetShowMIntrospectable.hinimizedWindows branch */ |
2360 | 4126 | 4118 | ||
2361 | 4127 | if (window->state() & CompWindowStateFullscreenMask) | 4119 | if (window->state() & CompWindowStateFullscreenMask) |
2362 | 4128 | uScreen->fullscreen_windows_.push_back(window); | 4120 | uScreen->fullscreen_windows_.push_back(window); |
2363 | @@ -4139,8 +4131,8 @@ | |||
2364 | 4139 | { | 4131 | { |
2365 | 4140 | Window xid = window->id(); | 4132 | Window xid = window->id(); |
2366 | 4141 | auto const& swins = uScreen->sScreen->getWindows(); | 4133 | auto const& swins = uScreen->sScreen->getWindows(); |
2367 | 4134 | WindowManager& wm = uScreen->WM; | ||
2368 | 4142 | bool scaled = std::find(swins.begin(), swins.end(), ScaleWindow::get(window)) != swins.end(); | 4135 | bool scaled = std::find(swins.begin(), swins.end(), ScaleWindow::get(window)) != swins.end(); |
2369 | 4143 | WindowManager& wm = WindowManager::Default(); | ||
2370 | 4144 | 4136 | ||
2371 | 4145 | introspection | 4137 | introspection |
2372 | 4146 | .add(scaled ? GetScaledGeometry() : wm.GetWindowGeometry(xid)) | 4138 | .add(scaled ? GetScaledGeometry() : wm.GetWindowGeometry(xid)) |
2373 | @@ -4376,9 +4368,7 @@ | |||
2374 | 4376 | 4368 | ||
2375 | 4377 | nux::Geometry UnityWindow::GetScaledGeometry() | 4369 | nux::Geometry UnityWindow::GetScaledGeometry() |
2376 | 4378 | { | 4370 | { |
2380 | 4379 | WindowManager& wm = WindowManager::Default(); | 4371 | if (!uScreen->WM.IsScaleActive()) |
2378 | 4380 | |||
2379 | 4381 | if (!wm.IsScaleActive()) | ||
2381 | 4382 | return nux::Geometry(); | 4372 | return nux::Geometry(); |
2382 | 4383 | 4373 | ||
2383 | 4384 | ScaleWindow* scale_win = ScaleWindow::get(window); | 4374 | ScaleWindow* scale_win = ScaleWindow::get(window); |
2384 | 4385 | 4375 | ||
2385 | === modified file 'plugins/unityshell/src/unityshell.h' | |||
2386 | --- plugins/unityshell/src/unityshell.h 2015-06-03 12:46:12 +0000 | |||
2387 | +++ plugins/unityshell/src/unityshell.h 2015-07-15 14:19:40 +0000 | |||
2388 | @@ -333,6 +333,7 @@ | |||
2389 | 333 | 333 | ||
2390 | 334 | /* The window thread should be the last thing removed, as c++ does it in reverse order */ | 334 | /* The window thread should be the last thing removed, as c++ does it in reverse order */ |
2391 | 335 | std::unique_ptr<nux::WindowThread> wt; | 335 | std::unique_ptr<nux::WindowThread> wt; |
2392 | 336 | WindowManager& WM; | ||
2393 | 336 | 337 | ||
2394 | 337 | menu::Manager::Ptr menus_; | 338 | menu::Manager::Ptr menus_; |
2395 | 338 | std::shared_ptr<decoration::Manager> deco_manager_; | 339 | std::shared_ptr<decoration::Manager> deco_manager_; |
2396 | @@ -368,7 +369,7 @@ | |||
2397 | 368 | typedef std::vector<CompActionPtr> ShortcutActions; | 369 | typedef std::vector<CompActionPtr> ShortcutActions; |
2398 | 369 | ShortcutActions _shortcut_actions; | 370 | ShortcutActions _shortcut_actions; |
2399 | 370 | std::map<CancelActionTarget, CompActionPtr> _escape_actions; | 371 | std::map<CancelActionTarget, CompActionPtr> _escape_actions; |
2401 | 371 | std::map<int, unsigned int> windows_for_monitor_; | 372 | std::unordered_map<int, unsigned int> windows_for_monitor_; |
2402 | 372 | 373 | ||
2403 | 373 | /* keyboard-nav mode */ | 374 | /* keyboard-nav mode */ |
2404 | 374 | CompWindow* newFocusedWindow; | 375 | CompWindow* newFocusedWindow; |
2405 | 375 | 376 | ||
2406 | === modified file 'services/panel-main.c' | |||
2407 | --- services/panel-main.c 2014-12-09 15:41:53 +0000 | |||
2408 | +++ services/panel-main.c 2015-07-15 14:19:40 +0000 | |||
2409 | @@ -26,20 +26,21 @@ | |||
2410 | 26 | #include "config.h" | 26 | #include "config.h" |
2411 | 27 | #include "panel-a11y.h" | 27 | #include "panel-a11y.h" |
2412 | 28 | #include "panel-service.h" | 28 | #include "panel-service.h" |
2413 | 29 | #include "panel-service-private.h" | ||
2414 | 29 | 30 | ||
2415 | 30 | static GDBusNodeInfo *introspection_data = NULL; | 31 | static GDBusNodeInfo *introspection_data = NULL; |
2416 | 31 | 32 | ||
2417 | 32 | static const gchar introspection_xml[] = | 33 | static const gchar introspection_xml[] = |
2418 | 33 | "<node>" | 34 | "<node>" |
2420 | 34 | " <interface name='com.canonical.Unity.Panel.Service'>" | 35 | " <interface name='"UPS_IFACE"'>" |
2421 | 35 | "" | 36 | "" |
2422 | 36 | " <method name='Sync'>" | 37 | " <method name='Sync'>" |
2424 | 37 | " <arg type='a(ssssbbusbbi)' name='state' direction='out'/>" | 38 | " <arg type='"ENTRY_ARRAY_SIGNATURE"' name='state' direction='out'/>" |
2425 | 38 | " </method>" | 39 | " </method>" |
2426 | 39 | "" | 40 | "" |
2427 | 40 | " <method name='SyncOne'>" | 41 | " <method name='SyncOne'>" |
2428 | 41 | " <arg type='s' name='indicator_id' direction='in'/>" | 42 | " <arg type='s' name='indicator_id' direction='in'/>" |
2430 | 42 | " <arg type='a(ssssbbusbbi)' name='state' direction='out'/>" | 43 | " <arg type='"ENTRY_ARRAY_SIGNATURE"' name='state' direction='out'/>" |
2431 | 43 | " </method>" | 44 | " </method>" |
2432 | 44 | "" | 45 | "" |
2433 | 45 | " <method name='SyncGeometries'>" | 46 | " <method name='SyncGeometries'>" |
2434 | @@ -109,10 +110,6 @@ | |||
2435 | 109 | " </interface>" | 110 | " </interface>" |
2436 | 110 | "</node>"; | 111 | "</node>"; |
2437 | 111 | 112 | ||
2438 | 112 | #define S_NAME_DESKTOP "com.canonical.Unity.Panel.Service.Desktop" | ||
2439 | 113 | #define S_NAME_LOCKSCREEN "com.canonical.Unity.Panel.Service.LockScreen" | ||
2440 | 114 | #define S_PATH "/com/canonical/Unity/Panel/Service" | ||
2441 | 115 | #define S_IFACE "com.canonical.Unity.Panel.Service" | ||
2442 | 116 | 113 | ||
2443 | 117 | /* Forwards */ | 114 | /* Forwards */ |
2444 | 118 | static void | 115 | static void |
2445 | @@ -270,8 +267,8 @@ | |||
2446 | 270 | GError *error = NULL; | 267 | GError *error = NULL; |
2447 | 271 | g_dbus_connection_emit_signal (connection, | 268 | g_dbus_connection_emit_signal (connection, |
2448 | 272 | NULL, | 269 | NULL, |
2451 | 273 | S_PATH, | 270 | UPS_PATH, |
2452 | 274 | S_IFACE, | 271 | UPS_IFACE, |
2453 | 275 | "ReSync", | 272 | "ReSync", |
2454 | 276 | g_variant_new ("(s)", indicator_id), | 273 | g_variant_new ("(s)", indicator_id), |
2455 | 277 | &error); | 274 | &error); |
2456 | @@ -292,10 +289,13 @@ | |||
2457 | 292 | GError *error = NULL; | 289 | GError *error = NULL; |
2458 | 293 | g_dbus_connection_emit_signal (connection, | 290 | g_dbus_connection_emit_signal (connection, |
2459 | 294 | NULL, | 291 | NULL, |
2462 | 295 | S_PATH, | 292 | UPS_PATH, |
2463 | 296 | S_IFACE, | 293 | UPS_IFACE, |
2464 | 297 | "EntryActivated", | 294 | "EntryActivated", |
2466 | 298 | g_variant_new ("(ss(iiuu))", panel_id, entry_id, x, y, w, h), | 295 | g_variant_new ("(ss(iiuu))", |
2467 | 296 | panel_id ? panel_id : "", | ||
2468 | 297 | entry_id ? entry_id : "", | ||
2469 | 298 | x, y, w, h), | ||
2470 | 299 | &error); | 299 | &error); |
2471 | 300 | 300 | ||
2472 | 301 | if (error) | 301 | if (error) |
2473 | @@ -315,8 +315,8 @@ | |||
2474 | 315 | 315 | ||
2475 | 316 | g_dbus_connection_emit_signal (connection, | 316 | g_dbus_connection_emit_signal (connection, |
2476 | 317 | NULL, | 317 | NULL, |
2479 | 318 | S_PATH, | 318 | UPS_PATH, |
2480 | 319 | S_IFACE, | 319 | UPS_IFACE, |
2481 | 320 | "EntryActivateRequest", | 320 | "EntryActivateRequest", |
2482 | 321 | g_variant_new ("(s)", entry_id), | 321 | g_variant_new ("(s)", entry_id), |
2483 | 322 | &error); | 322 | &error); |
2484 | @@ -337,8 +337,8 @@ | |||
2485 | 337 | GError *error = NULL; | 337 | GError *error = NULL; |
2486 | 338 | g_dbus_connection_emit_signal (connection, | 338 | g_dbus_connection_emit_signal (connection, |
2487 | 339 | NULL, | 339 | NULL, |
2490 | 340 | S_PATH, | 340 | UPS_PATH, |
2491 | 341 | S_IFACE, | 341 | UPS_IFACE, |
2492 | 342 | "EntryShowNowChanged", | 342 | "EntryShowNowChanged", |
2493 | 343 | g_variant_new ("(sb)", entry_id, show_now_state), | 343 | g_variant_new ("(sb)", entry_id, show_now_state), |
2494 | 344 | &error); | 344 | &error); |
2495 | @@ -356,8 +356,8 @@ | |||
2496 | 356 | GError *error = NULL; | 356 | GError *error = NULL; |
2497 | 357 | g_dbus_connection_emit_signal (connection, | 357 | g_dbus_connection_emit_signal (connection, |
2498 | 358 | NULL, | 358 | NULL, |
2501 | 359 | S_PATH, | 359 | UPS_PATH, |
2502 | 360 | S_IFACE, | 360 | UPS_IFACE, |
2503 | 361 | "IconPathsChanged", | 361 | "IconPathsChanged", |
2504 | 362 | NULL, | 362 | NULL, |
2505 | 363 | &error); | 363 | &error); |
2506 | @@ -378,7 +378,7 @@ | |||
2507 | 378 | guint reg_id; | 378 | guint reg_id; |
2508 | 379 | 379 | ||
2509 | 380 | reg_id = g_dbus_connection_register_object (connection, | 380 | reg_id = g_dbus_connection_register_object (connection, |
2511 | 381 | S_PATH, | 381 | UPS_PATH, |
2512 | 382 | introspection_data->interfaces[0], | 382 | introspection_data->interfaces[0], |
2513 | 383 | &interface_vtable, | 383 | &interface_vtable, |
2514 | 384 | service, | 384 | service, |
2515 | @@ -489,7 +489,7 @@ | |||
2516 | 489 | service = panel_service_get_default (); | 489 | service = panel_service_get_default (); |
2517 | 490 | 490 | ||
2518 | 491 | owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, | 491 | owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, |
2520 | 492 | !lockscreen_mode ? S_NAME_DESKTOP : S_NAME_LOCKSCREEN, | 492 | !lockscreen_mode ? UPS_NAME_DESKTOP : UPS_NAME_LOCKSCREEN, |
2521 | 493 | G_BUS_NAME_OWNER_FLAGS_NONE, | 493 | G_BUS_NAME_OWNER_FLAGS_NONE, |
2522 | 494 | on_bus_acquired, | 494 | on_bus_acquired, |
2523 | 495 | on_name_acquired, | 495 | on_name_acquired, |
2524 | 496 | 496 | ||
2525 | === modified file 'services/panel-service-private.h' | |||
2526 | --- services/panel-service-private.h 2013-10-03 15:15:35 +0000 | |||
2527 | +++ services/panel-service-private.h 2015-07-15 14:19:40 +0000 | |||
2528 | @@ -21,9 +21,27 @@ | |||
2529 | 21 | 21 | ||
2530 | 22 | #include <X11/Xlib.h> | 22 | #include <X11/Xlib.h> |
2531 | 23 | #include <X11/keysym.h> | 23 | #include <X11/keysym.h> |
2532 | 24 | #include <glib.h> | ||
2533 | 24 | 25 | ||
2534 | 25 | G_BEGIN_DECLS | 26 | G_BEGIN_DECLS |
2535 | 26 | 27 | ||
2536 | 28 | #ifdef __cplusplus | ||
2537 | 29 | extern "C" { | ||
2538 | 30 | #endif | ||
2539 | 31 | |||
2540 | 32 | #define UPS_NAME_DESKTOP "com.canonical.Unity.Panel.Service.Desktop" | ||
2541 | 33 | #define UPS_NAME_LOCKSCREEN "com.canonical.Unity.Panel.Service.LockScreen" | ||
2542 | 34 | #define UPS_PATH "/com/canonical/Unity/Panel/Service" | ||
2543 | 35 | #define UPS_IFACE "com.canonical.Unity.Panel.Service" | ||
2544 | 36 | |||
2545 | 37 | #define APPMENU_INDICATOR_NAME "libappmenu.so" | ||
2546 | 38 | |||
2547 | 39 | #define ENTRY_SIGNATURE "(sssusbbusbbi)" | ||
2548 | 40 | #define ENTRY_ARRAY_SIGNATURE "a" ENTRY_SIGNATURE "" | ||
2549 | 41 | |||
2550 | 42 | #define AltMask Mod1Mask | ||
2551 | 43 | #define SuperMask Mod4Mask | ||
2552 | 44 | |||
2553 | 27 | typedef struct _KeyBinding | 45 | typedef struct _KeyBinding |
2554 | 28 | { | 46 | { |
2555 | 29 | KeySym key; | 47 | KeySym key; |
2556 | @@ -31,11 +49,12 @@ | |||
2557 | 31 | guint32 modifiers; | 49 | guint32 modifiers; |
2558 | 32 | } KeyBinding; | 50 | } KeyBinding; |
2559 | 33 | 51 | ||
2560 | 34 | #define AltMask Mod1Mask | ||
2561 | 35 | #define SuperMask Mod4Mask | ||
2562 | 36 | |||
2563 | 37 | void parse_string_keybinding (const char *, KeyBinding *); | 52 | void parse_string_keybinding (const char *, KeyBinding *); |
2564 | 38 | 53 | ||
2565 | 54 | #ifdef __cplusplus | ||
2566 | 55 | } | ||
2567 | 56 | #endif | ||
2568 | 57 | |||
2569 | 39 | G_END_DECLS | 58 | G_END_DECLS |
2570 | 40 | 59 | ||
2571 | 41 | #endif /* _PANEL_SERVICE_PRIVATE_H_ */ | 60 | #endif /* _PANEL_SERVICE_PRIVATE_H_ */ |
2572 | 42 | 61 | ||
2573 | === modified file 'services/panel-service.c' | |||
2574 | --- services/panel-service.c 2015-07-15 14:19:40 +0000 | |||
2575 | +++ services/panel-service.c 2015-07-15 14:19:40 +0000 | |||
2576 | @@ -42,7 +42,7 @@ | |||
2577 | 42 | 42 | ||
2578 | 43 | #define NOTIFY_TIMEOUT 80 | 43 | #define NOTIFY_TIMEOUT 80 |
2579 | 44 | #define N_TIMEOUT_SLOTS 50 | 44 | #define N_TIMEOUT_SLOTS 50 |
2581 | 45 | #define MAX_INDICATOR_ENTRIES 100 | 45 | #define MAX_INDICATOR_ENTRIES 500 |
2582 | 46 | 46 | ||
2583 | 47 | #define NUX_VERTICAL_SCROLL_DELTA 120 | 47 | #define NUX_VERTICAL_SCROLL_DELTA 120 |
2584 | 48 | #define NUX_HORIZONTAL_SCROLL_DELTA (NUX_VERTICAL_SCROLL_DELTA ^ 2) | 48 | #define NUX_HORIZONTAL_SCROLL_DELTA (NUX_VERTICAL_SCROLL_DELTA ^ 2) |
2585 | @@ -60,10 +60,13 @@ | |||
2586 | 60 | { | 60 | { |
2587 | 61 | GSList *indicators; | 61 | GSList *indicators; |
2588 | 62 | GSList *dropdown_entries; | 62 | GSList *dropdown_entries; |
2589 | 63 | GSList *removed_entries; | ||
2590 | 63 | GHashTable *id2entry_hash; | 64 | GHashTable *id2entry_hash; |
2591 | 64 | GHashTable *panel2entries_hash; | 65 | GHashTable *panel2entries_hash; |
2592 | 66 | IndicatorObject *appmenu_indicator; | ||
2593 | 65 | 67 | ||
2595 | 66 | gint32 timeouts[N_TIMEOUT_SLOTS]; | 68 | guint timeouts[N_TIMEOUT_SLOTS]; |
2596 | 69 | guint remove_idle; | ||
2597 | 67 | 70 | ||
2598 | 68 | IndicatorObjectEntry *last_entry; | 71 | IndicatorObjectEntry *last_entry; |
2599 | 69 | IndicatorObjectEntry *last_dropdown_entry; | 72 | IndicatorObjectEntry *last_dropdown_entry; |
2600 | @@ -103,14 +106,14 @@ | |||
2601 | 103 | 106 | ||
2602 | 104 | enum | 107 | enum |
2603 | 105 | { | 108 | { |
2605 | 106 | SYNC_WAITING = -1, | 109 | SYNC_WAITING = G_MAXUINT, |
2606 | 107 | SYNC_NEUTRAL = 0, | 110 | SYNC_NEUTRAL = 0, |
2607 | 108 | }; | 111 | }; |
2608 | 109 | 112 | ||
2609 | 110 | static guint32 _service_signals[LAST_SIGNAL] = { 0 }; | 113 | static guint32 _service_signals[LAST_SIGNAL] = { 0 }; |
2610 | 111 | 114 | ||
2611 | 112 | static const gchar * indicator_order[][2] = { | 115 | static const gchar * indicator_order[][2] = { |
2613 | 113 | {"libappmenu.so", NULL}, /* indicator-appmenu" */ | 116 | {APPMENU_INDICATOR_NAME, NULL}, /* indicator-appmenu" */ |
2614 | 114 | {"libapplication.so", NULL}, /* indicator-application" */ | 117 | {"libapplication.so", NULL}, /* indicator-application" */ |
2615 | 115 | {"floating-indicators", NULL}, /* position-less NG indicators */ | 118 | {"floating-indicators", NULL}, /* position-less NG indicators */ |
2616 | 116 | {"libprintersmenu.so", NULL}, /* indicator-printers */ | 119 | {"libprintersmenu.so", NULL}, /* indicator-printers */ |
2617 | @@ -135,6 +138,8 @@ | |||
2618 | 135 | static void notify_object (IndicatorObject *object); | 138 | static void notify_object (IndicatorObject *object); |
2619 | 136 | static void update_keybinding (GSettings *, const gchar *, gpointer); | 139 | static void update_keybinding (GSettings *, const gchar *, gpointer); |
2620 | 137 | static void emit_upstart_event (const gchar *); | 140 | static void emit_upstart_event (const gchar *); |
2621 | 141 | static gchar * get_indicator_entry_id_by_entry (IndicatorObjectEntry *entry); | ||
2622 | 142 | static IndicatorObjectEntry * get_indicator_entry_by_id (PanelService *self, const gchar *entry_id); | ||
2623 | 138 | static GdkFilterReturn event_filter (GdkXEvent *, GdkEvent *, PanelService *); | 143 | static GdkFilterReturn event_filter (GdkXEvent *, GdkEvent *, PanelService *); |
2624 | 139 | 144 | ||
2625 | 140 | /* | 145 | /* |
2626 | @@ -163,7 +168,7 @@ | |||
2627 | 163 | 168 | ||
2628 | 164 | for (i = 0; i < N_TIMEOUT_SLOTS; i++) | 169 | for (i = 0; i < N_TIMEOUT_SLOTS; i++) |
2629 | 165 | { | 170 | { |
2631 | 166 | if (priv->timeouts[i] > 0) | 171 | if (priv->timeouts[i] > 0 && priv->timeouts[i] != SYNC_WAITING) |
2632 | 167 | { | 172 | { |
2633 | 168 | g_source_remove (priv->timeouts[i]); | 173 | g_source_remove (priv->timeouts[i]); |
2634 | 169 | priv->timeouts[i] = 0; | 174 | priv->timeouts[i] = 0; |
2635 | @@ -264,9 +269,10 @@ | |||
2636 | 264 | } | 269 | } |
2637 | 265 | 270 | ||
2638 | 266 | static gboolean | 271 | static gboolean |
2640 | 267 | is_point_in_rect (gint x, gint y, GdkRectangle* rect) | 272 | rect_contains_point (GdkRectangle* rect, gint x, gint y) |
2641 | 268 | { | 273 | { |
2643 | 269 | g_return_val_if_fail (rect, FALSE); | 274 | if (!rect) |
2644 | 275 | return FALSE; | ||
2645 | 270 | 276 | ||
2646 | 271 | return (x >= rect->x && x <= (rect->x + rect->width) && | 277 | return (x >= rect->x && x <= (rect->x + rect->width) && |
2647 | 272 | y >= rect->y && y <= (rect->y + rect->height)); | 278 | y >= rect->y && y <= (rect->y + rect->height)); |
2648 | @@ -289,7 +295,7 @@ | |||
2649 | 289 | IndicatorObjectEntry *entry = k; | 295 | IndicatorObjectEntry *entry = k; |
2650 | 290 | GdkRectangle *geo = v; | 296 | GdkRectangle *geo = v; |
2651 | 291 | 297 | ||
2653 | 292 | if (is_point_in_rect (x, y, geo)) | 298 | if (rect_contains_point (geo, x, y)) |
2654 | 293 | { | 299 | { |
2655 | 294 | return entry; | 300 | return entry; |
2656 | 295 | } | 301 | } |
2657 | @@ -320,8 +326,7 @@ | |||
2658 | 320 | IndicatorObjectEntry *entry = key; | 326 | IndicatorObjectEntry *entry = key; |
2659 | 321 | GdkRectangle *geo = value; | 327 | GdkRectangle *geo = value; |
2660 | 322 | 328 | ||
2663 | 323 | if (x >= geo->x && x <= (geo->x + geo->width) && | 329 | if (rect_contains_point (geo, x, y)) |
2662 | 324 | y >= geo->y && y <= (geo->y + geo->height)) | ||
2664 | 325 | { | 330 | { |
2665 | 326 | return entry; | 331 | return entry; |
2666 | 327 | } | 332 | } |
2667 | @@ -331,7 +336,7 @@ | |||
2668 | 331 | } | 336 | } |
2669 | 332 | 337 | ||
2670 | 333 | static const gchar* | 338 | static const gchar* |
2672 | 334 | get_panel_at (PanelService *self, gint x, gint y) | 339 | get_panel_for_parent_at (PanelService *self, guint parent, gint x, gint y) |
2673 | 335 | { | 340 | { |
2674 | 336 | GHashTableIter panel_iter, entries_iter; | 341 | GHashTableIter panel_iter, entries_iter; |
2675 | 337 | gpointer key, value, k, v; | 342 | gpointer key, value, k, v; |
2676 | @@ -345,12 +350,20 @@ | |||
2677 | 345 | 350 | ||
2678 | 346 | while (g_hash_table_iter_next (&entries_iter, &k, &v)) | 351 | while (g_hash_table_iter_next (&entries_iter, &k, &v)) |
2679 | 347 | { | 352 | { |
2680 | 353 | IndicatorObjectEntry *entry = k; | ||
2681 | 348 | GdkRectangle *geo = v; | 354 | GdkRectangle *geo = v; |
2682 | 349 | 355 | ||
2685 | 350 | if (x >= geo->x && x <= (geo->x + geo->width) && | 356 | /* The entry might be invalid at this point (as it could have been |
2686 | 351 | y >= geo->y && y <= (geo->y + geo->height)) | 357 | * removed, but still not synced), so it's better to double check */ |
2687 | 358 | if (g_slist_find (self->priv->removed_entries, entry)) | ||
2688 | 359 | continue; | ||
2689 | 360 | |||
2690 | 361 | if (!parent || entry->parent_window == parent) | ||
2691 | 352 | { | 362 | { |
2693 | 353 | return panel_id; | 363 | if (rect_contains_point (geo, x, y)) |
2694 | 364 | { | ||
2695 | 365 | return panel_id; | ||
2696 | 366 | } | ||
2697 | 354 | } | 367 | } |
2698 | 355 | } | 368 | } |
2699 | 356 | } | 369 | } |
2700 | @@ -413,7 +426,7 @@ | |||
2701 | 413 | /* Unity might register some "fake" dropdown entries that it might use to | 426 | /* Unity might register some "fake" dropdown entries that it might use to |
2702 | 414 | * to present long menu bars (right now only for appmenu indicator) */ | 427 | * to present long menu bars (right now only for appmenu indicator) */ |
2703 | 415 | entry = g_new0 (IndicatorObjectEntry, 1); | 428 | entry = g_new0 (IndicatorObjectEntry, 1); |
2705 | 416 | entry->parent_object = panel_service_get_indicator (self, "libappmenu.so"); | 429 | entry->parent_object = self->priv->appmenu_indicator; |
2706 | 417 | entry->name_hint = g_strdup (entry_id); | 430 | entry->name_hint = g_strdup (entry_id); |
2707 | 418 | self->priv->dropdown_entries = g_slist_append (self->priv->dropdown_entries, entry); | 431 | self->priv->dropdown_entries = g_slist_append (self->priv->dropdown_entries, entry); |
2708 | 419 | g_hash_table_insert (self->priv->id2entry_hash, (gpointer)entry->name_hint, entry); | 432 | g_hash_table_insert (self->priv->id2entry_hash, (gpointer)entry->name_hint, entry); |
2709 | @@ -423,6 +436,21 @@ | |||
2710 | 423 | } | 436 | } |
2711 | 424 | 437 | ||
2712 | 425 | static void | 438 | static void |
2713 | 439 | ensure_entry_menu_is_closed (PanelService *self, | ||
2714 | 440 | const gchar *panel_id, | ||
2715 | 441 | IndicatorObjectEntry *entry) | ||
2716 | 442 | { | ||
2717 | 443 | PanelServicePrivate *priv = self->priv; | ||
2718 | 444 | |||
2719 | 445 | /* If the entry has been removed let's make sure that its menu is closed */ | ||
2720 | 446 | if (GTK_IS_MENU (priv->last_menu) && priv->last_menu == entry->menu) | ||
2721 | 447 | { | ||
2722 | 448 | if (!priv->last_panel || !panel_id || g_strcmp0 (priv->last_panel, panel_id) == 0) | ||
2723 | 449 | gtk_menu_popdown (entry->menu); | ||
2724 | 450 | } | ||
2725 | 451 | } | ||
2726 | 452 | |||
2727 | 453 | static void | ||
2728 | 426 | reinject_key_event_to_root_window (XIDeviceEvent *ev) | 454 | reinject_key_event_to_root_window (XIDeviceEvent *ev) |
2729 | 427 | { | 455 | { |
2730 | 428 | XKeyEvent kev; | 456 | XKeyEvent kev; |
2731 | @@ -542,9 +570,7 @@ | |||
2732 | 542 | { | 570 | { |
2733 | 543 | /* Middle clicks over an appmenu entry are considered just like | 571 | /* Middle clicks over an appmenu entry are considered just like |
2734 | 544 | * all other clicks */ | 572 | * all other clicks */ |
2738 | 545 | IndicatorObject *obj = get_entry_parent_indicator (entry); | 573 | if (get_entry_parent_indicator (entry) == priv->appmenu_indicator) |
2736 | 546 | |||
2737 | 547 | if (g_strcmp0 (g_object_get_data (G_OBJECT (obj), "id"), "libappmenu.so") == 0) | ||
2739 | 548 | { | 574 | { |
2740 | 549 | event_is_a_click = TRUE; | 575 | event_is_a_click = TRUE; |
2741 | 550 | } | 576 | } |
2742 | @@ -609,7 +635,7 @@ | |||
2743 | 609 | initial_resync (PanelService *self) | 635 | initial_resync (PanelService *self) |
2744 | 610 | { | 636 | { |
2745 | 611 | g_signal_emit (self, _service_signals[RE_SYNC], 0, ""); | 637 | g_signal_emit (self, _service_signals[RE_SYNC], 0, ""); |
2747 | 612 | return FALSE; | 638 | return G_SOURCE_REMOVE; |
2748 | 613 | } | 639 | } |
2749 | 614 | 640 | ||
2750 | 615 | static gboolean | 641 | static gboolean |
2751 | @@ -618,7 +644,7 @@ | |||
2752 | 618 | if (!lockscreen_mode) | 644 | if (!lockscreen_mode) |
2753 | 619 | emit_upstart_event ("indicator-services-start"); | 645 | emit_upstart_event ("indicator-services-start"); |
2754 | 620 | 646 | ||
2756 | 621 | return FALSE; | 647 | return G_SOURCE_REMOVE; |
2757 | 622 | } | 648 | } |
2758 | 623 | 649 | ||
2759 | 624 | static void | 650 | static void |
2760 | @@ -782,10 +808,10 @@ | |||
2761 | 782 | if (self->priv->indicators == NULL) | 808 | if (self->priv->indicators == NULL) |
2762 | 783 | { | 809 | { |
2763 | 784 | g_signal_emit (self, _service_signals[INDICATORS_CLEARED], 0); | 810 | g_signal_emit (self, _service_signals[INDICATORS_CLEARED], 0); |
2765 | 785 | return FALSE; | 811 | return G_SOURCE_REMOVE; |
2766 | 786 | } | 812 | } |
2767 | 787 | 813 | ||
2769 | 788 | return TRUE; | 814 | return G_SOURCE_CONTINUE; |
2770 | 789 | } | 815 | } |
2771 | 790 | 816 | ||
2772 | 791 | static void | 817 | static void |
2773 | @@ -863,6 +889,9 @@ | |||
2774 | 863 | g_object_ref_sink (G_OBJECT (indicator)); | 889 | g_object_ref_sink (G_OBJECT (indicator)); |
2775 | 864 | } | 890 | } |
2776 | 865 | 891 | ||
2777 | 892 | if (self->priv->appmenu_indicator == indicator) | ||
2778 | 893 | self->priv->appmenu_indicator = NULL; | ||
2779 | 894 | |||
2780 | 866 | g_object_unref (G_OBJECT (indicator)); | 895 | g_object_unref (G_OBJECT (indicator)); |
2781 | 867 | } | 896 | } |
2782 | 868 | 897 | ||
2783 | @@ -1077,7 +1106,7 @@ | |||
2784 | 1077 | g_signal_emit (self, _service_signals[RE_SYNC], | 1106 | g_signal_emit (self, _service_signals[RE_SYNC], |
2785 | 1078 | 0, g_object_get_data (G_OBJECT (object), "id")); | 1107 | 0, g_object_get_data (G_OBJECT (object), "id")); |
2786 | 1079 | 1108 | ||
2788 | 1080 | return FALSE; | 1109 | return G_SOURCE_REMOVE; |
2789 | 1081 | } | 1110 | } |
2790 | 1082 | 1111 | ||
2791 | 1083 | static void | 1112 | static void |
2792 | @@ -1136,6 +1165,7 @@ | |||
2793 | 1136 | g_return_if_fail (PANEL_IS_SERVICE (self)); | 1165 | g_return_if_fail (PANEL_IS_SERVICE (self)); |
2794 | 1137 | g_return_if_fail (entry != NULL); | 1166 | g_return_if_fail (entry != NULL); |
2795 | 1138 | 1167 | ||
2796 | 1168 | self->priv->removed_entries = g_slist_remove (self->priv->removed_entries, entry); | ||
2797 | 1139 | gchar *entry_id = get_indicator_entry_id_by_entry (entry); | 1169 | gchar *entry_id = get_indicator_entry_id_by_entry (entry); |
2798 | 1140 | g_hash_table_insert (self->priv->id2entry_hash, entry_id, entry); | 1170 | g_hash_table_insert (self->priv->id2entry_hash, entry_id, entry); |
2799 | 1141 | 1171 | ||
2800 | @@ -1175,6 +1205,42 @@ | |||
2801 | 1175 | notify_object (object); | 1205 | notify_object (object); |
2802 | 1176 | } | 1206 | } |
2803 | 1177 | 1207 | ||
2804 | 1208 | static gboolean | ||
2805 | 1209 | on_removed_idle (PanelService *self) | ||
2806 | 1210 | { | ||
2807 | 1211 | GHashTableIter iter; | ||
2808 | 1212 | GHashTable *entry2geometry_hash; | ||
2809 | 1213 | IndicatorObjectEntry *entry; | ||
2810 | 1214 | gpointer value; | ||
2811 | 1215 | GSList *l; | ||
2812 | 1216 | |||
2813 | 1217 | for (l = self->priv->removed_entries; l; l = l->next) | ||
2814 | 1218 | { | ||
2815 | 1219 | entry = l->data; | ||
2816 | 1220 | ensure_entry_menu_is_closed (self, NULL, entry); | ||
2817 | 1221 | |||
2818 | 1222 | g_hash_table_iter_init (&iter, self->priv->panel2entries_hash); | ||
2819 | 1223 | while (g_hash_table_iter_next (&iter, NULL, &value)) | ||
2820 | 1224 | { | ||
2821 | 1225 | if ((entry2geometry_hash = value)) | ||
2822 | 1226 | { | ||
2823 | 1227 | g_hash_table_remove (entry2geometry_hash, entry); | ||
2824 | 1228 | |||
2825 | 1229 | if (g_hash_table_size (entry2geometry_hash) == 0) | ||
2826 | 1230 | { | ||
2827 | 1231 | g_hash_table_iter_remove (&iter); | ||
2828 | 1232 | } | ||
2829 | 1233 | } | ||
2830 | 1234 | } | ||
2831 | 1235 | |||
2832 | 1236 | } | ||
2833 | 1237 | |||
2834 | 1238 | g_slist_free (self->priv->removed_entries); | ||
2835 | 1239 | self->priv->removed_entries = NULL; | ||
2836 | 1240 | |||
2837 | 1241 | return G_SOURCE_REMOVE; | ||
2838 | 1242 | } | ||
2839 | 1243 | |||
2840 | 1178 | static void | 1244 | static void |
2841 | 1179 | on_entry_removed (IndicatorObject *object, | 1245 | on_entry_removed (IndicatorObject *object, |
2842 | 1180 | IndicatorObjectEntry *entry, | 1246 | IndicatorObjectEntry *entry, |
2843 | @@ -1183,11 +1249,6 @@ | |||
2844 | 1183 | g_return_if_fail (PANEL_IS_SERVICE (self)); | 1249 | g_return_if_fail (PANEL_IS_SERVICE (self)); |
2845 | 1184 | g_return_if_fail (entry != NULL); | 1250 | g_return_if_fail (entry != NULL); |
2846 | 1185 | 1251 | ||
2847 | 1186 | /* Don't remove here the value from panel2entries_hash, this should be | ||
2848 | 1187 | * done during the geometries sync, to avoid false positive. | ||
2849 | 1188 | * FIXME this in libappmenu.so to avoid to send an "entry-removed" signal | ||
2850 | 1189 | * when switching the focus from a window to one of its dialog children */ | ||
2851 | 1190 | |||
2852 | 1191 | gchar *entry_id = get_indicator_entry_id_by_entry (entry); | 1252 | gchar *entry_id = get_indicator_entry_id_by_entry (entry); |
2853 | 1192 | g_hash_table_remove (self->priv->id2entry_hash, entry_id); | 1253 | g_hash_table_remove (self->priv->id2entry_hash, entry_id); |
2854 | 1193 | g_free (entry_id); | 1254 | g_free (entry_id); |
2855 | @@ -1202,6 +1263,13 @@ | |||
2856 | 1202 | g_signal_handlers_disconnect_by_data (entry->image, object); | 1263 | g_signal_handlers_disconnect_by_data (entry->image, object); |
2857 | 1203 | } | 1264 | } |
2858 | 1204 | 1265 | ||
2859 | 1266 | self->priv->removed_entries = g_slist_append (self->priv->removed_entries, entry); | ||
2860 | 1267 | |||
2861 | 1268 | if (self->priv->remove_idle) | ||
2862 | 1269 | g_source_remove (self->priv->remove_idle); | ||
2863 | 1270 | |||
2864 | 1271 | self->priv->remove_idle = g_idle_add ((GSourceFunc) on_removed_idle, self); | ||
2865 | 1272 | |||
2866 | 1205 | notify_object (object); | 1273 | notify_object (object); |
2867 | 1206 | } | 1274 | } |
2868 | 1207 | 1275 | ||
2869 | @@ -1259,6 +1327,7 @@ | |||
2870 | 1259 | "unity", | 1327 | "unity", |
2871 | 1260 | "unity-3d", | 1328 | "unity-3d", |
2872 | 1261 | "unity-panel-service", | 1329 | "unity-panel-service", |
2873 | 1330 | "unity-all-menus", | ||
2874 | 1262 | NULL | 1331 | NULL |
2875 | 1263 | }; | 1332 | }; |
2876 | 1264 | 1333 | ||
2877 | @@ -1278,6 +1347,9 @@ | |||
2878 | 1278 | 1347 | ||
2879 | 1279 | priv->indicators = g_slist_append (priv->indicators, object); | 1348 | priv->indicators = g_slist_append (priv->indicators, object); |
2880 | 1280 | 1349 | ||
2881 | 1350 | if (!priv->appmenu_indicator && g_strcmp0 (name, APPMENU_INDICATOR_NAME) == 0) | ||
2882 | 1351 | priv->appmenu_indicator = object; | ||
2883 | 1352 | |||
2884 | 1281 | g_object_set_data_full (G_OBJECT (object), "id", g_strdup (name), g_free); | 1353 | g_object_set_data_full (G_OBJECT (object), "id", g_strdup (name), g_free); |
2885 | 1282 | 1354 | ||
2886 | 1283 | g_signal_connect (object, INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED, | 1355 | g_signal_connect (object, INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED, |
2887 | @@ -1539,10 +1611,11 @@ | |||
2888 | 1539 | guint32 image_type = 0; | 1611 | guint32 image_type = 0; |
2889 | 1540 | gchar *image_data = gtk_image_to_data (entry->image, &image_type); | 1612 | gchar *image_data = gtk_image_to_data (entry->image, &image_type); |
2890 | 1541 | 1613 | ||
2892 | 1542 | g_variant_builder_add (b, "(ssssbbusbbi)", | 1614 | g_variant_builder_add (b, ENTRY_SIGNATURE, |
2893 | 1543 | indicator_id, | 1615 | indicator_id, |
2894 | 1544 | id, | 1616 | id, |
2895 | 1545 | entry->name_hint ? entry->name_hint : "", | 1617 | entry->name_hint ? entry->name_hint : "", |
2896 | 1618 | entry->parent_window, | ||
2897 | 1546 | is_label ? gtk_label_get_label (entry->label) : "", | 1619 | is_label ? gtk_label_get_label (entry->label) : "", |
2898 | 1547 | is_label ? gtk_widget_get_sensitive (GTK_WIDGET (entry->label)) : FALSE, | 1620 | is_label ? gtk_widget_get_sensitive (GTK_WIDGET (entry->label)) : FALSE, |
2899 | 1548 | is_label ? gtk_widget_get_visible (GTK_WIDGET (entry->label)) : FALSE, | 1621 | is_label ? gtk_widget_get_visible (GTK_WIDGET (entry->label)) : FALSE, |
2900 | @@ -1559,14 +1632,15 @@ | |||
2901 | 1559 | indicator_entry_null_to_variant (const gchar *indicator_id, | 1632 | indicator_entry_null_to_variant (const gchar *indicator_id, |
2902 | 1560 | GVariantBuilder *b) | 1633 | GVariantBuilder *b) |
2903 | 1561 | { | 1634 | { |
2905 | 1562 | g_variant_builder_add (b, "(ssssbbusbbi)", | 1635 | g_variant_builder_add (b, ENTRY_SIGNATURE, |
2906 | 1563 | indicator_id, | 1636 | indicator_id, |
2907 | 1564 | "", | 1637 | "", |
2908 | 1565 | "", | 1638 | "", |
2909 | 1639 | 0, | ||
2910 | 1566 | "", | 1640 | "", |
2911 | 1567 | FALSE, | 1641 | FALSE, |
2912 | 1568 | FALSE, | 1642 | FALSE, |
2914 | 1569 | (guint32) 0, | 1643 | 0, |
2915 | 1570 | "", | 1644 | "", |
2916 | 1571 | FALSE, | 1645 | FALSE, |
2917 | 1572 | FALSE, | 1646 | FALSE, |
2918 | @@ -1574,15 +1648,20 @@ | |||
2919 | 1574 | } | 1648 | } |
2920 | 1575 | 1649 | ||
2921 | 1576 | static void | 1650 | static void |
2923 | 1577 | indicator_object_full_to_variant (IndicatorObject *object, const gchar *indicator_id, GVariantBuilder *b) | 1651 | indicator_object_full_to_variant (PanelService *self, IndicatorObject *object, |
2924 | 1652 | const gchar *indicator_id, GVariantBuilder *b) | ||
2925 | 1578 | { | 1653 | { |
2926 | 1579 | GList *entries, *e; | 1654 | GList *entries, *e; |
2927 | 1655 | GHashTable *index_hash = NULL; | ||
2928 | 1580 | gint parent_prio = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (object), "priority")); | 1656 | gint parent_prio = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (object), "priority")); |
2929 | 1581 | entries = indicator_object_get_entries (object); | 1657 | entries = indicator_object_get_entries (object); |
2931 | 1582 | gint index = 0; | 1658 | guint index = 0; |
2932 | 1583 | 1659 | ||
2933 | 1584 | if (entries) | 1660 | if (entries) |
2934 | 1585 | { | 1661 | { |
2935 | 1662 | if (object == self->priv->appmenu_indicator) | ||
2936 | 1663 | index_hash = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL); | ||
2937 | 1664 | |||
2938 | 1586 | for (e = entries; e; e = e->next) | 1665 | for (e = entries; e; e = e->next) |
2939 | 1587 | { | 1666 | { |
2940 | 1588 | gint prio = -1; | 1667 | gint prio = -1; |
2941 | @@ -1596,14 +1675,29 @@ | |||
2942 | 1596 | 1675 | ||
2943 | 1597 | if (prio < 0) | 1676 | if (prio < 0) |
2944 | 1598 | { | 1677 | { |
2945 | 1678 | if (index_hash) | ||
2946 | 1679 | { | ||
2947 | 1680 | index = GPOINTER_TO_UINT (g_hash_table_lookup (index_hash, | ||
2948 | 1681 | GUINT_TO_POINTER (entry->parent_window))); | ||
2949 | 1682 | } | ||
2950 | 1683 | |||
2951 | 1599 | prio = parent_prio + index; | 1684 | prio = parent_prio + index; |
2952 | 1600 | index++; | 1685 | index++; |
2953 | 1686 | |||
2954 | 1687 | if (index_hash) | ||
2955 | 1688 | { | ||
2956 | 1689 | g_hash_table_insert (index_hash, GUINT_TO_POINTER (entry->parent_window), | ||
2957 | 1690 | GUINT_TO_POINTER (index)); | ||
2958 | 1691 | } | ||
2959 | 1601 | } | 1692 | } |
2960 | 1602 | 1693 | ||
2961 | 1603 | indicator_entry_to_variant (entry, id, indicator_id, b, prio); | 1694 | indicator_entry_to_variant (entry, id, indicator_id, b, prio); |
2962 | 1604 | g_free (id); | 1695 | g_free (id); |
2963 | 1605 | } | 1696 | } |
2964 | 1606 | 1697 | ||
2965 | 1698 | if (index_hash) | ||
2966 | 1699 | g_hash_table_destroy (index_hash); | ||
2967 | 1700 | |||
2968 | 1607 | g_list_free (entries); | 1701 | g_list_free (entries); |
2969 | 1608 | } | 1702 | } |
2970 | 1609 | else | 1703 | else |
2971 | @@ -1614,15 +1708,15 @@ | |||
2972 | 1614 | } | 1708 | } |
2973 | 1615 | 1709 | ||
2974 | 1616 | static void | 1710 | static void |
2976 | 1617 | indicator_object_to_variant (IndicatorObject *object, const gchar *indicator_id, GVariantBuilder *b) | 1711 | indicator_object_to_variant (PanelService *self, IndicatorObject *object, |
2977 | 1712 | const gchar *indicator_id, GVariantBuilder *b) | ||
2978 | 1618 | { | 1713 | { |
2979 | 1619 | if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (object), "remove"))) | 1714 | if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (object), "remove"))) |
2980 | 1620 | { | 1715 | { |
2982 | 1621 | indicator_object_full_to_variant (object, indicator_id, b); | 1716 | indicator_object_full_to_variant (self, object, indicator_id, b); |
2983 | 1622 | } | 1717 | } |
2984 | 1623 | else | 1718 | else |
2985 | 1624 | { | 1719 | { |
2986 | 1625 | PanelService *self = panel_service_get_default (); | ||
2987 | 1626 | indicator_entry_null_to_variant (indicator_id, b); | 1720 | indicator_entry_null_to_variant (indicator_id, b); |
2988 | 1627 | panel_service_actually_remove_indicator (self, object); | 1721 | panel_service_actually_remove_indicator (self, object); |
2989 | 1628 | } | 1722 | } |
2990 | @@ -1650,7 +1744,7 @@ | |||
2991 | 1650 | rect.height *= scale; | 1744 | rect.height *= scale; |
2992 | 1651 | } | 1745 | } |
2993 | 1652 | 1746 | ||
2995 | 1653 | if (is_point_in_rect (x, y, &rect)) | 1747 | if (rect_contains_point (&rect, x, y)) |
2996 | 1654 | { | 1748 | { |
2997 | 1655 | return i; | 1749 | return i; |
2998 | 1656 | } | 1750 | } |
2999 | @@ -1722,8 +1816,8 @@ | |||
3000 | 1722 | GSList *i; | 1816 | GSList *i; |
3001 | 1723 | gint position; | 1817 | gint position; |
3002 | 1724 | 1818 | ||
3005 | 1725 | g_variant_builder_init (&b, G_VARIANT_TYPE ("(a(ssssbbusbbi))")); | 1819 | g_variant_builder_init (&b, G_VARIANT_TYPE ("("ENTRY_ARRAY_SIGNATURE")")); |
3006 | 1726 | g_variant_builder_open (&b, G_VARIANT_TYPE ("a(ssssbbusbbi)")); | 1820 | g_variant_builder_open (&b, G_VARIANT_TYPE (ENTRY_ARRAY_SIGNATURE)); |
3007 | 1727 | 1821 | ||
3008 | 1728 | for (i = self->priv->indicators; i;) | 1822 | for (i = self->priv->indicators; i;) |
3009 | 1729 | { | 1823 | { |
3010 | @@ -1733,7 +1827,7 @@ | |||
3011 | 1733 | 1827 | ||
3012 | 1734 | const gchar *indicator_id = g_object_get_data (G_OBJECT (indicator), "id"); | 1828 | const gchar *indicator_id = g_object_get_data (G_OBJECT (indicator), "id"); |
3013 | 1735 | position = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (indicator), "position")); | 1829 | position = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (indicator), "position")); |
3015 | 1736 | indicator_object_to_variant (indicator, indicator_id, &b); | 1830 | indicator_object_to_variant (self, indicator, indicator_id, &b); |
3016 | 1737 | 1831 | ||
3017 | 1738 | /* Set the sync back to neutral */ | 1832 | /* Set the sync back to neutral */ |
3018 | 1739 | self->priv->timeouts[position] = SYNC_NEUTRAL; | 1833 | self->priv->timeouts[position] = SYNC_NEUTRAL; |
3019 | @@ -1749,8 +1843,8 @@ | |||
3020 | 1749 | GVariantBuilder b; | 1843 | GVariantBuilder b; |
3021 | 1750 | GSList *i; | 1844 | GSList *i; |
3022 | 1751 | 1845 | ||
3025 | 1752 | g_variant_builder_init (&b, G_VARIANT_TYPE ("(a(ssssbbusbbi))")); | 1846 | g_variant_builder_init (&b, G_VARIANT_TYPE ("("ENTRY_ARRAY_SIGNATURE")")); |
3026 | 1753 | g_variant_builder_open (&b, G_VARIANT_TYPE ("a(ssssbbusbbi)")); | 1847 | g_variant_builder_open (&b, G_VARIANT_TYPE (ENTRY_ARRAY_SIGNATURE)); |
3027 | 1754 | 1848 | ||
3028 | 1755 | for (i = self->priv->indicators; i; i = i->next) | 1849 | for (i = self->priv->indicators; i; i = i->next) |
3029 | 1756 | { | 1850 | { |
3030 | @@ -1758,7 +1852,7 @@ | |||
3031 | 1758 | g_object_get_data (G_OBJECT (i->data), "id")) == 0) | 1852 | g_object_get_data (G_OBJECT (i->data), "id")) == 0) |
3032 | 1759 | { | 1853 | { |
3033 | 1760 | gint position = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (i->data), "position")); | 1854 | gint position = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (i->data), "position")); |
3035 | 1761 | indicator_object_to_variant (i->data, indicator_id, &b); | 1855 | indicator_object_to_variant (self, i->data, indicator_id, &b); |
3036 | 1762 | 1856 | ||
3037 | 1763 | /* Set the sync back to neutral */ | 1857 | /* Set the sync back to neutral */ |
3038 | 1764 | self->priv->timeouts[position] = SYNC_NEUTRAL; | 1858 | self->priv->timeouts[position] = SYNC_NEUTRAL; |
3039 | @@ -1782,6 +1876,7 @@ | |||
3040 | 1782 | { | 1876 | { |
3041 | 1783 | IndicatorObject *object; | 1877 | IndicatorObject *object; |
3042 | 1784 | IndicatorObjectEntry *entry; | 1878 | IndicatorObjectEntry *entry; |
3043 | 1879 | GHashTable *entry2geometry_hash; | ||
3044 | 1785 | gboolean valid_entry = TRUE; | 1880 | gboolean valid_entry = TRUE; |
3045 | 1786 | PanelServicePrivate *priv = self->priv; | 1881 | PanelServicePrivate *priv = self->priv; |
3046 | 1787 | 1882 | ||
3047 | @@ -1802,24 +1897,18 @@ | |||
3048 | 1802 | 1897 | ||
3049 | 1803 | if (entry) | 1898 | if (entry) |
3050 | 1804 | { | 1899 | { |
3052 | 1805 | GHashTable *entry2geometry_hash = g_hash_table_lookup (priv->panel2entries_hash, panel_id); | 1900 | entry2geometry_hash = g_hash_table_lookup (priv->panel2entries_hash, panel_id); |
3053 | 1806 | 1901 | ||
3054 | 1807 | if (width < 0 || height < 0 || !valid_entry) | 1902 | if (width < 0 || height < 0 || !valid_entry) |
3055 | 1808 | { | 1903 | { |
3062 | 1809 | /* If the entry has been removed let's make sure that its menu is closed */ | 1904 | if (valid_entry) |
3063 | 1810 | if (valid_entry && GTK_IS_MENU (priv->last_menu) && priv->last_menu == entry->menu) | 1905 | ensure_entry_menu_is_closed (self, panel_id, entry); |
3058 | 1811 | { | ||
3059 | 1812 | if (!priv->last_panel || g_strcmp0 (priv->last_panel, panel_id) == 0) | ||
3060 | 1813 | gtk_menu_popdown (entry->menu); | ||
3061 | 1814 | } | ||
3064 | 1815 | 1906 | ||
3065 | 1816 | if (entry2geometry_hash) | 1907 | if (entry2geometry_hash) |
3066 | 1817 | { | 1908 | { |
3072 | 1818 | if (g_hash_table_size (entry2geometry_hash) > 1) | 1909 | g_hash_table_remove (entry2geometry_hash, entry); |
3073 | 1819 | { | 1910 | |
3074 | 1820 | g_hash_table_remove (entry2geometry_hash, entry); | 1911 | if (g_hash_table_size (entry2geometry_hash) == 0) |
3070 | 1821 | } | ||
3071 | 1822 | else | ||
3075 | 1823 | { | 1912 | { |
3076 | 1824 | g_hash_table_remove (priv->panel2entries_hash, panel_id); | 1913 | g_hash_table_remove (priv->panel2entries_hash, panel_id); |
3077 | 1825 | } | 1914 | } |
3078 | @@ -2188,7 +2277,7 @@ | |||
3079 | 2188 | priv->last_x = x; | 2277 | priv->last_x = x; |
3080 | 2189 | priv->last_y = y; | 2278 | priv->last_y = y; |
3081 | 2190 | priv->last_menu_button = button; | 2279 | priv->last_menu_button = button; |
3083 | 2191 | priv->last_panel = get_panel_at (self, x, y); | 2280 | priv->last_panel = get_panel_for_parent_at (self, xid, x, y); |
3084 | 2192 | 2281 | ||
3085 | 2193 | g_signal_connect (priv->last_menu, "hide", G_CALLBACK (on_active_menu_hidden), self); | 2282 | g_signal_connect (priv->last_menu, "hide", G_CALLBACK (on_active_menu_hidden), self); |
3086 | 2194 | g_signal_connect_after (priv->last_menu, "move-current", | 2283 | g_signal_connect_after (priv->last_menu, "move-current", |
3087 | @@ -2394,10 +2483,9 @@ | |||
3088 | 2394 | GList *entries; | 2483 | GList *entries; |
3089 | 2395 | 2484 | ||
3090 | 2396 | g_return_if_fail (PANEL_IS_SERVICE (self)); | 2485 | g_return_if_fail (PANEL_IS_SERVICE (self)); |
3095 | 2397 | 2486 | g_return_if_fail (INDICATOR_IS_OBJECT (self->priv->appmenu_indicator)); | |
3096 | 2398 | object = panel_service_get_indicator (self, "libappmenu.so"); | 2487 | |
3097 | 2399 | g_return_if_fail (INDICATOR_IS_OBJECT (object)); | 2488 | object = self->priv->appmenu_indicator; |
3094 | 2400 | |||
3098 | 2401 | entries = indicator_object_get_entries (object); | 2489 | entries = indicator_object_get_entries (object); |
3099 | 2402 | 2490 | ||
3100 | 2403 | if (entries) | 2491 | if (entries) |
3101 | 2404 | 2492 | ||
3102 | === modified file 'services/panel-service.h' | |||
3103 | --- services/panel-service.h 2014-12-09 15:41:53 +0000 | |||
3104 | +++ services/panel-service.h 2015-07-15 14:19:40 +0000 | |||
3105 | @@ -56,14 +56,6 @@ | |||
3106 | 56 | struct _PanelServiceClass | 56 | struct _PanelServiceClass |
3107 | 57 | { | 57 | { |
3108 | 58 | GObjectClass parent_class; | 58 | GObjectClass parent_class; |
3109 | 59 | |||
3110 | 60 | /*< private >*/ | ||
3111 | 61 | void (*_view_padding1) (void); | ||
3112 | 62 | void (*_view_padding2) (void); | ||
3113 | 63 | void (*_view_padding3) (void); | ||
3114 | 64 | void (*_view_padding4) (void); | ||
3115 | 65 | void (*_view_padding5) (void); | ||
3116 | 66 | void (*_view_padding6) (void); | ||
3117 | 67 | }; | 59 | }; |
3118 | 68 | 60 | ||
3119 | 69 | GType panel_service_get_type (void) G_GNUC_CONST; | 61 | GType panel_service_get_type (void) G_GNUC_CONST; |
3120 | 70 | 62 | ||
3121 | === modified file 'shortcuts/ShortcutModel.h' | |||
3122 | --- shortcuts/ShortcutModel.h 2013-01-19 00:25:07 +0000 | |||
3123 | +++ shortcuts/ShortcutModel.h 2015-07-15 14:19:40 +0000 | |||
3124 | @@ -21,7 +21,7 @@ | |||
3125 | 21 | #define UNITYSHELL_SHORTCUS_MODEL_H | 21 | #define UNITYSHELL_SHORTCUS_MODEL_H |
3126 | 22 | 22 | ||
3127 | 23 | #include <boost/noncopyable.hpp> | 23 | #include <boost/noncopyable.hpp> |
3129 | 24 | #include <map> | 24 | #include <unordered_map> |
3130 | 25 | #include <memory> | 25 | #include <memory> |
3131 | 26 | #include <list> | 26 | #include <list> |
3132 | 27 | #include <string> | 27 | #include <string> |
3133 | @@ -43,7 +43,7 @@ | |||
3134 | 43 | 43 | ||
3135 | 44 | nux::Property<int> categories_per_column; | 44 | nux::Property<int> categories_per_column; |
3136 | 45 | std::vector<std::string> const& categories() const { return categories_; } | 45 | std::vector<std::string> const& categories() const { return categories_; } |
3138 | 46 | std::map<std::string, std::list<AbstractHint::Ptr>> const& hints() const { return hints_; } | 46 | std::unordered_map<std::string, std::list<AbstractHint::Ptr>> const& hints() const { return hints_; } |
3139 | 47 | 47 | ||
3140 | 48 | void Fill(); | 48 | void Fill(); |
3141 | 49 | 49 | ||
3142 | @@ -51,7 +51,7 @@ | |||
3143 | 51 | void AddHint(AbstractHint::Ptr const& hint); | 51 | void AddHint(AbstractHint::Ptr const& hint); |
3144 | 52 | 52 | ||
3145 | 53 | std::vector<std::string> categories_; | 53 | std::vector<std::string> categories_; |
3147 | 54 | std::map<std::string, std::list<AbstractHint::Ptr>> hints_; | 54 | std::unordered_map<std::string, std::list<AbstractHint::Ptr>> hints_; |
3148 | 55 | }; | 55 | }; |
3149 | 56 | 56 | ||
3150 | 57 | } | 57 | } |
3151 | 58 | 58 | ||
3152 | === modified file 'tests/autopilot/unity/emulators/panel.py' | |||
3153 | --- tests/autopilot/unity/emulators/panel.py 2013-05-10 05:16:07 +0000 | |||
3154 | +++ tests/autopilot/unity/emulators/panel.py 2015-07-15 14:19:40 +0000 | |||
3155 | @@ -159,6 +159,10 @@ | |||
3156 | 159 | return self.menus.panel_title | 159 | return self.menus.panel_title |
3157 | 160 | 160 | ||
3158 | 161 | @property | 161 | @property |
3159 | 162 | def focused(self): | ||
3160 | 163 | return self.menus.focused | ||
3161 | 164 | |||
3162 | 165 | @property | ||
3163 | 162 | def desktop_is_active(self): | 166 | def desktop_is_active(self): |
3164 | 163 | return self.menus.desktop_active | 167 | return self.menus.desktop_active |
3165 | 164 | 168 | ||
3166 | 165 | 169 | ||
3167 | === modified file 'tests/autopilot/unity/tests/__init__.py' | |||
3168 | --- tests/autopilot/unity/tests/__init__.py 2014-02-12 20:43:54 +0000 | |||
3169 | +++ tests/autopilot/unity/tests/__init__.py 2015-07-15 14:19:40 +0000 | |||
3170 | @@ -48,7 +48,7 @@ | |||
3171 | 48 | from Xlib import display | 48 | from Xlib import display |
3172 | 49 | from Xlib import Xutil | 49 | from Xlib import Xutil |
3173 | 50 | 50 | ||
3175 | 51 | from gi.repository import Gio | 51 | from gi.repository import GLib, Gio |
3176 | 52 | 52 | ||
3177 | 53 | log = getLogger(__name__) | 53 | log = getLogger(__name__) |
3178 | 54 | 54 | ||
3179 | @@ -256,20 +256,19 @@ | |||
3180 | 256 | atom_type = display.Display().intern_atom('CARDINAL') | 256 | atom_type = display.Display().intern_atom('CARDINAL') |
3181 | 257 | return bamf_window.x_win.get_property(atom, atom_type, 0, 1024).value[0] | 257 | return bamf_window.x_win.get_property(atom, atom_type, 0, 1024).value[0] |
3182 | 258 | 258 | ||
3184 | 259 | def call_gsettings_cmd(self, command, schema, *args): | 259 | def call_gsettings_cmd(self, command, schema, key, value=None): |
3185 | 260 | """Set a desktop wide gsettings option | 260 | """Set a desktop wide gsettings option |
3186 | 261 | |||
3187 | 262 | Using the gsettings command because there is a bug with importing | ||
3188 | 263 | from gobject introspection and pygtk2 simultaneously, and the Xlib | ||
3189 | 264 | keyboard layout bits are very unwieldy. This seems like the best | ||
3190 | 265 | solution, even a little bit brutish. | ||
3191 | 266 | """ | 261 | """ |
3198 | 267 | cmd = ['gsettings', command, schema] + list(args) | 262 | settings = Gio.Settings.new(schema) |
3199 | 268 | # strip to remove the trailing \n. | 263 | |
3200 | 269 | ret = check_output(cmd).strip() | 264 | if command == "get": |
3201 | 270 | time.sleep(5) | 265 | return settings.get_value(key).print_(type_annotate=False) |
3202 | 271 | reset_display() | 266 | elif command == "set": |
3203 | 272 | return ret | 267 | settings.set_value(key, GLib.Variant.parse(type=None, text=value)) |
3204 | 268 | settings.apply() | ||
3205 | 269 | reset_display() | ||
3206 | 270 | elif command == "reset": | ||
3207 | 271 | settings.reset(key) | ||
3208 | 273 | 272 | ||
3209 | 274 | def set_unity_option(self, option_name, option_value): | 273 | def set_unity_option(self, option_name, option_value): |
3210 | 275 | """Set an option in the unity compiz plugin options. | 274 | """Set an option in the unity compiz plugin options. |
3211 | 276 | 275 | ||
3212 | === modified file 'tests/autopilot/unity/tests/test_dash.py' | |||
3213 | --- tests/autopilot/unity/tests/test_dash.py 2014-02-28 19:53:07 +0000 | |||
3214 | +++ tests/autopilot/unity/tests/test_dash.py 2015-07-15 14:19:40 +0000 | |||
3215 | @@ -164,7 +164,7 @@ | |||
3216 | 164 | 164 | ||
3217 | 165 | self.assertProperty(char_win, is_active=True) | 165 | self.assertProperty(char_win, is_active=True) |
3218 | 166 | 166 | ||
3220 | 167 | def test_dash_does_not_open_when_fullscreen_window(self): | 167 | def test_dash_opens_when_fullscreen_window(self): |
3221 | 168 | """ The Dash must not open if a window is fullscreen. """ | 168 | """ The Dash must not open if a window is fullscreen. """ |
3222 | 169 | gedit = self.process_manager.start_app("Text Editor") | 169 | gedit = self.process_manager.start_app("Text Editor") |
3223 | 170 | self.keyboard.press_and_release('F11') | 170 | self.keyboard.press_and_release('F11') |
3224 | @@ -175,7 +175,7 @@ | |||
3225 | 175 | self.keybinding("dash/reveal") | 175 | self.keybinding("dash/reveal") |
3226 | 176 | self.addCleanup(self.unity.dash.ensure_hidden) | 176 | self.addCleanup(self.unity.dash.ensure_hidden) |
3227 | 177 | 177 | ||
3229 | 178 | self.assertThat(self.unity.dash.visible, Eventually(Equals(False))) | 178 | self.assertThat(self.unity.dash.visible, Eventually(Equals(True))) |
3230 | 179 | 179 | ||
3231 | 180 | 180 | ||
3232 | 181 | class DashRevealWithSpreadTests(DashTestCase): | 181 | class DashRevealWithSpreadTests(DashTestCase): |
3233 | 182 | 182 | ||
3234 | === modified file 'tests/autopilot/unity/tests/test_hud.py' | |||
3235 | --- tests/autopilot/unity/tests/test_hud.py 2014-02-28 19:53:07 +0000 | |||
3236 | +++ tests/autopilot/unity/tests/test_hud.py 2015-07-15 14:19:40 +0000 | |||
3237 | @@ -512,7 +512,7 @@ | |||
3238 | 512 | self.keyboard.type("e") | 512 | self.keyboard.type("e") |
3239 | 513 | self.assertThat(self.unity.hud.view.selected_button, Eventually(Equals(1))) | 513 | self.assertThat(self.unity.hud.view.selected_button, Eventually(Equals(1))) |
3240 | 514 | 514 | ||
3242 | 515 | def test_hud_does_not_open_when_fullscreen_window(self): | 515 | def test_hud_opens_when_fullscreen_window(self): |
3243 | 516 | """ The Hud must not open if a window is fullscreen. """ | 516 | """ The Hud must not open if a window is fullscreen. """ |
3244 | 517 | gedit = self.process_manager.start_app("Text Editor") | 517 | gedit = self.process_manager.start_app("Text Editor") |
3245 | 518 | self.keyboard.press_and_release('F11') | 518 | self.keyboard.press_and_release('F11') |
3246 | @@ -523,7 +523,7 @@ | |||
3247 | 523 | self.keybinding("hud/reveal") | 523 | self.keybinding("hud/reveal") |
3248 | 524 | self.addCleanup(self.unity.hud.ensure_hidden) | 524 | self.addCleanup(self.unity.hud.ensure_hidden) |
3249 | 525 | 525 | ||
3251 | 526 | self.assertThat(self.unity.hud.visible, Eventually(Equals(False))) | 526 | self.assertThat(self.unity.hud.visible, Eventually(Equals(True))) |
3252 | 527 | 527 | ||
3253 | 528 | 528 | ||
3254 | 529 | class HudLauncherInteractionsTests(HudTestsBase): | 529 | class HudLauncherInteractionsTests(HudTestsBase): |
3255 | 530 | 530 | ||
3256 | === modified file 'tests/autopilot/unity/tests/test_panel.py' | |||
3257 | --- tests/autopilot/unity/tests/test_panel.py 2014-03-04 15:30:06 +0000 | |||
3258 | +++ tests/autopilot/unity/tests/test_panel.py 2015-07-15 14:19:40 +0000 | |||
3259 | @@ -12,6 +12,7 @@ | |||
3260 | 12 | #from autopilot.emulators.bamf import BamfWindow | 12 | #from autopilot.emulators.bamf import BamfWindow |
3261 | 13 | from autopilot.process import Window | 13 | from autopilot.process import Window |
3262 | 14 | from autopilot.matchers import Eventually | 14 | from autopilot.matchers import Eventually |
3263 | 15 | from autopilot.testcase import multiply_scenarios | ||
3264 | 15 | import logging | 16 | import logging |
3265 | 16 | import os | 17 | import os |
3266 | 17 | from testtools.matchers import Equals, GreaterThan, NotEquals | 18 | from testtools.matchers import Equals, GreaterThan, NotEquals |
3267 | @@ -25,6 +26,13 @@ | |||
3268 | 25 | 26 | ||
3269 | 26 | logger = logging.getLogger(__name__) | 27 | logger = logging.getLogger(__name__) |
3270 | 27 | 28 | ||
3271 | 29 | def _make_scenarios(): | ||
3272 | 30 | return multiply_scenarios(_make_monitor_scenarios(), | ||
3273 | 31 | _make_menu_modes_scenarios()) | ||
3274 | 32 | |||
3275 | 33 | def _make_menu_modes_scenarios(): | ||
3276 | 34 | return [ ('Locally Integrated Menus', {'lim': True}), | ||
3277 | 35 | ('Global Menus', {'lim': False}) ] | ||
3278 | 28 | 36 | ||
3279 | 29 | def _make_monitor_scenarios(): | 37 | def _make_monitor_scenarios(): |
3280 | 30 | num_monitors = Display.create().get_num_screens() | 38 | num_monitors = Display.create().get_num_screens() |
3281 | @@ -38,17 +46,41 @@ | |||
3282 | 38 | 46 | ||
3283 | 39 | return scenarios | 47 | return scenarios |
3284 | 40 | 48 | ||
3285 | 41 | |||
3286 | 42 | class PanelTestsBase(UnityTestCase): | 49 | class PanelTestsBase(UnityTestCase): |
3287 | 43 | 50 | ||
3288 | 44 | panel_monitor = 0 | 51 | panel_monitor = 0 |
3289 | 52 | lim = False | ||
3290 | 45 | 53 | ||
3291 | 46 | def setUp(self): | 54 | def setUp(self): |
3292 | 47 | super(PanelTestsBase, self).setUp() | 55 | super(PanelTestsBase, self).setUp() |
3293 | 48 | self.panel = self.unity.panels.get_panel_for_monitor(self.panel_monitor) | 56 | self.panel = self.unity.panels.get_panel_for_monitor(self.panel_monitor) |
3294 | 57 | |||
3295 | 58 | old_lim = self.call_gsettings_cmd('get', 'com.canonical.Unity', 'integrated-menus') | ||
3296 | 59 | self.call_gsettings_cmd('set', 'com.canonical.Unity', 'integrated-menus', str(self.lim).lower()) | ||
3297 | 60 | self.addCleanup(self.call_gsettings_cmd, 'set', 'com.canonical.Unity', 'integrated-menus', old_lim) | ||
3298 | 61 | |||
3299 | 62 | old_showmenus = self.call_gsettings_cmd('get', 'com.canonical.Unity', 'always-show-menus') | ||
3300 | 63 | self.call_gsettings_cmd('set', 'com.canonical.Unity', 'always-show-menus', 'false') | ||
3301 | 64 | self.addCleanup(self.call_gsettings_cmd, 'set', 'com.canonical.Unity', 'always-show-menus', old_showmenus) | ||
3302 | 65 | |||
3303 | 49 | self.panel.move_mouse_below_the_panel() | 66 | self.panel.move_mouse_below_the_panel() |
3304 | 50 | self.addCleanup(self.panel.move_mouse_below_the_panel) | 67 | self.addCleanup(self.panel.move_mouse_below_the_panel) |
3305 | 51 | 68 | ||
3306 | 69 | self.assertThat(self.panel.menus.integrated_menus, Eventually(Equals(self.lim))) | ||
3307 | 70 | if not self.lim: | ||
3308 | 71 | self.assertThat(self.panel.focused, Eventually(Equals(True))) | ||
3309 | 72 | |||
3310 | 73 | def ensure_window_state(self, win, maximized=False): | ||
3311 | 74 | if maximized and not win.is_maximized: | ||
3312 | 75 | self.keybinding("window/maximize") | ||
3313 | 76 | self.addCleanup(self.keybinding, "window/restore") | ||
3314 | 77 | elif not maximized and win.is_maximized: | ||
3315 | 78 | self.keybinding("window/restore") | ||
3316 | 79 | self.addCleanup(self.keybinding, "window/maximize") | ||
3317 | 80 | |||
3318 | 81 | sleep(.25) | ||
3319 | 82 | self.assertProperty(win, is_maximized=maximized) | ||
3320 | 83 | |||
3321 | 52 | def open_new_application_window(self, app_name, maximized=False, move_to_monitor=True): | 84 | def open_new_application_window(self, app_name, maximized=False, move_to_monitor=True): |
3322 | 53 | """Opens a new instance of the requested application, ensuring that only | 85 | """Opens a new instance of the requested application, ensuring that only |
3323 | 54 | one window is opened. | 86 | one window is opened. |
3324 | @@ -68,17 +100,8 @@ | |||
3325 | 68 | if move_to_monitor: | 100 | if move_to_monitor: |
3326 | 69 | self.move_window_to_panel_monitor(app_win) | 101 | self.move_window_to_panel_monitor(app_win) |
3327 | 70 | 102 | ||
3328 | 71 | if maximized and not app_win.is_maximized: | ||
3329 | 72 | self.keybinding("window/maximize") | ||
3330 | 73 | self.addCleanup(self.keybinding, "window/restore") | ||
3331 | 74 | elif not maximized and app_win.is_maximized: | ||
3332 | 75 | self.keybinding("window/restore") | ||
3333 | 76 | self.addCleanup(self.keybinding, "window/maximize") | ||
3334 | 77 | |||
3335 | 78 | app_win.set_focus() | 103 | app_win.set_focus() |
3339 | 79 | sleep(.25) | 104 | self.ensure_window_state(app_win, maximized) |
3337 | 80 | |||
3338 | 81 | self.assertThat(app_win.is_maximized, Equals(maximized)) | ||
3340 | 82 | 105 | ||
3341 | 83 | return app_win | 106 | return app_win |
3342 | 84 | 107 | ||
3343 | @@ -137,9 +160,10 @@ | |||
3344 | 137 | 160 | ||
3345 | 138 | def sleep_menu_settle_period(self): | 161 | def sleep_menu_settle_period(self): |
3346 | 139 | """Sleep long enough for the menus to fade in and fade out again.""" | 162 | """Sleep long enough for the menus to fade in and fade out again.""" |
3350 | 140 | sleep(self.panel.menus.fadein_duration / 1000.0) | 163 | if not self.lim: |
3351 | 141 | sleep(self.panel.menus.discovery_duration) | 164 | sleep(self.panel.menus.fadein_duration / 1000.0) |
3352 | 142 | sleep(self.panel.menus.fadeout_duration / 1000.0) | 165 | sleep(self.panel.menus.discovery_duration) |
3353 | 166 | sleep(self.panel.menus.fadeout_duration / 1000.0) | ||
3354 | 143 | 167 | ||
3355 | 144 | # Unable to exit SDM without any active apps, need a placeholder. | 168 | # Unable to exit SDM without any active apps, need a placeholder. |
3356 | 145 | # See bug LP:1079460 | 169 | # See bug LP:1079460 |
3357 | @@ -152,7 +176,7 @@ | |||
3358 | 152 | 176 | ||
3359 | 153 | class PanelTitleTests(PanelTestsBase): | 177 | class PanelTitleTests(PanelTestsBase): |
3360 | 154 | 178 | ||
3362 | 155 | scenarios = _make_monitor_scenarios() | 179 | scenarios = _make_scenarios() |
3363 | 156 | 180 | ||
3364 | 157 | def setUp(self): | 181 | def setUp(self): |
3365 | 158 | super(PanelTitleTests, self).setUp() | 182 | super(PanelTitleTests, self).setUp() |
3366 | @@ -174,13 +198,15 @@ | |||
3367 | 174 | """Panel must display application name for a non-maximised application.""" | 198 | """Panel must display application name for a non-maximised application.""" |
3368 | 175 | calc_win = self.open_new_application_window("Calculator", maximized=False) | 199 | calc_win = self.open_new_application_window("Calculator", maximized=False) |
3369 | 176 | 200 | ||
3371 | 177 | self.assertThat(self.panel.title, Eventually(Equals(calc_win.application.name))) | 201 | expected = calc_win.application.name if not self.lim else '' |
3372 | 202 | self.assertThat(self.panel.title, Eventually(Equals(expected))) | ||
3373 | 178 | 203 | ||
3374 | 179 | def test_panel_title_with_maximized_application(self): | 204 | def test_panel_title_with_maximized_application(self): |
3375 | 180 | """Panel must display application name for a maximised application.""" | 205 | """Panel must display application name for a maximised application.""" |
3376 | 181 | text_win = self.open_new_application_window("Text Editor", maximized=True) | 206 | text_win = self.open_new_application_window("Text Editor", maximized=True) |
3377 | 182 | 207 | ||
3378 | 183 | self.assertThat(self.panel.title, Eventually(Equals(text_win.title))) | 208 | self.assertThat(self.panel.title, Eventually(Equals(text_win.title))) |
3379 | 209 | self.assertThat(self.panel.focused, Eventually(Equals(True))) | ||
3380 | 184 | 210 | ||
3381 | 185 | def test_panel_title_with_maximized_window_restored_child(self): | 211 | def test_panel_title_with_maximized_window_restored_child(self): |
3382 | 186 | """Tests the title shown in the panel when opening the restored child of | 212 | """Tests the title shown in the panel when opening the restored child of |
3383 | @@ -194,14 +220,18 @@ | |||
3384 | 194 | 220 | ||
3385 | 195 | self.assertThat(lambda: len(text_win.application.get_windows()), | 221 | self.assertThat(lambda: len(text_win.application.get_windows()), |
3386 | 196 | Eventually(Equals(2))) | 222 | Eventually(Equals(2))) |
3388 | 197 | self.assertThat(self.panel.title, Equals(text_win.application.name)) | 223 | expected = text_win.application.name if not self.lim else text_win.title |
3389 | 224 | self.assertThat(self.panel.title, Equals(expected)) | ||
3390 | 225 | self.assertThat(self.panel.focused, Eventually(Equals(not self.lim))) | ||
3391 | 198 | 226 | ||
3392 | 199 | def test_panel_shows_app_title_with_maximised_app(self): | 227 | def test_panel_shows_app_title_with_maximised_app(self): |
3393 | 200 | """Tests app titles are shown in the panel with a non-focused maximized application.""" | 228 | """Tests app titles are shown in the panel with a non-focused maximized application.""" |
3395 | 201 | self.open_new_application_window("Text Editor", maximized=True) | 229 | text_win = self.open_new_application_window("Text Editor", maximized=True) |
3396 | 202 | calc_win = self.open_new_application_window("Calculator", maximized=False) | 230 | calc_win = self.open_new_application_window("Calculator", maximized=False) |
3397 | 203 | 231 | ||
3399 | 204 | self.assertThat(self.panel.title, Eventually(Equals(calc_win.application.name))) | 232 | expected = calc_win.application.name if not self.lim else text_win.title |
3400 | 233 | self.assertThat(self.panel.title, Eventually(Equals(expected))) | ||
3401 | 234 | self.assertThat(self.panel.focused, Eventually(Equals(not self.lim))) | ||
3402 | 205 | 235 | ||
3403 | 206 | def test_panel_title_updates_when_switching_to_maximized_app(self): | 236 | def test_panel_title_updates_when_switching_to_maximized_app(self): |
3404 | 207 | """Switching to a maximised app from a restored one must update the panel title.""" | 237 | """Switching to a maximised app from a restored one must update the panel title.""" |
3405 | @@ -242,13 +272,14 @@ | |||
3406 | 242 | 272 | ||
3407 | 243 | class PanelWindowButtonsTests(PanelTestsBase): | 273 | class PanelWindowButtonsTests(PanelTestsBase): |
3408 | 244 | 274 | ||
3410 | 245 | scenarios = _make_monitor_scenarios() | 275 | scenarios = _make_scenarios() |
3411 | 246 | 276 | ||
3412 | 247 | def setUp(self): | 277 | def setUp(self): |
3413 | 248 | super(PanelWindowButtonsTests, self).setUp() | 278 | super(PanelWindowButtonsTests, self).setUp() |
3414 | 249 | # Locked Launchers on all monitors | 279 | # Locked Launchers on all monitors |
3415 | 250 | self.set_unity_option('num_launchers', 0) | 280 | self.set_unity_option('num_launchers', 0) |
3416 | 251 | self.set_unity_option('launcher_hide_mode', 0) | 281 | self.set_unity_option('launcher_hide_mode', 0) |
3417 | 282 | self.always_visible = self.lim | ||
3418 | 252 | 283 | ||
3419 | 253 | def test_window_buttons_dont_show_on_empty_desktop(self): | 284 | def test_window_buttons_dont_show_on_empty_desktop(self): |
3420 | 254 | """Tests that the window buttons are not shown on clean desktop.""" | 285 | """Tests that the window buttons are not shown on clean desktop.""" |
3421 | @@ -279,13 +310,14 @@ | |||
3422 | 279 | 310 | ||
3423 | 280 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(False))) | 311 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(False))) |
3424 | 281 | 312 | ||
3428 | 282 | def test_window_buttons_dont_show_for_maximized_window_on_mouse_out(self): | 313 | def test_window_buttons_show_for_maximized_window_on_mouse_out(self): |
3429 | 283 | """Window buttons must not show for a maximized window when the mouse is | 314 | """Window buttons might show for a maximized window when the mouse is |
3430 | 284 | outside the panel. | 315 | outside the panel, depending on LIM setting. |
3431 | 285 | """ | 316 | """ |
3432 | 286 | self.open_new_application_window("Text Editor", maximized=True) | 317 | self.open_new_application_window("Text Editor", maximized=True) |
3433 | 287 | 318 | ||
3435 | 288 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(False))) | 319 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(self.always_visible))) |
3436 | 320 | self.assertThat(self.panel.window_buttons.focused, Eventually(Equals(True))) | ||
3437 | 289 | 321 | ||
3438 | 290 | def test_window_buttons_show_for_maximized_window_on_mouse_in(self): | 322 | def test_window_buttons_show_for_maximized_window_on_mouse_in(self): |
3439 | 291 | """Window buttons must show when a maximized window is focused and the | 323 | """Window buttons must show when a maximized window is focused and the |
3440 | @@ -296,8 +328,30 @@ | |||
3441 | 296 | self.panel.move_mouse_over_window_buttons() | 328 | self.panel.move_mouse_over_window_buttons() |
3442 | 297 | 329 | ||
3443 | 298 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(True))) | 330 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(True))) |
3444 | 331 | self.assertThat(self.panel.window_buttons.focused, Eventually(Equals(True))) | ||
3445 | 299 | self.assertWinButtonsInOverlayMode(False) | 332 | self.assertWinButtonsInOverlayMode(False) |
3446 | 300 | 333 | ||
3447 | 334 | def test_window_buttons_show_for_maximized_unfocused_window_with_mouse_in_panel(self): | ||
3448 | 335 | """Window buttons might show for an unfocused maximized window when the | ||
3449 | 336 | mouse is over the panel, depending on LIM setting. | ||
3450 | 337 | """ | ||
3451 | 338 | self.open_new_application_window("Text Editor", maximized=True) | ||
3452 | 339 | self.open_new_application_window("Calculator") | ||
3453 | 340 | self.panel.move_mouse_over_window_buttons() | ||
3454 | 341 | |||
3455 | 342 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(self.always_visible))) | ||
3456 | 343 | self.assertThat(self.panel.window_buttons.focused, Eventually(Equals(not self.lim))) | ||
3457 | 344 | |||
3458 | 345 | def test_window_buttons_show_for_maximized_unfocused_window_on_mouse_out(self): | ||
3459 | 346 | """Window buttons might show for an unfocused maximized window when the | ||
3460 | 347 | mouse is outside the panel, depending on LIM setting. | ||
3461 | 348 | """ | ||
3462 | 349 | self.open_new_application_window("Text Editor", maximized=True) | ||
3463 | 350 | self.open_new_application_window("Calculator") | ||
3464 | 351 | |||
3465 | 352 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(self.always_visible))) | ||
3466 | 353 | self.assertThat(self.panel.window_buttons.focused, Eventually(Equals(not self.lim))) | ||
3467 | 354 | |||
3468 | 301 | def test_window_buttons_show_with_dash(self): | 355 | def test_window_buttons_show_with_dash(self): |
3469 | 302 | """Window buttons must be shown when the dash is open.""" | 356 | """Window buttons must be shown when the dash is open.""" |
3470 | 303 | self.unity.dash.ensure_visible() | 357 | self.unity.dash.ensure_visible() |
3471 | @@ -340,122 +394,6 @@ | |||
3472 | 340 | else: | 394 | else: |
3473 | 341 | self.assertThat(self.unity.hud.view.overlay_window_buttons_shown[monitor], Equals(False)) | 395 | self.assertThat(self.unity.hud.view.overlay_window_buttons_shown[monitor], Equals(False)) |
3474 | 342 | 396 | ||
3475 | 343 | def test_window_buttons_update_visual_state(self): | ||
3476 | 344 | """Window button must update its state in response to mouse events.""" | ||
3477 | 345 | self.open_new_application_window("Text Editor", maximized=True, move_to_monitor=True) | ||
3478 | 346 | self.panel.move_mouse_over_window_buttons() | ||
3479 | 347 | button = self.panel.window_buttons.unmaximize | ||
3480 | 348 | |||
3481 | 349 | self.assertThat(button.visual_state, Eventually(Equals("normal"))) | ||
3482 | 350 | |||
3483 | 351 | button.mouse_move_to() | ||
3484 | 352 | self.assertThat(button.visual_state, Eventually(Equals("prelight"))) | ||
3485 | 353 | |||
3486 | 354 | self.mouse.press() | ||
3487 | 355 | self.addCleanup(self.mouse.release) | ||
3488 | 356 | self.assertThat(button.visual_state, Eventually(Equals("pressed"))) | ||
3489 | 357 | |||
3490 | 358 | def test_window_buttons_cancel(self): | ||
3491 | 359 | """Window buttons must ignore clicks when the mouse released outside | ||
3492 | 360 | their area. | ||
3493 | 361 | """ | ||
3494 | 362 | win = self.open_new_application_window("Text Editor", maximized=True, move_to_monitor=True) | ||
3495 | 363 | self.panel.move_mouse_over_window_buttons() | ||
3496 | 364 | |||
3497 | 365 | button = self.panel.window_buttons.unmaximize | ||
3498 | 366 | button.mouse_move_to() | ||
3499 | 367 | self.mouse.press() | ||
3500 | 368 | self.assertThat(button.visual_state, Eventually(Equals("pressed"))) | ||
3501 | 369 | self.panel.move_mouse_below_the_panel() | ||
3502 | 370 | self.mouse.release() | ||
3503 | 371 | |||
3504 | 372 | self.assertThat(win.is_maximized, Equals(True)) | ||
3505 | 373 | |||
3506 | 374 | def test_window_buttons_close_button_works_for_window(self): | ||
3507 | 375 | """Close window button must actually closes a window.""" | ||
3508 | 376 | text_win = self.open_new_application_window("Text Editor", | ||
3509 | 377 | maximized=True, | ||
3510 | 378 | move_to_monitor=True) | ||
3511 | 379 | win_xid = text_win.x_id | ||
3512 | 380 | |||
3513 | 381 | self.panel.window_buttons.close.mouse_click() | ||
3514 | 382 | self.assertNoWindowOpenWithXid(win_xid) | ||
3515 | 383 | |||
3516 | 384 | def test_window_buttons_close_follows_fitts_law(self): | ||
3517 | 385 | """Tests that the 'Close' button is activated when clicking at 0,0. | ||
3518 | 386 | |||
3519 | 387 | See bug #839690 | ||
3520 | 388 | """ | ||
3521 | 389 | text_win = self.open_new_application_window("Text Editor", | ||
3522 | 390 | maximized=True, | ||
3523 | 391 | move_to_monitor=True) | ||
3524 | 392 | win_xid = text_win.x_id | ||
3525 | 393 | |||
3526 | 394 | self.panel.move_mouse_over_window_buttons() | ||
3527 | 395 | screen_x, screen_y = self.display.get_screen_geometry(self.panel_monitor)[:2] | ||
3528 | 396 | self.mouse.move(screen_x, screen_y) | ||
3529 | 397 | self.mouse.click() | ||
3530 | 398 | |||
3531 | 399 | self.assertNoWindowOpenWithXid(win_xid) | ||
3532 | 400 | |||
3533 | 401 | def test_window_buttons_minimize_button_works_for_window(self): | ||
3534 | 402 | """Tests that the window button 'Minimize' actually minimizes a window.""" | ||
3535 | 403 | text_win = self.open_new_application_window("Text Editor", | ||
3536 | 404 | maximized=True, | ||
3537 | 405 | move_to_monitor=True) | ||
3538 | 406 | |||
3539 | 407 | self.panel.window_buttons.minimize.mouse_click() | ||
3540 | 408 | |||
3541 | 409 | self.assertProperty(text_win, is_hidden=True) | ||
3542 | 410 | |||
3543 | 411 | def test_window_buttons_minimize_follows_fitts_law(self): | ||
3544 | 412 | """Tests that the 'Minimize' button is conform to Fitts's Law. | ||
3545 | 413 | |||
3546 | 414 | See bug #839690 | ||
3547 | 415 | """ | ||
3548 | 416 | text_win = self.open_new_application_window("Text Editor", | ||
3549 | 417 | maximized=True, | ||
3550 | 418 | move_to_monitor=True) | ||
3551 | 419 | |||
3552 | 420 | self.panel.move_mouse_over_window_buttons() | ||
3553 | 421 | button = self.panel.window_buttons.minimize | ||
3554 | 422 | target_x = button.x + button.width / 2 | ||
3555 | 423 | target_y = self.display.get_screen_geometry(self.panel_monitor)[1] | ||
3556 | 424 | self.mouse.move(target_x, target_y) | ||
3557 | 425 | self.mouse.click() | ||
3558 | 426 | |||
3559 | 427 | self.assertProperty(text_win, is_hidden=True) | ||
3560 | 428 | |||
3561 | 429 | def test_window_buttons_unmaximize_button_works_for_window(self): | ||
3562 | 430 | """Tests that the window button 'Unmaximize' actually unmaximizes a window.""" | ||
3563 | 431 | text_win = self.open_new_application_window("Text Editor", | ||
3564 | 432 | maximized=True, | ||
3565 | 433 | move_to_monitor=True) | ||
3566 | 434 | |||
3567 | 435 | self.panel.window_buttons.unmaximize.mouse_click() | ||
3568 | 436 | |||
3569 | 437 | self.assertProperties(text_win, is_maximized=False, is_focused=True) | ||
3570 | 438 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(False))) | ||
3571 | 439 | |||
3572 | 440 | def test_window_buttons_unmaximize_follows_fitts_law(self): | ||
3573 | 441 | """Tests that the 'Unmaximize' button is conform to Fitts's Law. | ||
3574 | 442 | |||
3575 | 443 | See bug #839690 | ||
3576 | 444 | """ | ||
3577 | 445 | text_win = self.open_new_application_window("Text Editor", | ||
3578 | 446 | maximized=True, | ||
3579 | 447 | move_to_monitor=True) | ||
3580 | 448 | |||
3581 | 449 | button = self.panel.window_buttons.unmaximize | ||
3582 | 450 | button.mouse_move_to() | ||
3583 | 451 | target_x = button.x + button.width / 2 | ||
3584 | 452 | target_y = self.display.get_screen_geometry(self.panel_monitor)[1] | ||
3585 | 453 | self.mouse.move(target_x, target_y) | ||
3586 | 454 | sleep(1) | ||
3587 | 455 | self.mouse.click() | ||
3588 | 456 | |||
3589 | 457 | self.assertProperty(text_win, is_maximized=False) | ||
3590 | 458 | |||
3591 | 459 | def test_window_buttons_close_button_works_for_hud(self): | 397 | def test_window_buttons_close_button_works_for_hud(self): |
3592 | 460 | """Tests that the window 'Close' actually closes the HUD.""" | 398 | """Tests that the window 'Close' actually closes the HUD.""" |
3593 | 461 | self.unity.hud.ensure_visible() | 399 | self.unity.hud.ensure_visible() |
3594 | @@ -604,9 +542,7 @@ | |||
3595 | 604 | 542 | ||
3596 | 605 | def test_minimize_button_disabled_for_non_minimizable_windows(self): | 543 | def test_minimize_button_disabled_for_non_minimizable_windows(self): |
3597 | 606 | """Minimize button must be disabled for windows that don't support minimization.""" | 544 | """Minimize button must be disabled for windows that don't support minimization.""" |
3601 | 607 | text_win = self.open_new_application_window("Text Editor", | 545 | text_win = self.open_new_application_window("Text Editor", maximized=True) |
3599 | 608 | maximized=False, | ||
3600 | 609 | move_to_monitor=True) | ||
3602 | 610 | 546 | ||
3603 | 611 | self.keyboard.press_and_release("Ctrl+S") | 547 | self.keyboard.press_and_release("Ctrl+S") |
3604 | 612 | self.addCleanup(self.keyboard.press_and_release, "Escape") | 548 | self.addCleanup(self.keyboard.press_and_release, "Escape") |
3605 | @@ -626,28 +562,24 @@ | |||
3606 | 626 | """Window buttons must be shown when mouse is over panel area with an | 562 | """Window buttons must be shown when mouse is over panel area with an |
3607 | 627 | indicator open. | 563 | indicator open. |
3608 | 628 | """ | 564 | """ |
3612 | 629 | self.open_new_application_window("Text Editor", | 565 | self.open_new_application_window("Text Editor", maximized=True) |
3610 | 630 | maximized=True, | ||
3611 | 631 | move_to_monitor=True) | ||
3613 | 632 | 566 | ||
3614 | 633 | indicator = self.panel.indicators.get_indicator_by_name_hint("indicator-session") | 567 | indicator = self.panel.indicators.get_indicator_by_name_hint("indicator-session") |
3615 | 634 | self.mouse_open_indicator(indicator) | 568 | self.mouse_open_indicator(indicator) |
3617 | 635 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(False))) | 569 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(self.always_visible))) |
3618 | 636 | 570 | ||
3619 | 637 | self.panel.move_mouse_below_the_panel() | 571 | self.panel.move_mouse_below_the_panel() |
3621 | 638 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(False))) | 572 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(self.always_visible))) |
3622 | 639 | 573 | ||
3623 | 640 | self.panel.move_mouse_over_grab_area() | 574 | self.panel.move_mouse_over_grab_area() |
3624 | 641 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(True))) | 575 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(True))) |
3625 | 642 | 576 | ||
3626 | 643 | def test_window_buttons_show_when_holding_show_menu_key(self): | 577 | def test_window_buttons_show_when_holding_show_menu_key(self): |
3627 | 644 | """Window buttons must show when we press the show-menu keybinding.""" | 578 | """Window buttons must show when we press the show-menu keybinding.""" |
3631 | 645 | self.open_new_application_window("Text Editor", | 579 | self.open_new_application_window("Text Editor", maximized=True) |
3629 | 646 | maximized=True, | ||
3630 | 647 | move_to_monitor=True) | ||
3632 | 648 | 580 | ||
3633 | 649 | self.sleep_menu_settle_period() | 581 | self.sleep_menu_settle_period() |
3635 | 650 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(False))) | 582 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(self.always_visible))) |
3636 | 651 | 583 | ||
3637 | 652 | self.keybinding_hold("panel/show_menus") | 584 | self.keybinding_hold("panel/show_menus") |
3638 | 653 | self.addCleanup(self.keybinding_release, "panel/show_menus") | 585 | self.addCleanup(self.keybinding_release, "panel/show_menus") |
3639 | @@ -657,7 +589,7 @@ | |||
3640 | 657 | # Sleep a bit to avoid a race with the Hud showing | 589 | # Sleep a bit to avoid a race with the Hud showing |
3641 | 658 | sleep(0.5) | 590 | sleep(0.5) |
3642 | 659 | self.keybinding_release("panel/show_menus") | 591 | self.keybinding_release("panel/show_menus") |
3644 | 660 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(False))) | 592 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(self.always_visible))) |
3645 | 661 | 593 | ||
3646 | 662 | def test_window_buttons_cant_accept_keynav_focus(self): | 594 | def test_window_buttons_cant_accept_keynav_focus(self): |
3647 | 663 | """On a mouse down event over the window buttons | 595 | """On a mouse down event over the window buttons |
3648 | @@ -673,57 +605,149 @@ | |||
3649 | 673 | 605 | ||
3650 | 674 | self.assertThat(self.unity.hud.search_string, Eventually(Equals("HelloWorld"))) | 606 | self.assertThat(self.unity.hud.search_string, Eventually(Equals("HelloWorld"))) |
3651 | 675 | 607 | ||
3661 | 676 | def test_double_click_unmaximize_window(self): | 608 | |
3662 | 677 | """Double clicking the grab area must unmaximize a maximized window.""" | 609 | class PanelWindowButtonsActionsTests(PanelTestsBase): |
3663 | 678 | gedit_win = self.open_new_application_window("Text Editor", maximized=True) | 610 | """Test WindowButtons actions on windows, focused or not depending on LIM""" |
3664 | 679 | 611 | restored_on_top = False | |
3665 | 680 | self.panel.move_mouse_over_grab_area() | 612 | scenarios = multiply_scenarios(_make_monitor_scenarios(), |
3666 | 681 | self.mouse.click() | 613 | (_make_menu_modes_scenarios() + |
3667 | 682 | self.mouse.click() | 614 | [('Locally Integrated Menus with restored on Top', |
3668 | 683 | 615 | {'lim': True, 'restored_on_top': True})])) | |
3669 | 684 | self.assertThat(self.panel.title, Eventually(Equals(gedit_win.application.name))) | 616 | |
3670 | 617 | def setUp(self): | ||
3671 | 618 | super(PanelWindowButtonsActionsTests, self).setUp() | ||
3672 | 619 | self.text_win = self.open_new_application_window("Text Editor", maximized=True) | ||
3673 | 620 | |||
3674 | 621 | if self.restored_on_top: | ||
3675 | 622 | self.open_new_application_window("Calculator") | ||
3676 | 623 | |||
3677 | 624 | def test_window_buttons_update_visual_state(self): | ||
3678 | 625 | """Window button must update its state in response to mouse events.""" | ||
3679 | 626 | self.panel.move_mouse_over_window_buttons() | ||
3680 | 627 | button = self.panel.window_buttons.unmaximize | ||
3681 | 628 | |||
3682 | 629 | self.assertThat(self.panel.window_buttons.focused, Eventually(Equals(not self.restored_on_top))) | ||
3683 | 630 | self.assertThat(button.visual_state, Eventually(Equals("normal"))) | ||
3684 | 631 | |||
3685 | 632 | button.mouse_move_to() | ||
3686 | 633 | self.assertThat(button.visual_state, Eventually(Equals("prelight"))) | ||
3687 | 634 | |||
3688 | 635 | self.mouse.press() | ||
3689 | 636 | self.addCleanup(self.mouse.release) | ||
3690 | 637 | self.assertThat(button.visual_state, Eventually(Equals("pressed"))) | ||
3691 | 638 | |||
3692 | 639 | def test_window_buttons_cancel(self): | ||
3693 | 640 | """Window buttons must ignore clicks when the mouse released outside | ||
3694 | 641 | their area. | ||
3695 | 642 | """ | ||
3696 | 643 | self.panel.move_mouse_over_window_buttons() | ||
3697 | 644 | |||
3698 | 645 | button = self.panel.window_buttons.unmaximize | ||
3699 | 646 | button.mouse_move_to() | ||
3700 | 647 | self.mouse.press() | ||
3701 | 648 | self.assertThat(button.visual_state, Eventually(Equals("pressed"))) | ||
3702 | 649 | self.panel.move_mouse_below_the_panel() | ||
3703 | 650 | self.mouse.release() | ||
3704 | 651 | |||
3705 | 652 | self.assertThat(self.text_win.is_maximized, Equals(True)) | ||
3706 | 653 | |||
3707 | 654 | def test_window_buttons_close_button_works_for_window(self): | ||
3708 | 655 | """Close window button must actually closes a window.""" | ||
3709 | 656 | win_xid = self.text_win.x_id | ||
3710 | 657 | |||
3711 | 658 | self.panel.window_buttons.close.mouse_click() | ||
3712 | 659 | self.assertNoWindowOpenWithXid(win_xid) | ||
3713 | 660 | |||
3714 | 661 | def test_window_buttons_close_follows_fitts_law(self): | ||
3715 | 662 | """Tests that the 'Close' button is activated when clicking at 0,0. | ||
3716 | 663 | |||
3717 | 664 | See bug #839690 | ||
3718 | 665 | """ | ||
3719 | 666 | win_xid = self.text_win.x_id | ||
3720 | 667 | |||
3721 | 668 | self.panel.move_mouse_over_window_buttons() | ||
3722 | 669 | screen_x, screen_y = self.display.get_screen_geometry(self.panel_monitor)[:2] | ||
3723 | 670 | self.mouse.move(screen_x, screen_y) | ||
3724 | 671 | self.mouse.click() | ||
3725 | 672 | |||
3726 | 673 | self.assertNoWindowOpenWithXid(win_xid) | ||
3727 | 674 | |||
3728 | 675 | def test_window_buttons_minimize_button_works_for_window(self): | ||
3729 | 676 | """Tests that the window button 'Minimize' actually minimizes a window.""" | ||
3730 | 677 | self.panel.window_buttons.minimize.mouse_click() | ||
3731 | 678 | self.assertProperty(self.text_win, is_hidden=True) | ||
3732 | 679 | |||
3733 | 680 | def test_window_buttons_minimize_follows_fitts_law(self): | ||
3734 | 681 | """Tests that the 'Minimize' button is conform to Fitts's Law. | ||
3735 | 682 | |||
3736 | 683 | See bug #839690 | ||
3737 | 684 | """ | ||
3738 | 685 | self.panel.move_mouse_over_window_buttons() | ||
3739 | 686 | button = self.panel.window_buttons.minimize | ||
3740 | 687 | target_x = button.x + button.width / 2 | ||
3741 | 688 | target_y = self.display.get_screen_geometry(self.panel_monitor)[1] | ||
3742 | 689 | self.mouse.move(target_x, target_y) | ||
3743 | 690 | self.mouse.click() | ||
3744 | 691 | |||
3745 | 692 | self.assertProperty(self.text_win, is_hidden=True) | ||
3746 | 693 | |||
3747 | 694 | def test_window_buttons_unmaximize_button_works_for_window(self): | ||
3748 | 695 | """Tests that the window button 'Unmaximize' actually unmaximizes a window.""" | ||
3749 | 696 | self.panel.window_buttons.unmaximize.mouse_click() | ||
3750 | 697 | |||
3751 | 698 | self.assertProperties(self.text_win, is_maximized=False, is_focused=True) | ||
3752 | 699 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(False))) | ||
3753 | 700 | |||
3754 | 701 | def test_window_buttons_unmaximize_follows_fitts_law(self): | ||
3755 | 702 | """Tests that the 'Unmaximize' button is conform to Fitts's Law. | ||
3756 | 703 | |||
3757 | 704 | See bug #839690 | ||
3758 | 705 | """ | ||
3759 | 706 | button = self.panel.window_buttons.unmaximize | ||
3760 | 707 | button.mouse_move_to() | ||
3761 | 708 | target_x = button.x + button.width / 2 | ||
3762 | 709 | target_y = self.display.get_screen_geometry(self.panel_monitor)[1] | ||
3763 | 710 | self.mouse.move(target_x, target_y) | ||
3764 | 711 | sleep(1) | ||
3765 | 712 | self.mouse.click() | ||
3766 | 713 | |||
3767 | 714 | self.assertProperty(self.text_win, is_maximized=False) | ||
3768 | 685 | 715 | ||
3769 | 686 | 716 | ||
3770 | 687 | class PanelHoverTests(PanelTestsBase): | 717 | class PanelHoverTests(PanelTestsBase): |
3771 | 688 | """Tests with the mouse pointer hovering the panel area.""" | 718 | """Tests with the mouse pointer hovering the panel area.""" |
3772 | 689 | 719 | ||
3774 | 690 | scenarios = _make_monitor_scenarios() | 720 | scenarios = _make_scenarios() |
3775 | 691 | 721 | ||
3776 | 692 | def test_only_menus_show_for_restored_window_on_mouse_in_window_btn_area(self): | 722 | def test_only_menus_show_for_restored_window_on_mouse_in_window_btn_area(self): |
3777 | 693 | """Restored windows should only show menus when the mouse is in the window | 723 | """Restored windows should only show menus when the mouse is in the window |
3778 | 694 | button area. | 724 | button area. |
3779 | 695 | """ | 725 | """ |
3783 | 696 | self.open_new_application_window("Calculator", | 726 | self.open_new_application_window("Calculator") |
3781 | 697 | maximized=False, | ||
3782 | 698 | move_to_monitor=True) | ||
3784 | 699 | self.sleep_menu_settle_period() | 727 | self.sleep_menu_settle_period() |
3785 | 700 | 728 | ||
3786 | 701 | self.panel.move_mouse_over_window_buttons() | 729 | self.panel.move_mouse_over_window_buttons() |
3787 | 702 | 730 | ||
3789 | 703 | self.assertThat(self.panel.menus_shown, Eventually(Equals(True))) | 731 | self.assertThat(self.panel.menus_shown, Eventually(Equals(not self.lim))) |
3790 | 704 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(False))) | 732 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(False))) |
3791 | 705 | 733 | ||
3792 | 706 | def test_only_menus_show_for_restored_window_on_mouse_in_menu_area(self): | 734 | def test_only_menus_show_for_restored_window_on_mouse_in_menu_area(self): |
3793 | 707 | """Restored windows should only show menus when the mouse is in the window | 735 | """Restored windows should only show menus when the mouse is in the window |
3794 | 708 | menu area. | 736 | menu area. |
3795 | 709 | """ | 737 | """ |
3799 | 710 | self.open_new_application_window("Calculator", | 738 | self.open_new_application_window("Calculator") |
3797 | 711 | maximized=False, | ||
3798 | 712 | move_to_monitor=True) | ||
3800 | 713 | self.sleep_menu_settle_period() | 739 | self.sleep_menu_settle_period() |
3801 | 714 | 740 | ||
3802 | 715 | self.panel.move_mouse_over_menus() | 741 | self.panel.move_mouse_over_menus() |
3803 | 716 | 742 | ||
3805 | 717 | self.assertThat(self.panel.menus_shown, Eventually(Equals(True))) | 743 | self.assertThat(self.panel.menus_shown, Eventually(Equals(not self.lim))) |
3806 | 718 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(False))) | 744 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(False))) |
3807 | 719 | 745 | ||
3808 | 720 | def test_only_menus_show_for_restored_window_on_mouse_in_grab_area(self): | 746 | def test_only_menus_show_for_restored_window_on_mouse_in_grab_area(self): |
3809 | 721 | """Restored windows should only show menus when the mouse is in the panel | 747 | """Restored windows should only show menus when the mouse is in the panel |
3810 | 722 | grab area. | 748 | grab area. |
3811 | 723 | """ | 749 | """ |
3815 | 724 | self.open_new_application_window("Calculator", | 750 | self.open_new_application_window("Calculator") |
3813 | 725 | maximized=False, | ||
3814 | 726 | move_to_monitor=True) | ||
3816 | 727 | self.sleep_menu_settle_period() | 751 | self.sleep_menu_settle_period() |
3817 | 728 | 752 | ||
3818 | 729 | if self.panel.grab_area.width <= 0: | 753 | if self.panel.grab_area.width <= 0: |
3819 | @@ -731,14 +755,12 @@ | |||
3820 | 731 | 755 | ||
3821 | 732 | self.panel.move_mouse_over_grab_area() | 756 | self.panel.move_mouse_over_grab_area() |
3822 | 733 | 757 | ||
3824 | 734 | self.assertThat(self.panel.menus_shown, Eventually(Equals(True))) | 758 | self.assertThat(self.panel.menus_shown, Eventually(Equals(not self.lim))) |
3825 | 735 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(False))) | 759 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(False))) |
3826 | 736 | 760 | ||
3827 | 737 | def test_hovering_over_indicators_does_not_show_app_menus(self): | 761 | def test_hovering_over_indicators_does_not_show_app_menus(self): |
3828 | 738 | """Hovering the mouse over the indicators must not show app menus.""" | 762 | """Hovering the mouse over the indicators must not show app menus.""" |
3832 | 739 | self.open_new_application_window("Calculator", | 763 | self.open_new_application_window("Text Editor", maximized=True) |
3830 | 740 | maximized=False, | ||
3831 | 741 | move_to_monitor=True) | ||
3833 | 742 | self.sleep_menu_settle_period() | 764 | self.sleep_menu_settle_period() |
3834 | 743 | 765 | ||
3835 | 744 | self.panel.move_mouse_over_menus() | 766 | self.panel.move_mouse_over_menus() |
3836 | @@ -754,9 +776,7 @@ | |||
3837 | 754 | """Menus and window buttons must be shown when the mouse is in the window | 776 | """Menus and window buttons must be shown when the mouse is in the window |
3838 | 755 | button area for a maximised application. | 777 | button area for a maximised application. |
3839 | 756 | """ | 778 | """ |
3843 | 757 | self.open_new_application_window("Text Editor", | 779 | self.open_new_application_window("Text Editor", maximized=True) |
3841 | 758 | maximized=True, | ||
3842 | 759 | move_to_monitor=True) | ||
3844 | 760 | self.sleep_menu_settle_period() | 780 | self.sleep_menu_settle_period() |
3845 | 761 | 781 | ||
3846 | 762 | self.panel.move_mouse_over_window_buttons() | 782 | self.panel.move_mouse_over_window_buttons() |
3847 | @@ -768,9 +788,7 @@ | |||
3848 | 768 | """Menus and window buttons must be shown when the mouse is in the menu | 788 | """Menus and window buttons must be shown when the mouse is in the menu |
3849 | 769 | area for a maximised application. | 789 | area for a maximised application. |
3850 | 770 | """ | 790 | """ |
3854 | 771 | self.open_new_application_window("Text Editor", | 791 | self.open_new_application_window("Text Editor", maximized=True) |
3852 | 772 | maximized=True, | ||
3853 | 773 | move_to_monitor=True) | ||
3855 | 774 | self.sleep_menu_settle_period() | 792 | self.sleep_menu_settle_period() |
3856 | 775 | 793 | ||
3857 | 776 | self.panel.move_mouse_over_menus() | 794 | self.panel.move_mouse_over_menus() |
3858 | @@ -785,9 +803,7 @@ | |||
3859 | 785 | if self.panel.grab_area.width <= 0: | 803 | if self.panel.grab_area.width <= 0: |
3860 | 786 | self.skipTest("Grab area is too small to run this test!") | 804 | self.skipTest("Grab area is too small to run this test!") |
3861 | 787 | 805 | ||
3865 | 788 | self.open_new_application_window("Text Editor", | 806 | self.open_new_application_window("Text Editor", maximized=True) |
3863 | 789 | maximized=True, | ||
3864 | 790 | move_to_monitor=True) | ||
3866 | 791 | self.sleep_menu_settle_period() | 807 | self.sleep_menu_settle_period() |
3867 | 792 | 808 | ||
3868 | 793 | self.panel.move_mouse_over_grab_area() | 809 | self.panel.move_mouse_over_grab_area() |
3869 | @@ -799,9 +815,7 @@ | |||
3870 | 799 | """Hovering the mouse over the indicators must hide the menus and window | 815 | """Hovering the mouse over the indicators must hide the menus and window |
3871 | 800 | buttons. | 816 | buttons. |
3872 | 801 | """ | 817 | """ |
3876 | 802 | self.open_new_application_window("Text Editor", | 818 | self.open_new_application_window("Text Editor", maximized=True) |
3874 | 803 | maximized=True, | ||
3875 | 804 | move_to_monitor=True) | ||
3877 | 805 | self.sleep_menu_settle_period() | 819 | self.sleep_menu_settle_period() |
3878 | 806 | 820 | ||
3879 | 807 | self.panel.move_mouse_over_menus() | 821 | self.panel.move_mouse_over_menus() |
3880 | @@ -811,14 +825,14 @@ | |||
3881 | 811 | 825 | ||
3882 | 812 | self.panel.move_mouse_over_indicators() | 826 | self.panel.move_mouse_over_indicators() |
3883 | 813 | 827 | ||
3885 | 814 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(False))) | 828 | self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(self.lim))) |
3886 | 815 | self.assertThat(self.panel.menus_shown, Eventually(Equals(False))) | 829 | self.assertThat(self.panel.menus_shown, Eventually(Equals(False))) |
3887 | 816 | 830 | ||
3888 | 817 | def test_hovering_indicators_open_menus(self): | 831 | def test_hovering_indicators_open_menus(self): |
3889 | 818 | """Opening an indicator entry, and then hovering on other entries must | 832 | """Opening an indicator entry, and then hovering on other entries must |
3890 | 819 | open them. | 833 | open them. |
3891 | 820 | """ | 834 | """ |
3893 | 821 | self.open_new_application_window("Text Editor") | 835 | self.open_new_application_window("Text Editor", maximized=self.lim) |
3894 | 822 | entries = self.panel.get_indicator_entries(include_hidden_menus=True) | 836 | entries = self.panel.get_indicator_entries(include_hidden_menus=True) |
3895 | 823 | 837 | ||
3896 | 824 | self.assertThat(len(entries), GreaterThan(0)) | 838 | self.assertThat(len(entries), GreaterThan(0)) |
3897 | @@ -832,7 +846,7 @@ | |||
3898 | 832 | 846 | ||
3899 | 833 | class PanelMenuTests(PanelTestsBase): | 847 | class PanelMenuTests(PanelTestsBase): |
3900 | 834 | 848 | ||
3902 | 835 | scenarios = _make_monitor_scenarios() | 849 | scenarios = _make_scenarios() |
3903 | 836 | 850 | ||
3904 | 837 | def start_test_app_with_menus(self): | 851 | def start_test_app_with_menus(self): |
3905 | 838 | window_spec = { | 852 | window_spec = { |
3906 | @@ -846,7 +860,12 @@ | |||
3907 | 846 | {"Title": "&Quit"} | 860 | {"Title": "&Quit"} |
3908 | 847 | ] | 861 | ] |
3909 | 848 | } | 862 | } |
3911 | 849 | self.launch_test_window(window_spec) | 863 | test_win = self.launch_test_window(window_spec) |
3912 | 864 | test_win.set_focus() | ||
3913 | 865 | self.move_window_to_panel_monitor(test_win) | ||
3914 | 866 | self.ensure_window_state(test_win, maximized=self.lim) | ||
3915 | 867 | |||
3916 | 868 | return test_win | ||
3917 | 850 | 869 | ||
3918 | 851 | def test_menus_are_added_on_new_application(self): | 870 | def test_menus_are_added_on_new_application(self): |
3919 | 852 | """Tests that menus are added when a new application is opened.""" | 871 | """Tests that menus are added when a new application is opened.""" |
3920 | @@ -872,10 +891,13 @@ | |||
3921 | 872 | "Current panel entries are: %r" % self.panel.menus.get_entries()) | 891 | "Current panel entries are: %r" % self.panel.menus.get_entries()) |
3922 | 873 | 892 | ||
3923 | 874 | self.panel.move_mouse_over_grab_area() | 893 | self.panel.move_mouse_over_grab_area() |
3925 | 875 | self.assertThat(self.panel.title, Eventually(Equals(test_win.application.name))) | 894 | expected = test_win.application.name if not self.lim else "" |
3926 | 895 | self.assertThat(self.panel.title, Eventually(Equals(expected))) | ||
3927 | 876 | 896 | ||
3928 | 877 | def test_menus_shows_when_new_application_is_opened(self): | 897 | def test_menus_shows_when_new_application_is_opened(self): |
3929 | 878 | """When starting a new application, menus must first show, then hide.""" | 898 | """When starting a new application, menus must first show, then hide.""" |
3930 | 899 | if self.lim: | ||
3931 | 900 | self.skipTest("Menu discovery is disabled when LIM are enabled.") | ||
3932 | 879 | 901 | ||
3933 | 880 | # This test requires the window to be opened on the monitor that is being tested and | 902 | # This test requires the window to be opened on the monitor that is being tested and |
3934 | 881 | # we cannot guarantee which monitor the window will open up on. | 903 | # we cannot guarantee which monitor the window will open up on. |
3935 | @@ -890,6 +912,9 @@ | |||
3936 | 890 | 912 | ||
3937 | 891 | def test_menus_dont_show_if_a_new_application_window_is_opened(self): | 913 | def test_menus_dont_show_if_a_new_application_window_is_opened(self): |
3938 | 892 | """This tests the menu discovery feature on new window for a know application.""" | 914 | """This tests the menu discovery feature on new window for a know application.""" |
3939 | 915 | if self.lim: | ||
3940 | 916 | self.skipTest("Menu discovery is disabled when LIM are enabled.") | ||
3941 | 917 | |||
3942 | 893 | self.open_new_application_window("Character Map") | 918 | self.open_new_application_window("Character Map") |
3943 | 894 | self.sleep_menu_settle_period() | 919 | self.sleep_menu_settle_period() |
3944 | 895 | 920 | ||
3945 | @@ -917,7 +942,7 @@ | |||
3946 | 917 | 942 | ||
3947 | 918 | self.panel.move_mouse_over_menus() | 943 | self.panel.move_mouse_over_menus() |
3948 | 919 | 944 | ||
3950 | 920 | self.assertThat(self.panel.menus_shown, Eventually(Equals(True))) | 945 | self.assertThat(self.panel.menus_shown, Eventually(Equals(not self.lim))) |
3951 | 921 | 946 | ||
3952 | 922 | def test_menus_dont_show_for_maximized_window_on_mouse_out(self): | 947 | def test_menus_dont_show_for_maximized_window_on_mouse_out(self): |
3953 | 923 | """Maximized window menus must not show when the mouse is outside the | 948 | """Maximized window menus must not show when the mouse is outside the |
3954 | @@ -947,7 +972,7 @@ | |||
3955 | 947 | 972 | ||
3956 | 948 | def test_menus_dont_show_with_hud(self): | 973 | def test_menus_dont_show_with_hud(self): |
3957 | 949 | """Tests that menus are not showing when opening the HUD.""" | 974 | """Tests that menus are not showing when opening the HUD.""" |
3959 | 950 | self.open_new_application_window("Text Editor", maximized=True) | 975 | self.open_new_application_window("Character Map", maximized=True) |
3960 | 951 | self.unity.hud.ensure_visible() | 976 | self.unity.hud.ensure_visible() |
3961 | 952 | self.addCleanup(self.unity.hud.ensure_hidden) | 977 | self.addCleanup(self.unity.hud.ensure_hidden) |
3962 | 953 | 978 | ||
3963 | @@ -957,11 +982,13 @@ | |||
3964 | 957 | class PanelIndicatorEntryTests(PanelTestsBase): | 982 | class PanelIndicatorEntryTests(PanelTestsBase): |
3965 | 958 | """Tests for the indicator entries, including both menu and indicators.""" | 983 | """Tests for the indicator entries, including both menu and indicators.""" |
3966 | 959 | 984 | ||
3968 | 960 | scenarios = _make_monitor_scenarios() | 985 | scenarios = _make_scenarios() |
3969 | 961 | 986 | ||
3970 | 962 | def open_app_and_get_menu_entry(self): | 987 | def open_app_and_get_menu_entry(self): |
3971 | 963 | """Open the test app and wait for the menu entry to appear.""" | 988 | """Open the test app and wait for the menu entry to appear.""" |
3973 | 964 | self.open_new_application_window("Calculator") | 989 | self.open_new_application_window("Remmina" if self.lim else "Calculator", |
3974 | 990 | maximized=self.lim) | ||
3975 | 991 | |||
3976 | 965 | refresh_fn = lambda: len(self.panel.menus.get_entries()) | 992 | refresh_fn = lambda: len(self.panel.menus.get_entries()) |
3977 | 966 | self.assertThat(refresh_fn, Eventually(GreaterThan(0))) | 993 | self.assertThat(refresh_fn, Eventually(GreaterThan(0))) |
3978 | 967 | menu_entry = self.panel.menus.get_entries()[0] | 994 | menu_entry = self.panel.menus.get_entries()[0] |
3979 | @@ -1033,7 +1060,7 @@ | |||
3980 | 1033 | 1060 | ||
3981 | 1034 | class PanelKeyNavigationTests(PanelTestsBase): | 1061 | class PanelKeyNavigationTests(PanelTestsBase): |
3982 | 1035 | 1062 | ||
3984 | 1036 | scenarios = _make_monitor_scenarios() | 1063 | scenarios = _make_scenarios() |
3985 | 1037 | 1064 | ||
3986 | 1038 | def get_active_indicator(self): | 1065 | def get_active_indicator(self): |
3987 | 1039 | """Get the active indicator in a safe manner. | 1066 | """Get the active indicator in a safe manner. |
3988 | @@ -1048,17 +1075,17 @@ | |||
3989 | 1048 | """Pressing the open-menus keybinding must open the first indicator.""" | 1075 | """Pressing the open-menus keybinding must open the first indicator.""" |
3990 | 1049 | self.open_new_application_window("Calculator") | 1076 | self.open_new_application_window("Calculator") |
3991 | 1050 | refresh_fn = lambda: len(self.panel.menus.get_entries()) | 1077 | refresh_fn = lambda: len(self.panel.menus.get_entries()) |
3993 | 1051 | self.assertThat(refresh_fn, Eventually(GreaterThan(0))) | 1078 | self.assertThat(refresh_fn, Eventually(Equals(0) if self.lim else GreaterThan(0))) |
3994 | 1052 | self.addCleanup(self.keyboard.press_and_release, "Escape") | 1079 | self.addCleanup(self.keyboard.press_and_release, "Escape") |
3995 | 1053 | self.keybinding("panel/open_first_menu") | 1080 | self.keybinding("panel/open_first_menu") |
3996 | 1054 | 1081 | ||
3997 | 1055 | open_indicator = self.get_active_indicator() | 1082 | open_indicator = self.get_active_indicator() |
3999 | 1056 | expected_indicator = self.panel.get_indicator_entries(include_hidden_menus=True)[0] | 1083 | expected_indicator = self.panel.get_indicator_entries(include_hidden_menus=not self.lim)[0] |
4000 | 1057 | self.assertThat(open_indicator.entry_id, Eventually(Equals(expected_indicator.entry_id))) | 1084 | self.assertThat(open_indicator.entry_id, Eventually(Equals(expected_indicator.entry_id))) |
4001 | 1058 | 1085 | ||
4002 | 1059 | def test_panel_hold_show_menu_works(self): | 1086 | def test_panel_hold_show_menu_works(self): |
4003 | 1060 | """Holding the show menu key must reveal the menu with mnemonics.""" | 1087 | """Holding the show menu key must reveal the menu with mnemonics.""" |
4005 | 1061 | self.open_new_application_window("Text Editor") | 1088 | self.open_new_application_window("Text Editor", maximized=self.lim) |
4006 | 1062 | refresh_fn = lambda: len(self.panel.menus.get_entries()) | 1089 | refresh_fn = lambda: len(self.panel.menus.get_entries()) |
4007 | 1063 | self.assertThat(refresh_fn, Eventually(GreaterThan(0))) | 1090 | self.assertThat(refresh_fn, Eventually(GreaterThan(0))) |
4008 | 1064 | self.addCleanup(self.keyboard.press_and_release, "Escape") | 1091 | self.addCleanup(self.keyboard.press_and_release, "Escape") |
4009 | @@ -1073,7 +1100,7 @@ | |||
4010 | 1073 | 1100 | ||
4011 | 1074 | def test_panel_menu_accelerators_work(self): | 1101 | def test_panel_menu_accelerators_work(self): |
4012 | 1075 | """Pressing a valid menu accelerator must open the correct menu item.""" | 1102 | """Pressing a valid menu accelerator must open the correct menu item.""" |
4014 | 1076 | self.open_new_application_window("Text Editor") | 1103 | self.open_new_application_window("Text Editor", maximized=self.lim) |
4015 | 1077 | refresh_fn = lambda: len(self.panel.menus.get_entries()) | 1104 | refresh_fn = lambda: len(self.panel.menus.get_entries()) |
4016 | 1078 | self.assertThat(refresh_fn, Eventually(GreaterThan(0))) | 1105 | self.assertThat(refresh_fn, Eventually(GreaterThan(0))) |
4017 | 1079 | self.addCleanup(self.keyboard.press_and_release, "Escape") | 1106 | self.addCleanup(self.keyboard.press_and_release, "Escape") |
4018 | @@ -1087,7 +1114,7 @@ | |||
4019 | 1087 | calc_win = self.open_new_application_window("Calculator") | 1114 | calc_win = self.open_new_application_window("Calculator") |
4020 | 1088 | self.assertProperty(calc_win, is_focused=True) | 1115 | self.assertProperty(calc_win, is_focused=True) |
4021 | 1089 | 1116 | ||
4023 | 1090 | available_indicators = self.panel.get_indicator_entries(include_hidden_menus=True) | 1117 | available_indicators = self.panel.get_indicator_entries(include_hidden_menus=not self.lim) |
4024 | 1091 | 1118 | ||
4025 | 1092 | self.keybinding("panel/open_first_menu") | 1119 | self.keybinding("panel/open_first_menu") |
4026 | 1093 | self.addCleanup(self.keyboard.press_and_release, "Escape") | 1120 | self.addCleanup(self.keyboard.press_and_release, "Escape") |
4027 | @@ -1102,7 +1129,7 @@ | |||
4028 | 1102 | calc_win = self.open_new_application_window("Calculator") | 1129 | calc_win = self.open_new_application_window("Calculator") |
4029 | 1103 | self.assertProperty(calc_win, is_focused=True) | 1130 | self.assertProperty(calc_win, is_focused=True) |
4030 | 1104 | 1131 | ||
4032 | 1105 | available_indicators = self.panel.get_indicator_entries(include_hidden_menus=True) | 1132 | available_indicators = self.panel.get_indicator_entries(include_hidden_menus=not self.lim) |
4033 | 1106 | 1133 | ||
4034 | 1107 | self.keybinding("panel/open_first_menu") | 1134 | self.keybinding("panel/open_first_menu") |
4035 | 1108 | self.addCleanup(self.keyboard.press_and_release, "Escape") | 1135 | self.addCleanup(self.keyboard.press_and_release, "Escape") |
4036 | @@ -1118,14 +1145,12 @@ | |||
4037 | 1118 | opened with the keyboard. | 1145 | opened with the keyboard. |
4038 | 1119 | """ | 1146 | """ |
4039 | 1120 | self.open_new_application_window("Calculator") | 1147 | self.open_new_application_window("Calculator") |
4041 | 1121 | available_indicators = self.panel.get_indicator_entries(include_hidden_menus=True) | 1148 | available_indicators = self.panel.get_indicator_entries(include_hidden_menus=not self.lim) |
4042 | 1122 | 1149 | ||
4043 | 1123 | self.keybinding("panel/open_first_menu") | 1150 | self.keybinding("panel/open_first_menu") |
4044 | 1124 | self.addCleanup(self.keyboard.press_and_release, "Escape") | 1151 | self.addCleanup(self.keyboard.press_and_release, "Escape") |
4045 | 1125 | 1152 | ||
4046 | 1126 | available_indicators[2].mouse_move_to() | 1153 | available_indicators[2].mouse_move_to() |
4047 | 1127 | self.addCleanup(self.panel.move_mouse_below_the_panel) | ||
4048 | 1128 | |||
4049 | 1129 | self.assertThat(available_indicators[2].active, Eventually(Equals(True))) | 1154 | self.assertThat(available_indicators[2].active, Eventually(Equals(True))) |
4050 | 1130 | 1155 | ||
4051 | 1131 | self.keybinding("panel/prev_indicator") | 1156 | self.keybinding("panel/prev_indicator") |
4052 | @@ -1135,11 +1160,10 @@ | |||
4053 | 1135 | class PanelGrabAreaTests(PanelTestsBase): | 1160 | class PanelGrabAreaTests(PanelTestsBase): |
4054 | 1136 | """Panel grab area tests.""" | 1161 | """Panel grab area tests.""" |
4055 | 1137 | 1162 | ||
4057 | 1138 | scenarios = _make_monitor_scenarios() | 1163 | scenarios = _make_scenarios() |
4058 | 1139 | 1164 | ||
4059 | 1140 | def move_mouse_over_grab_area(self): | 1165 | def move_mouse_over_grab_area(self): |
4060 | 1141 | self.panel.move_mouse_over_grab_area() | 1166 | self.panel.move_mouse_over_grab_area() |
4061 | 1142 | self.addCleanup(self.panel.move_mouse_below_the_panel) | ||
4062 | 1143 | sleep(.1) | 1167 | sleep(.1) |
4063 | 1144 | 1168 | ||
4064 | 1145 | def test_unmaximize_from_grab_area_works(self): | 1169 | def test_unmaximize_from_grab_area_works(self): |
4065 | @@ -1192,6 +1216,29 @@ | |||
4066 | 1192 | self.assertThat(self.unity.hud.search_string, Eventually(Equals("HelloWorld"))) | 1216 | self.assertThat(self.unity.hud.search_string, Eventually(Equals("HelloWorld"))) |
4067 | 1193 | 1217 | ||
4068 | 1194 | 1218 | ||
4069 | 1219 | class PanelLimTests(PanelTestsBase): | ||
4070 | 1220 | |||
4071 | 1221 | scenarios = _make_monitor_scenarios() | ||
4072 | 1222 | |||
4073 | 1223 | def setUp(self): | ||
4074 | 1224 | self.lim = True | ||
4075 | 1225 | super(PanelLimTests, self).setUp() | ||
4076 | 1226 | |||
4077 | 1227 | def test_title_focus_on_maximized_state_changes(self): | ||
4078 | 1228 | text_win = self.open_new_application_window("Text Editor", maximized=True) | ||
4079 | 1229 | self.assertThat(self.panel.focused, Eventually(Equals(True))) | ||
4080 | 1230 | self.assertThat(self.panel.title, Eventually(Equals(text_win.title))) | ||
4081 | 1231 | |||
4082 | 1232 | self.open_new_application_window("Calculator") | ||
4083 | 1233 | self.assertThat(self.panel.focused, Eventually(Equals(False))) | ||
4084 | 1234 | self.assertThat(self.panel.title, Eventually(Equals(text_win.title))) | ||
4085 | 1235 | |||
4086 | 1236 | text_win.set_focus() | ||
4087 | 1237 | self.assertProperty(text_win, is_focused=True) | ||
4088 | 1238 | self.assertThat(self.panel.focused, Eventually(Equals(True))) | ||
4089 | 1239 | self.assertThat(self.panel.title, Eventually(Equals(text_win.title))) | ||
4090 | 1240 | |||
4091 | 1241 | |||
4092 | 1195 | class PanelCrossMonitorsTests(PanelTestsBase): | 1242 | class PanelCrossMonitorsTests(PanelTestsBase): |
4093 | 1196 | """Multimonitor panel tests.""" | 1243 | """Multimonitor panel tests.""" |
4094 | 1197 | 1244 | ||
4095 | 1198 | 1245 | ||
4096 | === modified file 'tests/autopilot/unity/tests/test_wm_keybindings.py' | |||
4097 | --- tests/autopilot/unity/tests/test_wm_keybindings.py 2013-12-04 19:42:43 +0000 | |||
4098 | +++ tests/autopilot/unity/tests/test_wm_keybindings.py 2015-07-15 14:19:40 +0000 | |||
4099 | @@ -21,27 +21,24 @@ | |||
4100 | 21 | 21 | ||
4101 | 22 | def open_panel_menu(self): | 22 | def open_panel_menu(self): |
4102 | 23 | panel = self.unity.panels.get_panel_for_monitor(0) | 23 | panel = self.unity.panels.get_panel_for_monitor(0) |
4104 | 24 | self.assertThat(lambda: len(panel.menus.get_entries()), Eventually(GreaterThan(0))) | 24 | self.assertThat(lambda: len(panel.get_indicator_entries()), Eventually(GreaterThan(0))) |
4105 | 25 | self.addCleanup(self.keyboard.press_and_release, "Escape") | 25 | self.addCleanup(self.keyboard.press_and_release, "Escape") |
4106 | 26 | self.keybinding("panel/open_first_menu") | 26 | self.keybinding("panel/open_first_menu") |
4107 | 27 | self.assertThat(self.unity.panels.get_active_indicator, Eventually(NotEquals(None))) | 27 | self.assertThat(self.unity.panels.get_active_indicator, Eventually(NotEquals(None))) |
4108 | 28 | 28 | ||
4109 | 29 | def test_dash_shows_on_menus_opened(self): | 29 | def test_dash_shows_on_menus_opened(self): |
4110 | 30 | self.process_manager.start_app_window("Calculator") | ||
4111 | 31 | self.open_panel_menu() | 30 | self.open_panel_menu() |
4112 | 32 | self.addCleanup(self.unity.dash.ensure_hidden) | 31 | self.addCleanup(self.unity.dash.ensure_hidden) |
4113 | 33 | self.unity.dash.ensure_visible() | 32 | self.unity.dash.ensure_visible() |
4114 | 34 | self.assertThat(self.unity.panels.get_active_indicator, Eventually(Equals(None))) | 33 | self.assertThat(self.unity.panels.get_active_indicator, Eventually(Equals(None))) |
4115 | 35 | 34 | ||
4116 | 36 | def test_hud_shows_on_menus_opened(self): | 35 | def test_hud_shows_on_menus_opened(self): |
4117 | 37 | self.process_manager.start_app_window("Calculator") | ||
4118 | 38 | self.open_panel_menu() | 36 | self.open_panel_menu() |
4119 | 39 | self.addCleanup(self.unity.hud.ensure_hidden) | 37 | self.addCleanup(self.unity.hud.ensure_hidden) |
4120 | 40 | self.unity.hud.ensure_visible() | 38 | self.unity.hud.ensure_visible() |
4121 | 41 | self.assertThat(self.unity.panels.get_active_indicator, Eventually(Equals(None))) | 39 | self.assertThat(self.unity.panels.get_active_indicator, Eventually(Equals(None))) |
4122 | 42 | 40 | ||
4123 | 43 | def test_switcher_shows_on_menus_opened(self): | 41 | def test_switcher_shows_on_menus_opened(self): |
4124 | 44 | self.process_manager.start_app_window("Calculator") | ||
4125 | 45 | self.open_panel_menu() | 42 | self.open_panel_menu() |
4126 | 46 | self.addCleanup(self.unity.switcher.terminate) | 43 | self.addCleanup(self.unity.switcher.terminate) |
4127 | 47 | self.unity.switcher.initiate() | 44 | self.unity.switcher.initiate() |
4128 | @@ -49,7 +46,6 @@ | |||
4129 | 49 | self.assertThat(self.unity.panels.get_active_indicator, Eventually(Equals(None))) | 46 | self.assertThat(self.unity.panels.get_active_indicator, Eventually(Equals(None))) |
4130 | 50 | 47 | ||
4131 | 51 | def test_shortcut_hints_shows_on_menus_opened(self): | 48 | def test_shortcut_hints_shows_on_menus_opened(self): |
4132 | 52 | self.process_manager.start_app_window("Calculator") | ||
4133 | 53 | self.open_panel_menu() | 49 | self.open_panel_menu() |
4134 | 54 | self.addCleanup(self.unity.shortcut_hint.ensure_hidden) | 50 | self.addCleanup(self.unity.shortcut_hint.ensure_hidden) |
4135 | 55 | self.unity.shortcut_hint.show() | 51 | self.unity.shortcut_hint.show() |
4136 | @@ -57,7 +53,6 @@ | |||
4137 | 57 | self.assertThat(self.unity.panels.get_active_indicator, Eventually(Equals(None))) | 53 | self.assertThat(self.unity.panels.get_active_indicator, Eventually(Equals(None))) |
4138 | 58 | 54 | ||
4139 | 59 | def test_spread_shows_on_menus_opened(self): | 55 | def test_spread_shows_on_menus_opened(self): |
4140 | 60 | self.process_manager.start_app_window("Calculator") | ||
4141 | 61 | self.open_panel_menu() | 56 | self.open_panel_menu() |
4142 | 62 | self.addCleanup(self.unity.window_manager.terminate_spread) | 57 | self.addCleanup(self.unity.window_manager.terminate_spread) |
4143 | 63 | self.unity.window_manager.initiate_spread() | 58 | self.unity.window_manager.initiate_spread() |
4144 | 64 | 59 | ||
4145 | === modified file 'tests/mock-application.h' | |||
4146 | --- tests/mock-application.h 2014-03-21 04:40:12 +0000 | |||
4147 | +++ tests/mock-application.h 2015-07-15 14:19:40 +0000 | |||
4148 | @@ -20,7 +20,7 @@ | |||
4149 | 20 | #ifndef TESTS_MOCK_APPLICATION_H | 20 | #ifndef TESTS_MOCK_APPLICATION_H |
4150 | 21 | #define TESTS_MOCK_APPLICATION_H | 21 | #define TESTS_MOCK_APPLICATION_H |
4151 | 22 | 22 | ||
4153 | 23 | #include <map> | 23 | #include <unordered_map> |
4154 | 24 | #include <gmock/gmock.h> | 24 | #include <gmock/gmock.h> |
4155 | 25 | #include <gio/gdesktopappinfo.h> | 25 | #include <gio/gdesktopappinfo.h> |
4156 | 26 | #include <UnityCore/GLibWrapper.h> | 26 | #include <UnityCore/GLibWrapper.h> |
4157 | @@ -360,7 +360,7 @@ | |||
4158 | 360 | } | 360 | } |
4159 | 361 | 361 | ||
4160 | 362 | private: | 362 | private: |
4162 | 363 | typedef std::map<std::string, unity::ApplicationPtr> AppMap; | 363 | typedef std::unordered_map<std::string, unity::ApplicationPtr> AppMap; |
4163 | 364 | AppMap app_map_; | 364 | AppMap app_map_; |
4164 | 365 | }; | 365 | }; |
4165 | 366 | 366 | ||
4166 | 367 | 367 | ||
4167 | === modified file 'tests/test_dbus_indicators.cpp' | |||
4168 | --- tests/test_dbus_indicators.cpp 2013-03-25 18:22:32 +0000 | |||
4169 | +++ tests/test_dbus_indicators.cpp 2015-07-15 14:19:40 +0000 | |||
4170 | @@ -5,6 +5,7 @@ | |||
4171 | 5 | #include <UnityCore/GLibWrapper.h> | 5 | #include <UnityCore/GLibWrapper.h> |
4172 | 6 | #include <UnityCore/DBusIndicators.h> | 6 | #include <UnityCore/DBusIndicators.h> |
4173 | 7 | 7 | ||
4174 | 8 | #include "panel-service-private.h" | ||
4175 | 8 | #include "test_utils.h" | 9 | #include "test_utils.h" |
4176 | 9 | 10 | ||
4177 | 10 | using namespace unity; | 11 | using namespace unity; |
4178 | @@ -50,10 +51,8 @@ | |||
4179 | 50 | 51 | ||
4180 | 51 | GVariant* CallPanelMethod(std::string const& name) const | 52 | GVariant* CallPanelMethod(std::string const& name) const |
4181 | 52 | { | 53 | { |
4186 | 53 | return g_dbus_connection_call_sync(session, | 54 | return g_dbus_connection_call_sync(session, "com.canonical.Unity.Test", |
4187 | 54 | "com.canonical.Unity.Test", | 55 | UPS_PATH, UPS_IFACE, |
4184 | 55 | "/com/canonical/Unity/Panel/Service", | ||
4185 | 56 | "com.canonical.Unity.Panel.Service", | ||
4188 | 57 | name.c_str(), | 56 | name.c_str(), |
4189 | 58 | NULL, | 57 | NULL, |
4190 | 59 | NULL, | 58 | NULL, |
4191 | 60 | 59 | ||
4192 | === modified file 'tests/test_indicator.cpp' | |||
4193 | --- tests/test_indicator.cpp 2014-01-27 17:31:30 +0000 | |||
4194 | +++ tests/test_indicator.cpp 2015-07-15 14:19:40 +0000 | |||
4195 | @@ -44,7 +44,7 @@ | |||
4196 | 44 | 44 | ||
4197 | 45 | MOCK_CONST_METHOD0(Updated, void()); | 45 | MOCK_CONST_METHOD0(Updated, void()); |
4198 | 46 | MOCK_CONST_METHOD1(EntryAdded, void(Entry::Ptr const&)); | 46 | MOCK_CONST_METHOD1(EntryAdded, void(Entry::Ptr const&)); |
4200 | 47 | MOCK_CONST_METHOD1(EntryRemoved, void(std::string const&)); | 47 | MOCK_CONST_METHOD1(EntryRemoved, void(Entry::Ptr const&)); |
4201 | 48 | MOCK_CONST_METHOD5(ShowMenu, void(std::string const&, unsigned, int, int, unsigned)); | 48 | MOCK_CONST_METHOD5(ShowMenu, void(std::string const&, unsigned, int, int, unsigned)); |
4202 | 49 | MOCK_CONST_METHOD1(SecondaryActivate, void(std::string const&)); | 49 | MOCK_CONST_METHOD1(SecondaryActivate, void(std::string const&)); |
4203 | 50 | MOCK_CONST_METHOD2(Scroll, void(std::string const&, int)); | 50 | MOCK_CONST_METHOD2(Scroll, void(std::string const&, int)); |
4204 | @@ -57,7 +57,6 @@ | |||
4205 | 57 | EXPECT_EQ(indicator.name(), "indicator-test"); | 57 | EXPECT_EQ(indicator.name(), "indicator-test"); |
4206 | 58 | EXPECT_FALSE(indicator.IsAppmenu()); | 58 | EXPECT_FALSE(indicator.IsAppmenu()); |
4207 | 59 | EXPECT_EQ(indicator.GetEntry("test-entry"), nullptr); | 59 | EXPECT_EQ(indicator.GetEntry("test-entry"), nullptr); |
4208 | 60 | EXPECT_EQ(indicator.EntryIndex("test-entry"), -1); | ||
4209 | 61 | EXPECT_TRUE(indicator.GetEntries().empty()); | 60 | EXPECT_TRUE(indicator.GetEntries().empty()); |
4210 | 62 | } | 61 | } |
4211 | 63 | 62 | ||
4212 | @@ -69,17 +68,17 @@ | |||
4213 | 69 | Indicator indicator("indicator-test"); | 68 | Indicator indicator("indicator-test"); |
4214 | 70 | SigReceiver::Nice sig_receiver(indicator); | 69 | SigReceiver::Nice sig_receiver(indicator); |
4215 | 71 | 70 | ||
4217 | 72 | entry = new Entry("test-entry-1", "name-hint", "label", true, true, 0, "icon", | 71 | entry = new Entry("test-entry-1", "name-hint", 0, "label", true, true, 0, "icon", |
4218 | 73 | true, true, -1); | 72 | true, true, -1); |
4219 | 74 | Entry::Ptr entry1(entry); | 73 | Entry::Ptr entry1(entry); |
4220 | 75 | sync_data.push_back(entry1); | 74 | sync_data.push_back(entry1); |
4221 | 76 | 75 | ||
4223 | 77 | entry = new Entry("test-entry-2", "name-hint", "label", true, true, 0, "icon", | 76 | entry = new Entry("test-entry-2", "name-hint", 0, "label", true, true, 0, "icon", |
4224 | 78 | true, true, -1); | 77 | true, true, -1); |
4225 | 79 | Entry::Ptr entry2(entry); | 78 | Entry::Ptr entry2(entry); |
4226 | 80 | sync_data.push_back(entry2); | 79 | sync_data.push_back(entry2); |
4227 | 81 | 80 | ||
4229 | 82 | entry = new Entry("test-entry-3", "name-hint", "label", true, true, 0, "icon", | 81 | entry = new Entry("test-entry-3", "name-hint", 0, "label", true, true, 0, "icon", |
4230 | 83 | true, true, -1); | 82 | true, true, -1); |
4231 | 84 | Entry::Ptr entry3(entry); | 83 | Entry::Ptr entry3(entry); |
4232 | 85 | sync_data.push_back(entry3); | 84 | sync_data.push_back(entry3); |
4233 | @@ -97,31 +96,29 @@ | |||
4234 | 97 | indicator.Sync(sync_data); | 96 | indicator.Sync(sync_data); |
4235 | 98 | EXPECT_EQ(indicator.GetEntries().size(), 3); | 97 | EXPECT_EQ(indicator.GetEntries().size(), 3); |
4236 | 99 | EXPECT_EQ(indicator.GetEntry("test-entry-2"), entry2); | 98 | EXPECT_EQ(indicator.GetEntry("test-entry-2"), entry2); |
4237 | 100 | EXPECT_EQ(indicator.EntryIndex("test-entry-2"), 1); | ||
4238 | 101 | // Mock::VerifyAndClearExpectations(&sig_receiver); | 99 | // Mock::VerifyAndClearExpectations(&sig_receiver); |
4239 | 102 | 100 | ||
4240 | 103 | // Sync the indicator removing an entry | 101 | // Sync the indicator removing an entry |
4242 | 104 | sync_data.remove(entry2); | 102 | sync_data.erase(std::remove(sync_data.begin(), sync_data.end(), entry2), sync_data.end()); |
4243 | 105 | EXPECT_EQ(sync_data.size(), 2); | 103 | EXPECT_EQ(sync_data.size(), 2); |
4244 | 106 | EXPECT_CALL(sig_receiver, Updated()); | 104 | EXPECT_CALL(sig_receiver, Updated()); |
4245 | 107 | EXPECT_CALL(sig_receiver, EntryAdded(_)).Times(0); | 105 | EXPECT_CALL(sig_receiver, EntryAdded(_)).Times(0); |
4247 | 108 | EXPECT_CALL(sig_receiver, EntryRemoved(entry2->id())); | 106 | EXPECT_CALL(sig_receiver, EntryRemoved(entry2)); |
4248 | 109 | 107 | ||
4249 | 110 | indicator.Sync(sync_data); | 108 | indicator.Sync(sync_data); |
4250 | 111 | EXPECT_EQ(indicator.GetEntries().size(), 2); | 109 | EXPECT_EQ(indicator.GetEntries().size(), 2); |
4251 | 112 | EXPECT_EQ(indicator.GetEntry("test-entry-2"), nullptr); | 110 | EXPECT_EQ(indicator.GetEntry("test-entry-2"), nullptr); |
4252 | 113 | EXPECT_EQ(indicator.EntryIndex("test-entry-2"), -1); | ||
4253 | 114 | 111 | ||
4254 | 115 | // Sync the indicator removing an entry and adding a new one | 112 | // Sync the indicator removing an entry and adding a new one |
4256 | 116 | entry = new Entry("test-entry-4", "name-hint", "label", true, true, 0, "icon", | 113 | entry = new Entry("test-entry-4", "name-hint", 0, "label", true, true, 0, "icon", |
4257 | 117 | true, true, -1); | 114 | true, true, -1); |
4258 | 118 | Entry::Ptr entry4(entry); | 115 | Entry::Ptr entry4(entry); |
4259 | 119 | sync_data.push_back(entry4); | 116 | sync_data.push_back(entry4); |
4261 | 120 | sync_data.remove(entry3); | 117 | sync_data.erase(std::remove(sync_data.begin(), sync_data.end(), entry3), sync_data.end()); |
4262 | 121 | EXPECT_EQ(sync_data.size(), 2); | 118 | EXPECT_EQ(sync_data.size(), 2); |
4263 | 122 | 119 | ||
4264 | 123 | EXPECT_CALL(sig_receiver, EntryAdded(entry4)); | 120 | EXPECT_CALL(sig_receiver, EntryAdded(entry4)); |
4266 | 124 | EXPECT_CALL(sig_receiver, EntryRemoved(entry3->id())); | 121 | EXPECT_CALL(sig_receiver, EntryRemoved(entry3)); |
4267 | 125 | EXPECT_CALL(sig_receiver, Updated()); | 122 | EXPECT_CALL(sig_receiver, Updated()); |
4268 | 126 | indicator.Sync(sync_data); | 123 | indicator.Sync(sync_data); |
4269 | 127 | EXPECT_EQ(indicator.GetEntries().size(), 2); | 124 | EXPECT_EQ(indicator.GetEntries().size(), 2); |
4270 | @@ -129,8 +126,8 @@ | |||
4271 | 129 | // Remove all the indicators | 126 | // Remove all the indicators |
4272 | 130 | 127 | ||
4273 | 131 | EXPECT_CALL(sig_receiver, EntryAdded(_)).Times(0); | 128 | EXPECT_CALL(sig_receiver, EntryAdded(_)).Times(0); |
4276 | 132 | EXPECT_CALL(sig_receiver, EntryRemoved(entry1->id())); | 129 | EXPECT_CALL(sig_receiver, EntryRemoved(entry1)); |
4277 | 133 | EXPECT_CALL(sig_receiver, EntryRemoved(entry4->id())); | 130 | EXPECT_CALL(sig_receiver, EntryRemoved(entry4)); |
4278 | 134 | EXPECT_CALL(sig_receiver, Updated()); | 131 | EXPECT_CALL(sig_receiver, Updated()); |
4279 | 135 | 132 | ||
4280 | 136 | sync_data.clear(); | 133 | sync_data.clear(); |
4281 | @@ -144,13 +141,13 @@ | |||
4282 | 144 | SigReceiver::Nice sig_receiver(indicator); | 141 | SigReceiver::Nice sig_receiver(indicator); |
4283 | 145 | Indicator::Entries sync_data; | 142 | Indicator::Entries sync_data; |
4284 | 146 | 143 | ||
4286 | 147 | auto entry1 = std::make_shared<Entry>("test-entry-1", "name-hint", "label", true, true, 0, "icon", true, true, -1); | 144 | auto entry1 = std::make_shared<Entry>("test-entry-1", "name-hint", 0, "label", true, true, 0, "icon", true, true, -1); |
4287 | 148 | sync_data.push_back(entry1); | 145 | sync_data.push_back(entry1); |
4288 | 149 | 146 | ||
4290 | 150 | auto entry2 = std::make_shared<Entry>("test-entry-2", "name-hint", "label", true, true, 0, "icon", true, true, -1); | 147 | auto entry2 = std::make_shared<Entry>("test-entry-2", "name-hint", 0, "label", true, true, 0, "icon", true, true, -1); |
4291 | 151 | sync_data.push_back(entry2); | 148 | sync_data.push_back(entry2); |
4292 | 152 | 149 | ||
4294 | 153 | auto entry3 = std::make_shared<Entry>("test-entry-3", "name-hint", "label", true, true, 0, "icon", true, true, -1); | 150 | auto entry3 = std::make_shared<Entry>("test-entry-3", "name-hint", 0, "label", true, true, 0, "icon", true, true, -1); |
4295 | 154 | sync_data.push_back(entry3); | 151 | sync_data.push_back(entry3); |
4296 | 155 | 152 | ||
4297 | 156 | EXPECT_CALL(sig_receiver, Updated()); | 153 | EXPECT_CALL(sig_receiver, Updated()); |
4298 | @@ -162,7 +159,7 @@ | |||
4299 | 162 | EXPECT_CALL(sig_receiver, Updated()).Times(0); | 159 | EXPECT_CALL(sig_receiver, Updated()).Times(0); |
4300 | 163 | indicator.Sync(sync_data); | 160 | indicator.Sync(sync_data); |
4301 | 164 | 161 | ||
4303 | 165 | sync_data.remove(entry3); | 162 | sync_data.erase(std::remove(sync_data.begin(), sync_data.end(), entry3), sync_data.end()); |
4304 | 166 | EXPECT_CALL(sig_receiver, Updated()); | 163 | EXPECT_CALL(sig_receiver, Updated()); |
4305 | 167 | indicator.Sync(sync_data); | 164 | indicator.Sync(sync_data); |
4306 | 168 | 165 | ||
4307 | @@ -176,7 +173,7 @@ | |||
4308 | 176 | Indicator indicator("indicator-test"); | 173 | Indicator indicator("indicator-test"); |
4309 | 177 | SigReceiver::Nice sig_receiver(indicator); | 174 | SigReceiver::Nice sig_receiver(indicator); |
4310 | 178 | 175 | ||
4312 | 179 | auto entry = std::make_shared<Entry>("test-entry-1", "name-hint", "label", true, true, 0, "icon", true, true, -1); | 176 | auto entry = std::make_shared<Entry>("test-entry-1", "name-hint", 0, "label", true, true, 0, "icon", true, true, -1); |
4313 | 180 | indicator.Sync({entry}); | 177 | indicator.Sync({entry}); |
4314 | 181 | 178 | ||
4315 | 182 | EXPECT_CALL(sig_receiver, ShowMenu(entry->id(), 123456789, 50, 100, 2)); | 179 | EXPECT_CALL(sig_receiver, ShowMenu(entry->id(), 123456789, 50, 100, 2)); |
4316 | @@ -194,7 +191,7 @@ | |||
4317 | 194 | Indicator indicator("indicator-test"); | 191 | Indicator indicator("indicator-test"); |
4318 | 195 | SigReceiver::Nice sig_receiver(indicator); | 192 | SigReceiver::Nice sig_receiver(indicator); |
4319 | 196 | 193 | ||
4321 | 197 | auto entry = std::make_shared<Entry>("test-entry-2", "name-hint", "label", true, true, 0, "icon", true, true, -1); | 194 | auto entry = std::make_shared<Entry>("test-entry-2", "name-hint", 0, "label", true, true, 0, "icon", true, true, -1); |
4322 | 198 | indicator.Sync({entry}); | 195 | indicator.Sync({entry}); |
4323 | 199 | 196 | ||
4324 | 200 | EXPECT_CALL(sig_receiver, SecondaryActivate(entry->id())); | 197 | EXPECT_CALL(sig_receiver, SecondaryActivate(entry->id())); |
4325 | @@ -206,7 +203,7 @@ | |||
4326 | 206 | Indicator indicator("indicator-test"); | 203 | Indicator indicator("indicator-test"); |
4327 | 207 | SigReceiver::Nice sig_receiver(indicator); | 204 | SigReceiver::Nice sig_receiver(indicator); |
4328 | 208 | 205 | ||
4330 | 209 | auto entry = std::make_shared<Entry>("test-entry-2", "name-hint", "label", true, true, 0, "icon", true, true, -1); | 206 | auto entry = std::make_shared<Entry>("test-entry-2", "name-hint", 0, "label", true, true, 0, "icon", true, true, -1); |
4331 | 210 | indicator.Sync({entry}); | 207 | indicator.Sync({entry}); |
4332 | 211 | 208 | ||
4333 | 212 | EXPECT_CALL(sig_receiver, Scroll(entry->id(), -5)); | 209 | EXPECT_CALL(sig_receiver, Scroll(entry->id(), -5)); |
4334 | 213 | 210 | ||
4335 | === modified file 'tests/test_indicator_appmenu.cpp' | |||
4336 | --- tests/test_indicator_appmenu.cpp 2012-12-04 00:33:18 +0000 | |||
4337 | +++ tests/test_indicator_appmenu.cpp 2015-07-15 14:19:40 +0000 | |||
4338 | @@ -1,6 +1,6 @@ | |||
4339 | 1 | // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- | 1 | // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- |
4340 | 2 | /* | 2 | /* |
4342 | 3 | * Copyright (C) 2012 Canonical Ltd | 3 | * Copyright (C) 2012-2015 Canonical Ltd |
4343 | 4 | * | 4 | * |
4344 | 5 | * This program is free software: you can redistribute it and/or modify | 5 | * This program is free software: you can redistribute it and/or modify |
4345 | 6 | * it under the terms of the GNU General Public License version 3 as | 6 | * it under the terms of the GNU General Public License version 3 as |
4346 | @@ -18,15 +18,41 @@ | |||
4347 | 18 | */ | 18 | */ |
4348 | 19 | 19 | ||
4349 | 20 | #include <UnityCore/AppmenuIndicator.h> | 20 | #include <UnityCore/AppmenuIndicator.h> |
4352 | 21 | 21 | #include <gmock/gmock.h> | |
4351 | 22 | #include <gtest/gtest.h> | ||
4353 | 23 | 22 | ||
4354 | 24 | using namespace std; | 23 | using namespace std; |
4355 | 25 | using namespace unity; | 24 | using namespace unity; |
4356 | 26 | using namespace indicator; | 25 | using namespace indicator; |
4357 | 26 | using namespace testing; | ||
4358 | 27 | 27 | ||
4359 | 28 | namespace | 28 | namespace |
4360 | 29 | { | 29 | { |
4361 | 30 | struct SigReceiver : sigc::trackable | ||
4362 | 31 | { | ||
4363 | 32 | typedef NiceMock<SigReceiver> Nice; | ||
4364 | 33 | |||
4365 | 34 | SigReceiver(AppmenuIndicator const& const_indicator) | ||
4366 | 35 | { | ||
4367 | 36 | auto& indicator = const_cast<AppmenuIndicator&>(const_indicator); | ||
4368 | 37 | indicator.updated.connect(sigc::mem_fun(this, &SigReceiver::Updated)); | ||
4369 | 38 | indicator.updated_win.connect(sigc::mem_fun(this, &SigReceiver::UpdatedWin)); | ||
4370 | 39 | indicator.on_entry_added.connect(sigc::mem_fun(this, &SigReceiver::EntryAdded)); | ||
4371 | 40 | indicator.on_entry_removed.connect(sigc::mem_fun(this, &SigReceiver::EntryRemoved)); | ||
4372 | 41 | indicator.on_show_menu.connect(sigc::mem_fun(this, &SigReceiver::ShowMenu)); | ||
4373 | 42 | indicator.on_show_appmenu.connect(sigc::mem_fun(this, &SigReceiver::ShowAppmenu)); | ||
4374 | 43 | indicator.on_secondary_activate.connect(sigc::mem_fun(this, &SigReceiver::SecondaryActivate)); | ||
4375 | 44 | indicator.on_scroll.connect(sigc::mem_fun(this, &SigReceiver::Scroll)); | ||
4376 | 45 | } | ||
4377 | 46 | |||
4378 | 47 | MOCK_CONST_METHOD0(Updated, void()); | ||
4379 | 48 | MOCK_CONST_METHOD1(UpdatedWin, void(uint32_t)); | ||
4380 | 49 | MOCK_CONST_METHOD1(EntryAdded, void(Entry::Ptr const&)); | ||
4381 | 50 | MOCK_CONST_METHOD1(EntryRemoved, void(Entry::Ptr const&)); | ||
4382 | 51 | MOCK_CONST_METHOD5(ShowMenu, void(std::string const&, unsigned, int, int, unsigned)); | ||
4383 | 52 | MOCK_CONST_METHOD3(ShowAppmenu, void(unsigned, int, int)); | ||
4384 | 53 | MOCK_CONST_METHOD1(SecondaryActivate, void(std::string const&)); | ||
4385 | 54 | MOCK_CONST_METHOD2(Scroll, void(std::string const&, int)); | ||
4386 | 55 | }; | ||
4387 | 30 | 56 | ||
4388 | 31 | TEST(TestAppmenuIndicator, Construction) | 57 | TEST(TestAppmenuIndicator, Construction) |
4389 | 32 | { | 58 | { |
4390 | @@ -39,25 +65,160 @@ | |||
4391 | 39 | TEST(TestAppmenuIndicator, ShowAppmenu) | 65 | TEST(TestAppmenuIndicator, ShowAppmenu) |
4392 | 40 | { | 66 | { |
4393 | 41 | AppmenuIndicator indicator("indicator-appmenu"); | 67 | AppmenuIndicator indicator("indicator-appmenu"); |
4407 | 42 | 68 | SigReceiver::Nice sig_receiver(indicator); | |
4408 | 43 | bool signal_emitted = false; | 69 | |
4409 | 44 | int show_x, show_y; | 70 | EXPECT_CALL(sig_receiver, ShowAppmenu(123456789, 50, 100)); |
4397 | 45 | unsigned show_xid; | ||
4398 | 46 | |||
4399 | 47 | // Connecting to signals | ||
4400 | 48 | indicator.on_show_appmenu.connect([&] (unsigned int xid, int x, int y) { | ||
4401 | 49 | signal_emitted = true; | ||
4402 | 50 | show_xid = xid; | ||
4403 | 51 | show_x = x; | ||
4404 | 52 | show_y = y; | ||
4405 | 53 | }); | ||
4406 | 54 | |||
4410 | 55 | indicator.ShowAppmenu(123456789, 50, 100); | 71 | indicator.ShowAppmenu(123456789, 50, 100); |
4416 | 56 | EXPECT_TRUE(signal_emitted); | 72 | } |
4417 | 57 | 73 | ||
4418 | 58 | EXPECT_EQ(show_xid, 123456789); | 74 | TEST(TestAppmenuIndicator, Syncing) |
4419 | 59 | EXPECT_EQ(show_x, 50); | 75 | { |
4420 | 60 | EXPECT_EQ(show_y, 100); | 76 | Indicator::Entries sync_data; |
4421 | 77 | |||
4422 | 78 | AppmenuIndicator indicator("indicator-appmenu"); | ||
4423 | 79 | SigReceiver::Nice sig_receiver(indicator); | ||
4424 | 80 | const uint32_t parent_window1 = 12345; | ||
4425 | 81 | const uint32_t parent_window2 = 54321; | ||
4426 | 82 | |||
4427 | 83 | auto entry1 = std::make_shared<Entry>("test-entry-1", "name-hint", parent_window1, "label", true, true, 0, "icon", true, true, -1); | ||
4428 | 84 | sync_data.push_back(entry1); | ||
4429 | 85 | |||
4430 | 86 | auto entry2 = std::make_shared<Entry>("test-entry-2", "name-hint", parent_window1, "label", true, true, 0, "icon", true, true, -1); | ||
4431 | 87 | sync_data.push_back(entry2); | ||
4432 | 88 | |||
4433 | 89 | auto entry3 = std::make_shared<Entry>("test-entry-3", "name-hint", parent_window2, "label", true, true, 0, "icon", true, true, -1); | ||
4434 | 90 | sync_data.push_back(entry3); | ||
4435 | 91 | |||
4436 | 92 | // Sync the indicator, adding 3 entries | ||
4437 | 93 | { | ||
4438 | 94 | testing::InSequence s; | ||
4439 | 95 | EXPECT_CALL(sig_receiver, EntryAdded(entry1)); | ||
4440 | 96 | EXPECT_CALL(sig_receiver, EntryAdded(entry2)); | ||
4441 | 97 | EXPECT_CALL(sig_receiver, EntryAdded(entry3)); | ||
4442 | 98 | EXPECT_CALL(sig_receiver, EntryRemoved(_)).Times(0); | ||
4443 | 99 | EXPECT_CALL(sig_receiver, Updated()); | ||
4444 | 100 | } | ||
4445 | 101 | |||
4446 | 102 | EXPECT_CALL(sig_receiver, UpdatedWin(parent_window1)); | ||
4447 | 103 | EXPECT_CALL(sig_receiver, UpdatedWin(parent_window2)); | ||
4448 | 104 | |||
4449 | 105 | indicator.Sync(sync_data); | ||
4450 | 106 | EXPECT_EQ(indicator.GetEntriesForWindow(parent_window1), Indicator::Entries({entry1, entry2})); | ||
4451 | 107 | EXPECT_EQ(indicator.GetEntriesForWindow(parent_window2), Indicator::Entries({entry3})); | ||
4452 | 108 | |||
4453 | 109 | // Sync the indicator removing an entry | ||
4454 | 110 | sync_data.erase(std::remove(sync_data.begin(), sync_data.end(), entry2), sync_data.end()); | ||
4455 | 111 | ASSERT_EQ(sync_data.size(), 2); | ||
4456 | 112 | EXPECT_CALL(sig_receiver, Updated()); | ||
4457 | 113 | EXPECT_CALL(sig_receiver, UpdatedWin(parent_window1)); | ||
4458 | 114 | EXPECT_CALL(sig_receiver, UpdatedWin(parent_window2)).Times(0); | ||
4459 | 115 | EXPECT_CALL(sig_receiver, EntryAdded(_)).Times(0); | ||
4460 | 116 | EXPECT_CALL(sig_receiver, EntryRemoved(entry2)); | ||
4461 | 117 | |||
4462 | 118 | indicator.Sync(sync_data); | ||
4463 | 119 | EXPECT_EQ(indicator.GetEntries().size(), 2); | ||
4464 | 120 | EXPECT_EQ(indicator.GetEntry("test-entry-2"), nullptr); | ||
4465 | 121 | EXPECT_EQ(indicator.GetEntriesForWindow(parent_window1), Indicator::Entries({entry1})); | ||
4466 | 122 | |||
4467 | 123 | // Sync the indicator removing an entry and adding a new one | ||
4468 | 124 | auto entry4 = std::make_shared<Entry>("test-entry-4", "name-hint", parent_window2, "label", true, true, 0, "icon", true, true, -1); | ||
4469 | 125 | sync_data.push_back(entry4); | ||
4470 | 126 | sync_data.erase(std::remove(sync_data.begin(), sync_data.end(), entry3), sync_data.end()); | ||
4471 | 127 | EXPECT_EQ(sync_data.size(), 2); | ||
4472 | 128 | |||
4473 | 129 | EXPECT_CALL(sig_receiver, EntryAdded(entry4)); | ||
4474 | 130 | EXPECT_CALL(sig_receiver, EntryRemoved(entry3)); | ||
4475 | 131 | EXPECT_CALL(sig_receiver, Updated()); | ||
4476 | 132 | EXPECT_CALL(sig_receiver, UpdatedWin(parent_window1)).Times(0); | ||
4477 | 133 | EXPECT_CALL(sig_receiver, UpdatedWin(parent_window2)); | ||
4478 | 134 | indicator.Sync(sync_data); | ||
4479 | 135 | EXPECT_EQ(indicator.GetEntriesForWindow(parent_window1), Indicator::Entries({entry1})); | ||
4480 | 136 | EXPECT_EQ(indicator.GetEntriesForWindow(parent_window2), Indicator::Entries({entry4})); | ||
4481 | 137 | |||
4482 | 138 | // Remove all the indicators | ||
4483 | 139 | EXPECT_CALL(sig_receiver, EntryAdded(_)).Times(0); | ||
4484 | 140 | EXPECT_CALL(sig_receiver, EntryRemoved(entry1)); | ||
4485 | 141 | EXPECT_CALL(sig_receiver, EntryRemoved(entry4)); | ||
4486 | 142 | EXPECT_CALL(sig_receiver, Updated()); | ||
4487 | 143 | EXPECT_CALL(sig_receiver, UpdatedWin(parent_window1)); | ||
4488 | 144 | EXPECT_CALL(sig_receiver, UpdatedWin(parent_window2)); | ||
4489 | 145 | |||
4490 | 146 | sync_data.clear(); | ||
4491 | 147 | indicator.Sync(sync_data); | ||
4492 | 148 | |||
4493 | 149 | EXPECT_TRUE(indicator.GetEntriesForWindow(parent_window1).empty()); | ||
4494 | 150 | EXPECT_TRUE(indicator.GetEntriesForWindow(parent_window2).empty()); | ||
4495 | 151 | } | ||
4496 | 152 | |||
4497 | 153 | TEST(TestAppmenuIndicator, Updated) | ||
4498 | 154 | { | ||
4499 | 155 | AppmenuIndicator indicator("indicator-test"); | ||
4500 | 156 | SigReceiver::Nice sig_receiver(indicator); | ||
4501 | 157 | Indicator::Entries sync_data; | ||
4502 | 158 | const uint32_t parent_window1 = 12345; | ||
4503 | 159 | const uint32_t parent_window2 = 54321; | ||
4504 | 160 | |||
4505 | 161 | auto entry1 = std::make_shared<Entry>("test-entry-1", "name-hint", parent_window1, "label", true, true, 0, "icon", true, true, -1); | ||
4506 | 162 | sync_data.push_back(entry1); | ||
4507 | 163 | |||
4508 | 164 | auto entry2 = std::make_shared<Entry>("test-entry-2", "name-hint", parent_window2, "label", true, true, 0, "icon", true, true, -1); | ||
4509 | 165 | sync_data.push_back(entry2); | ||
4510 | 166 | |||
4511 | 167 | auto entry3 = std::make_shared<Entry>("test-entry-3", "name-hint", parent_window1, "label", true, true, 0, "icon", true, true, -1); | ||
4512 | 168 | sync_data.push_back(entry3); | ||
4513 | 169 | |||
4514 | 170 | EXPECT_CALL(sig_receiver, Updated()); | ||
4515 | 171 | |||
4516 | 172 | // Sync the indicator, adding 3 entries | ||
4517 | 173 | indicator.Sync(sync_data); | ||
4518 | 174 | |||
4519 | 175 | // Readding the same entries, nothing is emitted | ||
4520 | 176 | EXPECT_CALL(sig_receiver, Updated()).Times(0); | ||
4521 | 177 | indicator.Sync(sync_data); | ||
4522 | 178 | |||
4523 | 179 | sync_data.erase(std::remove(sync_data.begin(), sync_data.end(), entry3), sync_data.end()); | ||
4524 | 180 | EXPECT_CALL(sig_receiver, Updated()); | ||
4525 | 181 | indicator.Sync(sync_data); | ||
4526 | 182 | |||
4527 | 183 | sync_data.push_back(entry3); | ||
4528 | 184 | EXPECT_CALL(sig_receiver, Updated()); | ||
4529 | 185 | indicator.Sync(sync_data); | ||
4530 | 186 | } | ||
4531 | 187 | |||
4532 | 188 | TEST(TestAppmenuIndicator, UpdatedWin) | ||
4533 | 189 | { | ||
4534 | 190 | AppmenuIndicator indicator("indicator-test"); | ||
4535 | 191 | SigReceiver::Nice sig_receiver(indicator); | ||
4536 | 192 | Indicator::Entries sync_data; | ||
4537 | 193 | const uint32_t parent_window1 = 12345; | ||
4538 | 194 | const uint32_t parent_window2 = 54321; | ||
4539 | 195 | |||
4540 | 196 | auto entry1 = std::make_shared<Entry>("test-entry-1", "name-hint", parent_window1, "label", true, true, 0, "icon", true, true, -1); | ||
4541 | 197 | sync_data.push_back(entry1); | ||
4542 | 198 | |||
4543 | 199 | auto entry2 = std::make_shared<Entry>("test-entry-2", "name-hint", parent_window2, "label", true, true, 0, "icon", true, true, -1); | ||
4544 | 200 | sync_data.push_back(entry2); | ||
4545 | 201 | |||
4546 | 202 | auto entry3 = std::make_shared<Entry>("test-entry-3", "name-hint", parent_window1, "label", true, true, 0, "icon", true, true, -1); | ||
4547 | 203 | sync_data.push_back(entry3); | ||
4548 | 204 | |||
4549 | 205 | EXPECT_CALL(sig_receiver, UpdatedWin(parent_window1)); | ||
4550 | 206 | EXPECT_CALL(sig_receiver, UpdatedWin(parent_window2)); | ||
4551 | 207 | |||
4552 | 208 | // Sync the indicator, adding 3 entries | ||
4553 | 209 | indicator.Sync(sync_data); | ||
4554 | 210 | |||
4555 | 211 | // Readding the same entries, nothing is emitted | ||
4556 | 212 | EXPECT_CALL(sig_receiver, UpdatedWin(_)).Times(0); | ||
4557 | 213 | indicator.Sync(sync_data); | ||
4558 | 214 | |||
4559 | 215 | sync_data.erase(std::remove(sync_data.begin(), sync_data.end(), entry3), sync_data.end()); | ||
4560 | 216 | EXPECT_CALL(sig_receiver, UpdatedWin(entry3->parent_window())); | ||
4561 | 217 | indicator.Sync(sync_data); | ||
4562 | 218 | |||
4563 | 219 | sync_data.push_back(entry3); | ||
4564 | 220 | EXPECT_CALL(sig_receiver, UpdatedWin(entry3->parent_window())); | ||
4565 | 221 | indicator.Sync(sync_data); | ||
4566 | 61 | } | 222 | } |
4567 | 62 | 223 | ||
4568 | 63 | } | 224 | } |
4569 | 64 | 225 | ||
4570 | === modified file 'tests/test_indicator_entry.cpp' | |||
4571 | --- tests/test_indicator_entry.cpp 2014-02-07 23:54:15 +0000 | |||
4572 | +++ tests/test_indicator_entry.cpp 2015-07-15 14:19:40 +0000 | |||
4573 | @@ -36,11 +36,12 @@ | |||
4574 | 36 | TEST(TestIndicatorEntry, TestConstruction) | 36 | TEST(TestIndicatorEntry, TestConstruction) |
4575 | 37 | { | 37 | { |
4576 | 38 | 38 | ||
4578 | 39 | Entry entry("id", "name_hint", "label", true, true, 1, "some icon", false, true, -1); | 39 | Entry entry("id", "name_hint", 12345, "label", true, true, 1, "some icon", false, true, -1); |
4579 | 40 | 40 | ||
4580 | 41 | EXPECT_EQ(entry.id(), "id"); | 41 | EXPECT_EQ(entry.id(), "id"); |
4581 | 42 | EXPECT_EQ(entry.name_hint(), "name_hint"); | ||
4582 | 43 | EXPECT_EQ(entry.parent_window(), 12345); | ||
4583 | 42 | EXPECT_EQ(entry.label(), "label"); | 44 | EXPECT_EQ(entry.label(), "label"); |
4584 | 43 | EXPECT_EQ(entry.name_hint(), "name_hint"); | ||
4585 | 44 | EXPECT_TRUE(entry.label_sensitive()); | 45 | EXPECT_TRUE(entry.label_sensitive()); |
4586 | 45 | EXPECT_TRUE(entry.label_visible()); | 46 | EXPECT_TRUE(entry.label_visible()); |
4587 | 46 | EXPECT_FALSE(entry.image_sensitive()); | 47 | EXPECT_FALSE(entry.image_sensitive()); |
4588 | @@ -55,10 +56,11 @@ | |||
4589 | 55 | 56 | ||
4590 | 56 | TEST(TestIndicatorEntry, TestConstructionEmpty) | 57 | TEST(TestIndicatorEntry, TestConstructionEmpty) |
4591 | 57 | { | 58 | { |
4593 | 58 | Entry entry("id", "name_hint"); | 59 | Entry entry("id", "name_hint", 12345); |
4594 | 59 | 60 | ||
4595 | 60 | EXPECT_EQ(entry.id(), "id"); | 61 | EXPECT_EQ(entry.id(), "id"); |
4596 | 61 | EXPECT_EQ(entry.name_hint(), "name_hint"); | 62 | EXPECT_EQ(entry.name_hint(), "name_hint"); |
4597 | 63 | EXPECT_EQ(entry.parent_window(), 12345); | ||
4598 | 62 | EXPECT_TRUE(entry.label().empty()); | 64 | EXPECT_TRUE(entry.label().empty()); |
4599 | 63 | EXPECT_FALSE(entry.label_sensitive()); | 65 | EXPECT_FALSE(entry.label_sensitive()); |
4600 | 64 | EXPECT_FALSE(entry.label_visible()); | 66 | EXPECT_FALSE(entry.label_visible()); |
4601 | @@ -74,8 +76,8 @@ | |||
4602 | 74 | 76 | ||
4603 | 75 | TEST(TestIndicatorEntry, TestAssignment) | 77 | TEST(TestIndicatorEntry, TestAssignment) |
4604 | 76 | { | 78 | { |
4607 | 77 | Entry entry("id", "name_hint", "label", true, true, 0, "some icon", false, true, 10); | 79 | Entry entry("id", "name_hint", 12345, "label", true, true, 0, "some icon", false, true, 10); |
4608 | 78 | Entry other_entry("other_id", "other_name_hint", "other_label", false, false, 2, "other icon", true, false, 5); | 80 | Entry other_entry("other_id", "other_name_hint", 54321, "other_label", false, false, 2, "other icon", true, false, 5); |
4609 | 79 | 81 | ||
4610 | 80 | SigReceiver sig_receiver(entry); | 82 | SigReceiver sig_receiver(entry); |
4611 | 81 | EXPECT_CALL(sig_receiver, Updated()); | 83 | EXPECT_CALL(sig_receiver, Updated()); |
4612 | @@ -83,6 +85,7 @@ | |||
4613 | 83 | 85 | ||
4614 | 84 | EXPECT_EQ(entry.id(), "other_id"); | 86 | EXPECT_EQ(entry.id(), "other_id"); |
4615 | 85 | EXPECT_EQ(entry.name_hint(), "other_name_hint"); | 87 | EXPECT_EQ(entry.name_hint(), "other_name_hint"); |
4616 | 88 | EXPECT_EQ(entry.parent_window(), 54321); | ||
4617 | 86 | EXPECT_EQ(entry.label(), "other_label"); | 89 | EXPECT_EQ(entry.label(), "other_label"); |
4618 | 87 | EXPECT_FALSE(entry.label_sensitive()); | 90 | EXPECT_FALSE(entry.label_sensitive()); |
4619 | 88 | EXPECT_FALSE(entry.label_visible()); | 91 | EXPECT_FALSE(entry.label_visible()); |
4620 | @@ -95,8 +98,8 @@ | |||
4621 | 95 | 98 | ||
4622 | 96 | TEST(TestIndicatorEntry, TestShowNowEvents) | 99 | TEST(TestIndicatorEntry, TestShowNowEvents) |
4623 | 97 | { | 100 | { |
4626 | 98 | Entry entry("id", "name_hint", "label", true, true, | 101 | Entry entry("id", "name_hint", 0, "label", true, true, |
4627 | 99 | 0, "some icon", false, true, -1); | 102 | 0, "some icon", false, true, -1); |
4628 | 100 | SigReceiver sig_receiver(entry); | 103 | SigReceiver sig_receiver(entry); |
4629 | 101 | 104 | ||
4630 | 102 | // Setting show_now to the same value doesn't emit any events. | 105 | // Setting show_now to the same value doesn't emit any events. |
4631 | @@ -116,7 +119,7 @@ | |||
4632 | 116 | 119 | ||
4633 | 117 | TEST(TestIndicatorEntry, TestActiveEvents) | 120 | TEST(TestIndicatorEntry, TestActiveEvents) |
4634 | 118 | { | 121 | { |
4636 | 119 | Entry entry("id", "name_hint", "label", true, true, 0, "some icon", false, true, -1); | 122 | Entry entry("id", "name_hint", 0, "label", true, true, 0, "some icon", false, true, -1); |
4637 | 120 | 123 | ||
4638 | 121 | SigReceiver sig_receiver(entry); | 124 | SigReceiver sig_receiver(entry); |
4639 | 122 | 125 | ||
4640 | @@ -137,7 +140,7 @@ | |||
4641 | 137 | 140 | ||
4642 | 138 | TEST(TestIndicatorEntry, TestOnScroll) | 141 | TEST(TestIndicatorEntry, TestOnScroll) |
4643 | 139 | { | 142 | { |
4645 | 140 | Entry entry("id", "name_hint", "label", true, true, 0, "some icon", false, true, -1); | 143 | Entry entry("id", "name_hint", 0, "label", true, true, 0, "some icon", false, true, -1); |
4646 | 141 | SigReceiver sig_receiver(entry); | 144 | SigReceiver sig_receiver(entry); |
4647 | 142 | 145 | ||
4648 | 143 | EXPECT_CALL(sig_receiver, OnScroll("id", 10)); | 146 | EXPECT_CALL(sig_receiver, OnScroll("id", 10)); |
4649 | @@ -149,16 +152,16 @@ | |||
4650 | 149 | 152 | ||
4651 | 150 | TEST(TestIndicatorEntry, TestOnShowMenu) | 153 | TEST(TestIndicatorEntry, TestOnShowMenu) |
4652 | 151 | { | 154 | { |
4654 | 152 | Entry entry("id", "name_hint", "label", true, true, 0, "some icon", false, true, -1); | 155 | Entry entry("id", "name_hint", 123, "label", true, true, 0, "some icon", false, true, -1); |
4655 | 153 | SigReceiver sig_receiver(entry); | 156 | SigReceiver sig_receiver(entry); |
4656 | 154 | 157 | ||
4658 | 155 | EXPECT_CALL(sig_receiver, OnShowMenu("id", 0, 10, 20, 1)); | 158 | EXPECT_CALL(sig_receiver, OnShowMenu("id", 123, 10, 20, 1)); |
4659 | 156 | entry.ShowMenu(10, 20, 1); | 159 | entry.ShowMenu(10, 20, 1); |
4660 | 157 | } | 160 | } |
4661 | 158 | 161 | ||
4662 | 159 | TEST(TestIndicatorEntry, TestOnShowMenuXid) | 162 | TEST(TestIndicatorEntry, TestOnShowMenuXid) |
4663 | 160 | { | 163 | { |
4665 | 161 | Entry entry("xid", "name_hint", "label", true, true, 0, "some icon", false, true, -1); | 164 | Entry entry("xid", "name_hint", 0, "label", true, true, 0, "some icon", false, true, -1); |
4666 | 162 | SigReceiver sig_receiver(entry); | 165 | SigReceiver sig_receiver(entry); |
4667 | 163 | 166 | ||
4668 | 164 | EXPECT_CALL(sig_receiver, OnShowMenu("xid", 88492615, 15, 25, 2)); | 167 | EXPECT_CALL(sig_receiver, OnShowMenu("xid", 88492615, 15, 25, 2)); |
4669 | @@ -167,7 +170,7 @@ | |||
4670 | 167 | 170 | ||
4671 | 168 | TEST(TestIndicatorEntry, TestVisibility) | 171 | TEST(TestIndicatorEntry, TestVisibility) |
4672 | 169 | { | 172 | { |
4674 | 170 | Entry entry("id", "name_hint", "label", true, true, 0, "some icon", false, false, -1); | 173 | Entry entry("id", "name_hint", 0, "label", true, true, 0, "some icon", false, false, -1); |
4675 | 171 | 174 | ||
4676 | 172 | EXPECT_TRUE(entry.visible()); | 175 | EXPECT_TRUE(entry.visible()); |
4677 | 173 | 176 | ||
4678 | @@ -208,7 +211,7 @@ | |||
4679 | 208 | 211 | ||
4680 | 209 | TEST(TestIndicatorEntry, TestGeometry) | 212 | TEST(TestIndicatorEntry, TestGeometry) |
4681 | 210 | { | 213 | { |
4683 | 211 | Entry entry("id", "name_hint", "label", true, true, 0, "some icon", false, true, -1); | 214 | Entry entry("id", "name_hint", 0, "label", true, true, 0, "some icon", false, true, -1); |
4684 | 212 | SigReceiver sig_receiver(entry); | 215 | SigReceiver sig_receiver(entry); |
4685 | 213 | 216 | ||
4686 | 214 | // Setting to the same value doesn't emit any events. | 217 | // Setting to the same value doesn't emit any events. |
4687 | 215 | 218 | ||
4688 | === modified file 'tests/test_indicators.cpp' | |||
4689 | --- tests/test_indicators.cpp 2014-02-11 03:11:47 +0000 | |||
4690 | +++ tests/test_indicators.cpp 2015-07-15 14:19:40 +0000 | |||
4691 | @@ -62,15 +62,15 @@ | |||
4692 | 62 | 62 | ||
4693 | 63 | Indicator::Ptr test_indicator_1 = indicators.AddIndicator("indicator-test-1"); | 63 | Indicator::Ptr test_indicator_1 = indicators.AddIndicator("indicator-test-1"); |
4694 | 64 | 64 | ||
4704 | 65 | entry = new Entry("indicator-test-1|entry-1", "name-hint-1", "label", true, true, | 65 | entry = new Entry("indicator-test-1|entry-1", "name-hint-1", 0, "label", true, true, |
4705 | 66 | 0, "icon", true, true, -1); | 66 | 0, "icon", true, true, -1); |
4706 | 67 | sync_data.push_back(Entry::Ptr(entry)); | 67 | sync_data.push_back(Entry::Ptr(entry)); |
4707 | 68 | 68 | ||
4708 | 69 | entry = new Entry("indicator-test-1|entry-2", "name-hint-2", "label", true, true, | 69 | entry = new Entry("indicator-test-1|entry-2", "name-hint-2", 0, "label", true, true, |
4709 | 70 | 0, "icon", true, true, -1); | 70 | 0, "icon", true, true, -1); |
4710 | 71 | sync_data.push_back(Entry::Ptr(entry)); | 71 | sync_data.push_back(Entry::Ptr(entry)); |
4711 | 72 | 72 | ||
4712 | 73 | entry = new Entry("indicator-test-1|entry-3", "name-hint-3", "label", true, true, | 73 | entry = new Entry("indicator-test-1|entry-3", "name-hint-3", 0, "label", true, true, |
4713 | 74 | 0, "icon", true, true, -1); | 74 | 0, "icon", true, true, -1); |
4714 | 75 | sync_data.push_back(Entry::Ptr(entry)); | 75 | sync_data.push_back(Entry::Ptr(entry)); |
4715 | 76 | 76 | ||
4716 | @@ -83,11 +83,11 @@ | |||
4717 | 83 | Indicator::Ptr test_indicator_2 = indicators.AddIndicator("indicator-test-2"); | 83 | Indicator::Ptr test_indicator_2 = indicators.AddIndicator("indicator-test-2"); |
4718 | 84 | sync_data.clear(); | 84 | sync_data.clear(); |
4719 | 85 | 85 | ||
4721 | 86 | entry = new Entry("indicator-test-2|entry-1", "name-hint-1", "label", true, true, | 86 | entry = new Entry("indicator-test-2|entry-1", "name-hint-1", 0, "label", true, true, |
4722 | 87 | 0, "icon", true, true, -1); | 87 | 0, "icon", true, true, -1); |
4723 | 88 | sync_data.push_back(Entry::Ptr(entry)); | 88 | sync_data.push_back(Entry::Ptr(entry)); |
4724 | 89 | 89 | ||
4726 | 90 | entry = new Entry("indicator-test-2|entry-2", "name-hint-2", "label", true, true, | 90 | entry = new Entry("indicator-test-2|entry-2", "name-hint-2", 0, "label", true, true, |
4727 | 91 | 0, "icon", true, true, -1); | 91 | 0, "icon", true, true, -1); |
4728 | 92 | sync_data.push_back(Entry::Ptr(entry)); | 92 | sync_data.push_back(Entry::Ptr(entry)); |
4729 | 93 | 93 | ||
4730 | 94 | 94 | ||
4731 | === modified file 'tests/test_panel_menu_view.cpp' | |||
4732 | --- tests/test_panel_menu_view.cpp 2014-03-21 04:40:12 +0000 | |||
4733 | +++ tests/test_panel_menu_view.cpp 2015-07-15 14:19:40 +0000 | |||
4734 | @@ -36,11 +36,22 @@ | |||
4735 | 36 | 36 | ||
4736 | 37 | struct TestPanelMenuView : public testing::Test | 37 | struct TestPanelMenuView : public testing::Test |
4737 | 38 | { | 38 | { |
4738 | 39 | TestPanelMenuView() | ||
4739 | 40 | : menu_manager(std::make_shared<menu::MockManager>()) | ||
4740 | 41 | , menu_view(menu_manager) | ||
4741 | 42 | {} | ||
4742 | 43 | |||
4743 | 39 | struct MockPanelMenuView : public PanelMenuView | 44 | struct MockPanelMenuView : public PanelMenuView |
4744 | 40 | { | 45 | { |
4748 | 41 | MockPanelMenuView() | 46 | MockPanelMenuView(menu::Manager::Ptr const& menu_manager) |
4749 | 42 | : PanelMenuView(std::make_shared<menu::MockManager>()) | 47 | : PanelMenuView(menu_manager) |
4750 | 43 | {} | 48 | { |
4751 | 49 | view_opened_signal_.Disconnect(); | ||
4752 | 50 | active_win_changed_signal_.Disconnect(); | ||
4753 | 51 | active_app_changed_signal_.Disconnect(); | ||
4754 | 52 | view_closed_signal_.Disconnect(); | ||
4755 | 53 | maximized_wins_.clear(); | ||
4756 | 54 | } | ||
4757 | 44 | 55 | ||
4758 | 45 | MOCK_METHOD0(QueueDraw, void()); | 56 | MOCK_METHOD0(QueueDraw, void()); |
4759 | 46 | MOCK_CONST_METHOD1(GetActiveViewName, std::string(bool)); | 57 | MOCK_CONST_METHOD1(GetActiveViewName, std::string(bool)); |
4760 | @@ -53,6 +64,7 @@ | |||
4761 | 53 | using PanelMenuView::titlebar_grab_area_; | 64 | using PanelMenuView::titlebar_grab_area_; |
4762 | 54 | using PanelMenuView::we_control_active_; | 65 | using PanelMenuView::we_control_active_; |
4763 | 55 | using PanelMenuView::spread_showing_; | 66 | using PanelMenuView::spread_showing_; |
4764 | 67 | using PanelMenuView::maximized_wins_; | ||
4765 | 56 | }; | 68 | }; |
4766 | 57 | 69 | ||
4767 | 58 | nux::ObjectPtr<nux::BaseWindow> AddPanelToWindow(int monitor) | 70 | nux::ObjectPtr<nux::BaseWindow> AddPanelToWindow(int monitor) |
4768 | @@ -69,6 +81,7 @@ | |||
4769 | 69 | panel_win->ComputeContentSize(); | 81 | panel_win->ComputeContentSize(); |
4770 | 70 | 82 | ||
4771 | 71 | menu_view.SetMonitor(monitor); | 83 | menu_view.SetMonitor(monitor); |
4772 | 84 | menu_view.maximized_wins_.clear(); | ||
4773 | 72 | 85 | ||
4774 | 73 | return panel_win; | 86 | return panel_win; |
4775 | 74 | } | 87 | } |
4776 | @@ -79,6 +92,7 @@ | |||
4777 | 79 | MockUScreen uscreen; | 92 | MockUScreen uscreen; |
4778 | 80 | panel::Style panelStyle; | 93 | panel::Style panelStyle; |
4779 | 81 | testwrapper::StandaloneWM WM; | 94 | testwrapper::StandaloneWM WM; |
4780 | 95 | menu::MockManager::Ptr menu_manager; | ||
4781 | 82 | testing::NiceMock<MockPanelMenuView> menu_view; | 96 | testing::NiceMock<MockPanelMenuView> menu_view; |
4782 | 83 | }; | 97 | }; |
4783 | 84 | 98 | ||
4784 | @@ -91,6 +105,7 @@ | |||
4785 | 91 | 105 | ||
4786 | 92 | TEST_F(TestPanelMenuView, Escaping) | 106 | TEST_F(TestPanelMenuView, Escaping) |
4787 | 93 | { | 107 | { |
4788 | 108 | menu_manager->integrated_menus = false; | ||
4789 | 94 | ON_CALL(menu_view, GetActiveViewName(testing::_)).WillByDefault(Return("<>'")); | 109 | ON_CALL(menu_view, GetActiveViewName(testing::_)).WillByDefault(Return("<>'")); |
4790 | 95 | auto escapedText = "Panel d'Inici"; | 110 | auto escapedText = "Panel d'Inici"; |
4791 | 96 | ASSERT_TRUE(menu_view.GetCurrentTitle().empty()); | 111 | ASSERT_TRUE(menu_view.GetCurrentTitle().empty()); |
4792 | @@ -136,6 +151,7 @@ | |||
4793 | 136 | TEST_P(ProgressTester, RestoreOnGrabInBiggerWorkArea) | 151 | TEST_P(ProgressTester, RestoreOnGrabInBiggerWorkArea) |
4794 | 137 | { | 152 | { |
4795 | 138 | uscreen.SetupFakeMultiMonitor(); | 153 | uscreen.SetupFakeMultiMonitor(); |
4796 | 154 | connection::Manager conn; | ||
4797 | 139 | unsigned monitor = uscreen.GetMonitors().size() - 1; | 155 | unsigned monitor = uscreen.GetMonitors().size() - 1; |
4798 | 140 | auto const& monitor_geo = uscreen.GetMonitorGeometry(monitor); | 156 | auto const& monitor_geo = uscreen.GetMonitorGeometry(monitor); |
4799 | 141 | WM->SetWorkareaGeometry(monitor_geo); | 157 | WM->SetWorkareaGeometry(monitor_geo); |
4800 | 142 | 158 | ||
4801 | === modified file 'tests/test_panel_service.cpp' | |||
4802 | --- tests/test_panel_service.cpp 2013-10-03 15:16:06 +0000 | |||
4803 | +++ tests/test_panel_service.cpp 2015-07-15 14:19:40 +0000 | |||
4804 | @@ -32,8 +32,8 @@ | |||
4805 | 32 | { | 32 | { |
4806 | 33 | typedef std::tuple<glib::Object<GtkLabel>, glib::Object<GtkImage>> EntryObjects; | 33 | typedef std::tuple<glib::Object<GtkLabel>, glib::Object<GtkImage>> EntryObjects; |
4807 | 34 | 34 | ||
4810 | 35 | const std::string SYNC_ENTRY_VARIANT_FORMAT = "(ssssbbusbbi)"; | 35 | const std::string SYNC_ENTRY_VARIANT_FORMAT = ENTRY_SIGNATURE; |
4811 | 36 | const std::string SYNC_ENTRIES_VARIANT_FORMAT = "(a"+SYNC_ENTRY_VARIANT_FORMAT+")"; | 36 | const std::string SYNC_ENTRIES_VARIANT_FORMAT = "(" ENTRY_ARRAY_SIGNATURE ")"; |
4812 | 37 | 37 | ||
4813 | 38 | struct TestPanelService : Test | 38 | struct TestPanelService : Test |
4814 | 39 | { | 39 | { |
4815 | @@ -46,6 +46,7 @@ | |||
4816 | 46 | std::string indicator_id; | 46 | std::string indicator_id; |
4817 | 47 | std::string entry_id; | 47 | std::string entry_id; |
4818 | 48 | std::string entry_name_hint; | 48 | std::string entry_name_hint; |
4819 | 49 | uint32_t parent_window; | ||
4820 | 49 | std::string label; | 50 | std::string label; |
4821 | 50 | bool label_sensitive; | 51 | bool label_sensitive; |
4822 | 51 | bool label_visible; | 52 | bool label_visible; |
4823 | @@ -63,6 +64,7 @@ | |||
4824 | 63 | gchar* indicator_id; | 64 | gchar* indicator_id; |
4825 | 64 | gchar* entry_id; | 65 | gchar* entry_id; |
4826 | 65 | gchar* entry_name_hint; | 66 | gchar* entry_name_hint; |
4827 | 67 | guint32 parent_window; | ||
4828 | 66 | gchar* label; | 68 | gchar* label; |
4829 | 67 | gboolean label_sensitive; | 69 | gboolean label_sensitive; |
4830 | 68 | gboolean label_visible; | 70 | gboolean label_visible; |
4831 | @@ -77,6 +79,7 @@ | |||
4832 | 77 | &indicator_id, | 79 | &indicator_id, |
4833 | 78 | &entry_id, | 80 | &entry_id, |
4834 | 79 | &entry_name_hint, | 81 | &entry_name_hint, |
4835 | 82 | &parent_window, | ||
4836 | 80 | &label, | 83 | &label, |
4837 | 81 | &label_sensitive, | 84 | &label_sensitive, |
4838 | 82 | &label_visible, | 85 | &label_visible, |
4839 | @@ -89,6 +92,7 @@ | |||
4840 | 89 | results.push_back({ glib::gchar_to_string(indicator_id), | 92 | results.push_back({ glib::gchar_to_string(indicator_id), |
4841 | 90 | glib::gchar_to_string(entry_id), | 93 | glib::gchar_to_string(entry_id), |
4842 | 91 | glib::gchar_to_string(entry_name_hint), | 94 | glib::gchar_to_string(entry_name_hint), |
4843 | 95 | parent_window, | ||
4844 | 92 | glib::gchar_to_string(label), | 96 | glib::gchar_to_string(label), |
4845 | 93 | label_sensitive != FALSE, | 97 | label_sensitive != FALSE, |
4846 | 94 | label_visible != FALSE, | 98 | label_visible != FALSE, |
4847 | 95 | 99 | ||
4848 | === modified file 'tests/test_service_panel.cpp' | |||
4849 | --- tests/test_service_panel.cpp 2013-03-02 22:44:29 +0000 | |||
4850 | +++ tests/test_service_panel.cpp 2015-07-15 14:19:40 +0000 | |||
4851 | @@ -1,4 +1,5 @@ | |||
4852 | 1 | #include "test_service_panel.h" | 1 | #include "test_service_panel.h" |
4853 | 2 | #include "panel-service-private.h" | ||
4854 | 2 | 3 | ||
4855 | 3 | namespace unity | 4 | namespace unity |
4856 | 4 | { | 5 | { |
4857 | @@ -9,11 +10,11 @@ | |||
4858 | 9 | static const char * panel_interface = | 10 | static const char * panel_interface = |
4859 | 10 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" | 11 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
4860 | 11 | "<node name=\"/\">\n" | 12 | "<node name=\"/\">\n" |
4862 | 12 | " <interface name=\"com.canonical.Unity.Panel.Service\">\n" | 13 | " <interface name=\"" UPS_IFACE "\">\n" |
4863 | 13 | "\n" | 14 | "\n" |
4864 | 14 | "<!-- Begin of real methods/signals -->\n" | 15 | "<!-- Begin of real methods/signals -->\n" |
4865 | 15 | " <method name='Sync'>" | 16 | " <method name='Sync'>" |
4867 | 16 | " <arg type='a(ssssbbusbbi)' name='state' direction='out'/>" | 17 | " <arg type='" ENTRY_ARRAY_SIGNATURE "' name='state' direction='out'/>" |
4868 | 17 | " </method>" | 18 | " </method>" |
4869 | 18 | "\n" | 19 | "\n" |
4870 | 19 | " <signal name='ReSync'>" | 20 | " <signal name='ReSync'>" |
4871 | @@ -32,12 +33,13 @@ | |||
4872 | 32 | "</node>\n" | 33 | "</node>\n" |
4873 | 33 | ; | 34 | ; |
4874 | 34 | 35 | ||
4876 | 35 | void add_entry_id(GVariantBuilder *b) | 36 | void add_entry_id(GVariantBuilder *b, gint priority) |
4877 | 36 | { | 37 | { |
4879 | 37 | g_variant_builder_add (b, "(ssssbbusbbi)", | 38 | g_variant_builder_add (b, ENTRY_SIGNATURE, |
4880 | 38 | "test_indicator_id", | 39 | "test_indicator_id", |
4881 | 39 | "test_entry_id", | 40 | "test_entry_id", |
4882 | 40 | "test_entry_name_hint", | 41 | "test_entry_name_hint", |
4883 | 42 | 0, /* parent window */ | ||
4884 | 41 | "test_entry_label", | 43 | "test_entry_label", |
4885 | 42 | TRUE, /* label sensitive */ | 44 | TRUE, /* label sensitive */ |
4886 | 43 | TRUE, /* label visible */ | 45 | TRUE, /* label visible */ |
4887 | @@ -45,15 +47,16 @@ | |||
4888 | 45 | "", /* image_data */ | 47 | "", /* image_data */ |
4889 | 46 | TRUE, /* image sensitive */ | 48 | TRUE, /* image sensitive */ |
4890 | 47 | TRUE, /* image visible */ | 49 | TRUE, /* image visible */ |
4892 | 48 | 1 /* priority */); | 50 | priority); |
4893 | 49 | } | 51 | } |
4894 | 50 | 52 | ||
4896 | 51 | void add_entry_id_2(GVariantBuilder *b) | 53 | void add_entry_id_2(GVariantBuilder *b, gint priority) |
4897 | 52 | { | 54 | { |
4899 | 53 | g_variant_builder_add (b, "(ssssbbusbbi)", | 55 | g_variant_builder_add (b, ENTRY_SIGNATURE, |
4900 | 54 | "test_indicator_id", | 56 | "test_indicator_id", |
4901 | 55 | "test_entry_id2", | 57 | "test_entry_id2", |
4902 | 56 | "test_entry_name_hint2", | 58 | "test_entry_name_hint2", |
4903 | 59 | 12345, /* parent window */ | ||
4904 | 57 | "test_entry_label2", | 60 | "test_entry_label2", |
4905 | 58 | TRUE, /* label sensitive */ | 61 | TRUE, /* label sensitive */ |
4906 | 59 | TRUE, /* label visible */ | 62 | TRUE, /* label visible */ |
4907 | @@ -61,7 +64,7 @@ | |||
4908 | 61 | "", /* image_data */ | 64 | "", /* image_data */ |
4909 | 62 | TRUE, /* image sensitive */ | 65 | TRUE, /* image sensitive */ |
4910 | 63 | TRUE, /* image visible */ | 66 | TRUE, /* image visible */ |
4912 | 64 | 1 /* priority */); | 67 | priority); |
4913 | 65 | } | 68 | } |
4914 | 66 | } | 69 | } |
4915 | 67 | 70 | ||
4916 | @@ -73,7 +76,7 @@ | |||
4917 | 73 | auto object = glib::DBusObjectBuilder::GetObjectsForIntrospection(panel_interface).front(); | 76 | auto object = glib::DBusObjectBuilder::GetObjectsForIntrospection(panel_interface).front(); |
4918 | 74 | object->SetMethodsCallsHandler(sigc::mem_fun(this, &Panel::OnMethodCall)); | 77 | object->SetMethodsCallsHandler(sigc::mem_fun(this, &Panel::OnMethodCall)); |
4919 | 75 | 78 | ||
4921 | 76 | server_.AddObject(object, "/com/canonical/Unity/Panel/Service"); | 79 | server_.AddObject(object, UPS_PATH); |
4922 | 77 | } | 80 | } |
4923 | 78 | 81 | ||
4924 | 79 | GVariant* Panel::OnMethodCall(std::string const& method, GVariant *parameters) | 82 | GVariant* Panel::OnMethodCall(std::string const& method, GVariant *parameters) |
4925 | @@ -82,18 +85,18 @@ | |||
4926 | 82 | { | 85 | { |
4927 | 83 | GVariantBuilder b; | 86 | GVariantBuilder b; |
4928 | 84 | 87 | ||
4931 | 85 | g_variant_builder_init (&b, G_VARIANT_TYPE ("(a(ssssbbusbbi))")); | 88 | g_variant_builder_init (&b, G_VARIANT_TYPE ("(" ENTRY_ARRAY_SIGNATURE ")")); |
4932 | 86 | g_variant_builder_open (&b, G_VARIANT_TYPE ("a(ssssbbusbbi)")); | 89 | g_variant_builder_open (&b, G_VARIANT_TYPE (ENTRY_ARRAY_SIGNATURE)); |
4933 | 87 | 90 | ||
4934 | 88 | if (sync_return_mode_ == 0) | 91 | if (sync_return_mode_ == 0) |
4935 | 89 | { | 92 | { |
4938 | 90 | add_entry_id(&b); | 93 | add_entry_id(&b, 1); |
4939 | 91 | add_entry_id_2(&b); | 94 | add_entry_id_2(&b, 2); |
4940 | 92 | } | 95 | } |
4941 | 93 | else if (sync_return_mode_ == 1) | 96 | else if (sync_return_mode_ == 1) |
4942 | 94 | { | 97 | { |
4945 | 95 | add_entry_id_2(&b); | 98 | add_entry_id_2(&b, 1); |
4946 | 96 | add_entry_id(&b); | 99 | add_entry_id(&b, 2); |
4947 | 97 | } | 100 | } |
4948 | 98 | 101 | ||
4949 | 99 | if (sync_return_mode_ == 1) | 102 | if (sync_return_mode_ == 1) |
4950 | 100 | 103 | ||
4951 | === modified file 'unity-shared/IconLoader.cpp' | |||
4952 | --- unity-shared/IconLoader.cpp 2014-03-21 01:49:22 +0000 | |||
4953 | +++ unity-shared/IconLoader.cpp 2015-07-15 14:19:40 +0000 | |||
4954 | @@ -799,7 +799,7 @@ | |||
4955 | 799 | bool CoalesceTasksCb(); | 799 | bool CoalesceTasksCb(); |
4956 | 800 | 800 | ||
4957 | 801 | private: | 801 | private: |
4959 | 802 | std::map<std::string, glib::Object<GdkPixbuf>> cache_; | 802 | std::unordered_map<std::string, glib::Object<GdkPixbuf>> cache_; |
4960 | 803 | /* FIXME: the reference counting of IconLoaderTasks with shared pointers | 803 | /* FIXME: the reference counting of IconLoaderTasks with shared pointers |
4961 | 804 | * is currently somewhat broken, and the queued_tasks_ member is what keeps | 804 | * is currently somewhat broken, and the queued_tasks_ member is what keeps |
4962 | 805 | * it from crashing randomly. | 805 | * it from crashing randomly. |
4963 | @@ -807,7 +807,7 @@ | |||
4964 | 807 | * tasks, but when they are being completed in a worker thread, the thread | 807 | * tasks, but when they are being completed in a worker thread, the thread |
4965 | 808 | * should own them as well (yet it doesn't), this could cause trouble | 808 | * should own them as well (yet it doesn't), this could cause trouble |
4966 | 809 | * in the future... You've been warned! */ | 809 | * in the future... You've been warned! */ |
4968 | 810 | std::map<std::string, IconLoaderTask::Ptr> queued_tasks_; | 810 | std::unordered_map<std::string, IconLoaderTask::Ptr> queued_tasks_; |
4969 | 811 | std::queue<IconLoaderTask::Ptr> tasks_; | 811 | std::queue<IconLoaderTask::Ptr> tasks_; |
4970 | 812 | std::unordered_map<Handle, IconLoaderTask::Ptr> task_map_; | 812 | std::unordered_map<Handle, IconLoaderTask::Ptr> task_map_; |
4971 | 813 | std::vector<IconLoaderTask*> finished_tasks_; | 813 | std::vector<IconLoaderTask*> finished_tasks_; |
4972 | 814 | 814 | ||
4973 | === modified file 'unity-shared/MenuManager.cpp' | |||
4974 | --- unity-shared/MenuManager.cpp 2015-03-12 00:57:05 +0000 | |||
4975 | +++ unity-shared/MenuManager.cpp 2015-07-15 14:19:40 +0000 | |||
4976 | @@ -26,6 +26,7 @@ | |||
4977 | 26 | #include <unordered_map> | 26 | #include <unordered_map> |
4978 | 27 | 27 | ||
4979 | 28 | #include "MenuManager.h" | 28 | #include "MenuManager.h" |
4980 | 29 | #include "WindowManager.h" | ||
4981 | 29 | 30 | ||
4982 | 30 | namespace unity | 31 | namespace unity |
4983 | 31 | { | 32 | { |
4984 | @@ -48,16 +49,20 @@ | |||
4985 | 48 | : parent_(parent) | 49 | : parent_(parent) |
4986 | 49 | , indicators_(indicators) | 50 | , indicators_(indicators) |
4987 | 50 | , key_grabber_(grabber) | 51 | , key_grabber_(grabber) |
4988 | 52 | , show_now_window_(0) | ||
4989 | 51 | , settings_(g_settings_new(SETTINGS_NAME.c_str())) | 53 | , settings_(g_settings_new(SETTINGS_NAME.c_str())) |
4990 | 52 | { | 54 | { |
4991 | 53 | for (auto const& indicator : indicators_->GetIndicators()) | 55 | for (auto const& indicator : indicators_->GetIndicators()) |
4992 | 54 | AddIndicator(indicator); | 56 | AddIndicator(indicator); |
4993 | 55 | 57 | ||
4994 | 58 | GrabMnemonicsForActiveWindow(); | ||
4995 | 59 | |||
4996 | 56 | parent_->show_menus.changed.connect(sigc::mem_fun(this, &Impl::ShowMenus)); | 60 | parent_->show_menus.changed.connect(sigc::mem_fun(this, &Impl::ShowMenus)); |
4997 | 57 | indicators_->on_object_added.connect(sigc::mem_fun(this, &Impl::AddIndicator)); | 61 | indicators_->on_object_added.connect(sigc::mem_fun(this, &Impl::AddIndicator)); |
4998 | 58 | indicators_->on_object_removed.connect(sigc::mem_fun(this, &Impl::RemoveIndicator)); | 62 | indicators_->on_object_removed.connect(sigc::mem_fun(this, &Impl::RemoveIndicator)); |
4999 | 59 | indicators_->on_entry_activate_request.connect(sigc::mem_fun(this, &Impl::ActivateRequest)); | 63 | indicators_->on_entry_activate_request.connect(sigc::mem_fun(this, &Impl::ActivateRequest)); |
5000 | 60 | indicators_->icon_paths_changed.connect(sigc::mem_fun(this, &Impl::IconPathsChanged)); | 64 | indicators_->icon_paths_changed.connect(sigc::mem_fun(this, &Impl::IconPathsChanged)); |
FAILED: Continuous integration, rev:3832 jenkins. qa.ubuntu. com/job/ unity-7. 2-ci/20/ jenkins. qa.ubuntu. com/job/ unity-7. 2-trusty- amd64-ci/ 20/console jenkins. qa.ubuntu. com/job/ unity-7. 2-trusty- armhf-ci/ 20/console jenkins. qa.ubuntu. com/job/ unity-7. 2-trusty- i386-ci/ 20/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity- 7.2-ci/ 20/rebuild
http://