[polari] roomList: Allow triggering the context popover with keyboard



commit cf11ec9a5a843d891e986e49f49f6a252ca1ba96
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Aug 7 08:25:54 2015 +0200

    roomList: Allow triggering the context popover with keyboard
    
    Regular popup context menus can be brought up with the MENU key
    or Shift-F10, so it makes sense to allow the same for the context
    popover.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=753335

 src/roomList.js |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/roomList.js b/src/roomList.js
index f7ee09f..558d346 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -27,6 +27,8 @@ const RoomRow = new Lang.Class({
         this._popover.position = Gtk.PositionType.BOTTOM;
         this._eventBox.connect('button-release-event',
                             Lang.bind(this, this._onButtonRelease));
+        this.widget.connect('key-press-event',
+                            Lang.bind(this, this._onKeyPress));
 
         room.connect('notify::channel', Lang.bind(this,
             function() {
@@ -82,6 +84,19 @@ const RoomRow = new Lang.Class({
         return Gdk.EVENT_STOP;
     },
 
+    _onKeyPress: function(w, event) {
+        let [, keyval] = event.get_keyval();
+        let [, mods] = event.get_state();
+        if (keyval != Gdk.KEY_Menu &&
+            !(keyval == Gdk.KEY_F10 &&
+              mods & Gdk.ModifierType.SHIFT_MASK))
+            return Gdk.EVENT_PROPAGATE;
+
+        this._popover.show();
+
+        return Gdk.EVENT_STOP;
+    },
+
     _createWidget: function(gicon) {
         this.widget = new Gtk.ListBoxRow({ margin_bottom: 4 });
 


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