aboutsummaryrefslogtreecommitdiff
path: root/unix/sun/mouse.c
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /unix/sun/mouse.c
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'unix/sun/mouse.c')
-rw-r--r--unix/sun/mouse.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/unix/sun/mouse.c b/unix/sun/mouse.c
new file mode 100644
index 00000000..a7d4b538
--- /dev/null
+++ b/unix/sun/mouse.c
@@ -0,0 +1,47 @@
+/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+ */
+
+#include <suntool/sunview.h>
+
+/* MOUSE.C -- Routines for saving and restoring the mouse position. These
+ * are used by a window which needs to grab the mouse and set it to a specific
+ * position, e.g., because the user has entered a command in to another window
+ * requesting a cursor read by the process running in the current window.
+ * (It was NOT easy to figure out how to do this in SunView, but at least I
+ * was able to do it...).
+ */
+
+/* GET_ABSMOUSEPOS -- Get the current position of the mouse in absolute screen
+ * coordinates.
+ */
+get_absmousepos (mywinfd, x, y)
+int mywinfd; /* any window on current screen will do */
+int *x, *y; /* mouse position (output) */
+{
+ struct screen rootscreen;
+ int rootfd;
+
+ win_screenget (mywinfd, &rootscreen);
+ rootfd = open (rootscreen.scr_rootname, 0);
+
+ *x = win_get_vuid_value (rootfd, LOC_X_ABSOLUTE);
+ *y = win_get_vuid_value (rootfd, LOC_Y_ABSOLUTE);
+
+ close (rootfd);
+}
+
+
+/* SET_ABSMOUSEPOS -- Set the mouse position in absolute screen coordinates.
+ */
+set_absmousepos (mywinfd, x, y)
+int mywinfd; /* any window on current screen will do */
+int x, y; /* desired mouse position */
+{
+ struct screen rootscreen;
+ int rootfd;
+
+ win_screenget (mywinfd, &rootscreen);
+ rootfd = open (rootscreen.scr_rootname, 0);
+ win_setmouseposition (rootfd, x, y);
+ close (rootfd);
+}