Skip to content

Commit

Permalink
Prevent workspace scrolling when in app picker or search
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Yuki committed Nov 6, 2014
1 parent bd1c2da commit 47c80c3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions scroll-workspaces/extension.js
Expand Up @@ -4,6 +4,7 @@ const Shell = imports.gi.Shell;
const Meta = imports.gi.Meta;

const Main = imports.ui.main;
const ViewSelector = imports.ui.viewSelector;

const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
Expand All @@ -16,13 +17,19 @@ const WorkspaceScroller = new Lang.Class({
Main.panel.actor.reactive = true;
this._panelScrollEventId = Main.panel.actor.connect('scroll-event', Lang.bind(this, this._onScrollEvent));
this._lastScrollTime = new Date().getTime();
// Add workaround for https://bugzilla.gnome.org/show_bug.cgi?id=737534
this._onPageChangedId = Main.overview.viewSelector.connect('page-changed', Lang.bind(this, this._onPageChanged));
},

destroy: function() {
if (this._panelScrollEventId) {
Main.panel.actor.disconnect(this._panelScrollEventId);
this._panelScrollEventId = 0;
}
if (this._onPageChangedId) {
Main.overview.viewSelector.disconnect(this._onPageChangedId);
this._onPageChangedId = 0;
}
},

get _delay() {
Expand All @@ -39,6 +46,18 @@ const WorkspaceScroller = new Lang.Class({
toActivate.activate(global.get_current_time());
},

_onPageChanged: function() {
let activePage = Main.overview.viewSelector.getActivePage();
if (activePage != ViewSelector.ViewPage.WINDOWS) {
this._workspaceActivateFunc = Meta.Workspace.prototype.activate;
Meta.Workspace.prototype.activate = function() {};
}
else if (this._workspaceActivateFunc) {
Meta.Workspace.prototype.activate = this._workspaceActivateFunc;
delete this._workspaceActivateFunc;
}
},

_onScrollEvent: function(actor, event) {
let source = event.get_source();
if (source.__proto__ != Shell.GenericContainer.prototype) {
Expand Down

0 comments on commit 47c80c3

Please sign in to comment.