From 606cc791271e79a3be95c8d2947b5c07a0252cc4 Mon Sep 17 00:00:00 2001 From: Paolo Inaudi Date: Wed, 29 Oct 2014 02:05:51 +0100 Subject: [PATCH] Provide compatibility for gnome-shell 3.14 --- CoverflowAltTab@dmo60.de/extension.js | 7 ++- CoverflowAltTab@dmo60.de/metadata.json | 2 +- CoverflowAltTab@dmo60.de/platform.js | 62 +++++++++++++++++++++++++- 3 files changed, 67 insertions(+), 4 deletions(-) diff --git a/CoverflowAltTab@dmo60.de/extension.js b/CoverflowAltTab@dmo60.de/extension.js index 0c2ded2..c6d5b44 100644 --- a/CoverflowAltTab@dmo60.de/extension.js +++ b/CoverflowAltTab@dmo60.de/extension.js @@ -41,8 +41,11 @@ function enable() { else platform = new Platform.PlatformCinnamon18(); keybinder = HAS_META_KEYBIND_API ? new Keybinder.KeybinderNewApi() : new Keybinder.KeybinderOldApi(); - } else { - if(parseInt(PACKAGE_VERSION.split(".")[1]) >= 10 && PACKAGE_VERSION >= "3.10.0") { + } else { + if(parseInt(PACKAGE_VERSION.split(".")[1]) >= 14 && PACKAGE_VERSION >= "3.14.0") { + platform = new Platform.PlatformGnomeShell314(); + keybinder = new Keybinder.KeybinderNewGSApi(); + } else if(parseInt(PACKAGE_VERSION.split(".")[1]) >= 10 && PACKAGE_VERSION >= "3.10.0") { platform = new Platform.PlatformGnomeShell310(); keybinder = new Keybinder.KeybinderNewGSApi(); } else if(PACKAGE_VERSION >= "3.8.0") { diff --git a/CoverflowAltTab@dmo60.de/metadata.json b/CoverflowAltTab@dmo60.de/metadata.json index 07e8707..f4cbe39 100644 --- a/CoverflowAltTab@dmo60.de/metadata.json +++ b/CoverflowAltTab@dmo60.de/metadata.json @@ -1,6 +1,6 @@ { "cinnamon-version": ["1.2", "1.4", "1.6", "1.8"], - "shell-version": ["3.4", "3.6", "3.8", "3.10", "3.12"], + "shell-version": ["3.4", "3.6", "3.8", "3.10", "3.12", "3.14"], "uuid": "CoverflowAltTab@dmo60.de", "name": "Coverflow Alt-Tab", "description": "Replacement of Alt-Tab, iterates through windows in a cover-flow manner.", diff --git a/CoverflowAltTab@dmo60.de/platform.js b/CoverflowAltTab@dmo60.de/platform.js index 1abffb1..7d5cdae 100644 --- a/CoverflowAltTab@dmo60.de/platform.js +++ b/CoverflowAltTab@dmo60.de/platform.js @@ -439,7 +439,6 @@ PlatformGnomeShell310.prototype = { let backgrounds = this._backgroundGroup.get_children(); for (let i = 0; i < backgrounds.length; i++) { let background = backgrounds[i]._delegate; - Tweener.addTween(background, { brightness: this.getSettings().dim_factor, time: this.getSettings().animation_time, @@ -454,7 +453,67 @@ PlatformGnomeShell310.prototype = { let backgrounds = this._backgroundGroup.get_children(); for (let i = 0; i < backgrounds.length; i++) { let background = backgrounds[i]._delegate; + Tweener.addTween(background, + { brightness: 1.0, + time: this.getSettings().animation_time, + transition: TRANSITION_TYPE, + onComplete: onCompleteBind, + }); + } + }, + + removeBackground: function() { + Main.uiGroup.remove_child(this._backgroundGroup); + } +}; + + +function PlatformGnomeShell314() { + this._init.apply(this, arguments); +} + +PlatformGnomeShell314.prototype = { + __proto__: PlatformGnomeShell.prototype, + + _init: function() { + PlatformGnomeShell.prototype._init.apply(this, arguments); + }, + + getPrimaryModifier: function(mask) { + return imports.ui.switcherPopup.primaryModifier(mask); + }, + + initBackground: function() { + let Background = imports.ui.background; + + this._backgroundGroup = new Meta.BackgroundGroup(); + Main.uiGroup.add_child(this._backgroundGroup); + this._backgroundGroup.lower_bottom(); + this._backgroundGroup.hide(); + for (let i = 0; i < Main.layoutManager.monitors.length; i++) { + new Background.BackgroundManager({ container: this._backgroundGroup, + monitorIndex: i, }); + } + }, + + dimBackground: function() { + this._backgroundGroup.show(); + let backgrounds = this._backgroundGroup.get_children(); + for (let i = 0; i < backgrounds.length; i++) { + let background = backgrounds[i]; + Tweener.addTween(background, + { brightness: this.getSettings().dim_factor, + time: this.getSettings().animation_time, + transition: TRANSITION_TYPE + }); + } + }, + + undimBackground: function(onCompleteBind) { + let backgrounds = this._backgroundGroup.get_children(); + for (let i = 0; i < backgrounds.length; i++) { + let background = backgrounds[i]; Tweener.addTween(background, { brightness: 1.0, time: this.getSettings().animation_time, @@ -468,3 +527,4 @@ PlatformGnomeShell310.prototype = { Main.uiGroup.remove_child(this._backgroundGroup); } }; +