summaryrefslogtreecommitdiff
path: root/IvyCursor/IvyCursor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'IvyCursor/IvyCursor.cpp')
-rw-r--r--IvyCursor/IvyCursor.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/IvyCursor/IvyCursor.cpp b/IvyCursor/IvyCursor.cpp
index cb91542..2a018cf 100644
--- a/IvyCursor/IvyCursor.cpp
+++ b/IvyCursor/IvyCursor.cpp
@@ -30,6 +30,7 @@ BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
+bool lock = false;
void ivyCursorMouve(IvyApplication *app, void *user_data, int argc, const char **argv)
{
@@ -78,10 +79,12 @@ void ivyCursorClick(IvyApplication *app, void *user_data, int argc, const char *
_RPT3(_CRT_WARN,"ivyCursorClick can click to x=%d y=%d error=%d\n",x,y,GetLastError());
}
}
-void SendInput ( DWORD flags, float x, float y , int wheel )
+void SendInput ( DWORD flags, double x, double y , int wheel )
{
UINT nb;
INPUT Inputs;
+
+ if ( lock ) return;
Inputs.type = INPUT_MOUSE;
Inputs.mi.dwFlags = flags;
@@ -109,9 +112,9 @@ void ivyPointerEvent(IvyApplication *app, void *user_data, int argc, const char
int predicted_y = atoi(*argv++);
const char *type = *argv++;
int serial_number = atoi(*argv++);
- float time = atof(*argv++);
- float hires_x = atof(*argv++);
- float hires_y = atof(*argv++);
+ double time = atof(*argv++);
+ double hires_x = atof(*argv++);
+ double hires_y = atof(*argv++);
const char *proximity = *argv++; // (In|Out|unchanged)
// hack for tablet PC
@@ -141,9 +144,9 @@ void ivyButtonEvent(IvyApplication *app, void *user_data, int argc, const char *
int predicted_y = atoi(*argv++);
const char *type = *argv++;
int serial_number = atoi(*argv++);
- float time = atof(*argv++);
- float hires_x = atof(*argv++);
- float hires_y = atof(*argv++);
+ double time = atof(*argv++);
+ double hires_x = atof(*argv++);
+ double hires_y = atof(*argv++);
const char *proximity = *argv++; // (In|Out|unchanged)
// hack for tablet PC
@@ -152,7 +155,7 @@ void ivyButtonEvent(IvyApplication *app, void *user_data, int argc, const char *
hires_x *= 86800 / 1400;
hires_y *= 65000 / 1050;
}
- if ( hires_x < 0 || hires_y < 0 )
+ if ( hires_x < 0 || hires_y < 0 || hires_x > 1.0 || hires_y > 1.0 )
{
if ( *status == 'u' && bt_down )
{
@@ -190,6 +193,12 @@ void ivySliderEvent(IvyApplication *app, void *user_data, int argc, const char *
int time = atoi(*argv++);
}
+void ivyLockEvent(IvyApplication *app, void *user_data, int argc, const char **argv)
+{
+ const char* status = *argv++ ; // (lock|unlock)
+ lock = ( *status == 'l' );
+}
+
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
@@ -270,6 +279,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
bus->BindMsg(BUS_CALLBACK(ivyButtonEvent,0), "^button_event device_id=%s:%s:%s button=([-.0-9]+) status=(up|down) x=([-0-9]+) y=([-0-9]+) presure=([-0-9]+) tilt_x=([-0-9]+) tilt_y=([-0-9]+) wheel=([-0-9]+) predicted_x=([-0-9]+) predicted_y=([-0-9]+) type=(.*) serial_number=([-0-9]+) time=([-0-9]+) hires_x=([-.0-9]+) hires_y=([-.0-9]+) proximity=(In|Out|unchanged)", acc, wp, role );
bus->BindMsg(BUS_CALLBACK(ivyPadEvent,0), "^pad_event device_id=%s:%s:%s button=([0-9]+) status=(up|down) time=([-0-9]+)", acc, wp, role);
bus->BindMsg(BUS_CALLBACK(ivySliderEvent,0), "^slider_event device_id=%s:%s:%s value=([-0-9]+) side=(left|right) time=([-0-9]+)", acc, wp, role);
+ bus->BindMsg(BUS_CALLBACK(ivyLockEvent,0), "^lock_event device_id=%s:%s:%s status=(lock|unlock)", acc, wp, role);
bus->start( ivybus );