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
=== modified file 'include/test/mir_test_doubles/stub_compositing_criteria.h'
--- include/test/mir_test_doubles/stub_compositing_criteria.h 2013-10-07 08:34:36 +0000
+++ include/test/mir_test_doubles/stub_compositing_criteria.h 2013-10-09 07:15:52 +0000
@@ -35,10 +35,14 @@
35public:35public:
36 StubCompositingCriteria(int x, int y, int width, int height,36 StubCompositingCriteria(int x, int y, int width, int height,
37 float opacity=1.0f,37 float opacity=1.0f,
38 bool rectangular=true)38 bool rectangular=true,
39 bool visible=true,
40 bool posted=true)
39 : rect{{x, y}, {width, height}},41 : rect{{x, y}, {width, height}},
40 opacity(opacity),42 opacity(opacity),
41 rectangular(rectangular)43 rectangular(rectangular),
44 visible(visible),
45 posted(posted)
42 {46 {
43 const glm::mat4 ident;47 const glm::mat4 ident;
44 glm::vec3 size(width, height, 0.0f);48 glm::vec3 size(width, height, 0.0f);
@@ -58,7 +62,7 @@
5862
59 bool should_be_rendered_in(const mir::geometry::Rectangle &r) const override63 bool should_be_rendered_in(const mir::geometry::Rectangle &r) const override
60 {64 {
61 return rect.overlaps(r);65 return visible && posted && rect.overlaps(r);
62 }66 }
6367
64 bool shaped() const override68 bool shaped() const override
@@ -71,6 +75,8 @@
71 glm::mat4 trans;75 glm::mat4 trans;
72 float opacity;76 float opacity;
73 bool rectangular;77 bool rectangular;
78 bool visible;
79 bool posted;
74};80};
7581
76} // namespace doubles82} // namespace doubles
7783
=== modified file 'src/server/compositor/bypass.cpp'
--- src/server/compositor/bypass.cpp 2013-10-07 08:34:36 +0000
+++ src/server/compositor/bypass.cpp 2013-10-09 07:15:52 +0000
@@ -85,15 +85,9 @@
85 return false;85 return false;
86 }86 }
8787
88 // This could be replaced by adding a "CompositingCriteria::rect()"
89 int width = trans[0][0];
90 int height = trans[1][1];
91 int x = trans[3][0] - width / 2;
92 int y = trans[3][1] - height / 2;
93 geometry::Rectangle window{{x, y}, {width, height}};
94
95 // Not weirdly transformed but also not on this monitor? Don't care...88 // Not weirdly transformed but also not on this monitor? Don't care...
96 if (!window.overlaps(display_buffer.view_area()))89 // This will also check the surface is not hidden and has been posted.
90 if (!criteria.should_be_rendered_in(display_buffer.view_area()))
97 return false;91 return false;
9892
99 // Transformed perfectly to fit the monitor? Bypass!93 // Transformed perfectly to fit the monitor? Bypass!
10094
=== modified file 'tests/unit-tests/compositor/test_bypass.cpp'
--- tests/unit-tests/compositor/test_bypass.cpp 2013-10-07 08:34:36 +0000
+++ tests/unit-tests/compositor/test_bypass.cpp 2013-10-09 07:15:52 +0000
@@ -88,6 +88,26 @@
88 EXPECT_FALSE(filter.fullscreen_on_top());88 EXPECT_FALSE(filter.fullscreen_on_top());
89}89}
9090
91TEST_F(BypassFilterTest, hidden_fullscreen_window_not_bypassed)
92{
93 BypassFilter filter(display_buffer[0]);
94
95 StubCompositingCriteria win(0, 0, 1920, 1200, 1.0f, true, false);
96
97 EXPECT_FALSE(filter(win));
98 EXPECT_FALSE(filter.fullscreen_on_top());
99}
100
101TEST_F(BypassFilterTest, unposted_fullscreen_window_not_bypassed)
102{
103 BypassFilter filter(display_buffer[0]);
104
105 StubCompositingCriteria win(0, 0, 1920, 1200, 1.0f, true, true, false);
106
107 EXPECT_FALSE(filter(win));
108 EXPECT_FALSE(filter.fullscreen_on_top());
109}
110
91TEST_F(BypassFilterTest, shaped_fullscreen_window_not_bypassed)111TEST_F(BypassFilterTest, shaped_fullscreen_window_not_bypassed)
92{112{
93 BypassFilter filter(display_buffer[0]);113 BypassFilter filter(display_buffer[0]);
@@ -210,6 +230,43 @@
210 EXPECT_FALSE(filter.fullscreen_on_top());230 EXPECT_FALSE(filter.fullscreen_on_top());
211}231}
212232
233TEST_F(BypassFilterTest, many_fullscreen_windows_only_bypass_top_visible_posted)
234{
235 BypassFilter filter(display_buffer[0]);
236
237 StubCompositingCriteria a(0, 0, 1920, 1200, 1.0f, false);
238 EXPECT_FALSE(filter(a));
239 EXPECT_FALSE(filter.fullscreen_on_top());
240
241 StubCompositingCriteria b(1, 2, 3, 4);
242 EXPECT_FALSE(filter(b));
243 EXPECT_FALSE(filter.fullscreen_on_top());
244
245 StubCompositingCriteria c(0, 0, 1920, 1200);
246 EXPECT_TRUE(filter(c));
247 EXPECT_TRUE(filter.fullscreen_on_top());
248
249 StubCompositingCriteria d(5, 6, 7, 8);
250 EXPECT_FALSE(filter(d));
251 EXPECT_FALSE(filter.fullscreen_on_top());
252
253 StubCompositingCriteria e(0, 0, 1920, 1200, 1.0f, true, false, true);
254 EXPECT_FALSE(filter(e));
255 EXPECT_FALSE(filter.fullscreen_on_top());
256
257 StubCompositingCriteria f(0, 0, 1920, 1200, 1.0f, true, true, false);
258 EXPECT_FALSE(filter(f));
259 EXPECT_FALSE(filter.fullscreen_on_top());
260
261 StubCompositingCriteria g(9, 10, 11, 12);
262 EXPECT_FALSE(filter(g));
263 EXPECT_FALSE(filter.fullscreen_on_top());
264
265 StubCompositingCriteria h(0, 0, 1920, 1200, 1.0f, true, true, true);
266 EXPECT_TRUE(filter(h));
267 EXPECT_TRUE(filter.fullscreen_on_top());
268}
269
213TEST_F(BypassFilterTest, multimonitor_one_bypassed)270TEST_F(BypassFilterTest, multimonitor_one_bypassed)
214{271{
215 BypassFilter left(display_buffer[0]);272 BypassFilter left(display_buffer[0]);

Subscribers

People subscribed via source and target branches