Add showapps context menu to empty panel space

This commit is contained in:
Charles Gagnon
2020-02-11 13:32:16 -05:00
parent dd795a7ae2
commit 7a8cd40936
2 changed files with 19 additions and 6 deletions

View File

@@ -1660,6 +1660,7 @@ var ShowAppsIconWrapper = Utils.defineClass({
},
_onMenuPoppedDown: function() {
this._menu.sourceActor = this.actor;
this.actor.sync_hover();
this.emit('menu-state-changed', false);
},
@@ -1672,10 +1673,7 @@ var ShowAppsIconWrapper = Utils.defineClass({
this.actor.set_style('padding:' + (padding + (isVertical ? sidePadding : 0)) + 'px ' + (padding + (isVertical ? 0 : sidePadding)) + 'px;');
},
popupMenu: function() {
this._removeMenuTimeout();
this.actor.fake_release();
createMenu: function() {
if (!this._menu) {
this._menu = new MyShowAppsIconMenu(this.actor);
this._menu.connect('open-state-changed', Lang.bind(this, function(menu, isPoppedUp) {
@@ -1690,6 +1688,12 @@ var ShowAppsIconWrapper = Utils.defineClass({
});
this._menuManager.addMenu(this._menu);
}
},
popupMenu: function() {
this._removeMenuTimeout();
this.actor.fake_release();
this.createMenu(this.actor);
//this.emit('menu-state-changed', true);

View File

@@ -796,14 +796,23 @@ var dtpPanel = Utils.defineClass({
let type = event.type();
let isPress = type == Clutter.EventType.BUTTON_PRESS;
let button = isPress ? event.get_button() : -1;
let [stageX, stageY] = event.get_coords();
if (Main.modalCount > 0 || event.get_source() != actor ||
if (button == 3 && global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, stageX, stageY) == this.panel.actor) {
//right click on an empty part of the panel, temporarily borrow and display the showapps context menu
Main.layoutManager.setDummyCursorGeometry(stageX, stageY, 0, 0);
this.taskbar._showAppsIconWrapper.createMenu();
this.taskbar._showAppsIconWrapper._menu.sourceActor = Main.layoutManager.dummyCursor;
this.taskbar._showAppsIconWrapper.popupMenu();
return Clutter.EVENT_STOP;
} else if (Main.modalCount > 0 || event.get_source() != actor ||
(!isPress && type != Clutter.EventType.TOUCH_BEGIN) ||
(isPress && button != 1)) {
return Clutter.EVENT_PROPAGATE;
}
let [stageX, stageY] = event.get_coords();
let params = checkIfVertical() ? [stageY, 'y', 'height'] : [stageX, 'x', 'width'];
let dragWindow = this._getDraggableWindowForPosition.apply(this, params.concat(['maximized_' + getOrientation() + 'ly']));