summaryrefslogtreecommitdiff
path: root/IvyCursor/IvyCursor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'IvyCursor/IvyCursor.cpp')
-rw-r--r--IvyCursor/IvyCursor.cpp48
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;
}
}