From 74c0ac487332231e8dd6ba35580b07166ffbcfe2 Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 18 Feb 2010 08:36:40 +0000 Subject: mise en conformité de la reponse au Ping avec les autres implementations --- IvyCursor/IvyCursor.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) (limited to 'IvyCursor/IvyCursor.cpp') diff --git a/IvyCursor/IvyCursor.cpp b/IvyCursor/IvyCursor.cpp index 2a018cf..5b1a3d4 100644 --- a/IvyCursor/IvyCursor.cpp +++ b/IvyCursor/IvyCursor.cpp @@ -129,6 +129,47 @@ void ivyPointerEvent(IvyApplication *app, void *user_data, int argc, const char } +UINT TabletToMouseButton( int button , bool down ) +{ + UINT mouse_bttton; + if ( down ) + { + switch ( button ) + { + case 1: + mouse_bttton = MOUSEEVENTF_LEFTDOWN; + break; + case 2: + mouse_bttton = MOUSEEVENTF_MIDDLEDOWN; + break; + case 3: + mouse_bttton = MOUSEEVENTF_RIGHTDOWN; + break; + default: + mouse_bttton = MOUSEEVENTF_LEFTDOWN; + break; + } + } + else + { + switch ( button ) + { + case 1: + mouse_bttton = MOUSEEVENTF_LEFTUP; + break; + case 2: + mouse_bttton = MOUSEEVENTF_MIDDLEUP; + break; + case 3: + mouse_bttton = MOUSEEVENTF_RIGHTUP; + break; + default: + mouse_bttton = MOUSEEVENTF_LEFTUP; + break; + } + } + return button; +} void ivyButtonEvent(IvyApplication *app, void *user_data, int argc, const char **argv) { static int bt_down = 0; @@ -149,6 +190,7 @@ void ivyButtonEvent(IvyApplication *app, void *user_data, int argc, const char * double hires_y = atof(*argv++); const char *proximity = *argv++; // (In|Out|unchanged) + // hack for tablet PC if ( serial_number ==0 ) { @@ -159,7 +201,7 @@ void ivyButtonEvent(IvyApplication *app, void *user_data, int argc, const char * { if ( *status == 'u' && bt_down ) { - SendInput ( MOUSEEVENTF_LEFTUP, hires_x, hires_y , wheel ); + SendInput ( TabletToMouseButton( button,false ), hires_x, hires_y , wheel ); bt_down = 0; } @@ -168,12 +210,12 @@ void ivyButtonEvent(IvyApplication *app, void *user_data, int argc, const char * { if ( (*status) == 'd' ) { - SendInput ( MOUSEEVENTF_WHEEL | MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN , hires_x, hires_y , wheel ); + SendInput ( MOUSEEVENTF_WHEEL | MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | TabletToMouseButton( button,true ) , hires_x, hires_y , wheel ); bt_down = 1; } else { - SendInput ( MOUSEEVENTF_WHEEL | MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTUP , hires_x, hires_y , wheel ); + SendInput ( MOUSEEVENTF_WHEEL | MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE | TabletToMouseButton( button,false ) , hires_x, hires_y , wheel ); bt_down = 0; } } -- cgit v1.1