[gnome-shell/wip/carlosg/grabs-pt2: 4/11] appDisplay: Explicitly highlight selected app icon




commit 3676d883fff68e35a7729059b06ee5788b9117b7
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Nov 18 00:25:48 2021 +0100

    appDisplay: Explicitly highlight selected app icon
    
    While the menu is popped up, we artificially keep the icon highlighted
    by ensuring it's hovered, and muting events on the app icon until the
    menu is popped down.
    
    This is somewhat convoluted and won't work with Clutter.grab(), where
    it will be the menu itself that is the owner of input events while
    shown, so cut some corners and explicitly tell the app icon to be
    highlighted.

 js/ui/appDisplay.js | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 35fbfe49b6..e649391b8d 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1958,7 +1958,7 @@ class AppViewItem extends St.Button {
             label.disconnect(id);
         });
 
-        const expand = this.hover || this.has_key_focus();
+        const expand = this._highlighted || this.hover || this.has_key_focus();
         label.save_easing_state();
         label.set_easing_duration(expand
             ? APP_ICON_TITLE_EXPAND_TIME
@@ -2106,6 +2106,11 @@ class AppViewItem extends St.Button {
     get name() {
         return this._name;
     }
+
+    setHighlighted(highlighted) {
+        this._highlighted = highlighted;
+        this._updateMultiline();
+    }
 });
 
 var FolderGrid = GObject.registerClass(
@@ -3168,6 +3173,7 @@ var AppIcon = GObject.registerClass({
     }
 
     popupMenu(side = St.Side.LEFT) {
+        this.setHighlighted(true);
         this._removeMenuTimeout();
         this.fake_release();
 
@@ -3188,16 +3194,12 @@ var AppIcon = GObject.registerClass({
                 Main.overview.disconnect(id);
             });
 
-            // We want to keep the item hovered while the menu is up
-            this._menu.blockSourceEvents = true;
-
             Main.uiGroup.add_actor(this._menu.actor);
             this._menuManager.addMenu(this._menu);
         }
 
         this.emit('menu-state-changed', true);
 
-        this.set_hover(true);
         this._menu.open(BoxPointer.PopupAnimation.FULL);
         this._menuManager.ignoreRelease();
         this.emit('sync-tooltip');
@@ -3206,7 +3208,7 @@ var AppIcon = GObject.registerClass({
     }
 
     _onMenuPoppedDown() {
-        this.sync_hover();
+        this.setHighlighted(false);
         this.emit('menu-state-changed', false);
     }
 


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