grabHelper: Remove explicitly having to select modal
https://bugzilla.gnome.org/show_bug.cgi?id=700735
This commit is contained in:
parent
eef593a34e
commit
393577ee78
@ -144,7 +144,6 @@ const GrabHelper = new Lang.Class({
|
||||
// focus on the clicked on menu item.
|
||||
grab: function(params) {
|
||||
params = Params.parse(params, { actor: null,
|
||||
modal: false,
|
||||
focus: null,
|
||||
onUngrab: null });
|
||||
|
||||
@ -157,7 +156,7 @@ const GrabHelper = new Lang.Class({
|
||||
|
||||
params.savedFocus = focus;
|
||||
|
||||
if (params.modal && !this._takeModalGrab())
|
||||
if (!this._takeModalGrab())
|
||||
return false;
|
||||
|
||||
this._grabStack.push(params);
|
||||
@ -169,9 +168,6 @@ const GrabHelper = new Lang.Class({
|
||||
newFocus.grab_key_focus();
|
||||
}
|
||||
|
||||
if (params.modal && !this._capturedEventId)
|
||||
this._capturedEventId = global.stage.connect('captured-event', Lang.bind(this, this._onCapturedEvent));
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
@ -180,6 +176,8 @@ const GrabHelper = new Lang.Class({
|
||||
if (firstGrab) {
|
||||
if (!Main.pushModal(this._owner, this._modalParams))
|
||||
return false;
|
||||
|
||||
this._capturedEventId = global.stage.connect('captured-event', Lang.bind(this, this._onCapturedEvent));
|
||||
}
|
||||
|
||||
this._modalCount++;
|
||||
@ -191,6 +189,11 @@ const GrabHelper = new Lang.Class({
|
||||
if (this._modalCount > 0)
|
||||
return;
|
||||
|
||||
global.stage.disconnect(this._capturedEventId);
|
||||
this._capturedEventId = 0;
|
||||
|
||||
this._ignoreRelease = false;
|
||||
|
||||
Main.popModal(this._owner);
|
||||
global.sync_pointer();
|
||||
},
|
||||
@ -238,15 +241,7 @@ const GrabHelper = new Lang.Class({
|
||||
if (poppedGrab.onUngrab)
|
||||
poppedGrab.onUngrab(params.isUser);
|
||||
|
||||
if (poppedGrab.modal)
|
||||
this._releaseModalGrab();
|
||||
}
|
||||
|
||||
if (!this.grabbed && this._capturedEventId > 0) {
|
||||
global.stage.disconnect(this._capturedEventId);
|
||||
this._capturedEventId = 0;
|
||||
|
||||
this._ignoreRelease = false;
|
||||
this._releaseModalGrab();
|
||||
}
|
||||
|
||||
if (hadFocus) {
|
||||
|
@ -1808,7 +1808,6 @@ const MessageTray = new Lang.Class({
|
||||
let [x, y, mask] = global.get_pointer();
|
||||
this._contextMenu.setPosition(Math.round(x), Math.round(y));
|
||||
this._grabHelper.grab({ actor: this._contextMenu.actor,
|
||||
modal: true,
|
||||
onUngrab: Lang.bind(this, function () {
|
||||
this._contextMenu.close(BoxPointer.PopupAnimation.FULL);
|
||||
})
|
||||
@ -2375,7 +2374,6 @@ const MessageTray = new Lang.Class({
|
||||
|
||||
_showTray: function() {
|
||||
if (!this._grabHelper.grab({ actor: this.actor,
|
||||
modal: true,
|
||||
onUngrab: Lang.bind(this, this._escapeTray) })) {
|
||||
this._traySummoned = false;
|
||||
return false;
|
||||
@ -2720,7 +2718,6 @@ const MessageTray = new Lang.Class({
|
||||
|
||||
this._summaryBoxPointer.bin.child = child;
|
||||
this._grabHelper.grab({ actor: this._summaryBoxPointer.bin.child,
|
||||
modal: true,
|
||||
onUngrab: Lang.bind(this, this._onSummaryBoxPointerUngrabbed) });
|
||||
|
||||
this._summaryBoxPointer.actor.opacity = 0;
|
||||
|
@ -1701,7 +1701,7 @@ const PopupMenuManager = new Lang.Class({
|
||||
if (open) {
|
||||
if (this.activeMenu && !this.activeMenu.isChildMenu(menu))
|
||||
this.activeMenu.close(BoxPointer.PopupAnimation.FADE);
|
||||
this._grabHelper.grab({ actor: menu.actor, modal: true, focus: menu.sourceActor,
|
||||
this._grabHelper.grab({ actor: menu.actor, focus: menu.sourceActor,
|
||||
onUngrab: Lang.bind(this, this._closeMenu, menu) });
|
||||
} else {
|
||||
this._grabHelper.ungrab({ actor: menu.actor });
|
||||
|
Loading…
Reference in New Issue
Block a user