Merge lp:~andrew-bugs-launchpad-net/ubufox/flashsaver into lp:~asac/ubufox/main
- flashsaver
- Merge into main
Status: | Needs review |
---|---|
Proposed branch: | lp:~andrew-bugs-launchpad-net/ubufox/flashsaver |
Merge into: | lp:~asac/ubufox/main |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~andrew-bugs-launchpad-net/ubufox/flashsaver |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexander Sack | Pending | ||
Review via email: mp+6768@code.launchpad.net |
Commit message
Description of the change
Andrew Sayers (andrew-bugs-launchpad-net) wrote : | # |
Following discussion in #ubuntu-
https:/
The alternate fix more closely resembles Flash's behaviour in Windows, and is likely to cause fewer bugs. Please reject this merge request if/when that merge is completed successfully.
Unmerged revisions
- 168. By Andrew Sayers <email address hidden>
-
Fixed a bug in the no-screensaver case
- 167. By Andrew Sayers <email address hidden>
-
Now works when installed in /usr/share/ubufox instead of the user's profile directory
- 166. By Andrew Sayers <email address hidden>
-
Improved FlashSaver
FlashSaver will now disable the screensaver when at least one Flash object
exists in at least one window. - 165. By Andrew Sayers <email address hidden>
-
Added FlashSaver (initial implementation)
This will disable the screensaver if/when Firefox loads the Flash plugin.
The screensaver is disabled even if no Flash applications are currently running.
Preview Diff
1 | === modified file 'build.sh' | |||
2 | --- build.sh 2008-07-09 08:42:48 +0000 | |||
3 | +++ build.sh 2009-05-25 02:40:30 +0000 | |||
4 | @@ -63,6 +63,7 @@ | |||
5 | 63 | $BEFORE_BUILD | 63 | $BEFORE_BUILD |
6 | 64 | 64 | ||
7 | 65 | mkdir --parents --verbose $TMP_DIR/chrome | 65 | mkdir --parents --verbose $TMP_DIR/chrome |
8 | 66 | cp -a chrome/* $TMP_DIR/chrome | ||
9 | 66 | 67 | ||
10 | 67 | # generate the JAR file, excluding CVS and temporary files | 68 | # generate the JAR file, excluding CVS and temporary files |
11 | 68 | JAR_FILE=$TMP_DIR/chrome/$APP_NAME.jar | 69 | JAR_FILE=$TMP_DIR/chrome/$APP_NAME.jar |
12 | 69 | 70 | ||
13 | === added directory 'chrome' | |||
14 | === modified file 'chrome.manifest' | |||
15 | --- chrome.manifest 2009-03-18 19:16:05 +0000 | |||
16 | +++ chrome.manifest 2009-05-23 20:37:28 +0000 | |||
17 | @@ -31,5 +31,6 @@ | |||
18 | 31 | overlay chrome://mozapps/content/extensions/extensions.xul chrome://ubufox/content/ubuntuAddonsOverlay.xul appversion>=3.0b3 | 31 | overlay chrome://mozapps/content/extensions/extensions.xul chrome://ubufox/content/ubuntuAddonsOverlay.xul appversion>=3.0b3 |
19 | 32 | overlay chrome://mozapps/content/extensions/extensions.xul chrome://ubufox/content/ubuntuAddonsOverlay.ffox2.xul appversion<2.0.0.* | 32 | overlay chrome://mozapps/content/extensions/extensions.xul chrome://ubufox/content/ubuntuAddonsOverlay.ffox2.xul appversion<2.0.0.* |
20 | 33 | overlay chrome://browser/content/browser.xul chrome://ubufox/content/ubuntuAltpluginsOverlay.xul | 33 | overlay chrome://browser/content/browser.xul chrome://ubufox/content/ubuntuAltpluginsOverlay.xul |
21 | 34 | overlay chrome://browser/content/browser.xul chrome://ubufox/content/flashsaver.xul | ||
22 | 34 | 35 | ||
23 | 35 | override chrome://mozapps/content/plugins/pluginInstallerWizard.xul chrome://ubufox/content/pluginInstallerWizard.xul | 36 | override chrome://mozapps/content/plugins/pluginInstallerWizard.xul chrome://ubufox/content/pluginInstallerWizard.xul |
24 | 36 | 37 | ||
25 | === added file 'chrome/flashsaver.py' | |||
26 | --- chrome/flashsaver.py 1970-01-01 00:00:00 +0000 | |||
27 | +++ chrome/flashsaver.py 2009-05-25 02:40:30 +0000 | |||
28 | @@ -0,0 +1,103 @@ | |||
29 | 1 | #!/usr/bin/python | ||
30 | 2 | # | ||
31 | 3 | # (Dis)inhibit the screensaver | ||
32 | 4 | |||
33 | 5 | LICENSE = ''' | ||
34 | 6 | ***** BEGIN LICENSE BLOCK ***** | ||
35 | 7 | Version: MPL 1.1/GPL 2.0/LGPL 2.1 | ||
36 | 8 | # | ||
37 | 9 | The contents of this file are subject to the Mozilla Public License Version | ||
38 | 10 | 1.1 (the "License"); you may not use this file except in compliance with | ||
39 | 11 | the License. You may obtain a copy of the License at | ||
40 | 12 | http://www.mozilla.org/MPL/ | ||
41 | 13 | |||
42 | 14 | Software distributed under the License is distributed on an "AS IS" basis, | ||
43 | 15 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | ||
44 | 16 | for the specific language governing rights and limitations under the | ||
45 | 17 | License. | ||
46 | 18 | # | ||
47 | 19 | The Original Code is ubufox. | ||
48 | 20 | |||
49 | 21 | The Initial Developer of the Original Code is | ||
50 | 22 | Canonical Ltd. | ||
51 | 23 | Portions created by the Initial Developer are Copyright (C) 2008 | ||
52 | 24 | the Initial Developer. All Rights Reserved. | ||
53 | 25 | |||
54 | 26 | Contributor(s): | ||
55 | 27 | Alexander Sack <asac@jwsdot.com> - Canonical Ltd. | ||
56 | 28 | Arzhel Younsi <xionox@gmail.com> | ||
57 | 29 | # | ||
58 | 30 | Alternatively, the contents of this file may be used under the terms of | ||
59 | 31 | either the GNU General Public License Version 2 or later (the "GPL"), or | ||
60 | 32 | the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), | ||
61 | 33 | in which case the provisions of the GPL or the LGPL are applicable instead | ||
62 | 34 | of those above. If you wish to allow use of your version of this file only | ||
63 | 35 | under the terms of either the GPL or the LGPL, and not to allow others to | ||
64 | 36 | use your version of this file under the terms of the MPL, indicate your | ||
65 | 37 | decision by deleting the provisions above and replace them with the notice | ||
66 | 38 | and other provisions required by the GPL or the LGPL. If you do not delete | ||
67 | 39 | the provisions above, a recipient may use your version of this file under | ||
68 | 40 | the terms of any one of the MPL, the GPL or the LGPL. | ||
69 | 41 | |||
70 | 42 | ***** END LICENSE BLOCK ***** | ||
71 | 43 | ''' | ||
72 | 44 | |||
73 | 45 | import os, sys, signal | ||
74 | 46 | |||
75 | 47 | pid_file = sys.argv[1] + '/flashsaver.lock' | ||
76 | 48 | |||
77 | 49 | # Clear up any old lock files | ||
78 | 50 | # (Disinhibiting if necessary) | ||
79 | 51 | if os.path.exists(pid_file): | ||
80 | 52 | pid = int(file(pid_file).readline()) | ||
81 | 53 | os.unlink(pid_file) | ||
82 | 54 | try: | ||
83 | 55 | os.kill(pid, signal.SIGTERM) | ||
84 | 56 | except: | ||
85 | 57 | pass | ||
86 | 58 | |||
87 | 59 | # Unless we're supposed to inhibit, we're done now. | ||
88 | 60 | if 'inhibit' != sys.argv[2]: | ||
89 | 61 | exit(0) | ||
90 | 62 | |||
91 | 63 | # Fork a child process, so the parent can return as soon as it's safe | ||
92 | 64 | ppid = os.getppid() | ||
93 | 65 | pid = os.fork() | ||
94 | 66 | if pid: | ||
95 | 67 | open(pid_file, 'w', 0).write(str(pid)) | ||
96 | 68 | exit(0) | ||
97 | 69 | |||
98 | 70 | # DBus object that will be used to communicate with the screensaver | ||
99 | 71 | import dbus | ||
100 | 72 | bus = dbus.SessionBus() | ||
101 | 73 | |||
102 | 74 | class ScreenSaver: | ||
103 | 75 | def Inhibit(name, reason): | ||
104 | 76 | pass | ||
105 | 77 | def Uninhibit(cookie): | ||
106 | 78 | pass | ||
107 | 79 | |||
108 | 80 | screensaver = ScreenSaver() | ||
109 | 81 | |||
110 | 82 | try: | ||
111 | 83 | # KDE | ||
112 | 84 | screensaver = dbus.Interface(bus.get_object("org.freedesktop.ScreenSaver", "/org/freedesktop/ScreenSaver"), "org.freedesktop.ScreenSaver") | ||
113 | 85 | except: | ||
114 | 86 | try: | ||
115 | 87 | # GNOME | ||
116 | 88 | screensaver = dbus.Interface(bus.get_object("org.gnome.ScreenSaver", "/org/gnome/ScreenSaver"), "org.gnome.ScreenSaver") | ||
117 | 89 | except: | ||
118 | 90 | pass | ||
119 | 91 | |||
120 | 92 | cookie = screensaver.Inhibit("npviewer", "running Flash") | ||
121 | 93 | |||
122 | 94 | import time, os | ||
123 | 95 | while True: | ||
124 | 96 | |||
125 | 97 | # Die when Firefox dies | ||
126 | 98 | try: | ||
127 | 99 | os.kill(ppid, signal.SIG_DFL) | ||
128 | 100 | except: | ||
129 | 101 | exit(0) | ||
130 | 102 | |||
131 | 103 | time.sleep(30) | ||
132 | 0 | 104 | ||
133 | === added file 'content/flashsaver.css' | |||
134 | --- content/flashsaver.css 1970-01-01 00:00:00 +0000 | |||
135 | +++ content/flashsaver.css 2009-05-25 02:40:30 +0000 | |||
136 | @@ -0,0 +1,65 @@ | |||
137 | 1 | /* ***** BEGIN LICENSE BLOCK ***** | ||
138 | 2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | ||
139 | 3 | * | ||
140 | 4 | * The contents of this file are subject to the Mozilla Public License Version | ||
141 | 5 | * 1.1 (the "License"); you may not use this file except in compliance with | ||
142 | 6 | * the License. You may obtain a copy of the License at | ||
143 | 7 | * http://www.mozilla.org/MPL/ | ||
144 | 8 | * | ||
145 | 9 | * Software distributed under the License is distributed on an "AS IS" basis, | ||
146 | 10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | ||
147 | 11 | * for the specific language governing rights and limitations under the | ||
148 | 12 | * License. | ||
149 | 13 | * | ||
150 | 14 | * The Original Code is ubufox. | ||
151 | 15 | * | ||
152 | 16 | * The Initial Developer of the Original Code is | ||
153 | 17 | * Canonical Ltd. | ||
154 | 18 | * Portions created by the Initial Developer are Copyright (C) 2008 | ||
155 | 19 | * the Initial Developer. All Rights Reserved. | ||
156 | 20 | * | ||
157 | 21 | * Contributor(s): | ||
158 | 22 | * Alexander Sack <asac@jwsdot.com> - Canonical Ltd. | ||
159 | 23 | * Arzhel Younsi <xionox@gmail.com> | ||
160 | 24 | * | ||
161 | 25 | * Alternatively, the contents of this file may be used under the terms of | ||
162 | 26 | * either the GNU General Public License Version 2 or later (the "GPL"), or | ||
163 | 27 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), | ||
164 | 28 | * in which case the provisions of the GPL or the LGPL are applicable instead | ||
165 | 29 | * of those above. If you wish to allow use of your version of this file only | ||
166 | 30 | * under the terms of either the GPL or the LGPL, and not to allow others to | ||
167 | 31 | * use your version of this file under the terms of the MPL, indicate your | ||
168 | 32 | * decision by deleting the provisions above and replace them with the notice | ||
169 | 33 | * and other provisions required by the GPL or the LGPL. If you do not delete | ||
170 | 34 | * the provisions above, a recipient may use your version of this file under | ||
171 | 35 | * the terms of any one of the MPL, the GPL or the LGPL. | ||
172 | 36 | * | ||
173 | 37 | * ***** END LICENSE BLOCK ***** */ | ||
174 | 38 | |||
175 | 39 | /* | ||
176 | 40 | * THE FOLLOWING WAS TAKEN DIRECTLY FROM FLASHBLOCK 1.5.11a2 | ||
177 | 41 | * | ||
178 | 42 | * To update this, copy the equivalent code from flashblock.js, then do: | ||
179 | 43 | * | ||
180 | 44 | * 1) replace all instances of 'flashblock/content/flashblock' with 'ubufox/content/flashsaver' | ||
181 | 45 | */ | ||
182 | 46 | |||
183 | 47 | /* | ||
184 | 48 | * Flash Click to View by Ted Mielczarek (luser_mozilla@perilith.com) | ||
185 | 49 | * Original code by Jesse Ruderman (jruderman@hmc.edu) | ||
186 | 50 | * taken from http://www.squarefree.com/userstyles/xbl.html | ||
187 | 51 | * | ||
188 | 52 | * Change XBL binding for <object> tags, click to view flash | ||
189 | 53 | */ | ||
190 | 54 | |||
191 | 55 | /* | ||
192 | 56 | * Flash identifiers. | ||
193 | 57 | */ | ||
194 | 58 | object[classid*=":D27CDB6E-AE6D-11cf-96B8-444553540000"], | ||
195 | 59 | object[codebase*="swflash.cab"], | ||
196 | 60 | object[data*=".swf"], | ||
197 | 61 | embed[type="application/x-shockwave-flash"], | ||
198 | 62 | embed[src*=".swf"], | ||
199 | 63 | object[type="application/x-shockwave-flash"], | ||
200 | 64 | object[src*=".swf"] | ||
201 | 65 | { -moz-binding: url("chrome://ubufox/content/flashsaver.xml#flash") !important; } | ||
202 | 0 | 66 | ||
203 | === added file 'content/flashsaver.js' | |||
204 | --- content/flashsaver.js 1970-01-01 00:00:00 +0000 | |||
205 | +++ content/flashsaver.js 2009-05-25 02:40:30 +0000 | |||
206 | @@ -0,0 +1,114 @@ | |||
207 | 1 | /* ***** BEGIN LICENSE BLOCK ***** | ||
208 | 2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | ||
209 | 3 | * | ||
210 | 4 | * The contents of this file are subject to the Mozilla Public License Version | ||
211 | 5 | * 1.1 (the "License"); you may not use this file except in compliance with | ||
212 | 6 | * the License. You may obtain a copy of the License at | ||
213 | 7 | * http://www.mozilla.org/MPL/ | ||
214 | 8 | * | ||
215 | 9 | * Software distributed under the License is distributed on an "AS IS" basis, | ||
216 | 10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | ||
217 | 11 | * for the specific language governing rights and limitations under the | ||
218 | 12 | * License. | ||
219 | 13 | * | ||
220 | 14 | * The Original Code is ubufox. | ||
221 | 15 | * | ||
222 | 16 | * The Initial Developer of the Original Code is | ||
223 | 17 | * Canonical Ltd. | ||
224 | 18 | * Portions created by the Initial Developer are Copyright (C) 2008 | ||
225 | 19 | * the Initial Developer. All Rights Reserved. | ||
226 | 20 | * | ||
227 | 21 | * Contributor(s): | ||
228 | 22 | * Doron Rosenberg <doronr@us.ibm.com> | ||
229 | 23 | * Alexander Sack <asac@jwsdot.com> - Canonical Ltd. | ||
230 | 24 | * Arzhel Younsi <xionox@gmail.com> | ||
231 | 25 | * | ||
232 | 26 | * Alternatively, the contents of this file may be used under the terms of | ||
233 | 27 | * either the GNU General Public License Version 2 or later (the "GPL"), or | ||
234 | 28 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), | ||
235 | 29 | * in which case the provisions of the GPL or the LGPL are applicable instead | ||
236 | 30 | * of those above. If you wish to allow use of your version of this file only | ||
237 | 31 | * under the terms of either the GPL or the LGPL, and not to allow others to | ||
238 | 32 | * use your version of this file under the terms of the MPL, indicate your | ||
239 | 33 | * decision by deleting the provisions above and replace them with the notice | ||
240 | 34 | * and other provisions required by the GPL or the LGPL. If you do not delete | ||
241 | 35 | * the provisions above, a recipient may use your version of this file under | ||
242 | 36 | * the terms of any one of the MPL, the GPL or the LGPL. | ||
243 | 37 | * | ||
244 | 38 | * ***** END LICENSE BLOCK ***** */ | ||
245 | 39 | |||
246 | 40 | /* This file inhibits the screensaver when at least one Flash object exists in Firefox */ | ||
247 | 41 | |||
248 | 42 | var flashsaver = { | ||
249 | 43 | |||
250 | 44 | // Run this process to (dis)inhibit the screensaver | ||
251 | 45 | process: null, | ||
252 | 46 | // Number of currently-active Flash objects | ||
253 | 47 | count: 0, | ||
254 | 48 | // Location of the user's profile | ||
255 | 49 | profD: null, | ||
256 | 50 | |||
257 | 51 | init: function() { | ||
258 | 52 | window.removeEventListener("load", flashsaver, true); | ||
259 | 53 | |||
260 | 54 | try { | ||
261 | 55 | var exec = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); | ||
262 | 56 | |||
263 | 57 | const DIR_SERVICE = new Components.Constructor("@mozilla.org/file/directory_service;1","nsIProperties"); | ||
264 | 58 | |||
265 | 59 | flashsaver.profD = (new DIR_SERVICE()).get("ProfD", Components.interfaces.nsIFile).path; | ||
266 | 60 | |||
267 | 61 | exec.initWithPath( | ||
268 | 62 | flashsaver.profD + | ||
269 | 63 | "/extensions/ubufox@ubuntu.com/chrome/flashsaver.py" | ||
270 | 64 | ); | ||
271 | 65 | |||
272 | 66 | if (exec.exists()) { | ||
273 | 67 | flashsaver.process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess); | ||
274 | 68 | flashsaver.process.init(exec); | ||
275 | 69 | flashsaver.process.run(true, [ flashsaver.profD, 'init' ], 2); | ||
276 | 70 | }; | ||
277 | 71 | |||
278 | 72 | } catch (e) { | ||
279 | 73 | //alert("Error in flashsaver.init()"); alert(e); | ||
280 | 74 | }; | ||
281 | 75 | |||
282 | 76 | /* | ||
283 | 77 | THE FOLLOWING WAS TAKEN DIRECTLY FROM FLASHBLOCK 1.5.11a2 | ||
284 | 78 | |||
285 | 79 | To update this, copy the equivalent code from flashblock.js, then | ||
286 | 80 | replace all instances of 'flashblock/content/flashblock' | ||
287 | 81 | with 'ubufox/content/flashsaver' | ||
288 | 82 | */ | ||
289 | 83 | |||
290 | 84 | var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"] | ||
291 | 85 | .getService(Components.interfaces.nsIStyleSheetService); | ||
292 | 86 | var ios = Components.classes["@mozilla.org/network/io-service;1"] | ||
293 | 87 | .getService(Components.interfaces.nsIIOService); | ||
294 | 88 | var u = ios.newURI("chrome://ubufox/content/flashsaver.css", null, null); | ||
295 | 89 | if(!sss.sheetRegistered(u, sss.USER_SHEET)) { | ||
296 | 90 | sss.loadAndRegisterSheet(u, sss.USER_SHEET); | ||
297 | 91 | } | ||
298 | 92 | |||
299 | 93 | /* END BLATANT THEFT */ | ||
300 | 94 | |||
301 | 95 | |||
302 | 96 | }, | ||
303 | 97 | |||
304 | 98 | increment: function() { | ||
305 | 99 | if (flashsaver.process !== null && !flashsaver.count++) { | ||
306 | 100 | flashsaver.process.run(true, [ flashsaver.profD, 'inhibit' ], 2); | ||
307 | 101 | }; | ||
308 | 102 | }, | ||
309 | 103 | |||
310 | 104 | decrement: function() { | ||
311 | 105 | if (flashsaver.file !== null && !--flashsaver.count) { | ||
312 | 106 | flashsaver.process.run(true, [ flashsaver.profD, 'uninhibit' ], 2); | ||
313 | 107 | }; | ||
314 | 108 | }, | ||
315 | 109 | |||
316 | 110 | }; | ||
317 | 111 | |||
318 | 112 | window.addEventListener("load", flashsaver.init, true); | ||
319 | 113 | document.addEventListener("flashsaver-increment", flashsaver.increment, false, true); | ||
320 | 114 | document.addEventListener("flashsaver-decrement", flashsaver.decrement, false, true); | ||
321 | 0 | 115 | ||
322 | === added file 'content/flashsaver.xml' | |||
323 | --- content/flashsaver.xml 1970-01-01 00:00:00 +0000 | |||
324 | +++ content/flashsaver.xml 2009-05-25 02:40:30 +0000 | |||
325 | @@ -0,0 +1,74 @@ | |||
326 | 1 | <?xml version="1.0"?> | ||
327 | 2 | <!-- ***** BEGIN LICENSE BLOCK ***** | ||
328 | 3 | - Version: MPL 1.1/GPL 2.0/LGPL 2.1 | ||
329 | 4 | - | ||
330 | 5 | - The contents of this file are subject to the Mozilla Public License Version | ||
331 | 6 | - 1.1 (the "License"); you may not use this file except in compliance with | ||
332 | 7 | - the License. You may obtain a copy of the License at | ||
333 | 8 | - http://www.mozilla.org/MPL/ | ||
334 | 9 | - | ||
335 | 10 | - Software distributed under the License is distributed on an "AS IS" basis, | ||
336 | 11 | - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | ||
337 | 12 | - for the specific language governing rights and limitations under the | ||
338 | 13 | - License. | ||
339 | 14 | - | ||
340 | 15 | - The Original Code is ubufox. | ||
341 | 16 | - | ||
342 | 17 | - The Initial Developer of the Original Code is | ||
343 | 18 | - Canonical Ltd. | ||
344 | 19 | - Portions created by the Initial Developer are Copyright (C) 2008 | ||
345 | 20 | - the Initial Developer. All Rights Reserved. | ||
346 | 21 | - | ||
347 | 22 | - Contributor(s): | ||
348 | 23 | - Alexander Sack <asac@jwsdot.com> - Canonical Ltd. | ||
349 | 24 | - Arzhel Younsi <xionox@gmail.com> | ||
350 | 25 | - | ||
351 | 26 | - Alternatively, the contents of this file may be used under the terms of | ||
352 | 27 | - either the GNU General Public License Version 2 or later (the "GPL"), or | ||
353 | 28 | - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), | ||
354 | 29 | - in which case the provisions of the GPL or the LGPL are applicable instead | ||
355 | 30 | - of those above. If you wish to allow use of your version of this file only | ||
356 | 31 | - under the terms of either the GPL or the LGPL, and not to allow others to | ||
357 | 32 | - use your version of this file under the terms of the MPL, indicate your | ||
358 | 33 | - decision by deleting the provisions above and replace them with the notice | ||
359 | 34 | - and other provisions required by the GPL or the LGPL. If you do not delete | ||
360 | 35 | - the provisions above, a recipient may use your version of this file under | ||
361 | 36 | - the terms of any one of the MPL, the GPL or the LGPL. | ||
362 | 37 | - | ||
363 | 38 | - ***** END LICENSE BLOCK ***** --> | ||
364 | 39 | |||
365 | 40 | <bindings | ||
366 | 41 | xmlns="http://www.mozilla.org/xbl" | ||
367 | 42 | xmlns:html="http://www.w3.org/1999/xhtml" | ||
368 | 43 | > | ||
369 | 44 | |||
370 | 45 | <binding id="flash"> | ||
371 | 46 | <implementation> | ||
372 | 47 | <constructor><![CDATA[ | ||
373 | 48 | // The destructor won't fire when a tab is closed, so use an unload handler instead | ||
374 | 49 | function unloading(e) { | ||
375 | 50 | document.flashplayer_unloading = null; | ||
376 | 51 | var evt = document.createEvent("Events"); | ||
377 | 52 | evt.initEvent("flashsaver-decrement", true, false); | ||
378 | 53 | window.dispatchEvent(evt); | ||
379 | 54 | }; | ||
380 | 55 | window.addEventListener('beforeunload', unloading, false); | ||
381 | 56 | // Signal flashsaver.js to increment the counter | ||
382 | 57 | var evt = document.createEvent("Events"); | ||
383 | 58 | evt.initEvent("flashsaver-increment", true, false); | ||
384 | 59 | window.dispatchEvent(evt); | ||
385 | 60 | ]]> </constructor> | ||
386 | 61 | |||
387 | 62 | <destructor> <![CDATA[ | ||
388 | 63 | // If unloading() hasn't been called, signal flashsaver.js to decrement the counter | ||
389 | 64 | if ( ! ( 'flashplayer_unloading' in document ) ) { | ||
390 | 65 | var evt = document.createEvent("Events"); | ||
391 | 66 | evt.initEvent("flashsaver-decrement", true, false); | ||
392 | 67 | window.dispatchEvent(evt); | ||
393 | 68 | }; | ||
394 | 69 | |||
395 | 70 | ]]> </destructor> | ||
396 | 71 | </implementation> | ||
397 | 72 | </binding> | ||
398 | 73 | |||
399 | 74 | </bindings> | ||
400 | 0 | 75 | ||
401 | === added file 'content/flashsaver.xul' | |||
402 | --- content/flashsaver.xul 1970-01-01 00:00:00 +0000 | |||
403 | +++ content/flashsaver.xul 2009-05-25 02:40:30 +0000 | |||
404 | @@ -0,0 +1,44 @@ | |||
405 | 1 | <?xml version="1.0"?> | ||
406 | 2 | <!-- ***** BEGIN LICENSE BLOCK ***** | ||
407 | 3 | - Version: MPL 1.1/GPL 2.0/LGPL 2.1 | ||
408 | 4 | - | ||
409 | 5 | - The contents of this file are subject to the Mozilla Public License Version | ||
410 | 6 | - 1.1 (the "License"); you may not use this file except in compliance with | ||
411 | 7 | - the License. You may obtain a copy of the License at | ||
412 | 8 | - http://www.mozilla.org/MPL/ | ||
413 | 9 | - | ||
414 | 10 | - Software distributed under the License is distributed on an "AS IS" basis, | ||
415 | 11 | - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | ||
416 | 12 | - for the specific language governing rights and limitations under the | ||
417 | 13 | - License. | ||
418 | 14 | - | ||
419 | 15 | - The Original Code is ubufox. | ||
420 | 16 | - | ||
421 | 17 | - The Initial Developer of the Original Code is | ||
422 | 18 | - Canonical Ltd. | ||
423 | 19 | - Portions created by the Initial Developer are Copyright (C) 2008 | ||
424 | 20 | - the Initial Developer. All Rights Reserved. | ||
425 | 21 | - | ||
426 | 22 | - Contributor(s): | ||
427 | 23 | - Alexander Sack <asac@jwsdot.com> - Canonical Ltd. | ||
428 | 24 | - Arzhel Younsi <xionox@gmail.com> | ||
429 | 25 | - | ||
430 | 26 | - Alternatively, the contents of this file may be used under the terms of | ||
431 | 27 | - either the GNU General Public License Version 2 or later (the "GPL"), or | ||
432 | 28 | - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), | ||
433 | 29 | - in which case the provisions of the GPL or the LGPL are applicable instead | ||
434 | 30 | - of those above. If you wish to allow use of your version of this file only | ||
435 | 31 | - under the terms of either the GPL or the LGPL, and not to allow others to | ||
436 | 32 | - use your version of this file under the terms of the MPL, indicate your | ||
437 | 33 | - decision by deleting the provisions above and replace them with the notice | ||
438 | 34 | - and other provisions required by the GPL or the LGPL. If you do not delete | ||
439 | 35 | - the provisions above, a recipient may use your version of this file under | ||
440 | 36 | - the terms of any one of the MPL, the GPL or the LGPL. | ||
441 | 37 | - | ||
442 | 38 | - ***** END LICENSE BLOCK ***** --> | ||
443 | 39 | |||
444 | 40 | <!DOCTYPE overlay> | ||
445 | 41 | <overlay id="flashsaver-overlay" | ||
446 | 42 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> | ||
447 | 43 | <script type="application/x-javascript" src="chrome://ubufox/content/flashsaver.js" /> | ||
448 | 44 | </overlay> |
Adobe Flash doesn't currently inhibit the screensaver when playing a video: http:// bugs.adobe. com/jira/ browse/ FP-997? page=com. atlassian. jira.plugin. system. issuetabpanels: all-tabpanel).
There's no sign of activity in that bug report, and users are currently working around the bug on their own: http:// ubuntuforums. org/showthread. php?t=1090393
This branch includes a simple "flashsaver" which inhibits the screensaver when a Flash window is open. I think this is a better workaround, because it provides more granularity with less user involvement.
If you're interested in the principle, I'd be happy to look into further refinements. For example, the flashsaver could be toggled with a preference setting, or it could only inhibit the screensaver when there's a Flash application in the active window, or when a Flash application was the last thing the user clicked on.