From: Eli Zaretskii Date: Wed, 9 Aug 2000 12:26:13 +0000 (+0000) Subject: Include keyboard.h. X-Git-Tag: emacs-pretest-21.0.90~2387 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=97dd288b3cc86fc748a6d2c43ef164949a561923;p=emacs.git Include keyboard.h. (XMenuActivate): Empty no_event events from the event buffer. If no events are left after that, call clear_input_pending. (mouse_clear_clicks): New function, code moved from mouse_init. (mouse_init, XMenuActivate): Call mouse_clear_clicks to force the mouse driver to ``forget'' any past clicks. --- diff --git a/src/msdos.c b/src/msdos.c index f2ceb6d4564..4a8026b4c79 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -61,6 +61,7 @@ Boston, MA 02111-1307, USA. */ #include "buffer.h" #include "commands.h" #include "blockinput.h" +#include "keyboard.h" #include #include #include @@ -309,11 +310,26 @@ mouse_check_moved () mouse_last_y = y; } +/* Force the mouse driver to ``forget'' about any button clicks until + now. */ +static void +mouse_clear_clicks (void) +{ + int b; + + for (b = 0; b < mouse_button_count; b++) + { + int dummy_x, dummy_y; + + (void) mouse_pressed (b, &dummy_x, &dummy_y); + (void) mouse_released (b, &dummy_x, &dummy_y); + } +} + void mouse_init () { union REGS regs; - int b; if (termscript) fprintf (termscript, ""); @@ -325,13 +341,7 @@ mouse_init () doesn't do that automatically when function 21h is called, which causes Emacs to ``remember'' the click that switched focus to the window just before Emacs was started from that window. */ - for (b = 0; b < mouse_button_count; b++) - { - int dummy_x, dummy_y; - - (void) mouse_pressed (b, &dummy_x, &dummy_y); - (void) mouse_released (b, &dummy_x, &dummy_y); - } + mouse_clear_clicks (); regs.x.ax = 0x0007; regs.x.cx = 0; @@ -3916,6 +3926,9 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx, (which invoked the menu) too quickly. If we don't remove these events, Emacs will process them after we return and surprise the user. */ discard_mouse_events (); + mouse_clear_clicks (); + if (!kbd_buffer_events_waiting (1)) + clear_input_pending (); /* Allow mouse events generation by dos_rawgetc. */ mouse_preempted--; return result;