workspaceThumbnail: React to scroll event

https://bugzilla.gnome.org/show_bug.cgi?id=682050
This commit is contained in:
Tanner Doshier 2012-07-25 15:15:26 -05:00 committed by Cosimo Cecchi
parent 7e8968da52
commit 58023c81ad
2 changed files with 13 additions and 13 deletions

View File

@ -544,6 +544,8 @@ const ThumbnailsBox = new Lang.Class({
this.actor.connect('button-press-event', function() { return true; }); this.actor.connect('button-press-event', function() { return true; });
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',
Lang.bind(this, this._onScrollEvent));
Main.overview.connect('item-drag-begin', Main.overview.connect('item-drag-begin',
Lang.bind(this, this._onDragBegin)); Lang.bind(this, this._onDragBegin));
@ -1203,5 +1205,16 @@ const ThumbnailsBox = new Lang.Class({
}, },
onCompleteScope: this onCompleteScope: this
}); });
},
_onScrollEvent: function (actor, event) {
switch (event.get_scroll_direction()) {
case Clutter.ScrollDirection.UP:
Main.wm.actionMoveWorkspace(Meta.MotionDirection.UP);
break;
case Clutter.ScrollDirection.DOWN:
Main.wm.actionMoveWorkspace(Meta.MotionDirection.DOWN);
break;
}
} }
}); });

View File

@ -483,8 +483,6 @@ const WorkspacesDisplay = new Lang.Class({
controls.track_hover = true; controls.track_hover = true;
controls.connect('notify::hover', controls.connect('notify::hover',
Lang.bind(this, this._onControlsHoverChanged)); Lang.bind(this, this._onControlsHoverChanged));
controls.connect('scroll-event',
Lang.bind(this, this._onScrollEvent));
this._primaryIndex = Main.layoutManager.primaryIndex; this._primaryIndex = Main.layoutManager.primaryIndex;
@ -1004,17 +1002,6 @@ const WorkspacesDisplay = new Lang.Class({
// might as well avoid it. // might as well avoid it.
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
Lang.bind(this, this._updateZoom)); Lang.bind(this, this._updateZoom));
},
_onScrollEvent: function (actor, event) {
switch ( event.get_scroll_direction() ) {
case Clutter.ScrollDirection.UP:
Main.wm.actionMoveWorkspace(Meta.MotionDirection.UP);
break;
case Clutter.ScrollDirection.DOWN:
Main.wm.actionMoveWorkspace(Meta.MotionDirection.DOWN);
break;
}
} }
}); });
Signals.addSignalMethods(WorkspacesDisplay.prototype); Signals.addSignalMethods(WorkspacesDisplay.prototype);