Merge lp:~3v1n0/unity/single-workspace-scale-fix-5.0 into lp:unity/5.0

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 2379
Proposed branch: lp:~3v1n0/unity/single-workspace-scale-fix-5.0
Merge into: lp:unity/5.0
Diff against target: 74 lines (+36/-3)
2 files modified
plugins/unityshell/src/PluginAdapter.cpp (+9/-3)
tests/autopilot/autopilot/tests/test_launcher.py (+27/-0)
To merge this branch: bzr merge lp:~3v1n0/unity/single-workspace-scale-fix-5.0
Reviewer Review Type Date Requested Status
Brandon Schaefer (community) Approve
Review via email: mp+112868@code.launchpad.net

Commit message

PluginAdapterCompiz: ignore offscreen windows when looking for the top one

Description of the change

To post a comment you must log in.
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Looks good and confirmed working! +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/PluginAdapter.cpp'
2--- plugins/unityshell/src/PluginAdapter.cpp 2012-04-26 05:56:55 +0000
3+++ plugins/unityshell/src/PluginAdapter.cpp 2012-06-29 23:38:19 +0000
4@@ -533,9 +533,7 @@
5 PluginAdapter::IsWindowOnTop(guint32 xid)
6 {
7 Window win = xid;
8- CompWindow* window;
9-
10- window = m_Screen->findWindow(win);
11+ CompWindow* window = m_Screen->findWindow(win);
12
13 if (window)
14 {
15@@ -543,6 +541,7 @@
16 return false;
17
18 CompPoint window_vp = window->defaultViewport();
19+ nux::Geometry const& window_vp_geo = GetWorkAreaGeometry(window->id());
20 std::vector<Window> const& our_xids = nux::XInputWindow::NativeHandleList();
21
22 for (CompWindow* sibling = window->next; sibling; sibling = sibling->next)
23@@ -550,6 +549,13 @@
24 if (sibling->defaultViewport() == window_vp && !sibling->minimized() &&
25 sibling->isMapped() && sibling->isViewable() && !sibling->inShowDesktopMode() &&
26 !(sibling->state() & CompWindowStateAboveMask) &&
27+ !(sibling->type() & CompWindowTypeSplashMask) &&
28+ !(sibling->type() & CompWindowTypeDockMask) &&
29+ /* FIXME: This should be included by the above defaultViewport() check,
30+ * but it doesn't seem to work correctly when there's only one workspace
31+ * enabled, so please drop the line above when bug #996604 is fixed in
32+ * Compiz. */
33+ !window_vp_geo.Intersect(GetWindowGeometry(sibling->id())).IsNull() &&
34 std::find(our_xids.begin(), our_xids.end(), sibling->id()) == our_xids.end())
35 {
36 return false;
37
38=== modified file 'tests/autopilot/autopilot/tests/test_launcher.py'
39--- tests/autopilot/autopilot/tests/test_launcher.py 2012-06-21 17:30:08 +0000
40+++ tests/autopilot/autopilot/tests/test_launcher.py 2012-06-29 23:38:19 +0000
41@@ -456,6 +456,33 @@
42 self.assertTrue(mah_win2.is_hidden)
43 self.assertVisibleWindowStack([mah_win1, calc_win])
44
45+ def test_clicking_icon_twice_initiates_spread(self):
46+ """This tests shows that when you click on a launcher icon twice,
47+ when an application window is focused, the spread is initiated.
48+ """
49+ calc = self.start_app("Calculator")
50+ [calc_win1] = calc.get_windows()
51+ self.assertTrue(calc_win1.is_focused)
52+
53+ self.start_app("Calculator")
54+ # Sleeping due to the start_app only waiting for the bamf model to be
55+ # updated with the application. Since the app has already started,
56+ # and we are just waiting on a second window, however a defined sleep
57+ # here is likely to be problematic.
58+ # TODO: fix bamf emulator to enable waiting for new windows.
59+ sleep(1)
60+ [calc_win2] = [w for w in calc.get_windows() if w.x_id != calc_win1.x_id]
61+
62+ self.assertVisibleWindowStack([calc_win2, calc_win1])
63+ self.assertTrue(calc_win2.is_focused)
64+
65+ calc_icon = self.launcher.model.get_icon_by_desktop_id(calc.desktop_file)
66+ self.addCleanup(self.keybinding, "spread/cancel")
67+ self.launcher_instance.click_launcher_icon(calc_icon)
68+
69+ self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
70+ self.assertThat(self.window_manager.scale_active_for_group, Eventually(Equals(True)))
71+
72 def test_icon_shows_on_quick_application_reopen(self):
73 """Icons should stay on launcher when an application is quickly closed/reopened."""
74 calc = self.start_app("Calculator")

Subscribers

People subscribed via source and target branches