diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2017-03-23 17:17:51 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2017-03-23 17:17:51 (GMT) |
commit | 947a9c9e07cad7a318b7b8bfd667d2f786056830 (patch) | |
tree | 2f9d5a67ae754ff1ac40f1537f726a5156761570 /tkmacosx/xxlib.M | |
parent | 37e45d85c572c8f373e5a37a7080f4b71ce128ee (diff) | |
download | blt-947a9c9e07cad7a318b7b8bfd667d2f786056830.zip blt-947a9c9e07cad7a318b7b8bfd667d2f786056830.tar.gz blt-947a9c9e07cad7a318b7b8bfd667d2f786056830.tar.bz2 |
reneame
Diffstat (limited to 'tkmacosx/xxlib.M')
-rw-r--r-- | tkmacosx/xxlib.M | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tkmacosx/xxlib.M b/tkmacosx/xxlib.M new file mode 100644 index 0000000..412c56c --- /dev/null +++ b/tkmacosx/xxlib.M @@ -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); +} |