From ec6facb9e76c916b3faa78af568424694c8da133 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Wed, 26 Feb 2014 14:35:38 -0500 Subject: [PATCH] background: always copy background content when loading into cache Copying is actually a lightweight operation, so trying to avoid it just adds code complexity for little gain. Based on work from Jasper St. Pierre https://bugzilla.gnome.org/show_bug.cgi?id=722149 --- js/ui/background.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/js/ui/background.js b/js/ui/background.js index 3a7541cb5..3fe279dd5 100644 --- a/js/ui/background.js +++ b/js/ui/background.js @@ -143,8 +143,7 @@ const BackgroundCache = new Lang.Class({ for (let i = 0; i < this._pendingFileLoads.length; i++) { if (this._pendingFileLoads[i].filename == params.filename && this._pendingFileLoads[i].style == params.style) { - this._pendingFileLoads[i].callers.push({ shouldCopy: true, - monitorIndex: params.monitorIndex, + this._pendingFileLoads[i].callers.push({ monitorIndex: params.monitorIndex, effects: params.effects, onFinished: params.onFinished }); return; @@ -153,14 +152,11 @@ const BackgroundCache = new Lang.Class({ this._pendingFileLoads.push({ filename: params.filename, style: params.style, - callers: [{ shouldCopy: false, - monitorIndex: params.monitorIndex, + callers: [{ monitorIndex: params.monitorIndex, effects: params.effects, onFinished: params.onFinished }] }); - let content = new Meta.Background({ meta_screen: global.screen, - monitor: params.monitorIndex, - effects: params.effects }); + let content = new Meta.Background({ meta_screen: global.screen }); content.load_file_async(params.filename, params.style, @@ -171,7 +167,6 @@ const BackgroundCache = new Lang.Class({ content.load_file_finish(result); this._monitorFile(params.filename); - this._images.push(content); } catch(e) { content = null; } @@ -186,12 +181,10 @@ const BackgroundCache = new Lang.Class({ if (pendingLoad.callers[j].onFinished) { let newContent; - if (content && pendingLoad.callers[j].shouldCopy) { + if (content) { newContent = content.copy(pendingLoad.callers[j].monitorIndex, pendingLoad.callers[j].effects); this._images.push(newContent); - } else { - newContent = content; } pendingLoad.callers[j].onFinished(newContent);