Merge lp:~3v1n0/unity/menu-manager-multimonitor-scrubbing-fix into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 4229
Proposed branch: lp:~3v1n0/unity/menu-manager-multimonitor-scrubbing-fix
Merge into: lp:unity
Diff against target: 254 lines (+64/-17)
11 files modified
dash/DashView.cpp (+1/-0)
dash/ResultRendererTile.cpp (+3/-2)
lockscreen/LockScreenPanel.cpp (+1/-1)
panel/PanelView.cpp (+8/-3)
panel/PanelView.h (+1/-0)
services/panel-main.c (+36/-0)
services/panel-service.c (+8/-0)
services/panel-service.h (+2/-0)
tests/test_tabiterator.cpp (+0/-6)
tests/test_thumbnail_generator.cpp (+3/-3)
unity-shared/UScreen.cpp (+1/-2)
To merge this branch: bzr merge lp:~3v1n0/unity/menu-manager-multimonitor-scrubbing-fix
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Review via email: mp+322586@code.launchpad.net

Commit message

Panel: ensure the menu-manager tracker is updated to match monitor

Also always use an unique name for panel depending on monitor

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM,

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/DashView.cpp'
2--- dash/DashView.cpp 2017-04-07 18:28:56 +0000
3+++ dash/DashView.cpp 2017-04-18 10:51:13 +0000
4@@ -1447,6 +1447,7 @@
5 for (auto const& view : scope_views_)
6 view.second->neko_mode = (i != 0);
7
8+ search_bar_->search_string = "";
9 return;
10 }
11 }
12
13=== modified file 'dash/ResultRendererTile.cpp'
14--- dash/ResultRendererTile.cpp 2017-04-07 18:28:56 +0000
15+++ dash/ResultRendererTile.cpp 2017-04-18 10:51:13 +0000
16@@ -282,8 +282,9 @@
17 };
18 gsize tmp0;
19 int tmp1 = tile_size - (rand() % RawPixel(16).CP(scale));
20- glib::String tmp2((gchar*)g_base64_decode(pool[rand() % pool.size()], &tmp0));
21- icon_name = glib::String(g_strdup_printf(tmp2, tmp1, tmp1)).Str();
22+ int tmp2 = tile_size - (rand() % RawPixel(16).CP(scale));
23+ glib::String tmp3((gchar*)g_base64_decode(pool[rand() % pool.size()], &tmp0));
24+ icon_name = glib::String(g_strdup_printf(tmp3, tmp1, tmp2)).Str();
25 }
26
27 glib::Object<GIcon> icon(g_icon_new_for_string(icon_name.c_str(), nullptr));
28
29=== modified file 'lockscreen/LockScreenPanel.cpp'
30--- lockscreen/LockScreenPanel.cpp 2016-08-29 18:09:02 +0000
31+++ lockscreen/LockScreenPanel.cpp 2017-04-18 10:51:13 +0000
32@@ -149,7 +149,7 @@
33
34 std::string Panel::GetPanelName() const
35 {
36- return "LockScreenPanel";
37+ return "LockScreenPanel" + std::to_string(reinterpret_cast<uintptr_t>(this));
38 }
39
40 void Panel::OnIndicatorViewUpdated()
41
42=== modified file 'panel/PanelView.cpp'
43--- panel/PanelView.cpp 2016-09-01 23:57:23 +0000
44+++ panel/PanelView.cpp 2017-04-18 10:51:13 +0000
45@@ -52,7 +52,8 @@
46 PanelView::PanelView(MockableBaseWindow* parent, menu::Manager::Ptr const& menus, NUX_FILE_LINE_DECL)
47 : View(NUX_FILE_LINE_PARAM)
48 , parent_(parent)
49- , remote_(menus->Indicators())
50+ , menus_(menus)
51+ , remote_(menus_->Indicators())
52 , is_dirty_(true)
53 , opacity_maximized_toggle_(false)
54 , needs_geo_sync_(false)
55@@ -134,7 +135,7 @@
56 PanelView::~PanelView()
57 {
58 indicator::EntryLocationMap locations;
59- remote_->SyncGeometries(GetName() + std::to_string(monitor_), locations);
60+ remote_->SyncGeometries(GetPanelName(), locations);
61 }
62
63 void PanelView::LoadTextures()
64@@ -735,7 +736,7 @@
65
66 std::string PanelView::GetPanelName() const
67 {
68- return GetName() + std::to_string(monitor_);
69+ return GetName() + std::to_string(reinterpret_cast<uintptr_t>(this)) + '_' + std::to_string(monitor_);
70 }
71
72 void PanelView::SyncGeometries()
73@@ -751,9 +752,13 @@
74
75 void PanelView::SetMonitor(int monitor)
76 {
77+ auto mouse_tracker_cb = sigc::mem_fun(this, &PanelView::OnMenuPointerMoved);
78+ menus_->UnregisterTracker(GetPanelName(), mouse_tracker_cb);
79+
80 monitor_ = monitor;
81 menu_view_->SetMonitor(monitor);
82 indicators_->SetMonitor(monitor);
83+ menus_->RegisterTracker(GetPanelName(), mouse_tracker_cb);
84 Resize();
85
86 if (WindowManager::Default().IsScaleActive())
87
88=== modified file 'panel/PanelView.h'
89--- panel/PanelView.h 2016-08-29 17:42:24 +0000
90+++ panel/PanelView.h 2017-04-18 10:51:13 +0000
91@@ -111,6 +111,7 @@
92 void AddPanelView(PanelIndicatorsView* child, unsigned int stretchFactor);
93
94 MockableBaseWindow* parent_;
95+ menu::Manager::Ptr menus_;
96 indicator::Indicators::Ptr remote_;
97
98 // No ownership is taken for these views, that is done by the AddChild method.
99
100=== modified file 'services/panel-main.c'
101--- services/panel-main.c 2015-10-01 17:17:15 +0000
102+++ services/panel-main.c 2017-04-18 10:51:13 +0000
103@@ -343,6 +343,31 @@
104 }
105 }
106
107+void
108+on_unity_dbus_name_owner_changed_cb (GDBusConnection *connection,
109+ const gchar *sender_name,
110+ const gchar *object_path,
111+ const gchar *interface_name,
112+ const gchar *signal_name,
113+ GVariant *parameters,
114+ gpointer user_data)
115+{
116+ PanelService *service;
117+ const gchar *owner_name;
118+ const gchar *old_address;
119+ const gchar *new_address;
120+
121+ g_variant_get (parameters, "(&s&s&s)", &owner_name, &old_address, &new_address);
122+ g_debug ("%s: %s, %s -> %s", G_STRFUNC, owner_name, old_address, new_address);
123+
124+ service = user_data;
125+
126+ if (!new_address || *new_address == '\0')
127+ {
128+ panel_service_clear_remote_data (service);
129+ }
130+}
131+
132 static void
133 on_bus_acquired (GDBusConnection *connection,
134 const gchar *name,
135@@ -368,6 +393,17 @@
136 g_signal_connect (gtk_icon_theme_get_default(), "changed",
137 G_CALLBACK (on_icon_theme_changed), connection);
138
139+ g_dbus_connection_signal_subscribe (connection,
140+ /*sender*/ NULL,
141+ /*interface_name*/ "org.freedesktop.DBus",
142+ /*member*/ "NameOwnerChanged",
143+ /*object_path*/ "/org/freedesktop/DBus",
144+ /*arg0*/ "com.canonical.Unity",
145+ G_DBUS_SIGNAL_FLAGS_NONE,
146+ on_unity_dbus_name_owner_changed_cb,
147+ service,
148+ NULL);
149+
150 g_debug ("%s", G_STRFUNC);
151 g_assert (reg_id > 0);
152 }
153
154=== modified file 'services/panel-service.c'
155--- services/panel-service.c 2016-08-19 16:11:57 +0000
156+++ services/panel-service.c 2017-04-18 10:51:13 +0000
157@@ -195,6 +195,14 @@
158 G_OBJECT_CLASS (panel_service_parent_class)->dispose (self);
159 }
160
161+void
162+panel_service_clear_remote_data (PanelService *self)
163+{
164+ g_return_if_fail (PANEL_IS_SERVICE (self));
165+
166+ g_hash_table_remove_all (self->priv->panel2entries_hash);
167+}
168+
169 static void
170 panel_service_class_finalize (GObject *object)
171 {
172
173=== modified file 'services/panel-service.h'
174--- services/panel-service.h 2014-12-19 16:37:49 +0000
175+++ services/panel-service.h 2017-04-18 10:51:13 +0000
176@@ -76,6 +76,8 @@
177
178 void panel_service_clear_indicators (PanelService *self);
179
180+void panel_service_clear_remote_data (PanelService *self);
181+
182 GVariant * panel_service_sync (PanelService *self);
183
184 GVariant * panel_service_sync_one (PanelService *self,
185
186=== modified file 'tests/test_tabiterator.cpp'
187--- tests/test_tabiterator.cpp 2013-07-17 23:44:02 +0000
188+++ tests/test_tabiterator.cpp 2017-04-18 10:51:13 +0000
189@@ -171,9 +171,6 @@
190 auto second_entry = IMTextEntryPtr(new IMTextEntry);
191 tab_iterator.InsertBefore(second_entry.GetPointer(), first_entry.GetPointer());
192
193- std::list<nux::InputArea*>::iterator it = std::find(tab_iterator.areas_.begin(),
194- tab_iterator.areas_.end(), second_entry.GetPointer());
195-
196 nux::InputArea* last = tab_iterator.areas_.back();
197
198 EXPECT_EQ(second_entry.GetPointer(), last);
199@@ -206,9 +203,6 @@
200 auto second_entry = IMTextEntryPtr(new IMTextEntry);
201 tab_iterator.InsertAfter(second_entry.GetPointer(), first_entry.GetPointer());
202
203- std::list<nux::InputArea*>::iterator it = std::find(tab_iterator.areas_.begin(),
204- tab_iterator.areas_.end(), second_entry.GetPointer());
205-
206 nux::InputArea* last = tab_iterator.areas_.back();
207
208 EXPECT_EQ(second_entry.GetPointer(), last);
209
210=== modified file 'tests/test_thumbnail_generator.cpp'
211--- tests/test_thumbnail_generator.cpp 2016-03-31 02:03:55 +0000
212+++ tests/test_thumbnail_generator.cpp 2017-04-18 10:51:13 +0000
213@@ -58,7 +58,7 @@
214 }
215 };
216
217-void CheckResults(std::vector<LoadResult> const& results, unsigned max_wait = 500)
218+void CheckResults(std::vector<LoadResult> const& results, unsigned max_wait = 1500)
219 {
220 Utils::WaitUntilMSec([&results] {
221 bool got_all = true;
222@@ -149,7 +149,7 @@
223 results[i].cancelled = true;
224 }
225
226- CheckResults(results, 15000);
227+ CheckResults(results, 30000);
228 }
229
230
231@@ -206,7 +206,7 @@
232 results[i].cancelled = true;
233 }
234
235- CheckResults(results);
236+ CheckResults(results, 3000);
237 }
238
239
240
241=== modified file 'unity-shared/UScreen.cpp'
242--- unity-shared/UScreen.cpp 2016-06-27 10:00:13 +0000
243+++ unity-shared/UScreen.cpp 2017-04-18 10:51:13 +0000
244@@ -170,9 +170,8 @@
245
246 float scale = gdk_screen_get_monitor_scale_factor(screen_, i);
247 nux::Geometry geo(rect.x, rect.y, rect.width, rect.height);
248-
249 nux::Size physical_size(gdk_screen_get_monitor_width_mm(screen_, i),
250- gdk_screen_get_monitor_height_mm(screen_, i));
251+ gdk_screen_get_monitor_height_mm(screen_, i));
252
253 if (scale != 1.0)
254 geo = geo * scale;