From 6700f8614507a257878b3ff732b2cbbb2df63b56 Mon Sep 17 00:00:00 2001 From: Adel Gadllah Date: Thu, 7 Jun 2012 00:20:23 +0200 Subject: [PATCH] LayoutManager: Add primary-fullscreen-changed signal Add a signal to the LayoutManager which gets emitted once the primary monitor enters or leaves the fullscreen state. https://bugzilla.gnome.org/show_bug.cgi?id=677590 --- js/ui/layout.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/js/ui/layout.js b/js/ui/layout.js index 66bf995b9..6351ad9eb 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -53,6 +53,10 @@ const LayoutManager = new Lang.Class({ global.screen.connect('monitors-changed', Lang.bind(this, this._monitorsChanged)); this._monitorsChanged(); + + this._chrome.connect('primary-fullscreen-changed', Lang.bind(this, function(chrome, state) { + this.emit('primary-fullscreen-changed', state); + })); }, // This is called by Main after everything else is constructed; @@ -852,6 +856,8 @@ const Chrome = new Lang.Class({ for (let i = 0; i < this._monitors.length; i++) wasInFullscreen[i] = this._monitors[i].inFullscreen; + let primaryWasInFullscreen = this._primaryMonitor.inFullscreen; + this._updateFullscreen(); let changed = false; @@ -861,10 +867,15 @@ const Chrome = new Lang.Class({ break; } } + if (changed) { this._updateVisibility(); this._queueUpdateRegions(); } + + if (primaryWasInFullscreen != this._primaryMonitor.inFullscreen) { + this.emit('primary-fullscreen-changed', this._primaryMonitor.inFullscreen); + } }, updateRegions: function() { @@ -979,3 +990,5 @@ const Chrome = new Lang.Class({ return false; } }); + +Signals.addSignalMethods(Chrome.prototype);