workspacesView: Restore activation of (empty) workspaces

Clicking empty workspaces to leave the overview was broken by
commit 830e701d13, restore the previous behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=689552
This commit is contained in:
Florian Müllner 2012-12-01 01:37:28 +01:00
parent 6b1e632621
commit 6eb05af306

View File

@ -444,19 +444,33 @@ const WorkspacesDisplay = new Lang.Class({
this.actor.connect('allocate', Lang.bind(this, this._allocate)); this.actor.connect('allocate', Lang.bind(this, this._allocate));
this.actor.connect('parent-set', Lang.bind(this, this._parentSet)); this.actor.connect('parent-set', Lang.bind(this, this._parentSet));
this.actor.set_clip_to_allocation(true); this.actor.set_clip_to_allocation(true);
let action = new Clutter.PanAction();
action.connect('pan', Lang.bind(this, this._onPan)); let clickAction = new Clutter.ClickAction()
action.connect('gesture-begin', Lang.bind(this, function() { clickAction.connect('clicked', Lang.bind(this, function(action) {
// Only switch to the workspace when there's no application
// windows open. The problem is that it's too easy to miss
// an app window and get the wrong one focused.
if (action.get_button() == 1 &&
this._getPrimaryView().getActiveWorkspace().isEmpty())
Main.overview.hide();
}));
Main.overview.addAction(clickAction);
this.actor.bind_property('mapped', clickAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
let panAction = new Clutter.PanAction();
panAction.connect('pan', Lang.bind(this, this._onPan));
panAction.connect('gesture-begin', Lang.bind(this, function() {
for (let i = 0; i < this._workspacesViews.length; i++) for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].startSwipeScroll(); this._workspacesViews[i].startSwipeScroll();
return true; return true;
})); }));
action.connect('gesture-end', Lang.bind(this, function() { panAction.connect('gesture-end', Lang.bind(this, function() {
clickAction.release();
for (let i = 0; i < this._workspacesViews.length; i++) for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].endSwipeScroll(); this._workspacesViews[i].endSwipeScroll();
})); }));
Main.overview.addAction(action); Main.overview.addAction(panAction);
this.actor.bind_property('mapped', action, 'enabled', GObject.BindingFlags.SYNC_CREATE); this.actor.bind_property('mapped', panAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
let controls = new St.Bin({ style_class: 'workspace-controls', let controls = new St.Bin({ style_class: 'workspace-controls',
request_mode: Clutter.RequestMode.WIDTH_FOR_HEIGHT, request_mode: Clutter.RequestMode.WIDTH_FOR_HEIGHT,