Compare commits
2 Commits
citadel
...
wip/beniof
Author | SHA1 | Date | |
---|---|---|---|
|
920b169709 | ||
|
ccc5078802 |
@ -513,17 +513,25 @@ var TouchpadWorkspaceSwitchAction = new Lang.Class({
|
|||||||
if (event.get_touchpad_gesture_finger_count() != 4)
|
if (event.get_touchpad_gesture_finger_count() != 4)
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
|
|
||||||
if (event.get_gesture_phase() == Clutter.TouchpadGesturePhase.UPDATE) {
|
let workspacesDisplay = Main.overview.viewSelector._workspacesDisplay;
|
||||||
|
|
||||||
|
if (event.get_gesture_phase() == Clutter.TouchpadGesturePhase.BEGIN) {
|
||||||
|
workspacesDisplay._onPanStart();
|
||||||
|
} else if (event.get_gesture_phase() == Clutter.TouchpadGesturePhase.UPDATE) {
|
||||||
let [dx, dy] = event.get_gesture_motion_delta(event);
|
let [dx, dy] = event.get_gesture_motion_delta(event);
|
||||||
|
|
||||||
this._dx += dx;
|
this._dx += dx;
|
||||||
this._dy += dy;
|
this._dy += dy;
|
||||||
|
|
||||||
|
workspacesDisplay._onPan(dy * 1.5);
|
||||||
|
} else if (event.get_gesture_phase() == Clutter.TouchpadGesturePhase.CANCEL) {
|
||||||
|
workspacesDisplay._onPanCancel();
|
||||||
} else {
|
} else {
|
||||||
if (event.get_gesture_phase() == Clutter.TouchpadGesturePhase.END)
|
this._checkActivated();
|
||||||
this._checkActivated();
|
|
||||||
|
|
||||||
this._dx = 0;
|
this._dx = 0;
|
||||||
this._dy = 0;
|
this._dy = 0;
|
||||||
|
workspacesDisplay._onPanEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
|
@ -435,28 +435,14 @@ var WorkspacesDisplay = new Lang.Class({
|
|||||||
this.actor.bind_property('mapped', clickAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
|
this.actor.bind_property('mapped', clickAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
|
||||||
|
|
||||||
let panAction = new Clutter.PanAction({ threshold_trigger_edge: Clutter.GestureTriggerEdge.AFTER });
|
let panAction = new Clutter.PanAction({ threshold_trigger_edge: Clutter.GestureTriggerEdge.AFTER });
|
||||||
panAction.connect('pan', Lang.bind(this, this._onPan));
|
panAction.connect('pan', Lang.bind(this, function (action) {
|
||||||
panAction.connect('gesture-begin', Lang.bind(this, function() {
|
let [dist, dx, dy] = action.get_motion_delta(0);
|
||||||
if (this._workspacesOnlyOnPrimary) {
|
this._onPan(dy);
|
||||||
let event = Clutter.get_current_event();
|
|
||||||
if (this._getMonitorIndexForEvent(event) != this._primaryIndex)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < this._workspacesViews.length; i++)
|
|
||||||
this._workspacesViews[i].startSwipeScroll();
|
|
||||||
return true;
|
|
||||||
}));
|
|
||||||
panAction.connect('gesture-cancel', Lang.bind(this, function() {
|
|
||||||
clickAction.release();
|
|
||||||
for (let i = 0; i < this._workspacesViews.length; i++)
|
|
||||||
this._workspacesViews[i].endSwipeScroll();
|
|
||||||
}));
|
|
||||||
panAction.connect('gesture-end', Lang.bind(this, function() {
|
|
||||||
clickAction.release();
|
|
||||||
for (let i = 0; i < this._workspacesViews.length; i++)
|
|
||||||
this._workspacesViews[i].endSwipeScroll();
|
|
||||||
}));
|
}));
|
||||||
|
//panAction.connect('pan', Lang.bind(this, this._onPan));
|
||||||
|
panAction.connect('gesture-begin', Lang.bind(this, this._onPanStart));
|
||||||
|
panAction.connect('gesture-cancel', Lang.bind(this, this._onPanCancel));
|
||||||
|
panAction.connect('gesture-end', Lang.bind(this, this._onPanEnd));
|
||||||
Main.overview.addAction(panAction);
|
Main.overview.addAction(panAction);
|
||||||
this.actor.bind_property('mapped', panAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
|
this.actor.bind_property('mapped', panAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
|
||||||
|
|
||||||
@ -480,13 +466,36 @@ var WorkspacesDisplay = new Lang.Class({
|
|||||||
this._fullGeometry = null;
|
this._fullGeometry = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPan: function(action) {
|
_onPan: function(dy) {
|
||||||
let [dist, dx, dy] = action.get_motion_delta(0);
|
|
||||||
let adjustment = this._scrollAdjustment;
|
let adjustment = this._scrollAdjustment;
|
||||||
adjustment.value -= (dy / this.actor.height) * adjustment.page_size;
|
adjustment.value -= (dy / this.actor.height) * adjustment.page_size;
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onPanStart: function() {
|
||||||
|
if (this._workspacesOnlyOnPrimary) {
|
||||||
|
let event = Clutter.get_current_event();
|
||||||
|
if (this._getMonitorIndexForEvent(event) != this._primaryIndex)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < this._workspacesViews.length; i++)
|
||||||
|
this._workspacesViews[i].startSwipeScroll();
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
_onPanCancel: function() {
|
||||||
|
//clickAction.release();
|
||||||
|
for (let i = 0; i < this._workspacesViews.length; i++)
|
||||||
|
this._workspacesViews[i].endSwipeScroll();
|
||||||
|
},
|
||||||
|
|
||||||
|
_onPanEnd: function() {
|
||||||
|
//clickAction.release();
|
||||||
|
for (let i = 0; i < this._workspacesViews.length; i++)
|
||||||
|
this._workspacesViews[i].endSwipeScroll();
|
||||||
|
},
|
||||||
|
|
||||||
navigateFocus: function(from, direction) {
|
navigateFocus: function(from, direction) {
|
||||||
return this._getPrimaryView().actor.navigate_focus(from, direction, false);
|
return this._getPrimaryView().actor.navigate_focus(from, direction, false);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user