lorenzodelarocha / touchegg

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

Actions occur at start versus at end of gesture #185

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi! First, let me start off by saying how much more enjoyable touchegg has made 
navigating around my operating system. Very nice job, and thank you for your 
hard work!

I have a feature suggestion that I think would make touchegg even better. And 
looking quickly at the codebase, I think it would be reasonably easy to 
implement (and I would be happy to do so and contribute a patch). I notice that 
many actions - such as SEND_KEYS, CHANGE_DESKTOP, etc. - apply their effects at 
the end of the gesture. I think that some touchegg actions would feel more 
responsive if they could be configured to instead happen at the start of the 
gesture rather than at the end. 

For example on my OS, I map four-finger drags to changing desktops. My desktop 
starts to "slide" to the next one only after I remove my fingers from the 
trackpad. I modified ChangeDesktop.cpp to make the action take effect during 
executeStart(...) instead of executeEnd(...), and after recompiling and 
running, the gesture felt much more responsive and fluid to my taste. In my 
humble opinion, offering an option for users to choose when some actions take 
place would be quite a useful feature.

There are a few ways I can imagine doing this, and would be interested if you 
have any suggestions. Perhaps allowing something like <action type="..." 
timing="gesture-start"> ... </action> would work well for the appropriate 
actions, or using the ":" notation to separate different parameters within the 
action as is used by SCROLL actions. For example, <action 
type="CHANGE_DESKTOP">NEXT:TIMING=AT_START</action>. Then, the corresponding 
actions could simply decide via that boolean value whether to perform the 
action during executeStart(...) or executeEnd(...).

I'd be happy to contribute a patch for something like this and am curious what 
would be the preferred way.

Thanks!

Cheers,
Steve

Original issue reported on code.google.com by sjlevin...@gmail.com on 1 Jan 2013 at 2:58

GoogleCodeExporter commented 8 years ago
All patchs are wellcome!

Original comment by jose.exposito89@gmail.com on 1 Jan 2013 at 5:51

GoogleCodeExporter commented 8 years ago
Done! Please see the attached patch, which should apply cleanly at the base of 
the SVN repository.

My changes allow a "when" attribute to specified in actions, that can be either 
AT_START or AT_END. For example:

    <gesture type="DRAG" fingers="4" direction="UP">
            <action type="CHANGE_DESKTOP" when="AT_START">NEXT</action>
    </gesture>

In this example, the CHANGE_DESKTOP action will be triggered at the start of 
the drag, instead of at the end as before.

This sort of feature really makes a difference when there are compiz-like 
effects enabled. The screen appears to slide fluidly and smoothly to the next 
desktop as soon as the fingers start moving on the touchpad, which feels great. 
For actions that are a discrete event, being able to map them to the start/end 
of the gesture is very nice in my humble opinion.

If a user doesn't specify any "when" attributes in the configuration file, the 
code assumes "AT_END" by default (which is the original behavior). So, people 
with unmodified configuration files shouldn't see any difference in behavior 
when they update.

I modified the following actions to support this tag: CHANGE_DESKTOP, 
CHANGE_VIEWPORT, CLOSE_WINDOW, MOUSE_CLICK, MINIMIZE_WINDOW, 
MAXIMIZE_RESTORE_WINDOW, CLOSE_WINDOW, SHOW_DESKTOP, SEND_KEYS, and 
RUN_COMMAND. 

Please let me know what you think!

Cheers,
Steve

Original comment by sjlevin...@gmail.com on 2 Jan 2013 at 10:47

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you very much, I'll test and commit it this weekend.

Thanks again for your work!!

Original comment by jose.exposito89@gmail.com on 2 Jan 2013 at 10:48

GoogleCodeExporter commented 8 years ago
My pleasure! Again, don't hesitate to let me know if you have any questions or 
want me to make any changes.

Cheers,
Steve

Original comment by sjlevin...@gmail.com on 3 Jan 2013 at 1:33

GoogleCodeExporter commented 8 years ago
This patch is actually really cool, useful and working (at least for me) and I 
was wondering, why you didn't commit it to the svn? 
I had to manually patch it, at least.

Original comment by jannes.h...@gmail.com on 23 Oct 2013 at 10:15

GoogleCodeExporter commented 8 years ago
Yes, seems to work for me, too - and most non-continuous drag actions seem to 
benefit greatly from this change. I'd go so far as to suggest making the 
default timing to be at the start in future releases.

Original comment by thefishf...@gmail.com on 15 Nov 2013 at 12:10

GoogleCodeExporter commented 8 years ago
@sjlevine29 I'm so sorry for the big delay applying this patch, but I have just 
committed it.
Thank you very much for your collaboration :D

Original comment by jose.exposito89@gmail.com on 1 Dec 2013 at 12:48