From d3787d9c9e99130dbf6d5fc9b53c03eab8cee05c Mon Sep 17 00:00:00 2001 From: tissoire Date: Fri, 21 Dec 2007 15:54:46 +0000 Subject: ajout basculement relatif/absolu --- src/ivypointer.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ivypointer.c b/src/ivypointer.c index e6b6f37..7183f0d 100644 --- a/src/ivypointer.c +++ b/src/ivypointer.c @@ -74,7 +74,7 @@ float coords_input[4] = {0.0,0.0,100.0,100.0}; int width_input,height_input; int dragged = 0; -int relative = 1; +int relative = 0; Display* openDisplay(const char* displayName) @@ -357,9 +357,9 @@ void CallbackPad (IvyClientPtr app, void *user_data, int argc, char *argv[]) { press = 1; } // printf("Pad button=%d pressed%d event received\n",b, press); - if (b==11 || b==15){ - //mode relatif - relative = !press; + if (b==11 || b==15 || (press && (b==12 || b==16))){ + //inversion du mode + relative = !relative; } else { fakeMouseButton(b,press); } @@ -386,6 +386,7 @@ int main(int argc, char *argv[]) { "[options] [regexps]\n\t-b bus\t\tdefines the Ivy bus to which to connect to, defaults to 127:2010\n" "\t-w\t\tuse data from xinput_wacom instead of ModeManager\n" "\t-c x0,y0,x1,y1\tspecify the coords of the window used (only used with wacom)\n" + "\t-r\tuse relative mode by default\n" "\t-v\t\tprints the ivy relase number\n\n" ; int wacom = 0; @@ -396,7 +397,7 @@ int main(int argc, char *argv[]) { int j = 0; int coupures[4] = {0,0,0,0}; int last = 0; - while ((c = getopt(argc, argv, "vb:wc:")) != EOF) + while ((c = getopt(argc, argv, "vb:wc:r")) != EOF) switch (c) { case 'b': strcpy (busbuf, optarg); @@ -405,6 +406,9 @@ int main(int argc, char *argv[]) { case 'v': printf("ivy c library version %d.%d\n",IVYMAJOR_VERSION,IVYMINOR_VERSION); break; + case 'r': + relative = 1; + break; case 'w': wacom = 1; break; -- cgit v1.1