gmamaladze / globalmousekeyhook

This library allows you to tap keyboard and mouse, detect and record their activity even when an application is inactive and runs in background.
MIT License
1.05k stars 257 forks source link

Click delay #100

Open TominoCZ opened 6 years ago

TominoCZ commented 6 years ago

I bound a delegate function to the MouseClickevent handler in the global events and there is a really noticable delay between the calls. Even up to half a second.' ..so now I'm simulating the click event using MouseUpand MouseDown like so:

    public Form1()
    {
        InitializeComponent();

        var wasDown = false;

        _events.MouseDown += (o, e) => wasDown = true;
        _events.MouseUp += (o, e) =>
        {
            if (wasDown)
                click(e);

            wasDown = false;
        };
    }

    void click (MouseEventArgs e)
    {
         // stuff...
    }