From a21da73772583801f6f6b4d6b77ec906a2b0975b Mon Sep 17 00:00:00 2001 From: tissoire Date: Tue, 15 May 2012 12:28:16 +0000 Subject: fix segfault when using xinput2 and retrieving time information --- src/ivypointer.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/ivypointer.c') 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]; -- cgit v1.1