[gnome-shell] popupMenu: Adjust submenu arrows to RTL icon changes



commit 6823bad2d835ef5770259455f11deaf8644a440b
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Sep 9 19:00:13 2014 +0200

    popupMenu: Adjust submenu arrows to RTL icon changes
    
    Since commit e04e507659027, we will already get the right icon for the
    submenu arrow, so we must not mirror it again. However we do need to
    take the text direction into account for the rotation now (but that's
    not actually too bad - the resulting code gets quite a bit easier).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736343

 js/ui/popupMenu.js |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index be8bbe9..524191e 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -918,14 +918,14 @@ const PopupSubMenu = new Lang.Class({
         if (animate && needsScrollbar)
             animate = false;
 
+        let targetAngle = this.actor.text_direction == Clutter.TextDirection.RTL ? -90 : 90;
+
         if (animate) {
             let [minHeight, naturalHeight] = this.actor.get_preferred_height(-1);
             this.actor.height = 0;
             this.actor._arrowRotation = this._arrow.rotation_angle_z;
-            let angle = this.actor._arrowRotation;
-            // animate to the first multiple of 90 greater than current angle
             Tweener.addTween(this.actor,
-                             { _arrowRotation: angle - angle % 90 + 90,
+                             { _arrowRotation: targetAngle,
                                height: naturalHeight,
                                time: 0.25,
                                onUpdateScope: this,
@@ -938,7 +938,7 @@ const PopupSubMenu = new Lang.Class({
                                }
                              });
         } else {
-            this._arrow.rotation_angle_z = this.actor._arrowRotation + 90;
+            this._arrow.rotation_angle_z = targetAngle;
         }
     },
 
@@ -957,10 +957,8 @@ const PopupSubMenu = new Lang.Class({
 
         if (animate) {
             this.actor._arrowRotation = this._arrow.rotation_angle_z;
-            let angle = this.actor._arrowRotation;
-            // animate to the first multiple of 90 less than current angle
             Tweener.addTween(this.actor,
-                             { _arrowRotation: (angle - 1) - (angle - 1) % 90,
+                             { _arrowRotation: 0,
                                height: 0,
                                time: 0.25,
                                onUpdateScope: this,
@@ -974,7 +972,7 @@ const PopupSubMenu = new Lang.Class({
                                },
                              });
         } else {
-            this._arrow.rotation_angle_z = this.actor._arrowRotation - 90;
+            this._arrow.rotation_angle_z = 0;
             this.actor.hide();
         }
     },
@@ -1052,8 +1050,6 @@ const PopupSubMenuMenuItem = new Lang.Class({
         this._triangleBin = new St.Widget({ y_expand: true,
                                             y_align: Clutter.ActorAlign.CENTER });
         this._triangleBin.add_child(this._triangle);
-        if (this._triangleBin.get_text_direction() == Clutter.TextDirection.RTL)
-            this._triangleBin.set_scale(-1.0, 1.0);
 
         this.actor.add_child(this._triangleBin);
         this.actor.add_accessible_state (Atk.StateType.EXPANDABLE);


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