diff options
| author | Richard M. Stallman | 1994-04-22 21:45:11 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-04-22 21:45:11 +0000 |
| commit | 152e6c70336858449fc6fc36aea767ac38feb1d2 (patch) | |
| tree | 8b7941c8326d5e57510decba1b7b626cb246d205 /src | |
| parent | cd99f76d3d3a9ca9e037de859524bfdb7694ff85 (diff) | |
| download | emacs-152e6c70336858449fc6fc36aea767ac38feb1d2.tar.gz emacs-152e6c70336858449fc6fc36aea767ac38feb1d2.zip | |
(Fmouse_pixel_position, Fset_mouse_pixel_position): New functions.
(syms_of_frame): Set up Lisp functions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/frame.c | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/src/frame.c b/src/frame.c index ea438e75792..2eec0c87bab 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -935,9 +935,40 @@ and nil for X and Y.") | |||
| 935 | return Fcons (lispy_dummy, Fcons (x, y)); | 935 | return Fcons (lispy_dummy, Fcons (x, y)); |
| 936 | } | 936 | } |
| 937 | 937 | ||
| 938 | DEFUN ("mouse-pixel-position", Fmouse_pixel_position, | ||
| 939 | Smouse_pixel_position, 0, 0, 0, | ||
| 940 | "Return a list (FRAME X . Y) giving the current mouse frame and position.\n\ | ||
| 941 | The position is given in pixel units, where (0, 0) is the\n\ | ||
| 942 | upper-left corner.\n\ | ||
| 943 | If Emacs is running on a mouseless terminal or hasn't been programmed\n\ | ||
| 944 | to read the mouse position, it returns the selected frame for FRAME\n\ | ||
| 945 | and nil for X and Y.") | ||
| 946 | () | ||
| 947 | { | ||
| 948 | FRAME_PTR f; | ||
| 949 | Lisp_Object lispy_dummy; | ||
| 950 | enum scroll_bar_part party_dummy; | ||
| 951 | Lisp_Object x, y; | ||
| 952 | int col, row; | ||
| 953 | unsigned long long_dummy; | ||
| 954 | |||
| 955 | f = selected_frame; | ||
| 956 | x = y = Qnil; | ||
| 957 | |||
| 958 | /* It's okay for the hook to refrain from storing anything. */ | ||
| 959 | if (mouse_position_hook) | ||
| 960 | (*mouse_position_hook) (&f, | ||
| 961 | &lispy_dummy, &party_dummy, | ||
| 962 | &x, &y, | ||
| 963 | &long_dummy); | ||
| 964 | XSET (lispy_dummy, Lisp_Frame, f); | ||
| 965 | return Fcons (lispy_dummy, Fcons (x, y)); | ||
| 966 | } | ||
| 967 | |||
| 938 | DEFUN ("set-mouse-position", Fset_mouse_position, Sset_mouse_position, 3, 3, 0, | 968 | DEFUN ("set-mouse-position", Fset_mouse_position, Sset_mouse_position, 3, 3, 0, |
| 939 | "Move the mouse pointer to the center of character cell (X,Y) in FRAME.\n\ | 969 | "Move the mouse pointer to the center of character cell (X,Y) in FRAME.\n\ |
| 940 | WARNING: If you use this under X, you should do `unfocus-frame' afterwards.") | 970 | WARNING: If you use this under X windows,\n\ |
| 971 | you should call `unfocus-frame' afterwards.") | ||
| 941 | (frame, x, y) | 972 | (frame, x, y) |
| 942 | Lisp_Object frame, x, y; | 973 | Lisp_Object frame, x, y; |
| 943 | { | 974 | { |
| @@ -954,6 +985,28 @@ WARNING: If you use this under X, you should do `unfocus-frame' afterwards.") | |||
| 954 | 985 | ||
| 955 | return Qnil; | 986 | return Qnil; |
| 956 | } | 987 | } |
| 988 | |||
| 989 | DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position, | ||
| 990 | Sset_mouse_pixel_position, 3, 3, 0, | ||
| 991 | "Move the mouse pointer to pixel position (X,Y) in FRAME.\n\ | ||
| 992 | WARNING: If you use this under X windows,\n\ | ||
| 993 | you should call `unfocus-frame' afterwards.") | ||
| 994 | (frame, x, y) | ||
| 995 | Lisp_Object frame, x, y; | ||
| 996 | { | ||
| 997 | CHECK_LIVE_FRAME (frame, 0); | ||
| 998 | CHECK_NUMBER (x, 2); | ||
| 999 | CHECK_NUMBER (y, 1); | ||
| 1000 | |||
| 1001 | /* I think this should be done with a hook. */ | ||
| 1002 | #ifdef HAVE_X_WINDOWS | ||
| 1003 | if (FRAME_X_P (XFRAME (frame))) | ||
| 1004 | /* Warping the mouse will cause enternotify and focus events. */ | ||
| 1005 | x_set_mouse_pixel_position (XFRAME (frame), x, y); | ||
| 1006 | #endif | ||
| 1007 | |||
| 1008 | return Qnil; | ||
| 1009 | } | ||
| 957 | 1010 | ||
| 958 | DEFUN ("make-frame-visible", Fmake_frame_visible, Smake_frame_visible, | 1011 | DEFUN ("make-frame-visible", Fmake_frame_visible, Smake_frame_visible, |
| 959 | 0, 1, "", | 1012 | 0, 1, "", |
| @@ -1650,7 +1703,9 @@ For values specific to the separate minibuffer frame, see\n\ | |||
| 1650 | defsubr (&Sprevious_frame); | 1703 | defsubr (&Sprevious_frame); |
| 1651 | defsubr (&Sdelete_frame); | 1704 | defsubr (&Sdelete_frame); |
| 1652 | defsubr (&Smouse_position); | 1705 | defsubr (&Smouse_position); |
| 1706 | defsubr (&Smouse_pixel_position); | ||
| 1653 | defsubr (&Sset_mouse_position); | 1707 | defsubr (&Sset_mouse_position); |
| 1708 | defsubr (&Sset_mouse_pixel_position); | ||
| 1654 | #if 0 | 1709 | #if 0 |
| 1655 | defsubr (&Sframe_configuration); | 1710 | defsubr (&Sframe_configuration); |
| 1656 | defsubr (&Srestore_frame_configuration); | 1711 | defsubr (&Srestore_frame_configuration); |