[gnome-shell] dash/dashIcon: Popup menu above the icon



commit 1e2532cf25197cc90720bd0267bbc9335fec6a0c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Jan 7 10:05:18 2021 -0300

    dash/dashIcon: Popup menu above the icon
    
    Now that the Dash is horizontal, the popup menu of the Dash icons must
    show up, instead of left/right.
    
    Make AppIcon.popupMenu() receive an optional parameter with the side
    to show the menu, using St.Side.LEFT as default. Override this method
    in DashIcon to always pass St.Side.TOP.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1559>

 js/ui/appDisplay.js | 15 +++++++++------
 js/ui/dash.js       |  4 ++++
 2 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 4cfc13a7d1..a2c6adaa04 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -2756,7 +2756,7 @@ var AppIcon = GObject.registerClass({
         return this.app.get_id();
     }
 
-    popupMenu() {
+    popupMenu(side = St.Side.LEFT) {
         this._removeMenuTimeout();
         this.fake_release();
 
@@ -2764,7 +2764,7 @@ var AppIcon = GObject.registerClass({
             this._draggable.fakeRelease();
 
         if (!this._menu) {
-            this._menu = new AppIconMenu(this);
+            this._menu = new AppIconMenu(this, side);
             this._menu.connect('activate-window', (menu, window) => {
                 this.activateWindow(window);
             });
@@ -2920,10 +2920,13 @@ var AppIcon = GObject.registerClass({
 });
 
 var AppIconMenu = class AppIconMenu extends PopupMenu.PopupMenu {
-    constructor(source) {
-        let side = St.Side.LEFT;
-        if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
-            side = St.Side.RIGHT;
+    constructor(source, side) {
+        if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) {
+            if (side === St.Side.LEFT)
+                side = St.Side.RIGHT;
+            else if (side === St.Side.RIGHT)
+                side = St.Side.LEFT;
+        }
 
         super(source, 0.5, side);
 
diff --git a/js/ui/dash.js b/js/ui/dash.js
index 3d6e756232..9c8639b280 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -31,6 +31,10 @@ class DashIcon extends AppDisplay.AppIcon {
         });
     }
 
+    popupMenu() {
+        super.popupMenu(St.Side.BOTTOM);
+    }
+
     // Disable scale-n-fade methods used during DND by parent
     scaleAndFade() {
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]