changeset 28553:56d5ca61cfd8

(NUM_MOUSE_BUTTONS): Define. (IT_frame_up_to_date): Support the buffer local value of cursor-type, if defined.
author Eli Zaretskii <eliz@gnu.org>
date Wed, 12 Apr 2000 15:44:16 +0000
parents ccadb68eaefd
children 6d8c15a0df2a
files src/msdos.c
diffstat 1 files changed, 32 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/msdos.c	Tue Apr 11 09:31:34 2000 +0000
+++ b/src/msdos.c	Wed Apr 12 15:44:16 2000 +0000
@@ -124,6 +124,10 @@
  * Mouse buttons are numbered from left to right and also zero based.
  */
 
+/* This used to be in termhooks.h, but mainstream Emacs code no longer
+   uses it, and it was removed...  */
+#define NUM_MOUSE_BUTTONS (5)
+
 int have_mouse;          /* 0: no, 1: enabled, -1: disabled */
 static int mouse_visible;
 
@@ -1898,6 +1902,8 @@
 IT_frame_up_to_date (struct frame *f)
 {
   struct display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+  Lisp_Object new_cursor, frame_desired_cursor;
+  struct window *sw;
 
   if (dpyinfo->mouse_face_deferred_gc
       || f == dpyinfo->mouse_face_mouse_frame)
@@ -1911,8 +1917,32 @@
       UNBLOCK_INPUT;
     }
 
-  /* Set the cursor type to whatever they wanted.  */
-  IT_set_cursor_type (f, Fcdr (Fassq (Qcursor_type, f->param_alist)));
+  /* Set the cursor type to whatever they wanted.  In a minibuffer
+     window, we want the cursor to appear only if we are reading input
+     from this window, and we want the cursor to be taken from the
+     frame parameters.  For the selected window, we use either its
+     buffer-local value or the value from the frame parameters if the
+     buffer doesn't define its local value for the cursor type.  */
+  sw = XWINDOW (f->selected_window);
+  frame_desired_cursor = Fcdr (Fassq (Qcursor_type, f->param_alist));
+  if (cursor_in_echo_area
+      && FRAME_HAS_MINIBUF_P (f)
+      && EQ (FRAME_MINIBUF_WINDOW (f), echo_area_window)
+      && sw == XWINDOW (echo_area_window))
+    new_cursor = frame_desired_cursor;
+  else
+    {
+      struct buffer *b = XBUFFER (sw->buffer);
+
+      if (EQ (b->cursor_type, Qt))
+	new_cursor = frame_desired_cursor;
+      else if (NILP (b->cursor_type)) /* nil means no cursor */
+	new_cursor = Fcons (Qbar, make_number (0));
+      else
+	new_cursor = b->cursor_type;
+    }
+
+  IT_set_cursor_type (f, new_cursor);
 
   IT_cmgoto (f);  /* position cursor when update is done */
 }