[gnome-shell/gnome-40] dnd: Immediately start drag done by pointer devices



commit 76ed55ff96d6f22439bcff203a2384fe2287cfd7
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon May 31 10:12:05 2021 -0300

    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/1867>

 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 4fbe1acc78..cefde6f603 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 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]