From 5339b1e6a29dff0e23911be2df2bcb028b696498 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Mon, 31 May 2021 10:12:05 -0300 Subject: [PATCH] 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: --- js/ui/dnd.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/ui/dnd.js b/js/ui/dnd.js index 4fbe1acc7..cefde6f60 100644 --- a/js/ui/dnd.js +++ b/js/ui/dnd.js @@ -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 {