messageTray: Use a PopupMenuManager for the message tray context menu
https://bugzilla.gnome.org/show_bug.cgi?id=699272
This commit is contained in:
parent
e6ef11575b
commit
f5c0706c2e
@ -1766,6 +1766,8 @@ const MessageTray = new Lang.Class({
|
|||||||
this._updateNoMessagesLabel();
|
this._updateNoMessagesLabel();
|
||||||
|
|
||||||
this._contextMenu = new MessageTrayContextMenu(this);
|
this._contextMenu = new MessageTrayContextMenu(this);
|
||||||
|
this._contextMenuManager = new PopupMenu.PopupMenuManager({ actor: this.actor });
|
||||||
|
this._contextMenuManager.addMenu(this._contextMenu);
|
||||||
|
|
||||||
let clickAction = new Clutter.ClickAction();
|
let clickAction = new Clutter.ClickAction();
|
||||||
this.actor.add_action(clickAction);
|
this.actor.add_action(clickAction);
|
||||||
@ -1774,8 +1776,6 @@ const MessageTray = new Lang.Class({
|
|||||||
let button = action.get_button();
|
let button = action.get_button();
|
||||||
if (button == 3)
|
if (button == 3)
|
||||||
this._openContextMenu();
|
this._openContextMenu();
|
||||||
if (button == 1 && this._contextMenu.isOpen)
|
|
||||||
this._grabHelper.ungrab({ actor: this._contextMenu.actor });
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
clickAction.connect('long-press', Lang.bind(this, function(action, actor, state) {
|
clickAction.connect('long-press', Lang.bind(this, function(action, actor, state) {
|
||||||
@ -1792,11 +1792,6 @@ const MessageTray = new Lang.Class({
|
|||||||
_openContextMenu: function () {
|
_openContextMenu: function () {
|
||||||
let [x, y, mask] = global.get_pointer();
|
let [x, y, mask] = global.get_pointer();
|
||||||
this._contextMenu.setPosition(Math.round(x), Math.round(y));
|
this._contextMenu.setPosition(Math.round(x), Math.round(y));
|
||||||
this._grabHelper.grab({ actor: this._contextMenu.actor,
|
|
||||||
onUngrab: Lang.bind(this, function () {
|
|
||||||
this._contextMenu.close(BoxPointer.PopupAnimation.FULL);
|
|
||||||
})
|
|
||||||
});
|
|
||||||
this._contextMenu.open(BoxPointer.PopupAnimation.FULL);
|
this._contextMenu.open(BoxPointer.PopupAnimation.FULL);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user