diff options
author | tissoire | 2012-05-15 12:28:16 +0000 |
---|---|---|
committer | tissoire | 2012-05-15 12:28:16 +0000 |
commit | a21da73772583801f6f6b4d6b77ec906a2b0975b (patch) | |
tree | 3a983381f0f93a3ec1e2ae36ffa22713158fe3e7 /src/ivypointer.c | |
parent | 9a556b82b473f0ece9294791c21fbb1f9f72b891 (diff) | |
download | ivypointer-a21da73772583801f6f6b4d6b77ec906a2b0975b.zip ivypointer-a21da73772583801f6f6b4d6b77ec906a2b0975b.tar.gz ivypointer-a21da73772583801f6f6b4d6b77ec906a2b0975b.tar.bz2 ivypointer-a21da73772583801f6f6b4d6b77ec906a2b0975b.tar.xz |
fix segfault when using xinput2 and retrieving time information
Diffstat (limited to 'src/ivypointer.c')
-rw-r--r-- | src/ivypointer.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/ivypointer.c b/src/ivypointer.c index dbc9c72..c365042 100644 --- a/src/ivypointer.c +++ b/src/ivypointer.c @@ -80,6 +80,8 @@ #define CHAMP_X_WACOM 12 #define CHAMP_Y_WACOM 13 +#define CHAMP_TIME_WACOM 11 +#define CHAMP_PRESSURE_WACOM 3 #define CHAMP_X_WACOM_BUTTON 14 #define CHAMP_Y_WACOM_BUTTON 15 @@ -95,6 +97,8 @@ #define CHAMP_X_WACOM_2 1 #define CHAMP_Y_WACOM_2 2 +#define CHAMP_TIME_XINPUT_2 4 +#define CHAMP_PRESSURE_XINPUT_2 3 #define CHAMP_X_WACOM_BUTTON_2 1 #define CHAMP_Y_WACOM_BUTTON_2 2 @@ -134,6 +138,8 @@ static int champX; static int champY; static int champXButton; static int champYButton; +static int champTime; +static int champPressure; static float old_x = 0; static float old_y = 0; @@ -354,8 +360,8 @@ static void CallbackPointer (IvyClientPtr app, void *user_data, int argc, char * // char *id = argv[0]; float x = atof(argv[champX]); // predicted position float y = atof(argv[champY]); // predicted position - int time = atoi(argv[11-device_input_id_given]); - int presure = atoi(argv[3-device_input_id_given]); + int time = atoi(argv[champTime]); + int presure = atoi(argv[champPressure]); static int old_time = 0; static int should_click = 0; static int clicked = 0; @@ -652,6 +658,8 @@ int main(int argc, char *argv[]) { champXButton = CHAMP_X_WACOM_PREDICTIVE_BUTTON; champYButton = CHAMP_Y_WACOM_PREDICTIVE_BUTTON; } + champTime = CHAMP_TIME_WACOM; + champPressure = CHAMP_PRESSURE_WACOM; break; case XINPUT2: coords_input[2] = 104480.0; @@ -660,6 +668,8 @@ int main(int argc, char *argv[]) { champY = CHAMP_Y_WACOM_2; champXButton = CHAMP_X_WACOM_BUTTON_2; champYButton = CHAMP_Y_WACOM_BUTTON_2; + champTime = CHAMP_TIME_XINPUT_2; + champPressure = CHAMP_PRESSURE_XINPUT_2; break; default: champX = CHAMP_X_TELEPOINTEUR; @@ -670,6 +680,8 @@ int main(int argc, char *argv[]) { champY -= device_input_id_given; champXButton -= device_input_id_given; champYButton -= device_input_id_given; + champTime -= device_input_id_given; + champPressure -= device_input_id_given; width_input = coords_input[2]-coords_input[0]; height_input = coords_input[3]-coords_input[1]; |