Merge lp:~gustavold/ginn/ginn.gustavo into lp:ginn

Proposed by Gustavo Luiz Duarte
Status: Superseded
Proposed branch: lp:~gustavold/ginn/ginn.gustavo
Merge into: lp:ginn
Diff against target: 103 lines (+25/-8)
2 files modified
src/ginn.c (+13/-7)
src/xt.c (+12/-1)
To merge this branch: bzr merge lp:~gustavold/ginn/ginn.gustavo
Reviewer Review Type Date Requested Status
Mohamed IKBEL Boulabiar (community) Needs Fixing
Stephen M. Webb Pending
Review via email: mp+38769@code.launchpad.net

This proposal supersedes a proposal from 2010-10-18.

This proposal has been superseded by a proposal from 2010-10-18.

Description of the change

It provides necessary code for injecting pointer clicks (e.g. for scrolling) and gesture matching based on the gesture state (update vs finish).

To post a comment you must log in.
Revision history for this message
Stephen M. Webb (bregma) wrote : Posted in a previous version of this proposal

Hmm, mid-air collision!

Could you please bzr pull and resolve conflicts, then resubmit?

review: Needs Fixing
Revision history for this message
Gustavo Luiz Duarte (gustavold) wrote :

Sorry for that. Conflicts resolved. Please let me know if you have any other consideration.

lp:~gustavold/ginn/ginn.gustavo updated
29. By Mohamed IKBEL Boulabiar

Fixes the structure of configuration to support having the minimum and the max values.

30. By Mohamed IKBEL Boulabiar

Modify the order of storing gesture parameters.

31. By Mohamed IKBEL Boulabiar

Adds function to check inside intervall.
Make the verification of properties generic (can use up to all properties for matching)
Optimise the verification of gesture properties : only one traversal (or less)

Revision history for this message
Mohamed IKBEL Boulabiar (boulabiar) wrote :

Thanks Gustavo !
Sorry for the collision, can you just resubmit the xt.c file changes ?

review: Needs Fixing
lp:~gustavold/ginn/ginn.gustavo updated
32. By Mohamed IKBEL Boulabiar

Merge code from Gustavo to support modifiers in injected keystrokes.

33. By Mohamed IKBEL Boulabiar

Adding file to show possible keys to be used in Ginn wishes.

34. By Mohamed IKBEL Boulabiar

Adding a full structure to exchange the wish gesture information

35. By Mohamed IKBEL Boulabiar

Using the new structure to exchange wish information.
Moving from static to dynamic loading of wishes.
Preparing functions to handle more than 1 wish.

36. By Mohamed IKBEL Boulabiar

Add more wishes to be parsed in the config. file.

37. By Mohamed IKBEL Boulabiar

Parsing more than 1 wish and storing it in dynamic allocated structures => done.

38. By Mohamed IKBEL Boulabiar

Ginn now parses many wishes and react according to them.

39. By Mohamed IKBEL Boulabiar

Removing some useless code from the wish/gesture matching function.

40. By Mohamed IKBEL Boulabiar

Add somes wishes to be used with Evince.

41. By Mohamed IKBEL Boulabiar

Add the support of Modifiers inside the wish xml file.
Added 2 cases to be used with inkscape.

42. By Mohamed IKBEL Boulabiar

Add support for Modifiers in the parsing of the wishes and in sending events.

43. By Mohamed IKBEL Boulabiar

Merging Stephen's additions :
  Stephen M. Webb 2010-10-21 Added default wishes.xml to the distributed files.
    Stephen M. Webb 2010-10-21 Added a search for the default wishes file.

44. By Mohamed IKBEL Boulabiar

Added a wish for Tap-4 gesture to test a compiz effect.

45. By Mohamed IKBEL Boulabiar

Modify Ginn to not subscribe to 1-finger gestures.
There are to be used with other applications.

46. By Mohamed IKBEL Boulabiar

Adding file to know the number of mouse buttons.
This support may be added later to Ginn.

47. By Mohamed IKBEL Boulabiar

Passes the key to be injected through the new stucture.

48. By Mohamed IKBEL Boulabiar

Add 2 gestures where more than 1 modifier key is used.

49. By Mohamed IKBEL Boulabiar

Modify Ginn to support wishes up to 4 Modifiers keys.

50. By Mohamed IKBEL Boulabiar

Corrected a small bug of not comparing number of fingers.

51. By Mohamed IKBEL Boulabiar

Add some gestures wishes.
Merge Gustavo modifications and bugfixes:
  Gustavo Luiz Duarte 2010-10-26 Support for accumulated gesture values and state aware action configuration
    Gustavo Luiz Duarte 2010-10-26 Bugfix: Ginn was discarding the last configured trigger when there was more than one

52. By Mohamed IKBEL Boulabiar

Adding a ToDo file

53. By Mohamed IKBEL Boulabiar

Split the wishes parsing function for clarity.

54. By Mohamed IKBEL Boulabiar

Clean the logic of parsing wishes : Move to recursive handling
Remove a previous hack.

55. By Mohamed IKBEL Boulabiar

Small code cleanups and factorizations.

56. By Mohamed IKBEL Boulabiar

Add wishes for Inkscape and Evince

57. By Mohamed IKBEL Boulabiar

Add support for Application wishes parsing.

58. By Mohamed IKBEL Boulabiar

Add support for modifiers in injecting Buttons.

59. By Mohamed IKBEL Boulabiar

Add support for parsing and storing buttons from the wishes.

60. By Mohamed IKBEL Boulabiar

Support injecting mouse Buttons.

61. By Gustavo Luiz Duarte

Opens connection to X only once at startup and reuses it during execution

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ginn.c'
2--- src/ginn.c 2010-10-18 20:50:21 +0000
3+++ src/ginn.c 2010-10-18 22:06:01 +0000
4@@ -30,6 +30,10 @@
5 #include <X11/Xlib.h>
6 #include <X11/keysym.h>
7
8+#define GINN_START 0
9+#define GINN_UPDATE 1
10+#define GINN_FINISH 2
11+
12 att config_attr[25] = { [0 ... 24] = {.attrName="", .val=0, .valMax=0 } };
13
14 static int
15@@ -41,7 +45,8 @@
16 gesture_match( GeisGestureType gesture_type,
17 GeisGestureId gesture_id,
18 GeisSize attr_count,
19- GeisGestureAttr *attrs)
20+ GeisGestureAttr *attrs,
21+ int state)
22 {
23 int i = 0;
24 int valid=1;
25@@ -50,15 +55,15 @@
26 //Drag
27 case 0: if (gesture_type==config_attr[1].val) {
28 if (attrs[9].float_val > config_attr[2].val)
29- injTest(XStringToKeysym(config_attr[0].attrName));
30+ injTest(XStringToKeysym(config_attr[0].attrName), NULL);
31 }
32 break;
33 //Pinch/Zoom
34 case 1: if (gesture_type==config_attr[1].val) {
35 /* if (attrs[9].float_val > config_attr[2].val)
36- injTest(XStringToKeysym(config_attr[0].attrName));
37+ injTest(XStringToKeysym(config_attr[0].attrName), NULL);
38 else if (attrs[9].float_val < -config_attr[2].val)
39- injTest(XK_KP_Subtract);
40+ injTest(XK_KP_Subtract, NULL);
41 */
42 int attrsI=9, cAttrI=3;
43 do {
44@@ -71,13 +76,13 @@
45 } else attrsI++;
46 } while ( (0!=strcmp(config_attr[cAttrI+1].attrName,"")) && attrsI<18 && valid );
47 if (valid)
48- injTest(XStringToKeysym(config_attr[0].attrName));
49+ injTest(XStringToKeysym(config_attr[0].attrName), NULL);
50 }
51 break;
52 //Rotate
53 case 2: if (gesture_type==config_attr[1].val) {
54 if (attrs[9].float_val > config_attr[2].val)
55- injTest(XStringToKeysym(config_attr[0].attrName));
56+ injTest(XStringToKeysym(config_attr[0].attrName), NULL);
57 }
58 break;
59 //Tap
60@@ -184,7 +189,7 @@
61 fprintf(stdout, "Gesture type %d updated\n", gesture_type);
62 for (i = 0; i < attr_count; ++i)
63 print_attr(&attrs[i]);
64- gesture_match(gesture_type, gesture_id, attr_count, attrs);
65+ gesture_match(gesture_type, gesture_id, attr_count, attrs, GINN_UPDATE);
66 }
67
68 static void
69@@ -198,6 +203,7 @@
70 fprintf(stdout, "Gesture type %d finished\n", gesture_type);
71 for (i = 0; i < attr_count; ++i)
72 print_attr(&attrs[i]);
73+ gesture_match(gesture_type, gesture_id, attr_count, attrs, GINN_FINISH);
74 }
75
76
77
78=== modified file 'src/xt.c'
79--- src/xt.c 2010-10-08 12:12:10 +0000
80+++ src/xt.c 2010-10-18 22:06:01 +0000
81@@ -22,11 +22,22 @@
82 #include <X11/keysym.h>
83
84 void
85-injTest(KeySym ks)
86+injTest(KeySym ks, KeySym modifier)
87 {
88 Display* disp = XOpenDisplay(NULL);
89+ if (modifier != NULL) XTestFakeKeyEvent(disp, XKeysymToKeycode(disp, modifier), True, CurrentTime);
90 XTestFakeKeyEvent(disp, XKeysymToKeycode(disp, ks), True, CurrentTime);
91 XTestFakeKeyEvent(disp, XKeysymToKeycode(disp, ks), False, CurrentTime);
92+ if (modifier != NULL) XTestFakeKeyEvent(disp, XKeysymToKeycode(disp, modifier), False, CurrentTime);
93+ XCloseDisplay(disp);
94+}
95+
96+void
97+injButton(int btn, KeySym modifier)
98+{
99+ Display* disp = XOpenDisplay(NULL);
100+ XTestFakeButtonEvent(disp, btn, True, CurrentTime);
101+ XTestFakeButtonEvent(disp, btn, False, CurrentTime);
102 XCloseDisplay(disp);
103 }
104