Mir

Merge lp:~vanvugt/mir/fix-1236712 into lp:mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 1122
Proposed branch: lp:~vanvugt/mir/fix-1236712
Merge into: lp:mir
Diff against target: 135 lines (+68/-11)
3 files modified
include/test/mir_test_doubles/stub_compositing_criteria.h (+9/-3)
src/server/compositor/bypass.cpp (+2/-8)
tests/unit-tests/compositor/test_bypass.cpp (+57/-0)
To merge this branch: bzr merge lp:~vanvugt/mir/fix-1236712
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
PS Jenkins bot (community) continuous-integration Approve
Alexandros Frantzis (community) Approve
Review via email: mp+189768@code.launchpad.net

Commit message

BypassFilter: Remember to check that a surface is not hidden and has had a
buffer posted before allowing it to be bypassed. Or else you will see
something you shouldn't... (LP: #1236712)

Description of the change

Similar logic is also required to fix bug 1227739 for the phone, soon.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Try to ignore the failure. That's bug 1236698.

Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

Looks good.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/test/mir_test_doubles/stub_compositing_criteria.h'
2--- include/test/mir_test_doubles/stub_compositing_criteria.h 2013-10-07 08:34:36 +0000
3+++ include/test/mir_test_doubles/stub_compositing_criteria.h 2013-10-09 07:15:52 +0000
4@@ -35,10 +35,14 @@
5 public:
6 StubCompositingCriteria(int x, int y, int width, int height,
7 float opacity=1.0f,
8- bool rectangular=true)
9+ bool rectangular=true,
10+ bool visible=true,
11+ bool posted=true)
12 : rect{{x, y}, {width, height}},
13 opacity(opacity),
14- rectangular(rectangular)
15+ rectangular(rectangular),
16+ visible(visible),
17+ posted(posted)
18 {
19 const glm::mat4 ident;
20 glm::vec3 size(width, height, 0.0f);
21@@ -58,7 +62,7 @@
22
23 bool should_be_rendered_in(const mir::geometry::Rectangle &r) const override
24 {
25- return rect.overlaps(r);
26+ return visible && posted && rect.overlaps(r);
27 }
28
29 bool shaped() const override
30@@ -71,6 +75,8 @@
31 glm::mat4 trans;
32 float opacity;
33 bool rectangular;
34+ bool visible;
35+ bool posted;
36 };
37
38 } // namespace doubles
39
40=== modified file 'src/server/compositor/bypass.cpp'
41--- src/server/compositor/bypass.cpp 2013-10-07 08:34:36 +0000
42+++ src/server/compositor/bypass.cpp 2013-10-09 07:15:52 +0000
43@@ -85,15 +85,9 @@
44 return false;
45 }
46
47- // This could be replaced by adding a "CompositingCriteria::rect()"
48- int width = trans[0][0];
49- int height = trans[1][1];
50- int x = trans[3][0] - width / 2;
51- int y = trans[3][1] - height / 2;
52- geometry::Rectangle window{{x, y}, {width, height}};
53-
54 // Not weirdly transformed but also not on this monitor? Don't care...
55- if (!window.overlaps(display_buffer.view_area()))
56+ // This will also check the surface is not hidden and has been posted.
57+ if (!criteria.should_be_rendered_in(display_buffer.view_area()))
58 return false;
59
60 // Transformed perfectly to fit the monitor? Bypass!
61
62=== modified file 'tests/unit-tests/compositor/test_bypass.cpp'
63--- tests/unit-tests/compositor/test_bypass.cpp 2013-10-07 08:34:36 +0000
64+++ tests/unit-tests/compositor/test_bypass.cpp 2013-10-09 07:15:52 +0000
65@@ -88,6 +88,26 @@
66 EXPECT_FALSE(filter.fullscreen_on_top());
67 }
68
69+TEST_F(BypassFilterTest, hidden_fullscreen_window_not_bypassed)
70+{
71+ BypassFilter filter(display_buffer[0]);
72+
73+ StubCompositingCriteria win(0, 0, 1920, 1200, 1.0f, true, false);
74+
75+ EXPECT_FALSE(filter(win));
76+ EXPECT_FALSE(filter.fullscreen_on_top());
77+}
78+
79+TEST_F(BypassFilterTest, unposted_fullscreen_window_not_bypassed)
80+{
81+ BypassFilter filter(display_buffer[0]);
82+
83+ StubCompositingCriteria win(0, 0, 1920, 1200, 1.0f, true, true, false);
84+
85+ EXPECT_FALSE(filter(win));
86+ EXPECT_FALSE(filter.fullscreen_on_top());
87+}
88+
89 TEST_F(BypassFilterTest, shaped_fullscreen_window_not_bypassed)
90 {
91 BypassFilter filter(display_buffer[0]);
92@@ -210,6 +230,43 @@
93 EXPECT_FALSE(filter.fullscreen_on_top());
94 }
95
96+TEST_F(BypassFilterTest, many_fullscreen_windows_only_bypass_top_visible_posted)
97+{
98+ BypassFilter filter(display_buffer[0]);
99+
100+ StubCompositingCriteria a(0, 0, 1920, 1200, 1.0f, false);
101+ EXPECT_FALSE(filter(a));
102+ EXPECT_FALSE(filter.fullscreen_on_top());
103+
104+ StubCompositingCriteria b(1, 2, 3, 4);
105+ EXPECT_FALSE(filter(b));
106+ EXPECT_FALSE(filter.fullscreen_on_top());
107+
108+ StubCompositingCriteria c(0, 0, 1920, 1200);
109+ EXPECT_TRUE(filter(c));
110+ EXPECT_TRUE(filter.fullscreen_on_top());
111+
112+ StubCompositingCriteria d(5, 6, 7, 8);
113+ EXPECT_FALSE(filter(d));
114+ EXPECT_FALSE(filter.fullscreen_on_top());
115+
116+ StubCompositingCriteria e(0, 0, 1920, 1200, 1.0f, true, false, true);
117+ EXPECT_FALSE(filter(e));
118+ EXPECT_FALSE(filter.fullscreen_on_top());
119+
120+ StubCompositingCriteria f(0, 0, 1920, 1200, 1.0f, true, true, false);
121+ EXPECT_FALSE(filter(f));
122+ EXPECT_FALSE(filter.fullscreen_on_top());
123+
124+ StubCompositingCriteria g(9, 10, 11, 12);
125+ EXPECT_FALSE(filter(g));
126+ EXPECT_FALSE(filter.fullscreen_on_top());
127+
128+ StubCompositingCriteria h(0, 0, 1920, 1200, 1.0f, true, true, true);
129+ EXPECT_TRUE(filter(h));
130+ EXPECT_TRUE(filter.fullscreen_on_top());
131+}
132+
133 TEST_F(BypassFilterTest, multimonitor_one_bypassed)
134 {
135 BypassFilter left(display_buffer[0]);

Subscribers

People subscribed via source and target branches