workspacesView: Don't use the overview swipe scrolling system
Switch to a ClutterPanAction instead too. https://bugzilla.gnome.org/show_bug.cgi?id=689062
This commit is contained in:
parent
ae22bde368
commit
1e40264ee4
@ -341,6 +341,13 @@ const Overview = new Lang.Class({
|
|||||||
return DND.DragMotionResult.CONTINUE;
|
return DND.DragMotionResult.CONTINUE;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
addAction: function(action) {
|
||||||
|
if (this.isDummy)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._group.add_action(action);
|
||||||
|
},
|
||||||
|
|
||||||
setScrollAdjustment: function(adjustment, direction) {
|
setScrollAdjustment: function(adjustment, direction) {
|
||||||
if (this.isDummy)
|
if (this.isDummy)
|
||||||
return;
|
return;
|
||||||
|
@ -382,24 +382,11 @@ const WorkspacesView = new Lang.Class({
|
|||||||
this._scrolling = true;
|
this._scrolling = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
endSwipeScroll: function(result) {
|
endSwipeScroll: function() {
|
||||||
this._scrolling = false;
|
this._scrolling = false;
|
||||||
|
|
||||||
if (result == Overview.SwipeScrollResult.CLICK) {
|
|
||||||
let [x, y, mod] = global.get_pointer();
|
|
||||||
let actor = global.stage.get_actor_at_pos(Clutter.PickMode.ALL,
|
|
||||||
x, y);
|
|
||||||
|
|
||||||
// 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.
|
|
||||||
let active = global.screen.get_active_workspace_index();
|
|
||||||
if (this._workspaces[active].isEmpty() &&
|
|
||||||
this.actor.contains(actor))
|
|
||||||
Main.overview.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure title captions etc are shown as necessary
|
// Make sure title captions etc are shown as necessary
|
||||||
|
this._scrollToActive();
|
||||||
this._updateVisibility();
|
this._updateVisibility();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -451,9 +438,23 @@ const WorkspacesDisplay = new Lang.Class({
|
|||||||
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
|
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
|
||||||
this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
|
this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
|
||||||
this.actor.connect('allocate', Lang.bind(this, this._allocate));
|
this.actor.connect('allocate', Lang.bind(this, this._allocate));
|
||||||
this.actor.connect('notify::mapped', Lang.bind(this, this._setupSwipeScrolling));
|
|
||||||
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));
|
||||||
|
action.connect('gesture-begin', Lang.bind(this, function() {
|
||||||
|
for (let i = 0; i < this._workspacesViews.length; i++)
|
||||||
|
this._workspacesViews[i].startSwipeScroll();
|
||||||
|
return true;
|
||||||
|
}));
|
||||||
|
action.connect('gesture-end', Lang.bind(this, function() {
|
||||||
|
for (let i = 0; i < this._workspacesViews.length; i++)
|
||||||
|
this._workspacesViews[i].endSwipeScroll();
|
||||||
|
}));
|
||||||
|
Main.overview.addAction(action);
|
||||||
|
this.actor.connect('notify::mapped', Lang.bind(this, function() {
|
||||||
|
action.enabled = this.actor.mapped;
|
||||||
|
}));
|
||||||
|
|
||||||
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,
|
||||||
@ -526,6 +527,13 @@ const WorkspacesDisplay = new Lang.Class({
|
|||||||
Lang.bind(this, this._updateSwitcherVisibility));
|
Lang.bind(this, this._updateSwitcherVisibility));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onPan: function(action) {
|
||||||
|
let [dist, dx, dy] = action.get_motion_delta(0);
|
||||||
|
let adjustment = this._scrollAdjustment;
|
||||||
|
adjustment.value -= (dy / this.actor.height) * adjustment.page_size;
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
_updateSwitcherVisibility: function() {
|
_updateSwitcherVisibility: function() {
|
||||||
this._thumbnailsBox.actor.visible =
|
this._thumbnailsBox.actor.visible =
|
||||||
this._settings.get_boolean('dynamic-workspaces') ||
|
this._settings.get_boolean('dynamic-workspaces') ||
|
||||||
@ -635,33 +643,6 @@ const WorkspacesDisplay = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_setupSwipeScrolling: function() {
|
|
||||||
if (this._swipeScrollBeginId)
|
|
||||||
Main.overview.disconnect(this._swipeScrollBeginId);
|
|
||||||
this._swipeScrollBeginId = 0;
|
|
||||||
|
|
||||||
if (this._swipeScrollEndId)
|
|
||||||
Main.overview.disconnect(this._swipeScrollEndId);
|
|
||||||
this._swipeScrollEndId = 0;
|
|
||||||
|
|
||||||
if (!this.actor.mapped)
|
|
||||||
return;
|
|
||||||
|
|
||||||
let direction = Overview.SwipeScrollDirection.VERTICAL;
|
|
||||||
Main.overview.setScrollAdjustment(this._scrollAdjustment,
|
|
||||||
direction);
|
|
||||||
this._swipeScrollBeginId = Main.overview.connect('swipe-scroll-begin',
|
|
||||||
Lang.bind(this, function() {
|
|
||||||
for (let i = 0; i < this._workspacesViews.length; i++)
|
|
||||||
this._workspacesViews[i].startSwipeScroll();
|
|
||||||
}));
|
|
||||||
this._swipeScrollEndId = Main.overview.connect('swipe-scroll-end',
|
|
||||||
Lang.bind(this, function(overview, result) {
|
|
||||||
for (let i = 0; i < this._workspacesViews.length; i++)
|
|
||||||
this._workspacesViews[i].endSwipeScroll(result);
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
|
|
||||||
_workspacesOnlyOnPrimaryChanged: function() {
|
_workspacesOnlyOnPrimaryChanged: function() {
|
||||||
this._workspacesOnlyOnPrimary = this._settings.get_boolean('workspaces-only-on-primary');
|
this._workspacesOnlyOnPrimary = this._settings.get_boolean('workspaces-only-on-primary');
|
||||||
|
|
||||||
@ -701,7 +682,6 @@ const WorkspacesDisplay = new Lang.Class({
|
|||||||
this._scrollAdjustment = view.scrollAdjustment;
|
this._scrollAdjustment = view.scrollAdjustment;
|
||||||
this._scrollAdjustment.connect('notify::value',
|
this._scrollAdjustment.connect('notify::value',
|
||||||
Lang.bind(this, this._scrollValueChanged));
|
Lang.bind(this, this._scrollValueChanged));
|
||||||
this._setupSwipeScrolling();
|
|
||||||
}
|
}
|
||||||
this._workspacesViews.push(view);
|
this._workspacesViews.push(view);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user