Wednesday, April 6, 2011

twofing double click bug solved

Hey there,
    So even though nobody else was complaining about twofing double-clicking when it should only be single clicking, I've gone ahead and assumed that twofing is to blame. I messed around with my drivers but everything seemed ok.

So, I popped open gestures.c and looked through it. I added some debug prints at each of the fingerdown if statements and noticed that when I ran in debug mode (twfing --debug), nothing out of the ordinary was happening...
I press once and the finger down boolean switches to 1, when I lift my finger, the boolean goes back to zero...but two clicks appear to reach gnome. I remembered reading in the twofing doc that for interactions with non-special windows clicks are passed off to x...but the code on lines 509 to 516 looked suspicious:

  else if (fingersDown == 0 && fingersWereDown > 0) {
        /* Last finger released */
        if (hadTwoFingersOn == 0 && !isButtonDown()) {
            /* The button press time has not been reached yet, and we never had two
             * fingers on (we could not have done this in this short time) so
             * we simulate button down and up now. */
       
            pressButton();
            releaseButton();




So the comments there didn't make much sense to me but I went ahead and removed the last two statements which basically sent a (additional) mouse click.

Ran make and launched twofing and lo and behold no more double clicks for my single-click touches. Now I still need to run with this patch a little longer to confirm that it doesn't break anything but so far everything seems to be just perfecto...!


3 comments:

  1. Hi,
    I also sometimes got the double click... Later I found that I was starting the twofing daemon twice.. Now it works like charm.
    /* Offtopic
    my Wifi card and bluetooth are not recognized (my wlan0 is hard blocked as reported by 'rskill'). I'm about to install Backtrack 4 and see what happens. Will twofing work in backtrack as well? Thanks
    */

    ReplyDelete
  2. I think since BT4 is based on Ubuntu you should be fine as long as you get all your drivers in order.

    Not sure what is happening with your BT and Wifi, they work fine for me. What os are you running?

    I'm pretty sure I'm not starting two instances of twofing on my machine...I'll check again though.
    Cheers!

    ReplyDelete
  3. Hi Etheros,

    I have a very strange problem with twofing and KDE. When twofing runs, I can not use Dolphin and the KDE software center.

    Twofing does something magic. For example: When i want to select more files in Dolphin, the whole window moves. It seems, that twofing emulates the KDE Shortcut ALT+left mouse button. Then you can move the Dolphin windows.

    If I deactivate the shortcut in KDE system settings, the windows moves nethertheless :(

    Do you have any ideas?

    ReplyDelete