messageTray: Take over trayBox from LayoutManager
Since commit e189a34
, the trayBox uses a Contraint to cover the primary
monitor's work area. This allows banners to be clipped so they don't
leak into monitors above the primary one during animations. However even
without being reactive, the trayBox now interferes with operations like
Looking Glass' object picker and overview DND.
With the trayBox no longer being positioned manually, there's no strong
reason to keep it in LayoutManager, and handling it in MessageTray allows
to hide the actor while no banner is showing, which helps with the issue
outlined above.
https://bugzilla.gnome.org/show_bug.cgi?id=744912
This commit is contained in:
parent
5f5dc8327f
commit
b3a96f2f6c
@ -236,11 +236,6 @@ const LayoutManager = new Lang.Class({
|
|||||||
this.panelBox.connect('allocation-changed',
|
this.panelBox.connect('allocation-changed',
|
||||||
Lang.bind(this, this._panelBoxChanged));
|
Lang.bind(this, this._panelBoxChanged));
|
||||||
|
|
||||||
this.trayBox = new St.Widget({ name: 'trayBox',
|
|
||||||
clip_to_allocation: true,
|
|
||||||
layout_manager: new Clutter.BinLayout() });
|
|
||||||
this.addChrome(this.trayBox, { affectsInputRegion: false });
|
|
||||||
|
|
||||||
this.modalDialogGroup = new St.Widget({ name: 'modalDialogGroup',
|
this.modalDialogGroup = new St.Widget({ name: 'modalDialogGroup',
|
||||||
layout_manager: new Clutter.BinLayout() });
|
layout_manager: new Clutter.BinLayout() });
|
||||||
this.uiGroup.add_actor(this.modalDialogGroup);
|
this.uiGroup.add_actor(this.modalDialogGroup);
|
||||||
@ -284,12 +279,6 @@ const LayoutManager = new Lang.Class({
|
|||||||
init: function() {
|
init: function() {
|
||||||
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
|
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
|
||||||
|
|
||||||
let trayConstraint = new MonitorConstraint({ primary: true, work_area: true });
|
|
||||||
this.trayBox.add_constraint(trayConstraint);
|
|
||||||
this.panelBox.bind_property('visible', trayConstraint, 'work-area',
|
|
||||||
GObject.BindingFlags.SYNC_CREATE);
|
|
||||||
|
|
||||||
|
|
||||||
this._loadBackground();
|
this._loadBackground();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -599,7 +588,6 @@ const LayoutManager = new Lang.Class({
|
|||||||
// the UI group to get the correct allocation for the struts.
|
// the UI group to get the correct allocation for the struts.
|
||||||
this._updateRegions();
|
this._updateRegions();
|
||||||
|
|
||||||
this.trayBox.hide();
|
|
||||||
this.keyboardBox.hide();
|
this.keyboardBox.hide();
|
||||||
|
|
||||||
let monitor = this.primaryMonitor;
|
let monitor = this.primaryMonitor;
|
||||||
@ -666,7 +654,6 @@ const LayoutManager = new Lang.Class({
|
|||||||
|
|
||||||
this._startingUp = false;
|
this._startingUp = false;
|
||||||
|
|
||||||
this.trayBox.show();
|
|
||||||
this.keyboardBox.show();
|
this.keyboardBox.show();
|
||||||
|
|
||||||
if (!Main.sessionMode.isGreeter) {
|
if (!Main.sessionMode.isGreeter) {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
const GLib = imports.gi.GLib;
|
const GLib = imports.gi.GLib;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
|
const GObject = imports.gi.GObject;
|
||||||
const Gtk = imports.gi.Gtk;
|
const Gtk = imports.gi.Gtk;
|
||||||
const Atk = imports.gi.Atk;
|
const Atk = imports.gi.Atk;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
@ -15,6 +16,7 @@ const St = imports.gi.St;
|
|||||||
|
|
||||||
const Calendar = imports.ui.calendar;
|
const Calendar = imports.ui.calendar;
|
||||||
const GnomeSession = imports.misc.gnomeSession;
|
const GnomeSession = imports.misc.gnomeSession;
|
||||||
|
const Layout = imports.ui.layout;
|
||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const Params = imports.misc.params;
|
const Params = imports.misc.params;
|
||||||
const Tweener = imports.ui.tweener;
|
const Tweener = imports.ui.tweener;
|
||||||
@ -1494,19 +1496,30 @@ const MessageTray = new Lang.Class({
|
|||||||
global.sync_pointer();
|
global.sync_pointer();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.actor = new St.Widget({ name: 'notification-container',
|
this.actor = new St.Widget({ visible: false,
|
||||||
reactive: true,
|
clip_to_allocation: true,
|
||||||
track_hover: true,
|
|
||||||
y_align: Clutter.ActorAlign.START,
|
|
||||||
x_align: Clutter.ActorAlign.CENTER,
|
|
||||||
y_expand: true,
|
|
||||||
x_expand: true,
|
|
||||||
layout_manager: new Clutter.BinLayout() });
|
layout_manager: new Clutter.BinLayout() });
|
||||||
this.actor.connect('key-release-event', Lang.bind(this, this._onNotificationKeyRelease));
|
let constraint = new Layout.MonitorConstraint({ primary: true });
|
||||||
this.actor.connect('notify::hover', Lang.bind(this, this._onNotificationHoverChanged));
|
Main.layoutManager.panelBox.bind_property('visible',
|
||||||
|
constraint, 'work-area',
|
||||||
|
GObject.BindingFlags.SYNC_CREATE);
|
||||||
|
this.actor.add_constraint(constraint);
|
||||||
|
|
||||||
this.actor.hide();
|
this._bannerBin = new St.Widget({ name: 'notification-container',
|
||||||
this._notificationFocusGrabber = new FocusGrabber(this.actor);
|
reactive: true,
|
||||||
|
track_hover: true,
|
||||||
|
y_align: Clutter.ActorAlign.START,
|
||||||
|
x_align: Clutter.ActorAlign.CENTER,
|
||||||
|
y_expand: true,
|
||||||
|
x_expand: true,
|
||||||
|
layout_manager: new Clutter.BinLayout() });
|
||||||
|
this._bannerBin.connect('key-release-event',
|
||||||
|
Lang.bind(this, this._onNotificationKeyRelease));
|
||||||
|
this._bannerBin.connect('notify::hover',
|
||||||
|
Lang.bind(this, this._onNotificationHoverChanged));
|
||||||
|
this.actor.add_actor(this._bannerBin);
|
||||||
|
|
||||||
|
this._notificationFocusGrabber = new FocusGrabber(this._bannerBin);
|
||||||
this._notificationQueue = [];
|
this._notificationQueue = [];
|
||||||
this._notification = null;
|
this._notification = null;
|
||||||
this._banner = null;
|
this._banner = null;
|
||||||
@ -1525,7 +1538,7 @@ const MessageTray = new Lang.Class({
|
|||||||
// state of the pointer when a notification pops up.
|
// state of the pointer when a notification pops up.
|
||||||
this._pointerInNotification = false;
|
this._pointerInNotification = false;
|
||||||
|
|
||||||
// This tracks this.actor.hover and is used to fizzle
|
// This tracks this._bannerBin.hover and is used to fizzle
|
||||||
// out non-changing hover notifications in onNotificationHoverChanged.
|
// out non-changing hover notifications in onNotificationHoverChanged.
|
||||||
this._notificationHovered = false;
|
this._notificationHovered = false;
|
||||||
|
|
||||||
@ -1535,8 +1548,8 @@ const MessageTray = new Lang.Class({
|
|||||||
|
|
||||||
this.clearableCount = 0;
|
this.clearableCount = 0;
|
||||||
|
|
||||||
Main.layoutManager.trayBox.add_actor(this.actor);
|
Main.layoutManager.addChrome(this.actor, { affectsInputRegion: false });
|
||||||
Main.layoutManager.trackChrome(this.actor, { affectsInputRegion: true });
|
Main.layoutManager.trackChrome(this._bannerBin, { affectsInputRegion: true });
|
||||||
|
|
||||||
global.screen.connect('in-fullscreen-changed', Lang.bind(this, this._updateState));
|
global.screen.connect('in-fullscreen-changed', Lang.bind(this, this._updateState));
|
||||||
|
|
||||||
@ -1704,10 +1717,10 @@ const MessageTray = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_onNotificationHoverChanged: function() {
|
_onNotificationHoverChanged: function() {
|
||||||
if (this.actor.hover == this._notificationHovered)
|
if (this._bannerBin.hover == this._notificationHovered)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._notificationHovered = this.actor.hover;
|
this._notificationHovered = this._bannerBin.hover;
|
||||||
if (this._notificationHovered) {
|
if (this._notificationHovered) {
|
||||||
this._resetNotificationLeftTimeout();
|
this._resetNotificationLeftTimeout();
|
||||||
|
|
||||||
@ -1721,7 +1734,7 @@ const MessageTray = new Lang.Class({
|
|||||||
// automatically. Instead, the user is able to expand the notification by mousing away from it and then
|
// automatically. Instead, the user is able to expand the notification by mousing away from it and then
|
||||||
// mousing back in. Because this is an expected action, we set the boolean flag that indicates that a longer
|
// mousing back in. Because this is an expected action, we set the boolean flag that indicates that a longer
|
||||||
// timeout should be used before popping down the notification.
|
// timeout should be used before popping down the notification.
|
||||||
if (this.actor.contains(actorAtShowNotificationPosition)) {
|
if (this._bannerBin.contains(actorAtShowNotificationPosition)) {
|
||||||
this._useLongerNotificationLeftTimeout = true;
|
this._useLongerNotificationLeftTimeout = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1877,7 +1890,7 @@ const MessageTray = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_clampOpacity: function() {
|
_clampOpacity: function() {
|
||||||
this.actor.opacity = Math.max(0, Math.min(this.actor._opacity, 255));
|
this._bannerBin.opacity = Math.max(0, Math.min(this._bannerBin._opacity, 255));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onIdleMonitorBecameActive: function() {
|
_onIdleMonitorBecameActive: function() {
|
||||||
@ -1908,11 +1921,11 @@ const MessageTray = new Lang.Class({
|
|||||||
this._updateState();
|
this._updateState();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.actor.add_actor(this._banner.actor);
|
this._bannerBin.add_actor(this._banner.actor);
|
||||||
|
|
||||||
this.actor._opacity = 0;
|
this._bannerBin._opacity = 0;
|
||||||
this.actor.opacity = 0;
|
this._bannerBin.opacity = 0;
|
||||||
this.actor.y = -this._banner.actor.height;
|
this._bannerBin.y = -this._banner.actor.height;
|
||||||
this.actor.show();
|
this.actor.show();
|
||||||
|
|
||||||
this._updateShowingNotification();
|
this._updateShowingNotification();
|
||||||
@ -1965,7 +1978,7 @@ const MessageTray = new Lang.Class({
|
|||||||
onCompleteScope: this
|
onCompleteScope: this
|
||||||
};
|
};
|
||||||
|
|
||||||
this._tween(this.actor, '_notificationState', State.SHOWN, tweenParams);
|
this._tween(this._bannerBin, '_notificationState', State.SHOWN, tweenParams);
|
||||||
},
|
},
|
||||||
|
|
||||||
_showNotificationCompleted: function() {
|
_showNotificationCompleted: function() {
|
||||||
@ -2025,8 +2038,8 @@ const MessageTray = new Lang.Class({
|
|||||||
this._resetNotificationLeftTimeout();
|
this._resetNotificationLeftTimeout();
|
||||||
|
|
||||||
if (animate) {
|
if (animate) {
|
||||||
this._tween(this.actor, '_notificationState', State.HIDDEN,
|
this._tween(this._bannerBin, '_notificationState', State.HIDDEN,
|
||||||
{ y: -this.actor.height,
|
{ y: -this._bannerBin.height,
|
||||||
_opacity: 0,
|
_opacity: 0,
|
||||||
time: ANIMATION_TIME,
|
time: ANIMATION_TIME,
|
||||||
transition: 'easeOutBack',
|
transition: 'easeOutBack',
|
||||||
@ -2036,9 +2049,9 @@ const MessageTray = new Lang.Class({
|
|||||||
onCompleteScope: this
|
onCompleteScope: this
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Tweener.removeTweens(this.actor);
|
Tweener.removeTweens(this._bannerBin);
|
||||||
this.actor.y = -this.actor.height;
|
this._bannerBin.y = -this._bannerBin.height;
|
||||||
this.actor.opacity = 0;
|
this._bannerBin.opacity = 0;
|
||||||
this._notificationState = State.HIDDEN;
|
this._notificationState = State.HIDDEN;
|
||||||
this._hideNotificationCompleted();
|
this._hideNotificationCompleted();
|
||||||
}
|
}
|
||||||
@ -2054,7 +2067,7 @@ const MessageTray = new Lang.Class({
|
|||||||
this._notificationRemoved = false;
|
this._notificationRemoved = false;
|
||||||
|
|
||||||
if (notification.resident)
|
if (notification.resident)
|
||||||
this.actor.remove_actor(this._banner.actor);
|
this._bannerBin.remove_actor(this._banner.actor);
|
||||||
else
|
else
|
||||||
this._banner.actor.destroy();
|
this._banner.actor.destroy();
|
||||||
this._banner = null;
|
this._banner = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user