overview: Make 3fg vertical swipes bring overview and app grid
The gesture internally manipulates the main adjustment so one swipe up brings up the overview, and a second swipe up brings the app grid. The gesture also works in the other direction to get out of the overview. Internally, this is delegated on the OverviewControls, so the adjustment is not leaked out of there. This however meant open coding the gesture interaction so it can be directed from overview.js code. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1643>
This commit is contained in:
@ -583,6 +583,47 @@ class ControlsManager extends St.Widget {
|
||||
return this.layoutManager.getWorkspacesBoxForState(state);
|
||||
}
|
||||
|
||||
gestureBegin(tracker) {
|
||||
const baseDistance = global.screen_height;
|
||||
const progress = this._stateAdjustment.value;
|
||||
const points = [
|
||||
ControlsState.HIDDEN,
|
||||
ControlsState.WINDOW_PICKER,
|
||||
ControlsState.APP_GRID,
|
||||
];
|
||||
|
||||
const transition = this._stateAdjustment.get_transition('value');
|
||||
const cancelProgress = transition
|
||||
? transition.get_interval().peek_final_value()
|
||||
: Math.round(progress);
|
||||
|
||||
tracker.confirmSwipe(baseDistance, points, progress, cancelProgress);
|
||||
this._workspacesDisplay.prepareToEnterOverview();
|
||||
this._searchController.prepareToEnterOverview();
|
||||
this._stateAdjustment.gestureInProgress = true;
|
||||
}
|
||||
|
||||
gestureProgress(progress) {
|
||||
this._stateAdjustment.value = progress;
|
||||
}
|
||||
|
||||
gestureEnd(target, duration, onComplete) {
|
||||
if (target === ControlsState.HIDDEN)
|
||||
this._workspacesDisplay.prepareToLeaveOverview();
|
||||
|
||||
this.dash.showAppsButton.checked =
|
||||
target === ControlsState.APP_GRID;
|
||||
|
||||
this._stateAdjustment.remove_transition('value');
|
||||
this._stateAdjustment.ease(target, {
|
||||
duration,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
onComplete,
|
||||
});
|
||||
|
||||
this._stateAdjustment.gestureInProgress = false;
|
||||
}
|
||||
|
||||
get searchEntry() {
|
||||
return this._searchEntry;
|
||||
}
|
||||
|
Reference in New Issue
Block a user