use monitor constraint only if it is defined in the shell (GNOME >3.4)

This commit is contained in:
Olaf Leidinger 2013-11-05 02:32:46 +01:00
parent bb91e2a5c7
commit a6a3095e56

View File

@ -43,8 +43,12 @@ const TeaTimeFullscreenNotification = new Lang.Class({
// the center of itself // the center of itself
this._bin = new St.Bin({ x_align: St.Align.MIDDLE, y_align: St.Align.MIDDLE}); this._bin = new St.Bin({ x_align: St.Align.MIDDLE, y_align: St.Align.MIDDLE});
if (typeof Layout.MonitorConstraint != 'undefined') {
// MonitorConstraint was introduced in gnome-3.6
this._monitorConstraint = new Layout.MonitorConstraint(); this._monitorConstraint = new Layout.MonitorConstraint();
this._bin.add_constraint(this._monitorConstraint); this._bin.add_constraint(this._monitorConstraint);
}
Main.uiGroup.add_actor(this._bin); Main.uiGroup.add_actor(this._bin);
// a table imitating a vertical box layout to hold the texture and // a table imitating a vertical box layout to hold the texture and
@ -96,7 +100,9 @@ const TeaTimeFullscreenNotification = new Lang.Class({
this._texture.set_from_file(this._textureFiles[idx]); this._texture.set_from_file(this._textureFiles[idx]);
}, },
show: function() { show: function() {
if (typeof Layout.MonitorConstraint != 'undefined') {
this._monitorConstraint.index = global.screen.get_current_monitor() this._monitorConstraint.index = global.screen.get_current_monitor()
}
Main.pushModal(this._bin); Main.pushModal(this._bin);
this._timeline.start(); this._timeline.start();
this._lightbox.show(); this._lightbox.show();