[gnome-shell] appsMenu: Add side parameter



commit 958fb6fddccc60143a1fc8a69487353a3333e592
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Aug 11 22:53:54 2021 +0200

    appsMenu: Add side parameter
    
    In order to re-use the menu in the overview, we must be able to
    change the side of the arrow, so expose the parent class parameter.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>

 js/ui/appMenu.js | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/appMenu.js b/js/ui/appMenu.js
index a795e8e616..85c193bfe8 100644
--- a/js/ui/appMenu.js
+++ b/js/ui/appMenu.js
@@ -1,6 +1,6 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 /* exported AppMenu */
-const { Gio, GLib, Meta, Shell, St } = imports.gi;
+const { Clutter, Gio, GLib, Meta, Shell, St } = imports.gi;
 
 const PopupMenu = imports.ui.popupMenu;
 const Main = imports.ui.main;
@@ -8,9 +8,17 @@ const Main = imports.ui.main;
 var AppMenu = class AppMenu extends PopupMenu.PopupMenu {
     /**
      * @param {Clutter.Actor} sourceActor - actor the menu is attached to
+     * @param {St.Side} side - arrow side
      */
-    constructor(sourceActor) {
-        super(sourceActor, 0.5, St.Side.TOP);
+    constructor(sourceActor, side = St.Side.TOP) {
+        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(sourceActor, 0.5, side);
 
         this.actor.add_style_class_name('app-menu');
 


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