workspaceThumbnail: Add keyboard nav to ThumbnailsBox

https://bugzilla.gnome.org/show_bug.cgi?id=682050
This commit is contained in:
Tanner Doshier 2012-08-08 15:18:46 -05:00 committed by Jasper St. Pierre
parent a3a3f24ed3
commit b1e4d3335c

View File

@ -493,6 +493,7 @@ const ThumbnailsBox = new Lang.Class({
_init: function() { _init: function() {
this.actor = new Shell.GenericContainer({ reactive: true, this.actor = new Shell.GenericContainer({ reactive: true,
style_class: 'workspace-thumbnails', style_class: 'workspace-thumbnails',
can_focus: true,
request_mode: Clutter.RequestMode.WIDTH_FOR_HEIGHT }); request_mode: Clutter.RequestMode.WIDTH_FOR_HEIGHT });
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth)); this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
@ -545,6 +546,8 @@ const ThumbnailsBox = new Lang.Class({
this.actor.connect('button-release-event', Lang.bind(this, this._onButtonRelease)); this.actor.connect('button-release-event', Lang.bind(this, this._onButtonRelease));
this.actor.connect('scroll-event', this.actor.connect('scroll-event',
Lang.bind(this, this._onScrollEvent)); Lang.bind(this, this._onScrollEvent));
this.actor.connect('key-release-event',
Lang.bind(this, this._onKeyRelease));
Main.overview.connect('showing', Main.overview.connect('showing',
Lang.bind(this, this._createThumbnails)); Lang.bind(this, this._createThumbnails));
@ -1247,5 +1250,19 @@ const ThumbnailsBox = new Lang.Class({
Main.wm.actionMoveWorkspace(Meta.MotionDirection.DOWN); Main.wm.actionMoveWorkspace(Meta.MotionDirection.DOWN);
break; break;
} }
},
_onKeyRelease: function (actor, event) {
switch (event.get_key_symbol()) {
case Clutter.KEY_Up:
Main.wm.actionMoveWorkspace(Meta.MotionDirection.UP);
break;
case Clutter.KEY_Down:
Main.wm.actionMoveWorkspace(Meta.MotionDirection.DOWN);
break;
case Clutter.KEY_Return:
Main.overview.toggle();
break;
}
} }
}); });