appDisplay: Add threshold after overshoot page switches
We currently always switch app pages when a dragged app icon moves outside the grid boundaries, regardless of any previous page switches. This makes it too easy to switch multiple pages accidentally, so add a small threshold that the icon has to move back towards the grid before allowing another page switch. https://gitlab.gnome.org/GNOME/gnome-shell/issues/1693
This commit is contained in:
parent
0897915b05
commit
b0c8192496
@ -40,6 +40,8 @@ var PAGE_SWITCH_TIME = 300;
|
|||||||
var APP_ICON_SCALE_IN_TIME = 500;
|
var APP_ICON_SCALE_IN_TIME = 500;
|
||||||
var APP_ICON_SCALE_IN_DELAY = 700;
|
var APP_ICON_SCALE_IN_DELAY = 700;
|
||||||
|
|
||||||
|
const OVERSHOOT_THRESHOLD = 20;
|
||||||
|
|
||||||
const SWITCHEROO_BUS_NAME = 'net.hadess.SwitcherooControl';
|
const SWITCHEROO_BUS_NAME = 'net.hadess.SwitcherooControl';
|
||||||
const SWITCHEROO_OBJECT_PATH = '/net/hadess/SwitcherooControl';
|
const SWITCHEROO_OBJECT_PATH = '/net/hadess/SwitcherooControl';
|
||||||
|
|
||||||
@ -376,6 +378,8 @@ var AllView = GObject.registerClass({
|
|||||||
this._availWidth = 0;
|
this._availWidth = 0;
|
||||||
this._availHeight = 0;
|
this._availHeight = 0;
|
||||||
|
|
||||||
|
this._lastOvershootY = -1;
|
||||||
|
|
||||||
Main.overview.connect('hidden', () => this.goToPage(0));
|
Main.overview.connect('hidden', () => this.goToPage(0));
|
||||||
this._grid.connect('space-opened', () => {
|
this._grid.connect('space-opened', () => {
|
||||||
let fadeEffect = this._scrollView.get_effect('fade');
|
let fadeEffect = this._scrollView.get_effect('fade');
|
||||||
@ -775,11 +779,24 @@ var AllView = GObject.registerClass({
|
|||||||
let [, gridHeight] = this.get_transformed_size();
|
let [, gridHeight] = this.get_transformed_size();
|
||||||
let gridBottom = gridY + gridHeight;
|
let gridBottom = gridY + gridHeight;
|
||||||
|
|
||||||
// Within the grid boundaries, or already animating
|
// Already animating
|
||||||
if (dragEvent.y > gridY && dragEvent.y < gridBottom ||
|
if (this._adjustment.get_transition('value') !== null)
|
||||||
this._adjustment.get_transition('value') != null)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Within the grid boundaries
|
||||||
|
if (dragEvent.y > gridY && dragEvent.y < gridBottom) {
|
||||||
|
// Check whether we moved out the area of the last switch
|
||||||
|
if (Math.abs(this._lastOvershootY - dragEvent.y) > OVERSHOOT_THRESHOLD)
|
||||||
|
this._lastOvershootY = -1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Still in the area of the previous page switch
|
||||||
|
if (this._lastOvershootY >= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this._lastOvershootY = dragEvent.y;
|
||||||
|
|
||||||
// Moving above the grid
|
// Moving above the grid
|
||||||
let currentY = this._adjustment.value;
|
let currentY = this._adjustment.value;
|
||||||
if (dragEvent.y <= gridY && currentY > 0) {
|
if (dragEvent.y <= gridY && currentY > 0) {
|
||||||
@ -824,6 +841,7 @@ var AllView = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._eventBlocker.visible = this._currentPopup !== null;
|
this._eventBlocker.visible = this._currentPopup !== null;
|
||||||
|
this._lastOvershootY = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_canAccept(source) {
|
_canAccept(source) {
|
||||||
|
Loading…
Reference in New Issue
Block a user