Merge lp:~townsend/compiz/fix-minimize-unredirect-window into lp:compiz/0.9.10

Proposed by Christopher Townsend
Status: Merged
Approved by: Christopher Townsend
Approved revision: 3688
Merged at revision: 3686
Proposed branch: lp:~townsend/compiz/fix-minimize-unredirect-window
Merge into: lp:compiz/0.9.10
Diff against target: 72 lines (+27/-2)
4 files modified
plugins/opengl/src/fsregion/fsregion.cpp (+1/-1)
plugins/opengl/src/fsregion/fsregion.h (+2/-1)
plugins/opengl/src/fsregion/tests/test-fsregion.cpp (+19/-0)
plugins/opengl/src/paint.cpp (+5/-0)
To merge this branch: bzr merge lp:~townsend/compiz/fix-minimize-unredirect-window
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Sam Spilsbury Approve
Christopher Townsend Needs Resubmitting
Review via email: mp+162267@code.launchpad.net

Commit message

Fixed issue where minimizing an unredirect full screen window would repaint the full screen window after minimizing it even though it isn't really there.

Description of the change

= Issue =
Minimizing an unredirect full screen window will display the full screen window after the minimization even though it isn't really there.

= Fix =
Do not unredirect a full screen window if no occlusion is detected meaning that it has been minimized.

= Test =
Added some unit test coverage with Sam's guidance.

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
Sam Spilsbury (smspillaz) wrote :

This is more of a strange interaction with the unity plugin's fake minimization workaround than it is a compiz issue. I think the best way to handle this would be to simply skip painting any window marked minimized - eg over here:

 /* detect occlusions */
 for (rit = pl.rbegin (); rit != pl.rend (); ++rit)
 {
     w = (*rit);
     gw = GLWindow::get (w);

...

 /* detect occlusions */
 for (rit = pl.rbegin (); rit != pl.rend (); ++rit)
 {
     w = (*rit);
     gw = GLWindow::get (w);

     if (w->destroyed ())
  continue;

     if (!w->shaded ())
     {
  /* Non-damaged windows don't have valid pixmap
   * contents and we aren't displaying them yet
   * so don't factor them into occlusion detection */
  if (!gw->priv->cWindow->damaged ())
  {
      gw->priv->clip = region;
      continue;
  }

                /* Some plugins may explicitly inhibit paint of minimized
                 * windows, just don't paint them at all if they're viewable
                 * but also minimized */
  if (!w->isViewable () ||
+ w->minimized ())
      continue;
     }

Revision history for this message
Sam Spilsbury (smspillaz) :
review: Needs Fixing
Revision history for this message
Christopher Townsend (townsend) wrote :

Sam,

Thanks for reviewing this. I tried what you suggested and it does not fix the bug I'm trying to fix. In fact, the behavior is even worse in that the full screen image will not go away no matter what I do.

I still think my suggested fix is good since this issue is only caused by unredirect full screen windows and not setting a full screen window to unredirect when it is minimized seems to make sense.

review: Needs Resubmitting
Revision history for this message
Christopher Townsend (townsend) wrote :

Oops, didn't mean to set my comment as a resubmit...

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

Hey Chris, no problem.

I've only had a chance to have a passing look so far, but I'm doing a full test + look now. I still feel like putting the check for w->minimized () after we've built the unredirected windows list feels a little weird, but perhaps my previous approach was too overzealous. I'm just going to try something else now and see how that goes.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :
Download full text (3.2 KiB)

Hey Chris,

So I had a bit more of a look into this - I think the more general problem was that windows which plugins explicitly did not want to paint (eg, they set PAINT_WINDOW_NO_CORE_INSTANCE_MASK) were being factored into the undredirection algorithm when they shouldn't have been. Can you try out the following diff to see if it fixes the minimization problem? It should fix all of the other problems more generally too. Also has some automated test coverage.

=== modified file 'plugins/opengl/src/fsregion/fsregion.cpp'
--- plugins/opengl/src/fsregion/fsregion.cpp 2012-11-29 10:51:38 +0000
+++ plugins/opengl/src/fsregion/fsregion.cpp 2013-05-08 01:42:37 +0000
@@ -48,7 +48,7 @@
 {
     bool fullscreen = false;

- if (!(flags & (Desktop | Alpha)) &&
+ if (!(flags & (Desktop | Alpha | NoOcclusionDetection)) &&
         region == untouched &&
         region == orig)
     {

=== modified file 'plugins/opengl/src/fsregion/fsregion.h'
--- plugins/opengl/src/fsregion/fsregion.h 2012-11-29 10:51:38 +0000
+++ plugins/opengl/src/fsregion/fsregion.h 2013-05-08 01:42:34 +0000
@@ -37,7 +37,8 @@
     typedef enum
     {
  Desktop = 1,
- Alpha = 2
+ Alpha = 2,
+ NoOcclusionDetection = 3
     } WinFlag;

     typedef unsigned int WinFlags;

=== modified file 'plugins/opengl/src/fsregion/tests/test-fsregion.cpp'
--- plugins/opengl/src/fsregion/tests/test-fsregion.cpp 2012-11-29 10:51:38 +0000
+++ plugins/opengl/src/fsregion/tests/test-fsregion.cpp 2013-05-08 02:33:58 +0000
@@ -26,7 +26,7 @@
 #include "gtest/gtest.h"
 #include "fsregion.h"

-using namespace compiz::opengl;
+using namespace compiz::opengl;

 TEST (OpenGLFullscreenRegion, NoWindows)
 {
@@ -68,6 +68,25 @@
                                        FullscreenRegion::Desktop));
 }

+TEST (OpenGLFullscreenRegion, NoOcclusionFullscreen)
+{
+ FullscreenRegion monitor (CompRect (0, 0, 1024, 768));
+ EXPECT_FALSE (monitor.isCoveredBy (CompRegion (0, 0, 1024, 768),
+ FullscreenRegion::NoOcclusionDetection));
+ EXPECT_FALSE (monitor.isCoveredBy (CompRegion (0, 0, 1024, 768),
+ FullscreenRegion::Desktop));
+}
+
+TEST (OpenGLFullscreenRegion, NoOcclusionOverFullscreen)
+{
+ FullscreenRegion monitor (CompRect (0, 0, 1024, 768));
+ EXPECT_FALSE (monitor.isCoveredBy (CompRegion (50, 60, 70, 80),
+ FullscreenRegion::NoOcclusionDetection));
+ EXPECT_FALSE (monitor.isCoveredBy (CompRegion (0, 0, 1024, 768)));
+ EXPECT_FALSE (monitor.isCoveredBy (CompRegion (0, 0, 1024, 768),
+ FullscreenRegion::Desktop));
+}
+
 TEST (OpenGLFullscreenRegion, NormalWindows)
 {
     FullscreenRegion monitor (CompRect (0, 0, 1024, 768));

=== modified file 'plugins/opengl/src/paint.cpp'
--- plugins/opengl/src/paint.cpp 2013-04-25 17:01:46 +0000
+++ plugins/opengl/src/paint.cpp 2013-05-08 02:31:48 +0000
@@ -353,6 +353,11 @@
          flags |= FullscreenRegion::Desktop;
      if (w->alpha ())
   flags |= FullscreenRegion::Alpha;
+
+ /* Anything which was not occlusion detected is not a suitable
+ * candidate for unredirection either */
+ if (...

Read more...

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

Oops, seems like launchpad mangled that one. Try here: http://paste.ubuntu.com/5643479/

I should also note that unity's fullscreen window detection seems to detect such "non painted" windows as well causing the launcher and panel to be invisible when a fullscreen window gets minimized. I think the fullscreen window detection code can be adjusted to handle this case. The relevant bits can be found in unityshell.cpp:UnityWindow::glPaint

Revision history for this message
Christopher Townsend (townsend) wrote :

Wow, thanks Sam!

I tried it and it works. I'll get my branch updated soon with the changes you proposed.

As far as the Launcher and Panel not repainting, I have a separate MP in Unity already to fix that. Just waiting on a review.

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

Excellent - I've reviewed your unity branch too - similar comment as to here.

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

Excellent, thanks.

review: Approve
Revision history for this message
Christopher Townsend (townsend) wrote :

Ok, this is ready for review again.

Thanks!

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Christopher Townsend (townsend) wrote :

Re-approving since the armhf build failed due to some transient failure.

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

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-11-29 10:51:38 +0000
3+++ plugins/opengl/src/fsregion/fsregion.cpp 2013-05-08 15:16:22 +0000
4@@ -48,7 +48,7 @@
5 {
6 bool fullscreen = false;
7
8- if (!(flags & (Desktop | Alpha)) &&
9+ if (!(flags & (Desktop | Alpha | NoOcclusionDetection)) &&
10 region == untouched &&
11 region == orig)
12 {
13
14=== modified file 'plugins/opengl/src/fsregion/fsregion.h'
15--- plugins/opengl/src/fsregion/fsregion.h 2012-11-29 10:51:38 +0000
16+++ plugins/opengl/src/fsregion/fsregion.h 2013-05-08 15:16:22 +0000
17@@ -37,7 +37,8 @@
18 typedef enum
19 {
20 Desktop = 1,
21- Alpha = 2
22+ Alpha = 2,
23+ NoOcclusionDetection = 3
24 } WinFlag;
25
26 typedef unsigned int WinFlags;
27
28=== modified file 'plugins/opengl/src/fsregion/tests/test-fsregion.cpp'
29--- plugins/opengl/src/fsregion/tests/test-fsregion.cpp 2012-11-29 10:51:38 +0000
30+++ plugins/opengl/src/fsregion/tests/test-fsregion.cpp 2013-05-08 15:16:22 +0000
31@@ -68,6 +68,25 @@
32 FullscreenRegion::Desktop));
33 }
34
35+TEST (OpenGLFullscreenRegion, NoOcclusionFullscreen)
36+{
37+ FullscreenRegion monitor (CompRect (0, 0, 1024, 768));
38+ EXPECT_FALSE (monitor.isCoveredBy (CompRegion (0, 0, 1024, 768),
39+ FullscreenRegion::NoOcclusionDetection));
40+ EXPECT_FALSE (monitor.isCoveredBy (CompRegion (0, 0, 1024, 768),
41+ FullscreenRegion::Desktop));
42+}
43+
44+TEST (OpenGLFullscreenRegion, NoOcclusionOverFullscreen)
45+{
46+ FullscreenRegion monitor (CompRect (0, 0, 1024, 768));
47+ EXPECT_FALSE (monitor.isCoveredBy (CompRegion (50, 60, 70, 80),
48+ FullscreenRegion::NoOcclusionDetection));
49+ EXPECT_FALSE (monitor.isCoveredBy (CompRegion (0, 0, 1024, 768)));
50+ EXPECT_FALSE (monitor.isCoveredBy (CompRegion (0, 0, 1024, 768),
51+ FullscreenRegion::Desktop));
52+}
53+
54 TEST (OpenGLFullscreenRegion, NormalWindows)
55 {
56 FullscreenRegion monitor (CompRect (0, 0, 1024, 768));
57
58=== modified file 'plugins/opengl/src/paint.cpp'
59--- plugins/opengl/src/paint.cpp 2013-01-03 16:05:26 +0000
60+++ plugins/opengl/src/paint.cpp 2013-05-08 15:16:22 +0000
61@@ -354,6 +354,11 @@
62 if (w->alpha ())
63 flags |= FullscreenRegion::Alpha;
64
65+ /* Anything which was not occlusion detected is not a suitable
66+ * candidate for unredirection either */
67+ if (!status)
68+ flags |= FullscreenRegion::NoOcclusionDetection;
69+
70 CompositeWindow *cw = CompositeWindow::get (w);
71
72 /*

Subscribers

People subscribed via source and target branches