workspaceThumbnails: Allow mousewheel scrolling

Allow the user to switch the active workspace by using
the mousewheel over the workspace thumbnails.

https://bugzilla.gnome.org/show_bug.cgi?id=642303
This commit is contained in:
Sardem FF7 2011-02-12 10:11:20 +01:00 committed by Adel Gadllah
parent ef983480c0
commit 1b4cff7cdc

View File

@ -630,6 +630,9 @@ WorkspacesDisplay.prototype = {
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._thumbnailsBox = new WorkspaceThumbnail.ThumbnailsBox(); this._thumbnailsBox = new WorkspaceThumbnail.ThumbnailsBox();
controls.add_actor(this._thumbnailsBox.actor); controls.add_actor(this._thumbnailsBox.actor);
@ -925,6 +928,17 @@ WorkspacesDisplay.prototype = {
// 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.actionMoveWorkspaceUp();
break;
case Clutter.ScrollDirection.DOWN:
Main.wm.actionMoveWorkspaceDown();
break;
}
} }
}; };
Signals.addSignalMethods(WorkspacesDisplay.prototype); Signals.addSignalMethods(WorkspacesDisplay.prototype);