diff --git a/src/keyboard.c b/src/keyboard.c index 47b5e59024..92f842f2d7 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5625,11 +5625,12 @@ make_lispy_event (struct input_event *event) start_pos = *start_pos_ptr; *start_pos_ptr = Qnil; + struct frame *f; + { /* On window-system frames, use the value of double-click-fuzz as is. On other frames, interpret it as a multiple of 1/8 characters. */ - struct frame *f; intmax_t fuzz; if (WINDOWP (event->frame_or_window)) @@ -5727,9 +5728,48 @@ make_lispy_event (struct input_event *event) it's probably OK to ignore it as well. */ && EQ (Fcar (Fcdr (start_pos)), Fcar (Fcdr (position))))) { - /* Mouse has moved enough. */ - button_down_time = 0; - click_or_drag_modifier = drag_modifier; + Lisp_Object start_window = XCAR (start_pos); + Lisp_Object pos_window = XCAR (position); + + /* For the minibuffer window special precautions are + needed because it may change its height in between + two clicks. */ + if (WINDOW_LIVE_P (pos_window) + && WINDOW_LIVE_P (start_window) + && MINI_WINDOW_P (XWINDOW (start_window))) + { + struct window *start_w = XWINDOW (start_window); + struct window *pos_w = XWINDOW (pos_window); + + if (start_w == pos_w + && WINDOW_PIXEL_HEIGHT (pos_w) >= XFIXNUM (XCDR (down)) + && WINDOW_PIXEL_WIDTH (pos_w) >= XFIXNUM (XCAR (down))) + /* Mouse has moved enough. */ + { + button_down_time = 0; + click_or_drag_modifier = drag_modifier; + } + else if (start_w != pos_w + && (WINDOW_PIXEL_HEIGHT (start_w) >= XFIXNUM (XCDR (down)) + || WINDOW_PIXEL_WIDTH (start_w) >= XFIXNUM (XCDR (down)))) + /* Artificially move mouse into the minibuffer + window's new text area. */ + position + = make_lispy_position (f, + make_fixnum (WINDOW_BOX_LEFT_EDGE_X (start_w) + + WINDOW_LEFT_FRINGE_WIDTH (start_w) + + WINDOW_LEFT_MARGIN_WIDTH (start_w) + + 1), + make_fixnum (WINDOW_TOP_EDGE_Y (start_w) + 1), + event->timestamp); + } + else + /* Mouse has moved enough. */ + { + button_down_time = 0; + click_or_drag_modifier = drag_modifier; + } + } }