[gnome-shell/T27795: 78/138] Add an addBackgroundMenuForAction function for greater flexibility
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/T27795: 78/138] Add an addBackgroundMenuForAction function for greater flexibility
- Date: Tue, 1 Oct 2019 23:35:53 +0000 (UTC)
commit fd867efddb9e83f0a92f5f2bb4e10e4c93cfec17
Author: Mario Sanchez Prada <mario endlessm com>
Date: Fri Jun 9 13:10:03 2017 +0100
Add an addBackgroundMenuForAction function for greater flexibility
In some cases we want to have more control over the ClutterClickAction
used to open the background menu, so that we can bind its 'enabled'
property to the eventBlocker actor reactive state and to the mapped
state of the overview, so add this alternative function for that.
Also, disable the background menu when in initial-setup mode, otherwise
it's possible to launch the App Center from it and, with some additional
effort, ending up executing anything even before the FBE is finished.
https://phabricator.endlessm.com/T20471
js/ui/backgroundMenu.js | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/backgroundMenu.js b/js/ui/backgroundMenu.js
index 0fe9c5f311..f26741eeb3 100644
--- a/js/ui/backgroundMenu.js
+++ b/js/ui/backgroundMenu.js
@@ -36,7 +36,23 @@ var BackgroundMenu = class BackgroundMenu extends PopupMenu.PopupMenu {
}
};
-function addBackgroundMenu(actor, layoutManager) {
+function _addBackgroundMenuFull(actor, clickAction, layoutManager) {
+ // We don't want the background menu enabled on the desktop
+ // during the FBE, or in any mode without an overview, fwiw.
+ if (!Main.sessionMode.hasOverview)
+ return;
+
+ // Either the actor or the action has to be defined
+ if (!actor && !clickAction)
+ return;
+
+ if (actor) {
+ clickAction = new Clutter.ClickAction();
+ actor.add_action(clickAction);
+ } else {
+ actor = clickAction.get_actor();
+ }
+
actor.reactive = true;
actor._backgroundMenu = new BackgroundMenu(layoutManager);
actor._backgroundManager = new PopupMenu.PopupMenuManager(actor);
@@ -47,7 +63,6 @@ function addBackgroundMenu(actor, layoutManager) {
actor._backgroundMenu.open(BoxPointer.PopupAnimation.FULL);
}
- let clickAction = new Clutter.ClickAction();
clickAction.connect('long-press', (action, actor, state) => {
if (state == Clutter.LongPressState.QUERY)
return ((action.get_button() == 0 ||
@@ -66,7 +81,6 @@ function addBackgroundMenu(actor, layoutManager) {
openMenu(x, y);
}
});
- actor.add_action(clickAction);
let grabOpBeginId = global.display.connect('grab-op-begin', () => {
clickAction.release();
@@ -91,3 +105,11 @@ function addBackgroundMenu(actor, layoutManager) {
clickAction.release();
});
}
+
+function addBackgroundMenu(actor, layoutManager) {
+ _addBackgroundMenuFull(actor, null, layoutManager);
+}
+
+function addBackgroundMenuForAction(clickAction, layoutManager) {
+ _addBackgroundMenuFull(null, clickAction, layoutManager);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]