nativeWindowPlacement: Handle captions-on-top settings changes

Currently the injection to move title captions to the top depends on
the value of the setting at the time the extension is enabled.
Instead, do the injections unconditionally and query the setting
inside the function to pick up settings changes.

https://bugzilla.gnome.org/show_bug.cgi?id=787934
This commit is contained in:
Florian Müllner
2017-09-20 02:35:12 +02:00
parent 97d1cbca19
commit 778eebc421

View File

@@ -91,7 +91,6 @@ function enable() {
let settings = Convenience.getSettings();
let useMoreScreen = settings.get_boolean('use-more-screen');
let windowCaptionsOnTop = settings.get_boolean('window-captions-on-top');
let signalId = settings.connect('changed::use-more-screen', function() {
useMoreScreen = settings.get_boolean('use-more-screen');
});
@@ -370,15 +369,15 @@ function enable() {
/// position window titles on top of windows in overlay ////
if (windowCaptionsOnTop) {
winInjections['relayout'] = Workspace.WindowOverlay.prototype.relayout;
Workspace.WindowOverlay.prototype.relayout = function(animate) {
winInjections['relayout'] = Workspace.WindowOverlay.prototype.relayout;
Workspace.WindowOverlay.prototype.relayout = function(animate) {
if (settings.get_boolean('window-captions-on-top')) {
let [, , , cloneHeight] = this._windowClone.slot;
this.title.translation_y = -cloneHeight;
}
winInjections['relayout'].call(this, animate);
};
}
winInjections['relayout'].call(this, animate);
};
}
function removeInjection(object, injection, name) {