dnd: Immediately start drag done by pointer devices

Unlike touch screens, pointer devices (e.g. cursor, touchpad) are
basically never used to switch app grid pages, which is the main
use case for the drag threshold. This point was recently raised
as design feedback.

Immediately start drags when using pointer devices.

See https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3802#note_1124701

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4287

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1866>
This commit is contained in:
Georges Basile Stavracas Neto 2021-05-31 10:12:05 -03:00
parent e89c6179af
commit 5339b1e6a2

View File

@ -508,9 +508,14 @@ var _Draggable = class _Draggable {
if (!currentDraggable &&
(Math.abs(stageX - this._dragStartX) > threshold ||
Math.abs(stageY - this._dragStartY) > threshold)) {
const deviceType = event.get_source_device().get_device_type();
const isPointerOrTouchpad =
deviceType === Clutter.InputDeviceType.POINTER_DEVICE ||
deviceType === Clutter.InputDeviceType.TOUCHPAD_DEVICE;
const ellapsedTime = event.get_time() - this._dragStartTime;
if (ellapsedTime > this._dragTimeoutThreshold) {
// Pointer devices (e.g. mouse) start the drag immediately
if (isPointerOrTouchpad || ellapsedTime > this._dragTimeoutThreshold) {
this.startDrag(stageX, stageY, event.get_time(), this._touchSequence, event.get_device());
this._updateDragPosition(event);
} else {