aboutsummaryrefslogtreecommitdiffstats
path: root/src/nsfns.m
diff options
context:
space:
mode:
Diffstat (limited to 'src/nsfns.m')
-rw-r--r--src/nsfns.m20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nsfns.m b/src/nsfns.m
index 68eba8b6a2e..36748cebb8b 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -3080,6 +3080,25 @@ The coordinates X and Y are interpreted in pixels relative to a position
3080 return Qnil; 3080 return Qnil;
3081} 3081}
3082 3082
3083DEFUN ("ns-mouse-absolute-pixel-position",
3084 Fns_mouse_absolute_pixel_position,
3085 Sns_mouse_absolute_pixel_position, 0, 0, 0,
3086 doc: /* Return absolute position of mouse cursor in pixels.
3087The position is returned as a cons cell (X . Y) of the
3088coordinates of the mouse cursor position in pixels relative to a
3089position (0, 0) of the selected frame's terminal. */)
3090 (void)
3091{
3092 struct frame *f = SELECTED_FRAME ();
3093 EmacsView *view = FRAME_NS_VIEW (f);
3094 NSScreen *screen = [[view window] screen];
3095 NSPoint pt = [NSEvent mouseLocation];
3096
3097 return Fcons(make_number(pt.x - screen.frame.origin.x),
3098 make_number(screen.frame.size.height -
3099 (pt.y - screen.frame.origin.y)));
3100}
3101
3083/* ========================================================================== 3102/* ==========================================================================
3084 3103
3085 Class implementations 3104 Class implementations
@@ -3269,6 +3288,7 @@ be used as the image of the icon representing the frame. */);
3269 defsubr (&Sns_frame_list_z_order); 3288 defsubr (&Sns_frame_list_z_order);
3270 defsubr (&Sns_frame_restack); 3289 defsubr (&Sns_frame_restack);
3271 defsubr (&Sns_set_mouse_absolute_pixel_position); 3290 defsubr (&Sns_set_mouse_absolute_pixel_position);
3291 defsubr (&Sns_mouse_absolute_pixel_position);
3272 defsubr (&Sx_display_mm_width); 3292 defsubr (&Sx_display_mm_width);
3273 defsubr (&Sx_display_mm_height); 3293 defsubr (&Sx_display_mm_height);
3274 defsubr (&Sx_display_screens); 3294 defsubr (&Sx_display_screens);