Merge lp:~ivenvd/compiz/compiz.fix_1050757 into lp:compiz/0.9.8

Proposed by Iven Hsu
Status: Merged
Approved by: Daniel van Vugt
Approved revision: 3386
Merged at revision: 3395
Proposed branch: lp:~ivenvd/compiz/compiz.fix_1050757
Merge into: lp:compiz/0.9.8
Diff against target: 176 lines (+45/-36)
2 files modified
plugins/opacify/src/opacify.cpp (+41/-35)
plugins/opacify/src/opacify.h (+4/-1)
To merge this branch: bzr merge lp:~ivenvd/compiz/compiz.fix_1050757
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Sam Spilsbury Approve
Review via email: mp+126017@code.launchpad.net

Commit message

Reset opacity of the passive windows when window focus changed.
(LP: #1050757)

Also fixes the bug that clearPassive() doesn't reset the opacity of the
passive windows.

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

Looking good.

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

Looks OK and still seems to work.

I can't say I've found the opacify plugin to be particularly reliable, but that's nothing to do with this proposal.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/opacify/src/opacify.cpp'
2--- plugins/opacify/src/opacify.cpp 2012-09-14 06:51:27 +0000
3+++ plugins/opacify/src/opacify.cpp 2012-09-24 14:04:27 +0000
4@@ -64,7 +64,7 @@
5 */
6
7 void
8-OpacifyScreen::resetOpacity (Window id)
9+OpacifyScreen::resetWindowOpacity (Window id)
10 {
11 CompWindow *w;
12
13@@ -78,11 +78,39 @@
14 ow->cWindow->addDamage ();
15 }
16
17+/* Resets all the windows on the screen to the original opacity
18+ * if necessary. Then reset active.
19+*/
20+
21+void
22+OpacifyScreen::resetScreenOpacity ()
23+{
24+ if (active)
25+ {
26+ clearPassive();
27+ resetWindowOpacity(active);
28+ active = 0;
29+ }
30+}
31+
32 /* Resets the opacity of windows on the passive list.
33 */
34 void
35 OpacifyScreen::clearPassive ()
36 {
37+ foreach (Window xid, passive)
38+ {
39+ CompWindow *win = screen->findWindow (xid);
40+
41+ if (!win)
42+ continue;
43+
44+ OPACIFY_WINDOW (win);
45+
46+ ow->setOpacity (MAX (OPAQUE * optionGetActiveOpacity () / 100,
47+ ow->gWindow->paintAttrib ().opacity));
48+ resetWindowOpacity (xid);
49+ }
50 passive.clear ();
51 }
52
53@@ -116,20 +144,7 @@
54 int i = 0;
55
56 /* Clear the list first to prevent memleaks */
57- foreach (Window xid, passive)
58- {
59- CompWindow *win = screen->findWindow (xid);
60-
61- if (!win)
62- continue;
63-
64- OPACIFY_WINDOW (win);
65-
66- resetOpacity (xid);
67- ow->setOpacity (MAX (OPAQUE * optionGetActiveOpacity () / 100,
68- ow->gWindow->paintAttrib ().opacity));
69- }
70- passive.clear ();
71+ clearPassive ();
72
73 foreach (CompWindow *w, screen->windows ())
74 {
75@@ -177,16 +192,14 @@
76 return;
77 }
78
79- os->clearPassive ();
80- os->resetOpacity (os->active);
81- os->active = 0;
82+ os->resetScreenOpacity ();
83 return;
84 }
85
86 if (!window || os->active != window->id () || os->justMoved)
87 {
88 os->justMoved = false;
89- os->resetOpacity (os->active);
90+ os->resetWindowOpacity (os->active);
91 os->active = 0;
92 }
93
94@@ -214,7 +227,7 @@
95 OpacifyScreen::handleTimeout ()
96 {
97 if (newActive)
98- OpacifyWindow::get (newActive)->handleEnter ();
99+ OpacifyWindow::get (newActive)->handleEnter ();
100
101 return false;
102 }
103@@ -287,7 +300,7 @@
104 Window id;
105
106 id = event->xcrossing.window;
107- newActive = screen->findTopLevelWindow (id);
108+ newActive = screen->findTopLevelWindow (id);
109
110 if (timeoutHandle.active ())
111 timeoutHandle.stop ();
112@@ -296,7 +309,10 @@
113 handleTimeout ();
114 else
115 timeoutHandle.start ();
116- break;
117+ break;
118+ case FocusIn:
119+ resetScreenOpacity();
120+ break;
121 case ConfigureNotify:
122
123 if (active != event->xconfigure.window)
124@@ -311,7 +327,7 @@
125 if (w)
126 passiveWindows (w->region ());
127 }
128- break;
129+ break;
130 default:
131 break;
132 }
133@@ -329,12 +345,7 @@
134 isToggle = !isToggle;
135 if (!isToggle && optionGetToggleReset ())
136 {
137- if (active)
138- {
139- clearPassive ();
140- resetOpacity (active);
141- active = 0;
142- }
143+ resetScreenOpacity();
144 }
145
146 setFunctions (isToggle);
147@@ -357,12 +368,7 @@
148 case OpacifyOptions::InitToggle:
149 isToggle = option->value ().b ();
150 setFunctions (isToggle);
151- if (active)
152- {
153- clearPassive ();
154- resetOpacity (active);
155- active = 0;
156- }
157+ resetScreenOpacity();
158 break;
159 case OpacifyOptions::Timeout:
160 timeoutHandle.setTimes (optionGetTimeout (), optionGetTimeout () * 1.2);
161
162=== modified file 'plugins/opacify/src/opacify.h'
163--- plugins/opacify/src/opacify.h 2012-09-07 23:29:42 +0000
164+++ plugins/opacify/src/opacify.h 2012-09-24 14:04:27 +0000
165@@ -61,7 +61,10 @@
166 handleEvent (XEvent *);
167
168 void
169- resetOpacity (Window id);
170+ resetWindowOpacity (Window id);
171+
172+ void
173+ resetScreenOpacity ();
174
175 void
176 clearPassive ();

Subscribers

People subscribed via source and target branches