Switch to confirm dialog when closing
Some applications show a confirm dialog before closing, which the close button happily ignores. Detect newly created windows which are transient for the window we try to close and switch to them. https://bugzilla.gnome.org/show_bug.cgi?id=602532
This commit is contained in:
parent
1cc78fdf60
commit
efc291ac5b
@ -336,6 +336,7 @@ WindowOverlay.prototype = {
|
|||||||
Lang.bind(this, this._onStyleChanged));
|
Lang.bind(this, this._onStyleChanged));
|
||||||
button._overlap = 0;
|
button._overlap = 0;
|
||||||
|
|
||||||
|
windowClone.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||||
windowClone.actor.connect('notify::allocation',
|
windowClone.actor.connect('notify::allocation',
|
||||||
Lang.bind(this, this._positionItems));
|
Lang.bind(this, this._positionItems));
|
||||||
windowClone.actor.connect('enter-event',
|
windowClone.actor.connect('enter-event',
|
||||||
@ -345,10 +346,9 @@ WindowOverlay.prototype = {
|
|||||||
|
|
||||||
this._idleToggleCloseId = 0;
|
this._idleToggleCloseId = 0;
|
||||||
button.connect('button-release-event',
|
button.connect('button-release-event',
|
||||||
Lang.bind(this, function(actor, event) {
|
Lang.bind(this, this._closeWindow));
|
||||||
metaWindow.delete(event.get_time());
|
|
||||||
}));
|
|
||||||
|
|
||||||
|
this._windowAddedId = 0;
|
||||||
windowClone.connect('zoom-start', Lang.bind(this, this.hide));
|
windowClone.connect('zoom-start', Lang.bind(this, this.hide));
|
||||||
windowClone.connect('zoom-end', Lang.bind(this, this.show));
|
windowClone.connect('zoom-end', Lang.bind(this, this.show));
|
||||||
|
|
||||||
@ -380,15 +380,6 @@ WindowOverlay.prototype = {
|
|||||||
transition: "easeOutQuad" });
|
transition: "easeOutQuad" });
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
|
||||||
if (this._idleToggleCloseId > 0) {
|
|
||||||
Mainloop.source_remove(this._idleToggleCloseId);
|
|
||||||
this._idleToggleCloseId = 0;
|
|
||||||
}
|
|
||||||
this.title.destroy();
|
|
||||||
this.closeButton.destroy();
|
|
||||||
},
|
|
||||||
|
|
||||||
chromeWidth: function () {
|
chromeWidth: function () {
|
||||||
return this.closeButton.width - this.closeButton._overlap;
|
return this.closeButton.width - this.closeButton._overlap;
|
||||||
},
|
},
|
||||||
@ -418,6 +409,47 @@ WindowOverlay.prototype = {
|
|||||||
title.set_position(Math.floor(titleX), Math.floor(titleY));
|
title.set_position(Math.floor(titleX), Math.floor(titleY));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_closeWindow: function(actor, event) {
|
||||||
|
let metaWindow = this._windowClone.metaWindow;
|
||||||
|
this._workspace = metaWindow.get_workspace();
|
||||||
|
|
||||||
|
this._windowAddedId = this._workspace.connect('window-added',
|
||||||
|
Lang.bind(this,
|
||||||
|
this._onWindowAdded));
|
||||||
|
|
||||||
|
metaWindow.delete(event.get_time());
|
||||||
|
},
|
||||||
|
|
||||||
|
_onWindowAdded: function(workspace, win) {
|
||||||
|
let metaWindow = this._windowClone.metaWindow;
|
||||||
|
|
||||||
|
if (win.get_transient_for() == metaWindow) {
|
||||||
|
workspace.disconnect(this._windowAddedId);
|
||||||
|
this._windowAddedId = 0;
|
||||||
|
|
||||||
|
// use an idle handler to avoid mapping problems -
|
||||||
|
// see comment in Workspace._windowAdded
|
||||||
|
Mainloop.idle_add(Lang.bind(this,
|
||||||
|
function() {
|
||||||
|
this._windowClone.emit('selected');
|
||||||
|
return false;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_onDestroy: function() {
|
||||||
|
if (this._windowAddedId > 0) {
|
||||||
|
this._workspace.disconnect(this._windowAddedId);
|
||||||
|
this._windowAddedId = 0;
|
||||||
|
}
|
||||||
|
if (this._idleToggleCloseId > 0) {
|
||||||
|
Mainloop.source_remove(this._idleToggleCloseId);
|
||||||
|
this._idleToggleCloseId = 0;
|
||||||
|
}
|
||||||
|
this.title.destroy();
|
||||||
|
this.closeButton.destroy();
|
||||||
|
},
|
||||||
|
|
||||||
_onEnter: function() {
|
_onEnter: function() {
|
||||||
this.closeButton.raise_top();
|
this.closeButton.raise_top();
|
||||||
this.closeButton.show();
|
this.closeButton.show();
|
||||||
@ -1047,7 +1079,6 @@ Workspace.prototype = {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
let clone = this._windows[index];
|
let clone = this._windows[index];
|
||||||
let overlay = this._windowOverlays[index];
|
|
||||||
|
|
||||||
this._windows.splice(index, 1);
|
this._windows.splice(index, 1);
|
||||||
this._windowOverlays.splice(index, 1);
|
this._windowOverlays.splice(index, 1);
|
||||||
@ -1068,7 +1099,6 @@ Workspace.prototype = {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
clone.destroy();
|
clone.destroy();
|
||||||
overlay.destroy();
|
|
||||||
|
|
||||||
this.positionWindows(false);
|
this.positionWindows(false);
|
||||||
this.updateRemovable();
|
this.updateRemovable();
|
||||||
|
Loading…
Reference in New Issue
Block a user