changeset 111027:656b7a197029

* src/frame.c (Fframe_pointer_visible_p): Add `frame-pointer-visible-p' to get the pointer visibility.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 18 Oct 2010 17:07:31 -0400
parents 40219338786d
children f9f451f4584f
files doc/lispref/frames.texi src/ChangeLog src/frame.c
diffstat 3 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/doc/lispref/frames.texi	Mon Oct 18 17:02:00 2010 -0400
+++ b/doc/lispref/frames.texi	Mon Oct 18 17:07:31 2010 -0400
@@ -1748,6 +1748,15 @@
 value is not significant.
 @end defun
 
+@defun frame-pointer-visible-p &optional frame
+This predicate function returns non-@code{nil} if the mouse pointer
+displayed on @var{frame} is visible; otherwise it returns @code{nil}.
+@var{frame} omitted or @code{nil} means the selected frame.  This is
+useful when @code{make-pointer-invisible} is set to @code{t}: it
+allows to know if the pointer has been hidden.
+@xref{Mouse Avoidance,,,emacs}.
+@end defun
+
 @need 3000
 
 @node Pop-Up Menus
--- a/src/ChangeLog	Mon Oct 18 17:02:00 2010 -0400
+++ b/src/ChangeLog	Mon Oct 18 17:07:31 2010 -0400
@@ -1,3 +1,8 @@
+2010-10-18  Julien Danjou  <julien@danjou.info>
+
+	* frame.c (Fframe_pointer_visible_p):
+	Add `frame-pointer-visible-p' to get the pointer visibility.
+
 2010-10-18  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
 	* gnutls.c (emacs_gnutls_read): Return 0 if we get a
--- a/src/frame.c	Mon Oct 18 17:02:00 2010 -0400
+++ b/src/frame.c	Mon Oct 18 17:07:31 2010 -0400
@@ -4314,6 +4314,20 @@
     }
 }
 
+DEFUN ("frame-pointer-visible-p", Fframe_pointer_visible_p,
+       Sframe_pointer_visible_p, 0, 1, 0,
+       doc: /* Return t if the mouse pointer displayed on FRAME is visible.
+Otherwise it returns nil.  FRAME omitted or nil means the
+selected frame.  This is useful when `make-pointer-invisible' is set.  */)
+  (Lisp_Object frame)
+{
+  if (NILP (frame))
+    frame = selected_frame;
+
+  CHECK_FRAME (frame);
+
+  return (XFRAME (frame)->pointer_invisible ? Qnil : Qt);
+}
 
 
 /***********************************************************************
@@ -4623,6 +4637,7 @@
   defsubr (&Sset_frame_width);
   defsubr (&Sset_frame_size);
   defsubr (&Sset_frame_position);
+  defsubr (&Sframe_pointer_visible_p);
 
 #ifdef HAVE_WINDOW_SYSTEM
   defsubr (&Sx_get_resource);