Merge lp:~azzar1/unity/fix-991637-6.0 into lp:unity

Proposed by Andrea Azzarone
Status: Superseded
Proposed branch: lp:~azzar1/unity/fix-991637-6.0
Merge into: lp:unity
Diff against target: 468 lines (+238/-2) (has conflicts)
12 files modified
dash/previews/PreviewContainer.cpp (+5/-0)
hud/HudController.cpp (+2/-0)
launcher/LauncherController.cpp (+1/-1)
launcher/SwitcherView.cpp (+20/-1)
plugins/unityshell/src/unityshell.cpp (+21/-0)
tests/CMakeLists.txt (+65/-0)
tests/autopilot/unity/tests/launcher/test_keynav.py (+13/-0)
tests/autopilot/unity/tests/test_hud.py (+22/-0)
tests/test_glib_source.cpp (+35/-0)
tests/test_launcher_controller.cpp (+10/-0)
tests/test_time_util.cpp (+38/-0)
unity-shared/TimeUtil.h (+6/-0)
Text conflict in dash/previews/PreviewContainer.cpp
Text conflict in launcher/SwitcherView.cpp
Text conflict in plugins/unityshell/src/unityshell.cpp
Text conflict in tests/CMakeLists.txt
Text conflict in tests/autopilot/unity/tests/launcher/test_keynav.py
Text conflict in tests/autopilot/unity/tests/test_hud.py
Text conflict in tests/test_glib_source.cpp
Conflict adding file tests/test_time_util.cpp.  Moved existing file to tests/test_time_util.cpp.moved.
Text conflict in unity-shared/TimeUtil.h
To merge this branch: bzr merge lp:~azzar1/unity/fix-991637-6.0
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+148544@code.launchpad.net

This proposal has been superseded by a proposal from 2013-02-14.

Description of the change

== Problem ==
unity launcher vanishes when switching to mirrored displays

== Test ==
Unit test added.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/previews/PreviewContainer.cpp'
2--- dash/previews/PreviewContainer.cpp 2013-01-16 15:43:38 +0000
3+++ dash/previews/PreviewContainer.cpp 2013-02-14 20:05:37 +0000
4@@ -586,8 +586,13 @@
5
6 float PreviewContainer::GetSwipeAnimationProgress(struct timespec const& current) const
7 {
8+<<<<<<< TREE
9 DeltaTime time_delta = TimeUtil::TimeDelta(&current, &last_progress_time_);
10 float progress = preview_layout_->GetAnimationProgress() + (navigation_progress_speed_ * time_delta);
11+=======
12+ DeltaTime time_delta = TimeUtil::TimeDelta(&current, &last_progress_time_);
13+ float progress = content_layout_->GetAnimationProgress() + (navigation_progress_speed_ * time_delta);
14+>>>>>>> MERGE-SOURCE
15
16 return progress;
17 }
18
19=== modified file 'hud/HudController.cpp'
20--- hud/HudController.cpp 2013-01-17 21:39:37 +0000
21+++ hud/HudController.cpp 2013-02-14 20:05:37 +0000
22@@ -357,6 +357,8 @@
23 focused_app_icon_ = PKGDATADIR "/launcher_bfb.png";
24 }
25
26+ WindowManager::Default()->saveInputFocus();
27+
28 LOG_DEBUG(logger) << "Taking application icon: " << focused_app_icon_;
29 SetIcon(focused_app_icon_);
30
31
32=== modified file 'launcher/Launcher.cpp'
33=== modified file 'launcher/LauncherController.cpp'
34--- launcher/LauncherController.cpp 2013-02-09 15:16:41 +0000
35+++ launcher/LauncherController.cpp 2013-02-14 20:05:37 +0000
36@@ -216,7 +216,7 @@
37 launchers[i] = nux::ObjectPtr<Launcher>(CreateLauncher());
38 }
39
40- int monitor = (num_launchers == 1) ? primary : i;
41+ int monitor = (num_launchers == 1 && num_monitors > 1) ? primary : i;
42
43 if (launchers[i]->monitor() != monitor)
44 {
45
46=== modified file 'launcher/SwitcherView.cpp'
47--- launcher/SwitcherView.cpp 2013-02-07 17:06:56 +0000
48+++ launcher/SwitcherView.cpp 2013-02-14 20:05:37 +0000
49@@ -253,8 +253,15 @@
50
51 nux::Geometry SwitcherView::UpdateRenderTargets(float progress)
52 {
53+<<<<<<< TREE
54 std::vector<Window> const& xids = model_->DetailXids();
55 render_targets_.clear();
56+=======
57+ std::vector<Window> xids = model_->DetailXids ();
58+
59+ DeltaTime ms_since_change = TimeUtil::TimeDelta(&current, &save_time_);
60+ float progress = MIN (1.0f, (float) ms_since_change / (float) animation_length());
61+>>>>>>> MERGE-SOURCE
62
63 for (Window window : xids)
64 {
65@@ -517,7 +524,12 @@
66 ++i;
67 }
68
69+<<<<<<< TREE
70 if (saved_args_.size () == results.size () && progress < 1.0f)
71+=======
72+ DeltaTime ms_since_change = TimeUtil::TimeDelta(&current, &save_time_);
73+ if (saved_args_.size () == results.size () && ms_since_change < animation_length)
74+>>>>>>> MERGE-SOURCE
75 {
76 std::list<RenderArg> end = results;
77 results.clear();
78@@ -623,7 +635,14 @@
79 nux::GetPainter().PopPaintLayerStack();
80 }
81
82- DeltaTime ms_since_change = TimeUtil::TimeDelta(&current_, &save_time_);
83+<<<<<<< TREE
84+ DeltaTime ms_since_change = TimeUtil::TimeDelta(&current_, &save_time_);
85+=======
86+ text_view_->SetBaseY(last_background_.y + last_background_.height - 45);
87+ text_view_->Draw(GfxContext, force_draw);
88+
89+ DeltaTime ms_since_change = TimeUtil::TimeDelta(&current_, &save_time_);
90+>>>>>>> MERGE-SOURCE
91
92 if (ms_since_change < animation_length && !redraw_idle_)
93 {
94
95=== modified file 'panel/PanelMenuView.cpp'
96=== modified file 'plugins/unityshell/src/unityshell.cpp'
97--- plugins/unityshell/src/unityshell.cpp 2013-02-08 18:31:30 +0000
98+++ plugins/unityshell/src/unityshell.cpp 2013-02-14 20:05:37 +0000
99@@ -1436,6 +1436,7 @@
100 view->QueueDraw();
101 }
102 }
103+<<<<<<< TREE
104
105 if (switcher_controller_ && switcher_controller_->Visible())
106 {
107@@ -1450,6 +1451,22 @@
108 view->QueueDraw();
109 }
110 }
111+=======
112+
113+ if (switcher_controller_ && switcher_controller_->Visible())
114+ {
115+ unity::switcher::SwitcherView* view = switcher_controller_->GetView();
116+
117+ if (G_LIKELY(view))
118+ {
119+ nux::Geometry const& geo = view->GetAbsoluteGeometry();
120+ CompRegion switcher_region(geo.x, geo.y, geo.width, geo.height);
121+
122+ if (damage.intersects(switcher_region))
123+ view->QueueDraw();
124+ }
125+ }
126+>>>>>>> MERGE-SOURCE
127 }
128
129 /* Grab changed nux regions and add damage rects for them */
130@@ -3671,7 +3688,11 @@
131 int text_x = win::decoration::ITEMS_PADDING * 2 + win::decoration::CLOSE_SIZE;
132 RenderText(context, text_x, 0.0, width - win::decoration::ITEMS_PADDING, height);
133 decoration_selected_tex_ = context.pixmap_texture_;
134+<<<<<<< TREE
135 uScreen->damageRegion(CompRegion(geo.x, geo.y, width, height));
136+=======
137+ uScreen->damageRegion(CompRegion(scaled_geo.x, scaled_geo.y, width, height));
138+>>>>>>> MERGE-SOURCE
139 }
140 else
141 {
142
143=== modified file 'tests/CMakeLists.txt'
144--- tests/CMakeLists.txt 2013-02-07 21:31:13 +0000
145+++ tests/CMakeLists.txt 2013-02-14 20:05:37 +0000
146@@ -94,6 +94,7 @@
147
148
149 # The actual test executable (xless) - do not put anything that requires X in here
150+<<<<<<< TREE
151 set (GTEST_XLESS_SOURCES
152 test_main_xless.cpp
153 test_abstract_interface_generator.cpp
154@@ -163,6 +164,70 @@
155
156 target_link_libraries(test-gtest-xless ${GTEST_XLESS_LIBS})
157
158+=======
159+ add_executable(test-gtest-xless
160+ test_main_xless.cpp
161+ test_animator.cpp
162+ test_launcher_model.cpp
163+ test_glib_object.cpp
164+ test_glib_object_utils.cpp
165+ test_glib_object_utils.h
166+ test_glib_signals.cpp
167+ test_glib_signals_utils.cpp
168+ test_glib_signals_utils.h
169+ test_glib_source.cpp
170+ test_glib_variant.cpp
171+ test_grabhandle.cpp
172+ test_desktop_utilities.cpp
173+ test_hud_private.cpp
174+ test_indicator.cpp
175+ test_indicator_appmenu.cpp
176+ test_indicator_entry.cpp
177+ test_indicators.cpp
178+ test_introspection.cpp
179+ test_favorite_store.cpp
180+ test_favorite_store_gsettings.cpp
181+ test_favorite_store_private.cpp
182+ test_home_lens.cpp
183+ test_launcher_entry_remote.cpp
184+ test_model_iterator.cpp
185+ test_pointer_barrier.cpp
186+ test_previews.cpp
187+ test_shortcut_model.cpp
188+ test_shortcut_private.cpp
189+ test_showdesktop_handler.cpp
190+ test_time_util.cpp
191+ test_unityshell_private.cpp
192+ ${CMAKE_CURRENT_BINARY_DIR}/test_glib_signals_utils_marshal.cpp
193+ ${CMAKE_SOURCE_DIR}/launcher/AbstractLauncherIcon.cpp
194+ ${CMAKE_SOURCE_DIR}/unity-shared/Animator.cpp
195+ ${UNITY_SRC}/DebugDBusInterface.cpp
196+ ${UNITY_SRC}/XPathQueryPart.cpp
197+ ${CMAKE_SOURCE_DIR}/launcher/FavoriteStore.cpp
198+ ${CMAKE_SOURCE_DIR}/launcher/FavoriteStoreGSettings.cpp
199+ ${CMAKE_SOURCE_DIR}/unity-shared/IconTextureSource.cpp
200+ ${CMAKE_SOURCE_DIR}/launcher/LauncherModel.cpp
201+ ${CMAKE_SOURCE_DIR}/launcher/LauncherEntryRemote.cpp
202+ ${CMAKE_SOURCE_DIR}/launcher/MockLauncherIcon.cpp
203+ ${CMAKE_SOURCE_DIR}/launcher/FavoriteStorePrivate.cpp
204+ ${CMAKE_SOURCE_DIR}/launcher/PointerBarrier.cpp
205+ ${CMAKE_SOURCE_DIR}/shortcuts/ShortcutModel.cpp
206+ ${CMAKE_SOURCE_DIR}/shortcuts/ShortcutHintPrivate.cpp
207+ ${CMAKE_SOURCE_DIR}/unity-shared/Introspectable.cpp
208+ ${CMAKE_SOURCE_DIR}/unity-shared/TextureCache.cpp
209+ ${CMAKE_SOURCE_DIR}/unity-shared/Timer.cpp
210+ ${UNITY_SRC}/UnityshellPrivate.cpp
211+ ${CMAKE_SOURCE_DIR}/unity-shared/WindowManager.cpp
212+ ${UNITY_SRC}/UnityShowdesktopHandler.cpp
213+ ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle.cpp
214+ ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-group.cpp
215+ ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-impl-factory.cpp
216+ ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-grab-handle-layout.cpp
217+ ${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src/unity-mt-texture.cpp
218+ ${CMAKE_SOURCE_DIR}/hud/HudPrivate.cpp
219+ )
220+ target_link_libraries(test-gtest-xless gtest unity-shared ${GMOCK_LIB} ${GMOCK_MAIN_LIB} ${LIBS})
221+>>>>>>> MERGE-SOURCE
222 add_test(UnityGTestXless test-gtest-xless)
223
224 # tests that require dbus, must not require X
225
226=== modified file 'tests/autopilot/unity/tests/launcher/test_keynav.py'
227--- tests/autopilot/unity/tests/launcher/test_keynav.py 2013-02-04 22:31:47 +0000
228+++ tests/autopilot/unity/tests/launcher/test_keynav.py 2013-02-14 20:05:37 +0000
229@@ -234,6 +234,7 @@
230 bfb_ql = bfb_icon.get_quicklist()
231
232 bfb_ql.click_item(bfb_ql.selected_item)
233+<<<<<<< TREE
234 self.addCleanup(self.unity.dash.ensure_hidden)
235
236 self.assertThat(self.unity.dash.visible, Eventually(Equals(True)))
237@@ -244,3 +245,15 @@
238
239 self.start_keynav_with_cleanup_cancel()
240 self.assertThat(self.unity.panels.get_active_panel().title, Eventually(Equals("Search your computer and online sources")))
241+=======
242+ self.addCleanup(self.dash.ensure_hidden)
243+
244+ self.assertThat(self.dash.visible, Eventually(Equals(True)))
245+ self.assertThat(self.launcher.key_nav_is_active, Eventually(Equals(False)))
246+
247+ def test_launcher_keynav_changes_panel(self):
248+ """The panel title must change when in key nav mode."""
249+
250+ self.start_keynav_with_cleanup_cancel()
251+ self.assertThat(self.panels.get_active_panel().title, Eventually(Equals("Dash Home")))
252+>>>>>>> MERGE-SOURCE
253
254=== modified file 'tests/autopilot/unity/tests/test_hud.py'
255--- tests/autopilot/unity/tests/test_hud.py 2013-02-04 19:54:47 +0000
256+++ tests/autopilot/unity/tests/test_hud.py 2013-02-14 20:05:37 +0000
257@@ -422,8 +422,13 @@
258
259 self.mouse.move(x + w + (screen_w-((screen_x-x)+w))/2, y + h + (screen_h-((screen_y-y)+h))/2)
260 self.mouse.click()
261+<<<<<<< TREE
262
263 self.assertThat(self.unity.hud.visible, Eventually(Equals(False)))
264+=======
265+
266+ self.assertThat(self.hud.visible, Eventually(Equals(False)))
267+>>>>>>> MERGE-SOURCE
268
269 def test_closes_then_focuses_window_on_mouse_down(self):
270 """If 2 windows are open with 1 maximized and the non-maxmized
271@@ -445,6 +450,7 @@
272
273 self.assertProperty(char_win, is_active=True)
274
275+<<<<<<< TREE
276 def test_hud_does_not_focus_wrong_window_after_alt_tab(self):
277 """Test the Hud focuses the correct window after an Alt+Tab."""
278
279@@ -460,6 +466,22 @@
280 self.assertProperty(char_win, is_active=True)
281
282
283+=======
284+ def test_hud_does_not_focus_wrong_window_after_alt_tab(self):
285+ """Test the Hud focuses the correct window after an Alt+Tab."""
286+
287+ char_win = self.start_app('Character Map')
288+ self.start_app('Calculator')
289+
290+ self.keybinding("switcher/reveal_normal")
291+
292+ self.hud.ensure_visible()
293+ self.hud.ensure_hidden()
294+
295+ self.assertProperty(char_win, is_active=True)
296+
297+
298+>>>>>>> MERGE-SOURCE
299 class HudLauncherInteractionsTests(HudTestsBase):
300
301 launcher_modes = [('Launcher autohide', {'launcher_autohide': False}),
302
303=== modified file 'tests/test_glib_source.cpp'
304--- tests/test_glib_source.cpp 2013-01-24 14:46:08 +0000
305+++ tests/test_glib_source.cpp 2013-02-14 20:05:37 +0000
306@@ -139,7 +139,13 @@
307 Utils::WaitUntilMSec([&timeout] {return timeout.IsRunning();}, false, 500);
308 EXPECT_TRUE(callback_called);
309 EXPECT_EQ(callback_call_count, 1);
310+<<<<<<< TREE
311 EXPECT_TRUE(removed_called);
312+=======
313+ DeltaTime time_delta = unity::TimeUtil::TimeDelta(&post, &pre);
314+ EXPECT_GE(time_delta, 100);
315+ EXPECT_LT(time_delta, 110);
316+>>>>>>> MERGE-SOURCE
317 }
318
319 TEST(TestGLibTimeout, MultipleShotsRun)
320@@ -157,8 +163,15 @@
321 }
322
323 EXPECT_TRUE(callback_called);
324+<<<<<<< TREE
325 EXPECT_GT(callback_call_count, 1);
326 EXPECT_TRUE(removed_called);
327+=======
328+ EXPECT_EQ(callback_call_count, 6);
329+ DeltaTime time_delta = unity::TimeUtil::TimeDelta(&post, &pre);
330+ EXPECT_GE(time_delta, 600);
331+ EXPECT_LT(time_delta, 700);
332+>>>>>>> MERGE-SOURCE
333 }
334
335 TEST(TestGLibTimeout, OneShotRunWithEmptyCallback)
336@@ -167,8 +180,16 @@
337 Timeout timeout(100, Source::Callback());
338 timeout.removed.connect([&] (unsigned int id) { removed_called = true; });
339
340+<<<<<<< TREE
341 Utils::WaitUntilMSec([&timeout] {return timeout.IsRunning();}, false, 500);
342 EXPECT_TRUE(removed_called);
343+=======
344+ Utils::WaitForTimeoutMSec(500);
345+ EXPECT_FALSE(timeout.IsRunning());
346+ DeltaTime time_delta = unity::TimeUtil::TimeDelta(&post, &pre);
347+ EXPECT_GE(time_delta, 100);
348+ EXPECT_LT(time_delta, 110);
349+>>>>>>> MERGE-SOURCE
350 }
351
352 TEST(TestGLibTimeout, Removal)
353@@ -322,7 +343,13 @@
354 Utils::WaitUntil([&timeout] {return timeout.IsRunning();}, false, 2);
355 EXPECT_TRUE(callback_called);
356 EXPECT_EQ(callback_call_count, 1);
357+<<<<<<< TREE
358 EXPECT_TRUE(removed_called);
359+=======
360+ DeltaTime time_delta = unity::TimeUtil::TimeDelta(&post, &pre);
361+ EXPECT_GE(time_delta, 500);
362+ EXPECT_LT(time_delta, 2000);
363+>>>>>>> MERGE-SOURCE
364 }
365
366 TEST(TestGLibTimeoutSeconds, MultipleShotsRun)
367@@ -340,8 +367,16 @@
368 }
369
370 EXPECT_TRUE(callback_called);
371+<<<<<<< TREE
372 EXPECT_GT(callback_call_count, 1);
373 EXPECT_TRUE(removed_called);
374+=======
375+ EXPECT_GE(callback_call_count, 3);
376+ EXPECT_LE(callback_call_count, 4);
377+ DeltaTime time_delta = unity::TimeUtil::TimeDelta(&post, &pre);
378+ EXPECT_GE(time_delta, 3500);
379+ EXPECT_LT(time_delta, 5000);
380+>>>>>>> MERGE-SOURCE
381 }
382
383 // GLib Idle tests
384
385=== modified file 'tests/test_launcher_controller.cpp'
386--- tests/test_launcher_controller.cpp 2013-02-09 15:16:41 +0000
387+++ tests/test_launcher_controller.cpp 2013-02-14 20:05:37 +0000
388@@ -346,6 +346,16 @@
389 }
390 }
391
392+TEST_F(TestLauncherController, MirroredMultimonitorSingleLauncherOnExternalMonitor)
393+{
394+ // See lp bug 991637
395+ lc.multiple_launchers = false;
396+ uscreen.SetPrimary(1);
397+
398+ ASSERT_EQ(lc.launchers().size(), 1);
399+ ASSERT_EQ(lc.launcher().monitor(), 0);
400+}
401+
402 TEST_F(TestLauncherController, MultimonitorSwitchToMultipleLaunchers)
403 {
404 lc.multiple_launchers = false;
405
406=== added file 'tests/test_time_util.cpp'
407--- tests/test_time_util.cpp 1970-01-01 00:00:00 +0000
408+++ tests/test_time_util.cpp 2013-02-14 20:05:37 +0000
409@@ -0,0 +1,38 @@
410+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
411+/*
412+* Copyright (C) 2012 Canonical Ltd
413+*
414+* This program is free software: you can redistribute it and/or modify
415+* it under the terms of the GNU General Public License version 3 as
416+* published by the Free Software Foundation.
417+*
418+* This program is distributed in the hope that it will be useful,
419+* but WITHOUT ANY WARRANTY; without even the implied warranty of
420+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
421+* GNU General Public License for more details.
422+*
423+* You should have received a copy of the GNU General Public License
424+* along with this program. If not, see <http://www.gnu.org/licenses/>.
425+*
426+* Authored by: Brandon Schaefer <brandon.schaefer@canonical.com>
427+*
428+*/
429+
430+
431+#include <cinttypes>
432+#include <gtest/gtest.h>
433+#include <unity-shared/TimeUtil.h>
434+
435+using namespace testing;
436+
437+TEST(TestTimeUtil, Testin32BufferOverflow)
438+{
439+ struct timespec start, end;
440+ unity::TimeUtil::SetTimeStruct(&start);
441+ unity::TimeUtil::SetTimeStruct(&end);
442+
443+ end.tv_sec = start.tv_sec + INT32_MAX;
444+
445+ EXPECT_GT(unity::TimeUtil::TimeDelta(&end, &start), 0);
446+}
447+
448
449=== renamed file 'tests/test_time_util.cpp' => 'tests/test_time_util.cpp.moved'
450=== modified file 'unity-shared/TimeUtil.h'
451--- unity-shared/TimeUtil.h 2012-11-30 20:22:13 +0000
452+++ unity-shared/TimeUtil.h 2013-02-14 20:05:37 +0000
453@@ -30,9 +30,15 @@
454 public:
455 static DeltaTime TimeDelta (struct timespec const* x, struct timespec const* y)
456 {
457+<<<<<<< TREE
458 DeltaTime d_sec = ((x->tv_sec - y->tv_sec));
459 DeltaTime d_nsec = ((x->tv_nsec - y->tv_nsec));
460 return (d_sec * 1000) + (d_nsec / 1000000);
461+=======
462+ DeltaTime d_sec = (x->tv_sec - y->tv_sec);
463+ DeltaTime d_nsec = (x->tv_nsec - y->tv_nsec);
464+ return (d_sec * 1000) + (d_nsec / 1000000);
465+>>>>>>> MERGE-SOURCE
466 }
467
468 static void SetTimeStruct(struct timespec* timer, struct timespec* sister = 0, DeltaTime sister_relation = 0)