Fix key navigation on system menu sliders

Rely key press events management if the menu item contains
a slider.

https://bugzilla.gnome.org/show_bug.cgi?id=706386
This commit is contained in:
Alejandro Piñeiro 2013-08-22 13:15:00 +02:00
parent 3d57fd3227
commit aa569304bc
3 changed files with 9 additions and 2 deletions

View File

@ -23,7 +23,7 @@ const Slider = new Lang.Class({
this.actor.connect('repaint', Lang.bind(this, this._sliderRepaint)); this.actor.connect('repaint', Lang.bind(this, this._sliderRepaint));
this.actor.connect('button-press-event', Lang.bind(this, this._startDragging)); this.actor.connect('button-press-event', Lang.bind(this, this._startDragging));
this.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent)); this.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent)); this.actor.connect('key-press-event', Lang.bind(this, this.onKeyPressEvent));
this._releaseId = this._motionId = 0; this._releaseId = this._motionId = 0;
this._dragging = false; this._dragging = false;
@ -168,7 +168,7 @@ const Slider = new Lang.Class({
return true; return true;
}, },
_onKeyPressEvent: function (actor, event) { onKeyPressEvent: function (actor, event) {
let key = event.get_key_symbol(); let key = event.get_key_symbol();
if (key == Clutter.KEY_Right || key == Clutter.KEY_Left) { if (key == Clutter.KEY_Right || key == Clutter.KEY_Left) {
let delta = key == Clutter.KEY_Right ? 0.1 : -0.1; let delta = key == Clutter.KEY_Right ? 0.1 : -0.1;

View File

@ -47,6 +47,10 @@ const Indicator = new Lang.Class({
this._item.actor.connect('button-press-event', Lang.bind(this, function(actor, event) { this._item.actor.connect('button-press-event', Lang.bind(this, function(actor, event) {
this._slider.startDragging(event); this._slider.startDragging(event);
})); }));
this._item.actor.connect('key-press-event', Lang.bind(this, function(actor, event) {
return this._slider.onKeyPressEvent(actor, event);
}));
}, },
_sliderChanged: function(slider, value) { _sliderChanged: function(slider, value) {

View File

@ -44,6 +44,9 @@ const StreamSlider = new Lang.Class({
this.item.actor.connect('button-press-event', Lang.bind(this, function(actor, event) { this.item.actor.connect('button-press-event', Lang.bind(this, function(actor, event) {
this._slider.startDragging(event); this._slider.startDragging(event);
})); }));
this.item.actor.connect('key-press-event', Lang.bind(this, function(actor, event) {
return this._slider.onKeyPressEvent(actor, event);
}));
this._stream = null; this._stream = null;
}, },