summaryrefslogtreecommitdiffstats
path: root/tkmacosx/xxlib.mm
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2016-10-27 19:10:39 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2016-10-27 19:10:39 (GMT)
commit85403083fb82f4ef26fd0585b1c9b7beb53819fb (patch)
tree0e411059977f543cc5afbdf0c6bf99350d3e572a /tkmacosx/xxlib.mm
parent12166aa342f7c8d905097e43a1f50e0775503069 (diff)
downloadblt-85403083fb82f4ef26fd0585b1c9b7beb53819fb.zip
blt-85403083fb82f4ef26fd0585b1c9b7beb53819fb.tar.gz
blt-85403083fb82f4ef26fd0585b1c9b7beb53819fb.tar.bz2
Initial commit
Diffstat (limited to 'tkmacosx/xxlib.mm')
-rw-r--r--tkmacosx/xxlib.mm32
1 files changed, 32 insertions, 0 deletions
diff --git a/tkmacosx/xxlib.mm b/tkmacosx/xxlib.mm
new file mode 100644
index 0000000..412c56c
--- /dev/null
+++ b/tkmacosx/xxlib.mm
@@ -0,0 +1,32 @@
+// Copyright (C) 1999-2016
+// Smithsonian Astrophysical Observatory, Cambridge, MA, USA
+// For conditions of distribution and use, see copyright notice in "copyright"
+
+#include <iostream>
+#include <sstream>
+#include <iomanip>
+using namespace std;
+
+#include <tkMacOSXPrivate.h>
+
+void XXWarpPointer(Display* display, Window src_w, Window dest_w,
+ int src_x, int src_y,
+ unsigned int src_width, unsigned int src_height,
+ int dest_x, int dest_y)
+{
+ int xx, yy;
+ if (dest_w)
+ Tk_GetRootCoords(Tk_IdToWindow(display,dest_w), &xx, &yy);
+ else
+ XQueryPointer(display, dest_w, NULL, NULL, &xx, &yy, NULL, NULL, NULL);
+
+ CGPoint pt;
+ pt.x = xx+dest_x;
+ pt.y = yy+dest_y;
+
+ CGEventSourceRef src = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState);
+ CGEventRef ev = CGEventCreateMouseEvent(src,kCGEventMouseMoved,pt,kCGMouseButtonLeft);
+ CGEventPost(kCGSessionEventTap,ev);
+ CFRelease(ev);
+ CFRelease(src);
+}