From 0c3cfc5194a6f76bb883866b05e3f3ee8be04bd3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 12 Apr 2000 15:46:49 +0000 Subject: [PATCH] (NUM_MOUSE_BUTTONS): Define. (IT_frame_up_to_date): Support the buffer local value of cursor-type, if defined. --- src/ChangeLog | 6 ++++++ src/msdos.c | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 131967a7cf..8cd69950e0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2000-04-12 Eli Zaretskii + + * msdos.c (NUM_MOUSE_BUTTONS): Define. + (IT_frame_up_to_date): Support the buffer local value of + cursor-type, if defined. + 2000-04-10 Dave Love * editfns.c (preceding-char, following-char): Doc fix. diff --git a/src/msdos.c b/src/msdos.c index 0351b04c02..d56ee7cf88 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -124,6 +124,10 @@ event_timestamp () * 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 @@ static void 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 @@ IT_frame_up_to_date (struct frame *f) 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 */ } -- 2.20.1