From 62b0397482222d42fee37b0e3fcba897a0fbe948 Mon Sep 17 00:00:00 2001 From: Florian Müllner Date: Sep 05 2019 22:12:44 +0000 Subject: [PATCH 1/5] Remove some old compatibility code When adjusting to fractional scaling support, we didn't provide any compatibility with older versions. That means we require at least GNOME 3.32, so there is no point in keeping old compatibility code for versions before 3.14. https://pagure.io/background-logo-extension/pull-request/16 --- diff --git a/extension.js b/extension.js index 53a3115..a618819 100644 --- a/extension.js +++ b/extension.js @@ -197,10 +197,8 @@ class BackgroundLogo { let visible; if (this._settings.get_boolean('logo-always-visible')) visible = true; - else if (background._file) // > 3.14 + else if (background._file) visible = background._file.equal(file); - else if (background._filename) // <= 3.14 - visible = background._filename == file.get_path(); else // background == NONE visible = false; From 849358e11638557ec571ed8c9b5f21423f5adaaf Mon Sep 17 00:00:00 2001 From: Florian Müllner Date: Sep 05 2019 22:12:50 +0000 Subject: [PATCH 2/5] prefs: Adjust to GnomeDesktop API change The :filename property was changed to a (Gio.File) :file one. https://pagure.io/background-logo-extension/pull-request/16 --- diff --git a/prefs.js b/prefs.js index ef97251..b827ae2 100644 --- a/prefs.js +++ b/prefs.js @@ -137,7 +137,7 @@ class BackgroundLogoPrefsWidget extends Gtk.Grid { let file = Gio.File.new_for_commandline_arg(uri); if (uri.endsWith('.xml')) { - let slideShow = new GnomeDesktop.BGSlideShow({ filename: file.get_path() }); + let slideShow = new GnomeDesktop.BGSlideShow({ file }); slideShow.load(); let [progress_, duration_, isFixed_, filename1, filename2_] = From a5a6c2dd1e5690a2bc31d1bcabd939ce1939276a Mon Sep 17 00:00:00 2001 From: Florian Müllner Date: Sep 05 2019 22:12:57 +0000 Subject: [PATCH 3/5] Use implicit animations instead of Tweener gnome-shell replaced Tweener with implicit animations, which affects us as we are re-using the Background animation time: All animations are now defined in milliseconds instead of seconds, so we are now off by a factor of 1000. But instead of adjusting the time, switch to implicit animations like gnome-shell. https://pagure.io/background-logo-extension/pull-request/16 --- diff --git a/extension.js b/extension.js index a618819..276d0c4 100644 --- a/extension.js +++ b/extension.js @@ -21,7 +21,6 @@ const Background = imports.ui.background; const ExtensionUtils = imports.misc.extensionUtils; const Layout = imports.ui.layout; const Main = imports.ui.main; -const Tweener = imports.ui.tweener; var IconContainer = GObject.registerClass( class IconContainer extends St.Widget { @@ -202,10 +201,10 @@ class BackgroundLogo { else // background == NONE visible = false; - Tweener.addTween(this.actor, { + this.actor.ease({ opacity: visible ? 255 : 0, - time: Background.FADE_ANIMATION_TIME, - transition: 'easeOutQuad' + duration: Background.FADE_ANIMATION_TIME, + mode: Clutter.AnimationMode.EASE_OUT_QUAD, }); } From 83580b380141096d1a967b306ffc5b46de671ba1 Mon Sep 17 00:00:00 2001 From: Florian Müllner Date: Sep 05 2019 22:13:05 +0000 Subject: [PATCH 4/5] Turn BackgroundLogo itself into an actor This makes for a nice cleanup and - more importantly - will make it easier to mimick Meta.BackgroundActor as expected by gnome-shell. https://pagure.io/background-logo-extension/pull-request/16 --- diff --git a/extension.js b/extension.js index 276d0c4..255cab8 100644 --- a/extension.js +++ b/extension.js @@ -46,8 +46,9 @@ class IconContainer extends St.Widget { } }); -class BackgroundLogo { - constructor(bgManager) { +var BackgroundLogo = GObject.registerClass( +class BackgroundLogo extends St.Widget { + _init(bgManager) { this._bgManager = bgManager; this._monitorIndex = bgManager._monitorIndex; @@ -73,22 +74,22 @@ class BackgroundLogo { this._updateLogoTexture(); }); - this.actor = new St.Widget({ + super._init({ layout_manager: new Clutter.BinLayout(), opacity: 0 }); - bgManager._container.add_actor(this.actor); + bgManager._container.add_actor(this); - this.actor.connect('destroy', this._onDestroy.bind(this)); + this.connect('destroy', this._onDestroy.bind(this)); let constraint = new Layout.MonitorConstraint({ index: this._monitorIndex, work_area: true }); - this.actor.add_constraint(constraint); + this.add_constraint(constraint); this._bin = new IconContainer({ x_expand: true, y_expand: true }); - this.actor.add_actor(this._bin); + this.add_actor(this._bin); this._bin.connect('notify::resource-scale', this._updateLogoTexture.bind(this)); @@ -185,7 +186,7 @@ class BackgroundLogo { _updateBorder() { let border = this._settings.get_uint('logo-border'); - this.actor.style = 'padding: %dpx;'.format(border); + this.style = 'padding: %dpx;'.format(border); } _updateVisibility() { @@ -201,7 +202,7 @@ class BackgroundLogo { else // background == NONE visible = false; - this.actor.ease({ + this.ease({ opacity: visible ? 255 : 0, duration: Background.FADE_ANIMATION_TIME, mode: Clutter.AnimationMode.EASE_OUT_QUAD, @@ -216,7 +217,7 @@ class BackgroundLogo { this._bgManager.backgroundActor.connect('destroy', this._backgroundDestroyed.bind(this)); else // bgManager destroyed - this.actor.destroy(); + this.destroy(); } _onDestroy() { @@ -235,7 +236,7 @@ class BackgroundLogo { this._logoFile = null; } -} +}); class Extension { @@ -254,7 +255,7 @@ class Extension { this._destroyLogo(); this._forEachBackgroundManager(bgManager => { let logo = new BackgroundLogo(bgManager); - logo.actor.connect('destroy', () => { + logo.connect('destroy', () => { this._logos.delete(logo); }); this._logos.add(logo); @@ -262,7 +263,7 @@ class Extension { } _destroyLogo() { - this._logos.forEach(l => l.actor.destroy()); + this._logos.forEach(l => l.destroy()); } enable() { From f2e4c6e2efbf2abbe2ef2aac6f1e2a16d536eb87 Mon Sep 17 00:00:00 2001 From: Florian Müllner Date: Sep 05 2019 22:13:10 +0000 Subject: [PATCH 5/5] Provide Meta.BackgroundActor compatibility We add ourselves to the background group, so gnome-shell will try to animate the 'brightness' and 'vignette-sharpness' properties when entering the overview (assuming all background actors are Meta.BackgroundActors). In the past this caused a harmless warning, but after dropping Tweener for animations, we now trigger an error that messes up the overview. Fix this by providing the same properties as Meta.BackgroundActor. https://pagure.io/background-logo-extension/pull-request/16 --- diff --git a/extension.js b/extension.js index 255cab8..fc4a041 100644 --- a/extension.js +++ b/extension.js @@ -46,8 +46,19 @@ class IconContainer extends St.Widget { } }); -var BackgroundLogo = GObject.registerClass( -class BackgroundLogo extends St.Widget { +var BackgroundLogo = GObject.registerClass({ + Properties: { + // For compatibility with Meta.BackgroundActor + 'brightness': GObject.ParamSpec.double( + 'brightness', 'brightness', 'brightness', + GObject.ParamFlags.READWRITE, + 0, 1, 1), + 'vignette-sharpness': GObject.ParamSpec.double( + 'vignette-sharpness', 'vignette-sharpness', 'vignette-sharpness', + GObject.ParamFlags.READWRITE, + 0, 1, 0), + }, +}, class BackgroundLogo extends St.Widget { _init(bgManager) { this._bgManager = bgManager; this._monitorIndex = bgManager._monitorIndex;