aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortissoire2008-01-30 13:42:07 +0000
committertissoire2008-01-30 13:42:07 +0000
commit422be6425b61457d8122b6e9ebe5e05ea241b380 (patch)
tree5ed3a3812eec202791cc1d2992ef146dc6dad3a6
parente57bf8c57f8e6e655abd8d73874a29c10ddea6c3 (diff)
downloadivypointer-422be6425b61457d8122b6e9ebe5e05ea241b380.zip
ivypointer-422be6425b61457d8122b6e9ebe5e05ea241b380.tar.gz
ivypointer-422be6425b61457d8122b6e9ebe5e05ea241b380.tar.bz2
ivypointer-422be6425b61457d8122b6e9ebe5e05ea241b380.tar.xz
Inversion des ~v~nements 'move' et 'click'
-rw-r--r--config.h.in6
-rwxr-xr-xconfigure280
-rw-r--r--configure.in2
-rw-r--r--debian/changelog6
-rw-r--r--debian/control2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/Makefile.in2
-rw-r--r--src/ivypointer.c202
8 files changed, 427 insertions, 75 deletions
diff --git a/config.h.in b/config.h.in
index 6df6aeb..1d62eec 100644
--- a/config.h.in
+++ b/config.h.in
@@ -9,6 +9,9 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
+/* Define to 1 if you have the <pcre.h> header file. */
+#undef HAVE_PCRE_H
+
/* Define to 1 if stdbool.h conforms to C99. */
#undef HAVE_STDBOOL_H
@@ -33,6 +36,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define to 1 if you have the <X11/extensions/XInput.h> header file. */
+#undef HAVE_X11_EXTENSIONS_XINPUT_H
+
/* Define to 1 if you have the <X11/extensions/XTest.h> header file. */
#undef HAVE_X11_EXTENSIONS_XTEST_H
diff --git a/configure b/configure
index 82bfde1..4d50716 100755
--- a/configure
+++ b/configure
@@ -4887,6 +4887,146 @@ fi
done
+for ac_header in pcre.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
for ac_header in X11/extensions/XTest.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -5026,6 +5166,146 @@ fi
done
+
+for ac_header in X11/extensions/XInput.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
CPPFLAGS="-Wall -O" # définition de la variable CPPFLAGS
# inscription (propagation) de la variable
ac_ext=c
diff --git a/configure.in b/configure.in
index d48ee42..caf17de 100644
--- a/configure.in
+++ b/configure.in
@@ -9,7 +9,9 @@ AC_C_CONST
AC_CHECK_HEADERS([Ivy/ivy.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([string.h])
+AC_CHECK_HEADERS([pcre.h])
AC_CHECK_HEADERS([X11/extensions/XTest.h])
+AC_CHECK_HEADERS([X11/extensions/XInput.h])
CPPFLAGS="-Wall -O" # définition de la variable CPPFLAGS
AC_SUBST(CPPFLAGS) # inscription (propagation) de la variable
AC_PROG_CC
diff --git a/debian/changelog b/debian/changelog
index a7c983f..7c2f1bc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+ivypointer (0.0.4-1) unstable; urgency=low
+
+ * Inversion des évènements 'move' et 'click'
+
+ -- Benjamin Tissoires <tissoire@cena.fr> Fri, 30 Jan 2008 14:39:06 +0100
+
ivypointer (0.0.4-0) unstable; urgency=low
* Ajout de la possibilite de modifier la resolution de la fenetre cible
diff --git a/debian/control b/debian/control
index 671a9c0..14dd567 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Priority: extra
Section: unknown
Maintainer: Benjamin Tissoires <tissoire@cena.fr>
Build-Depends: debhelper (>> 4.0.0), libc6-dev, xlibs-dev | libx11-dev | xorg-dev, ivy-c-dev
-Standards-Version: 0.0.4
+Standards-Version: 0.0.4-1
Package: ivypointer
Section: unknown
diff --git a/src/Makefile.am b/src/Makefile.am
index 4af348e..7c46171 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,3 +1,3 @@
bin_PROGRAMS = ivypointer
ivypointer_SOURCES = ivypointer.c getopt.c
-ivypointer_LDADD = -livy -lX11 -lXtst
+ivypointer_LDADD = -livy -lX11 -lXtst -lpcre -lXi
diff --git a/src/Makefile.in b/src/Makefile.in
index 1247e33..c683a27 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -144,7 +144,7 @@ target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ivypointer_SOURCES = ivypointer.c getopt.c
-ivypointer_LDADD = -livy -lX11 -lXtst
+ivypointer_LDADD = -livy -lX11 -lXtst -lpcre -lXi
all: all-am
.SUFFIXES:
diff --git a/src/ivypointer.c b/src/ivypointer.c
index 95ade81..55b9343 100644
--- a/src/ivypointer.c
+++ b/src/ivypointer.c
@@ -26,9 +26,17 @@
# include <X11/Xlib.h>
# include <X11/X.h>
# include <X11/Xutil.h>
+//# include<X11/extensions/XInput.h>
+//# include<X11/extensions/shape.h>
# define XK_MISCELLANY
# define XK_XKB_KEYS
# include <X11/keysymdef.h>
+# ifndef IsXExtensionKeyboard
+# define IsXExtensionKeyboard 3
+# endif
+# ifndef IsXExtensionPointer
+# define IsXExtensionPointer 4
+# endif
# if HAVE_X11_EXTENSIONS_XTEST_H
# include <X11/extensions/XTest.h>
# else
@@ -70,6 +78,7 @@
#define TIME_BETWEEN_CLICK 200
Display* display = NULL;
+XDevice* device = NULL;
int width,height;
float coords_input[4] = {0.0,0.0,100.0,100.0};
int width_input,height_input, offsetx, offsety;
@@ -77,6 +86,9 @@ int width_input,height_input, offsetx, offsety;
int dragged = 0;
int relative = 0;
+int champX = 1;
+int champY = 2;
+
Display*
openDisplay(const char* displayName)
{
@@ -125,6 +137,41 @@ openDisplay(const char* displayName)
}
#endif
+// XDeviceInfo* devices;
+// int devicecount;
+//
+// devices = XListInputDevices(display, &devicecount);
+//// printf("there are %d available devices :\n",devicecount);
+// while(devicecount)
+// {
+// XDeviceInfo* currDevice;
+//
+// currDevice = &devices[--devicecount];
+// switch(currDevice->use){
+// case IsXPointer:
+// printf("xpointer id=%d\n",(int)currDevice->id);
+// device = XOpenDevice(display, currDevice->id);
+// if (device == NULL) {
+// printf("EE : can't open device \"%d\"\n", (int)currDevice->id);
+// return NULL;
+// // throw XScreenUnavailable(60.0);
+// }
+// break;
+// case IsXKeyboard:
+// printf("xkeyboard id=%d\n",(int)currDevice->id);
+// break;
+// case IsXExtensionDevice:
+// printf("xextensiondevice id=%d\n",(int)currDevice->id);
+// break;
+// case IsXExtensionKeyboard:
+// printf("XExtensionKeyboard id=%d\n",(int)currDevice->id);
+// break;
+// case IsXExtensionPointer:
+// printf("XExtensionPointer id=%d\n",(int)currDevice->id);
+// break;
+// }
+// }
+
return display;
}
@@ -287,82 +334,86 @@ void CallbackButton (IvyClientPtr app, void *user_data, int argc, char *argv[])
// --------------------------------------------------------------------------
void CallbackPointer (IvyClientPtr app, void *user_data, int argc, char *argv[]) {
-// char *id = argv[0];
- float x = atof(argv[1]);
- float y = atof(argv[2]);
- int time = atoi(argv[11]);
- int presure = atoi(argv[3]);
- static float old_x = 0;
- static float old_y = 0;
- static int old_time = 0;
- static int should_click = 0;
- static int clicked = 0;
- if (dragged && presure==0){
- fakeMouseButton(1,0);
- dragged = 0;
- }
- if (!relative) {
- if (!dragged && presure>0){
- fakeMouseButton(1,1);
- dragged = 1;
- }
- }
-// printf("x = %f,y = %f; ",x,y);
- if (valid(x,y)){
- x = offsetx + (x-coords_input[0])*width/width_input;
- y = offsety + (y-coords_input[1])*height/height_input;
-// printf("x = %f,y = %f\n",x,y);
- if (!relative) {
- fakeMouseMove((int)x,(int)y);
- } else {
- int dx = (int)(x-old_x);
- int dy = (int)(y-old_y);
- int dt = time-old_time;
+ // char *id = argv[0];
+ float x = atof(argv[champX]); // predicted position
+ float y = atof(argv[champY]); // predicted position
+ int time = atoi(argv[11]);
+ int presure = atoi(argv[3]);
+ static float old_x = 0;
+ static float old_y = 0;
+ static int old_time = 0;
+ static int should_click = 0;
+ static int clicked = 0;
+ if (!valid(x,y)){
+ // ignore outside events
+ return;
+ }
+ // printf("x = %f,y = %f; ",x,y);
+ x = offsetx + (x-coords_input[0])*width/width_input;
+ y = offsety + (y-coords_input[1])*height/height_input;
+
+
+ if (!relative) {
+ //absolute mode
+ fakeMouseMove((int)x,(int)y);
+ if (!dragged && presure>0){
+ fakeMouseButton(1,1);
+ dragged = 1;
+ }
+ } else {
+ //relative mode
+ int dx = (int)(x-old_x);
+ int dy = (int)(y-old_y);
+ int dt = time-old_time;
// if (old_time)
// printf("time=%d, old_time=%d, dt=%d\n",time, old_time, dt);
- if (presure > 0) {
- if (!should_click){
- old_time = time;
- dt = 0;
- should_click = 1;
-// printf("armement du timeout\n");
+ if (presure > 0) {
+ if (!should_click){
+ old_time = time;
+ dt = 0;
+ should_click = 1;
+// printf("armement du timeout\n");
+ } else {
+ if (should_click ==1 && dt > TIME_CLICK){
+ should_click = 2;
+// printf("timeout\n");
+ }
+ }
+ fakeMouseRelativeMove(dx,dy);
} else {
- if (should_click ==1 && dt > TIME_CLICK){
- should_click = 2;
-// printf("timeout\n");
- }
- }
- fakeMouseRelativeMove(dx,dy);
- } else {
- if (should_click == 1) {
-// printf("dt = %d\n",dt);
- if (clicked) {
- //double click
-// printf("ck\n");
- fakeMouseButton(1,0);
- }
-// printf("cli\n");
- clicked = 1;
- old_time = time;
- fakeMouseButton(1,1);
- }
- should_click = 0;
- if (clicked) {
- if (dt > TIME_BETWEEN_CLICK){
-// printf("ck\n");
- fakeMouseButton(1,0);
- clicked = 0;
+ if (should_click == 1) {
+// printf("dt = %d\n",dt);
+ if (clicked) {
+ //double click
+// printf("ck\n");
+ fakeMouseButton(1,0);
+ }
+// printf("cli\n");
+ clicked = 1;
+ old_time = time;
+ fakeMouseButton(1,1);
+ }
+ should_click = 0;
+ if (clicked) {
+ if (dt > TIME_BETWEEN_CLICK){
+// printf("ck\n");
+ fakeMouseButton(1,0);
+ clicked = 0;
+ }
+ } else {
+ old_time = 0;
}
- } else {
- old_time = 0;
}
- }
}
- old_x = x;
- old_y = y;
-// } else {
-// printf("bad event\n");
- }
+
+ // release (common of both modes)
+ if (dragged && presure==0){
+ fakeMouseButton(1,0);
+ dragged = 0;
+ }
+
+ old_x = x;
+ old_y = y;
}
void CallbackPad (IvyClientPtr app, void *user_data, int argc, char *argv[]) {
@@ -400,6 +451,7 @@ void printHelpMsg(const char *name){
"\t-c x0,y0,x1,y1\tspecify the coords of the input used (only used with wacom)\n"
"\t-C x0,y0,x1,y1\tspecify the coords of the screen used\n"
"\t-r\tuse relative mode by default\n"
+ "\t-p\tuse predictive mode\n"
"\t-v\t\tprints the ivy relase number\n\n"
;
printf("usage: %s %s",name,helpmsg);
@@ -451,7 +503,7 @@ int main(int argc, char *argv[]) {
int coordsI[4] = {0,0,0,0};
int coordsO[4] = {0,0,0,0};
int c;
- while ((c = getopt(argc, argv, "vb:wc:C:r")) != EOF)
+ while ((c = getopt(argc, argv, "vb:wc:C:rp")) != EOF)
switch (c) {
case 'b':
strcpy (busbuf, optarg);
@@ -466,6 +518,10 @@ int main(int argc, char *argv[]) {
case 'w':
wacom = 1;
break;
+ case 'p':
+ champX = 7;
+ champY = 8;
+ break;
case 'c':
user_coordsI = extractValues(optarg, coordsI, argv[0]);
break;
@@ -511,7 +567,9 @@ int main(int argc, char *argv[]) {
printf("screen : %d+%d x %d+%d\n",offsetx,width,offsety,height);
// verifications
- if (width < 2 || height < 2 || width_input < 2 || height_input < 2){
+ if (width < 2 || height < 2 || (wacom && (width_input < 2 || height_input < 2))){
+ print_coords_input();
+ printf("%d %d %d %d\n",width,height,width_input,height_input);
printHelpMsg(argv[0]);
exit(1);
}