workspace: Move decision to show/hide chrome to clone
Currently the chrome layer decides itself which events on the window clone should show or hide the chrome, which makes it harder to extent. Instead, move the decision to the window clone by letting it emit show/hide-chrome events when appropriate. https://bugzilla.gnome.org/show_bug.cgi?id=783953
This commit is contained in:
parent
1218e68b93
commit
6816aea906
@ -157,6 +157,12 @@ var WindowClone = new Lang.Class({
|
|||||||
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||||
this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPress));
|
this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPress));
|
||||||
|
|
||||||
|
this.actor.connect('enter-event', () => { this.emit('show-chrome'); });
|
||||||
|
this.actor.connect('key-focus-in', () => { this.emit('show-chrome'); });
|
||||||
|
|
||||||
|
this.actor.connect('leave-event', () => { this.emit('hide-chrome'); });
|
||||||
|
this.actor.connect('key-focus-out', () => { this.emit('hide-chrome'); });
|
||||||
|
|
||||||
this._draggable = DND.makeDraggable(this.actor,
|
this._draggable = DND.makeDraggable(this.actor,
|
||||||
{ restoreOnSuccess: true,
|
{ restoreOnSuccess: true,
|
||||||
manualMode: true,
|
manualMode: true,
|
||||||
@ -454,14 +460,8 @@ var WindowOverlay = new Lang.Class({
|
|||||||
button.connect('clicked', Lang.bind(this, this._closeWindow));
|
button.connect('clicked', Lang.bind(this, this._closeWindow));
|
||||||
|
|
||||||
windowClone.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
windowClone.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||||
windowClone.actor.connect('enter-event',
|
windowClone.connect('show-chrome', Lang.bind(this, this._onShowChrome));
|
||||||
Lang.bind(this, this._onEnter));
|
windowClone.connect('hide-chrome', Lang.bind(this, this._onHideChrome));
|
||||||
windowClone.actor.connect('leave-event',
|
|
||||||
Lang.bind(this, this._onLeave));
|
|
||||||
windowClone.actor.connect('key-focus-in',
|
|
||||||
Lang.bind(this, this._onEnter));
|
|
||||||
windowClone.actor.connect('key-focus-out',
|
|
||||||
Lang.bind(this, this._onLeave));
|
|
||||||
|
|
||||||
this._windowAddedId = 0;
|
this._windowAddedId = 0;
|
||||||
|
|
||||||
@ -651,25 +651,23 @@ var WindowOverlay = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_onEnter: function() {
|
_onShowChrome: function() {
|
||||||
// We might get enter events on the clone while the overlay is
|
// We might get enter events on the clone while the overlay is
|
||||||
// hidden, e.g. during animations, we ignore these events,
|
// hidden, e.g. during animations, we ignore these events,
|
||||||
// as the close button will be shown as needed when the overlays
|
// as the close button will be shown as needed when the overlays
|
||||||
// are shown again
|
// are shown again
|
||||||
if (this._hidden)
|
if (this._hidden)
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return;
|
||||||
|
|
||||||
this._animateVisible();
|
this._animateVisible();
|
||||||
this.emit('show-close-button');
|
this.emit('show-close-button');
|
||||||
return Clutter.EVENT_PROPAGATE;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_onLeave: function() {
|
_onHideChrome: function() {
|
||||||
if (this._idleToggleCloseId == 0) {
|
if (this._idleToggleCloseId == 0) {
|
||||||
this._idleToggleCloseId = Mainloop.timeout_add(750, Lang.bind(this, this._idleToggleCloseButton));
|
this._idleToggleCloseId = Mainloop.timeout_add(750, Lang.bind(this, this._idleToggleCloseButton));
|
||||||
GLib.Source.set_name_by_id(this._idleToggleCloseId, '[gnome-shell] this._idleToggleCloseButton');
|
GLib.Source.set_name_by_id(this._idleToggleCloseId, '[gnome-shell] this._idleToggleCloseButton');
|
||||||
}
|
}
|
||||||
return Clutter.EVENT_PROPAGATE;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_idleToggleCloseButton: function() {
|
_idleToggleCloseButton: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user