Merge lp:~compiz-team/compiz-core/compiz-core.notify_occlusion_detection into lp:compiz-core/0.9.5

Proposed by Sam Spilsbury
Status: Rejected
Rejected by: Sam Spilsbury
Proposed branch: lp:~compiz-team/compiz-core/compiz-core.notify_occlusion_detection
Merge into: lp:compiz-core/0.9.5
Diff against target: 93 lines (+44/-2)
1 file modified
plugins/decor/src/decor.cpp (+44/-2)
To merge this branch: bzr merge lp:~compiz-team/compiz-core/compiz-core.notify_occlusion_detection
Reviewer Review Type Date Requested Status
Tim Penhey (community) Needs Fixing
Review via email: mp+73232@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

Hi Sam,

This screams for a private function. If that isn't possible for ABI break
reasons, please add a note to refactor ASAP.

"o" is a terrible name for a variable. Also, using the correct constructor
for the vector means avoiding a call to resize.

void WHATEVER::ComputeShadowsForScreen(Screen* screen)
{
  CompOption::Vector options(1);
  CompOption& option = options.back ();
  option = CompOption ("active", CompOption::TypeBool);
  option.value ().set (true);

  screen->handleCompizEvent ("decor", "occlusion_detection", options);
  foreach (CompWindow *cw,
           DecorScreen::get (screen)->cScreen->getWindowPaintList ())
  {
    DecorWindow::get (cw)->computeShadowRegion ();
  }
  option.value ().set (false);
  screen->handleCompizEvent ("decor", "occlusion_detection", options);
}

review: Needs Fixing
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

> This screams for a private function. If that isn't possible for ABI break
> reasons, please add a note to refactor ASAP.

Or keeping it ABI stable just a simple C-style static function that takes the object and the needed pointers to private members. That will make the post-Oneiric refactoring a 2-liner. In my experience it's better to get the structure right while you have your hands and mind in it anyway.

Revision history for this message
Tim Penhey (thumper) wrote :

Good call Mikkel. I thought about that, but didn't say it.

Unmerged revisions

2798. By Sam Spilsbury

Notify that we're doing occlusion detection

2797. By Sam Spilsbury

Merge lp:~compiz-team/compiz-core/compiz-core.fix_831987

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 2011-08-19 14:25:11 +0000
3+++ plugins/decor/src/decor.cpp 2011-08-29 13:26:23 +0000
4@@ -2161,10 +2161,21 @@
5 update (true);
6 if (dScreen->cmActive)
7 {
8- foreach (CompWindow *cw, DecorScreen::get (screen)->cScreen->getWindowPaintList ())
9+ CompOption::Vector o;
10+
11+ o.resize (1);
12+ o.back () = CompOption ("active", CompOption::TypeBool);
13+ o.back ().value ().set (true);
14+
15+ screen->handleCompizEvent ("decor", "occlusion_detection", o);
16+ foreach (CompWindow *cw,
17+ DecorScreen::get (screen)->cScreen->getWindowPaintList ())
18 {
19 DecorWindow::get (cw)->computeShadowRegion ();
20 }
21+
22+ o.back ().value ().set (false);
23+ screen->handleCompizEvent ("decor", "occlusion_detection", o);
24 }
25 break;
26 case CompWindowNotifyUnreparent:
27@@ -2370,10 +2381,21 @@
28 {
29 if (cmActive)
30 {
31- foreach (CompWindow *cw, cScreen->getWindowPaintList ())
32+ CompOption::Vector o;
33+
34+ o.resize (1);
35+ o.back () = CompOption ("active", CompOption::TypeBool);
36+ o.back ().value ().set (true);
37+
38+ screen->handleCompizEvent ("decor", "occlusion_detection", o);
39+ foreach (CompWindow *cw,
40+ DecorScreen::get (screen)->cScreen->getWindowPaintList ())
41 {
42 DecorWindow::get (cw)->computeShadowRegion ();
43 }
44+
45+ o.back ().value ().set (false);
46+ screen->handleCompizEvent ("decor", "occlusion_detection", o);
47 }
48 }
49 else
50@@ -2690,11 +2712,21 @@
51
52 if (dScreen->cmActive)
53 {
54+ CompOption::Vector o;
55+
56+ o.resize (1);
57+ o.back () = CompOption ("active", CompOption::TypeBool);
58+ o.back ().value ().set (true);
59+
60+ screen->handleCompizEvent ("decor", "occlusion_detection", o);
61 foreach (CompWindow *cw,
62 DecorScreen::get (screen)->cScreen->getWindowPaintList ())
63 {
64 DecorWindow::get (cw)->computeShadowRegion ();
65 }
66+
67+ o.back ().value ().set (false);
68+ screen->handleCompizEvent ("decor", "occlusion_detection", o);
69 }
70
71 window->moveNotify (dx, dy, immediate);
72@@ -2750,11 +2782,21 @@
73
74 if (dScreen->cmActive)
75 {
76+ CompOption::Vector o;
77+
78+ o.resize (1);
79+ o.back () = CompOption ("active", CompOption::TypeBool);
80+ o.back ().value ().set (true);
81+
82+ screen->handleCompizEvent ("decor", "occlusion_detection", o);
83 foreach (CompWindow *cw,
84 DecorScreen::get (screen)->cScreen->getWindowPaintList ())
85 {
86 DecorWindow::get (cw)->computeShadowRegion ();
87 }
88+
89+ o.back ().value ().set (false);
90+ screen->handleCompizEvent ("decor", "occlusion_detection", o);
91 }
92
93 window->resizeNotify (dx, dy, dwidth, dheight);

Subscribers

People subscribed via source and target branches