Brianbe1976 / touchegg

Automatically exported from code.google.com/p/touchegg
0 stars 0 forks source link

Configure Drag'n'Drop speed #178

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hello. I have a speed issue: drag'n'drop is too fast, it differs from normal 
cursor speed in near 3 times. 

I have a 3 finger drag gesture to select text, move objects etc (as on Mac OS 
X).

I haven't found, how can I configure it.

Also, maybe it's related issue: scroll speed is high too, despite I've set 
SPEED to 1. 

I have a synaptics driver (evdev simple doesn't work. Cursor doesn't move) with 
following configuration:

https://gist.github.com/3928552

Original issue reported on code.google.com by Sergey.K...@gmail.com on 21 Oct 2012 at 9:23

GoogleCodeExporter commented 8 years ago
Issue 179 has been merged into this issue.

Original comment by jose.exposito89@gmail.com on 21 Oct 2012 at 9:40

GoogleCodeExporter commented 8 years ago

Original comment by jose.exposito89@gmail.com on 21 Oct 2012 at 9:42

GoogleCodeExporter commented 8 years ago
I have the same problem with the driver evdev on ubuntu 12,04

Original comment by txetx...@gmail.com on 28 Oct 2012 at 12:45

GoogleCodeExporter commented 8 years ago
Same problem. It seems like the motion is multiplied by each finger. If I start 
dragging with 3 fingers then only move one, the motion is a bit more 
manageable, but still too fast.

Additionally, if I don't lift all three fingers at exactly the same time, the 
end point of the selection (or drag) jumps across the screen. 

Original comment by mrorog...@gmail.com on 2 Dec 2012 at 8:25

GoogleCodeExporter commented 8 years ago
I have kind of the same problems, but somehow twisted: scrolling (via 
two-finger-drag) is too fast despite setting to 1, but moving windows via the 
three-finger-drag is way too slow.

I also have the problem with three fingers not beeing lifted at the same time.

Original comment by mat.lech...@gmail.com on 11 Dec 2012 at 8:31

GoogleCodeExporter commented 8 years ago
Same here on Ubuntu Gnome 13.10.

Window dragging with 4 buttons is extremely slow. Any ideas how to debug and 
solve this?

Original comment by dmt....@gmail.com on 16 Jan 2014 at 8:06

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Same on Ubuntu 14.04.  I have recompiled unity so that it doesn't hijack 
multitouch as per 
http://elscreemo.blogspot.co.uk/2013/05/restoring-three-finger-gesture-in.html 
so that I can use touchegg for my own gestures.  Works great except for 3 
finger drag being 3 times as fast as it should be!

So I thought I'd put my recently gained "hacking and recompiling" knowledge to 
work with this.  Step by step instructions for adventurous users until if/when 
an option is implemented:

sudo apt-get build-dep touchegg
cd ~
mkdir toucheggbuild
cd toucheggbuild
apt-get source touchegg
gedit touchegg-1.1.1/src/touchegg/actions/implementation/DragAndDrop.cpp

Find:
{{{
QCursor::setPos(QCursor::pos().x() + 
attrs.value(GEIS_GESTURE_ATTRIBUTE_DELTA_X).toFloat(),
            QCursor::pos().y() + attrs.value(GEIS_GESTURE_ATTRIBUTE_DELTA_Y).toFloat());
}}}

Replace with:
{{{
QCursor::setPos(QCursor::pos().x() + 
(attrs.value(GEIS_GESTURE_ATTRIBUTE_DELTA_X).toFloat() / 
attrs.value(GEIS_GESTURE_ATTRIBUTE_TOUCHES).toFloat()),
            QCursor::pos().y() + (attrs.value(GEIS_GESTURE_ATTRIBUTE_DELTA_Y).toFloat() / attrs.value(GEIS_GESTURE_ATTRIBUTE_TOUCHES).toFloat()));
}}}

dpkg-buildpackage -us -uc -nc
sudo dpkg -i touchegg_*.deb
sudo apt-mark hold touchegg

It's just a quick and dirty hack.  Basically, I'm dividing the movement delta 
by the number of fingers.  It occurs to me that I'm risking a divide by zero, 
though I guess it's unlikely to be registering touches with 0 fingers.

Original comment by m...@deryk.co.uk on 14 May 2014 at 3:45

GoogleCodeExporter commented 8 years ago
Try to replace the commands:
$ mkdir toucheggbuild
$ cd toucheggbuild
$ apt-get source touchegg

With the commands:
$ svn checkout https://touchegg.googlecode.com/svn/touchegg/ toucheggbuild
$ cd toucheggbuild

To get the latest source code with some extra fixes and features:
https://code.google.com/p/touchegg/issues/detail?id=185
https://code.google.com/p/touchegg/issues/detail?id=222

I'm so sorry but I'm living abroad for a long time now and I don't have a linux 
box to test your patch... and Virtualbox is not very good for multitouch 
testing. By the way, if you would like to avoid division by 0 replace that line 
with:

    int numTouches = attrs.value(GEIS_GESTURE_ATTRIBUTE_TOUCHES).toInt();
    int newX = QCursor::pos().x() + (attrs.value(GEIS_GESTURE_ATTRIBUTE_DELTA_X).toFloat();
    int newY = QCursor::pos().y() + attrs.value(GEIS_GESTURE_ATTRIBUTE_DELTA_Y).toFloat();

    if (numTouches > 0) {
        newX /= numTouches;
        newY /= numTouches;
    }

    QCursor::setPos(newX, newY);

That should do the trick. Thank you very much and sorry guys for having the 
project a little bit unmaintained but I don't have the tools here to hack it.

Original comment by jose.exposito89@gmail.com on 14 May 2014 at 6:42

GoogleCodeExporter commented 8 years ago
I'm using touchegg on Arch with synaptics and was having the same problems 
described:

1. scrolling and dragging (or any gesture I believe) with 2 or 3 fingers seems 
to multiply the tracking speed by the number of fingers.
2. Lifting a finger while doing a 3 finger drag made the cursor jump.

Jose, I copy and pasted your code directly and it didn't quite work for me. 
Actually, what happened was when I triggered the DragAndDrop with 3 fingers, 
the cursor would repeatedly jump to the top left corner (0, 0). I didn't take 
the time to figure out why but I copied the solution above and it works fine. I 
don't think dividing by 0 will ever be an issue but I suppose it would be 
better to prevent it altogether.

So, dividing by the number of fingers works great and the tracking speed is 
normal for a DragAndDrop. I have not tried fixing the scrolling (or other 
gestures) yet but I am assuming the same fix will work.

In order to fix the issue where the cursor jumps, the DragAndDrop.cpp needs 
further modification. The problem is (as described above) if you do not lift 
all three fingers at exactly the same time to end the action, the cursor jumps. 
Further testing indicates if you simply lift one finger while doing a 3 finger 
drag and leave the other 2 down, the cursor jumps. The fix is simple and works 
but it's not the ideal fix. What we do is check to see if the number of fingers 
has changed when the action gets updated, and if the number of fingers is not 
the same as the number that initially triggered the action, we do nothing. A 
better fix would end the action entirely when one or more fingers are lifted. 
Anyway, to fix this the following changes need to be made:

1. Add a private variable to DragAndDrop.h to hold the initial number of fingers

    private:

        /**
         * Button to emulate.
         */
        int button;
        int startNumFingers;

    };

2. Set the int to 0 when the action starts (not sure if this is necessary)

    DragAndDrop::DragAndDrop(const QString &settings, Window window)
        : Action(settings, window)
    {
        this->button = 1;
        this->startNumFingers = 0;

    ...

3. Set the number of fingers to the correct number when the action updates, 
then check if the current number of fingers is equal to the initial number of 
fingers. If not, return.

    void DragAndDrop::executeUpdate(const QHash<QString, QVariant>& attrs)
    {
        int numFingers = attrs.value(GEIS_GESTURE_ATTRIBUTE_TOUCHES).toFloat();
        if(startNumFingers == 0) {
            startNumFingers = numFingers;
        }

        if (!attrs.contains(GEIS_GESTURE_ATTRIBUTE_DELTA_X) || !attrs.contains(GEIS_GESTURE_ATTRIBUTE_DELTA_Y))
            return;
        if (numFingers != startNumFingers)
            return;

That's it! I've uploaded DragAndDrop.h and DragAndDrop.cpp for the lazy.

Original comment by mtbro...@gmail.com on 7 Jun 2014 at 11:23

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks!

Original comment by charcoal...@gmail.com on 2 Sep 2014 at 12:53

GoogleCodeExporter commented 8 years ago
I am having the same issue. Everything is working great I just want to slow the 
speed of DragAndDrop. But I can't apply this solution because I installed 
touchegg from xubuntu 14.10 repos (sudo apt-get install touchegg). I tried to 
compile but it does not build dependencies.

Original comment by davinder...@gmail.com on 15 Nov 2014 at 5:05