Mercurial > emacs
comparison src/frame.c @ 7025:24e759919770
(Fmouse_pixel_position, Fset_mouse_pixel_position): New functions.
(syms_of_frame): Set up Lisp functions.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 22 Apr 1994 21:45:11 +0000 |
parents | a39502978078 |
children | 5e4906d964b8 |
comparison
equal
deleted
inserted
replaced
7024:f00ad05e91b0 | 7025:24e759919770 |
---|---|
933 } | 933 } |
934 XSET (lispy_dummy, Lisp_Frame, f); | 934 XSET (lispy_dummy, Lisp_Frame, f); |
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 { |
944 CHECK_LIVE_FRAME (frame, 0); | 975 CHECK_LIVE_FRAME (frame, 0); |
945 CHECK_NUMBER (x, 2); | 976 CHECK_NUMBER (x, 2); |
948 /* I think this should be done with a hook. */ | 979 /* I think this should be done with a hook. */ |
949 #ifdef HAVE_X_WINDOWS | 980 #ifdef HAVE_X_WINDOWS |
950 if (FRAME_X_P (XFRAME (frame))) | 981 if (FRAME_X_P (XFRAME (frame))) |
951 /* Warping the mouse will cause enternotify and focus events. */ | 982 /* Warping the mouse will cause enternotify and focus events. */ |
952 x_set_mouse_position (XFRAME (frame), x, y); | 983 x_set_mouse_position (XFRAME (frame), x, y); |
984 #endif | |
985 | |
986 return Qnil; | |
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); | |
953 #endif | 1006 #endif |
954 | 1007 |
955 return Qnil; | 1008 return Qnil; |
956 } | 1009 } |
957 | 1010 |
1648 defsubr (&Sframe_list); | 1701 defsubr (&Sframe_list); |
1649 defsubr (&Snext_frame); | 1702 defsubr (&Snext_frame); |
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); |
1657 #endif | 1712 #endif |
1658 defsubr (&Smake_frame_visible); | 1713 defsubr (&Smake_frame_visible); |