diff options
author | fcolin | 2010-02-18 08:36:40 +0000 |
---|---|---|
committer | fcolin | 2010-02-18 08:36:40 +0000 |
commit | 74c0ac487332231e8dd6ba35580b07166ffbcfe2 (patch) | |
tree | 9701376529ae517ff148ebddadcffba69edf47f5 /IvyCursor/IvyCursor.cpp | |
parent | 47ef2ac6357971a3feedd8f32462874ca7566c26 (diff) | |
download | ivy-cplusplus-74c0ac487332231e8dd6ba35580b07166ffbcfe2.zip ivy-cplusplus-74c0ac487332231e8dd6ba35580b07166ffbcfe2.tar.gz ivy-cplusplus-74c0ac487332231e8dd6ba35580b07166ffbcfe2.tar.bz2 ivy-cplusplus-74c0ac487332231e8dd6ba35580b07166ffbcfe2.tar.xz |
mise en conformité de la reponse au Ping avec les autres implementations
Diffstat (limited to 'IvyCursor/IvyCursor.cpp')
-rw-r--r-- | IvyCursor/IvyCursor.cpp | 48 |
1 files changed, 45 insertions, 3 deletions
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;
}
}
|