Merge lp:~compiz-team/compiz/compiz.fix_1012956 into lp:compiz/0.9.8

Proposed by Sam Spilsbury
Status: Superseded
Proposed branch: lp:~compiz-team/compiz/compiz.fix_1012956
Merge into: lp:compiz/0.9.8
Diff against target: 46 lines (+23/-4)
1 file modified
plugins/decor/src/decor.cpp (+23/-4)
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.fix_1012956
Reviewer Review Type Date Requested Status
Daniel van Vugt Needs Fixing
Tim Penhey (community) Needs Fixing
Review via email: mp+110268@code.launchpad.net

This proposal has been superseded by a proposal from 2012-06-18.

Commit message

Check if the window would actually paint before painting the shadow, since
it is possible that another plugin could be inhibiting paint of the dock window.

Fixes (LP: #1012956)

Description of the change

Check if the window would actually paint before painting the shadow, since
it is possible that another plugin could be inhibiting paint of the dock window.

Fixes (LP: #1012956)

Unblocks: https://code.launchpad.net/~smspillaz/unity/unity.less-paint-insanity/+merge/110267

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

I'm going to be pedantic here...

> bool isDock = w->type () & CompWindowTypeDockMask;

This looks fine.

However...

> bool invisible = w->invisible ();
> invisible |= w->destroyed ();
> if (isDock && !invisible)

Seems a bit more weird. Primarily because the local invisible variable reflects the window invisible state, which is fine, but then it becomes "invisible or destroyed", which isn't what the variable reflects.

As an aside, this value is then negated in the if statement.

How about...

  bool drawShadow = !w->invisible ();
  if (w->destroyed ())
    drawShadow = false;

  if (isDock && drawShadow)
  // ...

Having booleans expressed in the positive are simpler to follow.

  bool drawShadow = !(w->invisible () || w-> destroyed ());

Also seems simple enough to follow.

I can't really comment on the internals of the method though.
How expensive is the glPaint call?

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

Also, I think it's technically wrong to be using an arithmetic OR on a bool:
  invisible |= w->destroyed ();

I'm not sure if that's a new C++ feature, but it shouldn't work normally.

It should probably be:
  bool invisible = w->invisible () || w->destroyed();

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

Ack. glPaint is not expensive since plugins will not have their hooks called unless they are running animations on the window and PAINT_WINDOW_NO_CORE_INSTANCE_MASK means that no gl operations occurr

Sent from Samsung Mobile

 Tim Penhey <email address hidden> wrote:

Review: Needs Fixing

I'm going to be pedantic here...

> bool isDock = w->type () & CompWindowTypeDockMask;

This looks fine.

However...

> bool invisible = w->invisible ();
> invisible |= w->destroyed ();
> if (isDock && !invisible)

Seems a bit more weird.  Primarily because the local invisible variable reflects the window invisible state, which is fine, but then it becomes "invisible or destroyed", which isn't what the variable reflects.

As an aside, this value is then negated in the if statement.

How about...

  bool drawShadow = !w->invisible ();
  if (w->destroyed ())
    drawShadow = false;

  if (isDock && drawShadow)
  // ...

Having booleans expressed in the positive are simpler to follow.

  bool drawShadow = !(w->invisible () || w-> destroyed ());

Also seems simple enough to follow.

I can't really comment on the internals of the method though.
How expensive is the glPaint call?
--
https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1012956/+merge/110268
Your team Compiz Maintainers is subscribed to branch lp:compiz.

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

Binary or has always worked on booleans.

Proof:

False = 0X0
True = 0X1

a = 0
a |= 1 == 1
a |= 0 == 1

In any case im happy to convert it.

Sent from Samsung Mobile

 Daniel van Vugt <email address hidden> wrote:

Review: Needs Fixing

Also, I think it's technically wrong to be using an arithmetic OR on a bool:
  invisible |= w->destroyed ();

I'm not sure if that's a new C++ feature, but it shouldn't work normally.

It should probably be:
  bool invisible = w->invisible () || w->destroyed();
--
https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1012956/+merge/110268
Your team Compiz Maintainers is subscribed to branch lp:compiz.

3247. By Sam Spilsbury

Express booleans more clearly

3248. By Sam Spilsbury

Style

3249. By Sam Spilsbury

Indent

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/decor/src/decor.cpp'
2--- plugins/decor/src/decor.cpp 2012-06-05 09:31:34 +0000
3+++ plugins/decor/src/decor.cpp 2012-06-14 09:15:22 +0000
4@@ -170,11 +170,30 @@
5 {
6 foreach (CompWindow *w, dScreen->cScreen->getWindowPaintList ())
7 {
8- if ((w->type () & CompWindowTypeDockMask) &&
9- !(w->destroyed () || w->invisible ()))
10+ bool isDock = w->type () & CompWindowTypeDockMask;
11+ bool invisible = w->invisible ();
12+
13+ invisible |= w->destroyed ();
14+
15+ if (isDock && !invisible)
16 {
17 DecorWindow *d = DecorWindow::get (w);
18- d->glDecorate (transform, attrib, region, mask);
19+
20+ /* Check if the window would draw by
21+ * seeing if glPaint returns true when
22+ * using PAINT_NO_CORE_INSTANCE_MASK
23+ */
24+
25+ unsigned int pmask = d->gWindow->lastMask () & ~(PAINT_WINDOW_OCCLUSION_DETECTION_MASK);
26+
27+ if (d->gWindow->glPaint (d->gWindow->paintAttrib (),
28+ transform,
29+ region,
30+ pmask | PAINT_WINDOW_NO_CORE_INSTANCE_MASK))
31+ {
32+ GLFragment::Attrib fa (d->gWindow->paintAttrib ());
33+ d->glDecorate (transform, fa, region, mask);
34+ }
35 }
36 }
37 }
38@@ -185,7 +204,7 @@
39
40 void
41 DecorWindow::glDecorate (const GLMatrix &transform,
42- GLFragment::Attrib &attrib,
43+ GLFragment::Attrib &attrib,
44 const CompRegion &region,
45 unsigned int mask)
46 {

Subscribers

People subscribed via source and target branches