Merge lp:~vanvugt/compiz/fix-1084401 into lp:compiz/0.9.9

Proposed by Daniel van Vugt
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 3490
Merged at revision: 3497
Proposed branch: lp:~vanvugt/compiz/fix-1084401
Merge into: lp:compiz/0.9.9
Diff against target: 105 lines (+34/-9)
4 files modified
plugins/opengl/src/fsregion/fsregion.cpp (+17/-5)
plugins/opengl/src/fsregion/fsregion.h (+3/-1)
plugins/opengl/src/fsregion/tests/test-fsregion.cpp (+13/-2)
plugins/opengl/src/paint.cpp (+1/-1)
To merge this branch: bzr merge lp:~vanvugt/compiz/fix-1084401
Reviewer Review Type Date Requested Status
Sam Spilsbury Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+136901@code.launchpad.net

Commit message

Fixed: unredirected fullscreen windows sliding offscreen were staying
unredirected (always visible), because compiz thought they were fullscreen
on a different monitor. Add extra smarts to tell the difference between
fullscreen and offscreen. (LP: #1084401)

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

This looks correct, a few questions:

+FullscreenRegion::FullscreenRegion (const CompRect &output) :
+ untouched (output),
+ orig (output),
+ allOutputs (output)
+{
+}
+

Is that necessary? It seems like FullscreenRegion cares about the current monitor and all monitors, having this constructor might be misleading

75 + CompRect offscreen1 (2048, 0, 1024, 768);
76 + CompRect offscreen2 (-1024, 0, 1024, 768);

...

88 + EXPECT_TRUE (monitor.allowRedirection (offscreen1));
89 + EXPECT_TRUE (monitor.allowRedirection (offscreen2));

There's not a whole lot of dependency here - can it be moved into a separate test?

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

The old constructor is not necessary right now. It's only used to simplify existing test cases. But if you don't like it I can update all the test cases and remove it.

And no; I would prefer to not create a separate test. Doing so only generates more (redundant) code to achieve exactly the same thing. It's perfectly normal for a single test to be comprised of multiple assertions. And for each test to represent a single real-world configuration. As it does right now.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

On Mon, Dec 3, 2012 at 2:36 PM, Daniel van Vugt
<email address hidden> wrote:
> The old constructor is not necessary right now. It's only used to simplify existing test cases. But if you don't like it I can update all the test cases and remove it.

OK, lets keep it, didn't realize it was still in use.

>
> And no; I would prefer to not create a separate test. Doing so only generates more (redundant) code to achieve exactly the same thing. It's perfectly normal for a single test to be comprised of multiple assertions. And for each test to represent a single real-world configuration. As it does right now.

That would be functional testing yes, but not unit testing. Unit
testing is when each test only tests one particular aspect of a
program state. Then when that test fails, it fails only at that
particular level. Having one test that tests-the-world or a larger
subset than just a unit has less resolution for problem diagnosis.

Redundant code was what the test fixtures were designed to solve:

class TestFixture
{
    public:

        virtual void SetUp ()
        {
            ... set up the test "problem"
        }
};

TEST_F (TestFixture, HasStateX)
{
    ASSERT...
}

TEST_F (TestFixture, HasStateY)
{
    ASSERT....
}

I do note that compiz has a mix between unit and functional testing in
our testing areas, so its not that big a deal, just keep it in mind in
light of that.

Otherwise if you really don't want to change it, just say so and I'll
put this in.

> --
> https://code.launchpad.net/~vanvugt/compiz/fix-1084401/+merge/136901
> Your team Compiz Maintainers is requested to review the proposed merge of lp:~vanvugt/compiz/fix-1084401 into lp:compiz.

--
Sam Spilsbury

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

On principle I will not change it. You're taking something simple, making it more complex and adding zero value. That's very anti-canonical :)

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

On Mon, Dec 3, 2012 at 5:32 PM, Daniel van Vugt
<email address hidden> wrote:
> On principle I will not change it. You're taking something simple, making it more complex and adding zero value. That's very anti-canonical :)

Questionable, but okay, not worth arguing over.

> --
> https://code.launchpad.net/~vanvugt/compiz/fix-1084401/+merge/136901
> Your team Compiz Maintainers is requested to review the proposed merge of lp:~vanvugt/compiz/fix-1084401 into lp:compiz.

--
Sam Spilsbury

Revision history for this message
Sam Spilsbury (smspillaz) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/opengl/src/fsregion/fsregion.cpp'
2--- plugins/opengl/src/fsregion/fsregion.cpp 2012-09-21 09:45:00 +0000
3+++ plugins/opengl/src/fsregion/fsregion.cpp 2012-11-29 10:55:23 +0000
4@@ -28,9 +28,18 @@
5 namespace compiz {
6 namespace opengl {
7
8-FullscreenRegion::FullscreenRegion (const CompRect &rect) :
9- untouched (rect),
10- orig (untouched)
11+FullscreenRegion::FullscreenRegion (const CompRect &output) :
12+ untouched (output),
13+ orig (output),
14+ allOutputs (output)
15+{
16+}
17+
18+FullscreenRegion::FullscreenRegion (const CompRect &output,
19+ const CompRegion &all) :
20+ untouched (output),
21+ orig (output),
22+ allOutputs (all)
23 {
24 }
25
26@@ -56,8 +65,11 @@
27 {
28 /* Don't allow existing unredirected windows that cover this
29 * region to be redirected again as they were probably unredirected
30- * on another monitor */
31- return region.intersects (orig);
32+ * on another monitor
33+ * Also be careful to not allow unredirection of offscreen windows
34+ * (outside of allOutputs).
35+ */
36+ return region.intersects (orig) || !region.intersects (allOutputs);
37 }
38
39 } // namespace opengl
40
41=== modified file 'plugins/opengl/src/fsregion/fsregion.h'
42--- plugins/opengl/src/fsregion/fsregion.h 2012-09-21 09:45:00 +0000
43+++ plugins/opengl/src/fsregion/fsregion.h 2012-11-29 10:55:23 +0000
44@@ -42,7 +42,8 @@
45
46 typedef unsigned int WinFlags;
47
48- FullscreenRegion (const CompRect &rect);
49+ FullscreenRegion (const CompRect &output);
50+ FullscreenRegion (const CompRect &output, const CompRegion &all);
51
52 // isCoveredBy is called for windows from TOP to BOTTOM
53 bool isCoveredBy (const CompRegion &region, WinFlags flags = 0);
54@@ -51,6 +52,7 @@
55 private:
56 CompRegion untouched;
57 CompRegion orig;
58+ CompRegion allOutputs;
59 };
60
61 } // namespace opengl
62
63=== modified file 'plugins/opengl/src/fsregion/tests/test-fsregion.cpp'
64--- plugins/opengl/src/fsregion/tests/test-fsregion.cpp 2012-09-21 09:45:00 +0000
65+++ plugins/opengl/src/fsregion/tests/test-fsregion.cpp 2012-11-29 10:55:23 +0000
66@@ -139,13 +139,24 @@
67
68 TEST (OpenGLFullscreenRegion, KeepUnredirectedStateIfNotOnMonitor)
69 {
70- FullscreenRegion monitor (CompRect (0, 0, 1024, 768));
71- CompRegion window (1025, 0, 1024, 768);
72+ CompRect left (0, 0, 1024, 768);
73+ CompRect right (1025, 0, 1024, 768);
74+ CompRegion all (0, 0, 2048, 768);
75+ CompRect offscreen1 (2048, 0, 1024, 768);
76+ CompRect offscreen2 (-1024, 0, 1024, 768);
77+ CompRegion window (right);
78+ FullscreenRegion monitor (left, all);
79+
80 /* Eg, not covering the monitor, should be redirected */
81 EXPECT_FALSE (monitor.isCoveredBy (window));
82+
83 /* Don't allow the redirection however, because we weren't
84 * covering the monitor at all. */
85 EXPECT_FALSE (monitor.allowRedirection (window));
86+
87+ /* Verify off-screen windows are always redirected (eg. other viewports) */
88+ EXPECT_TRUE (monitor.allowRedirection (offscreen1));
89+ EXPECT_TRUE (monitor.allowRedirection (offscreen2));
90 }
91
92 TEST (OpenGLFullscreenRegion, MaximizedWithDocks) // LP: #1053902
93
94=== modified file 'plugins/opengl/src/paint.cpp'
95--- plugins/opengl/src/paint.cpp 2012-10-04 09:22:29 +0000
96+++ plugins/opengl/src/paint.cpp 2012-11-29 10:55:23 +0000
97@@ -276,7 +276,7 @@
98
99 if (!(mask & PAINT_SCREEN_NO_OCCLUSION_DETECTION_MASK))
100 {
101- FullscreenRegion fs (*output);
102+ FullscreenRegion fs (*output, screen->region ());
103
104 /* detect occlusions */
105 for (rit = pl.rbegin (); rit != pl.rend (); ++rit)

Subscribers

People subscribed via source and target branches