[gnome-shell] popupMenu: Use an appropriate key to move focus into the menu
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] popupMenu: Use an appropriate key to move focus into the menu
- Date: Thu, 28 Aug 2014 17:13:10 +0000 (UTC)
commit 98847f22798f526bd8a724cd954ed73b93b743b8
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Aug 28 17:27:00 2014 +0200
popupMenu: Use an appropriate key to move focus into the menu
The code from PanelMenu.Button assumed menus would open below their
source actor, making KEY_Down a good choice; however with the new
generic code, we should base the key used on the actual menu position.
https://bugzilla.gnome.org/show_bug.cgi?id=735614
js/ui/popupMenu.js | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 3d41b73..1694e0a 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -746,6 +746,22 @@ const PopupMenu = new Lang.Class({
},
_onKeyPress: function(actor, event) {
+ let navKey;
+ switch (this._boxPointer.arrowSide) {
+ case St.Side.TOP:
+ navKey = Clutter.KEY_Down;
+ break;
+ case St.Side.BOTTOM:
+ navKey = Clutter.KEY_Up;
+ break;
+ case St.Side.LEFT:
+ navKey = Clutter.KEY_Right;
+ break;
+ case St.Side.RIGHT:
+ navKey = Clutter.KEY_Left;
+ break;
+ }
+
let symbol = event.get_key_symbol();
if (symbol == Clutter.KEY_space || symbol == Clutter.KEY_Return) {
this.toggle();
@@ -753,10 +769,10 @@ const PopupMenu = new Lang.Class({
} else if (symbol == Clutter.KEY_Escape && this.isOpen) {
this.close();
return Clutter.EVENT_STOP;
- } else if (symbol == Clutter.KEY_Down) {
+ } else if (symbol == navKey) {
if (!this.isOpen)
this.toggle();
- this.actor.navigate_focus(actor, Gtk.DirectionType.DOWN, false);
+ this.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
return Clutter.EVENT_STOP;
} else
return Clutter.EVENT_PROPAGATE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]