diff options
| author | Eli Zaretskii | 2000-08-09 12:26:13 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2000-08-09 12:26:13 +0000 |
| commit | 97dd288b3cc86fc748a6d2c43ef164949a561923 (patch) | |
| tree | 64355f6064da09c5b07228641253849941b8e7e9 /src | |
| parent | 3f2ccb2106de738cccc02e16055fb2483d59abc2 (diff) | |
| download | emacs-97dd288b3cc86fc748a6d2c43ef164949a561923.tar.gz emacs-97dd288b3cc86fc748a6d2c43ef164949a561923.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/msdos.c | 29 |
1 files changed, 21 insertions, 8 deletions
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. */ | |||
| 61 | #include "buffer.h" | 61 | #include "buffer.h" |
| 62 | #include "commands.h" | 62 | #include "commands.h" |
| 63 | #include "blockinput.h" | 63 | #include "blockinput.h" |
| 64 | #include "keyboard.h" | ||
| 64 | #include <go32.h> | 65 | #include <go32.h> |
| 65 | #include <pc.h> | 66 | #include <pc.h> |
| 66 | #include <ctype.h> | 67 | #include <ctype.h> |
| @@ -309,11 +310,26 @@ mouse_check_moved () | |||
| 309 | mouse_last_y = y; | 310 | mouse_last_y = y; |
| 310 | } | 311 | } |
| 311 | 312 | ||
| 313 | /* Force the mouse driver to ``forget'' about any button clicks until | ||
| 314 | now. */ | ||
| 315 | static void | ||
| 316 | mouse_clear_clicks (void) | ||
| 317 | { | ||
| 318 | int b; | ||
| 319 | |||
| 320 | for (b = 0; b < mouse_button_count; b++) | ||
| 321 | { | ||
| 322 | int dummy_x, dummy_y; | ||
| 323 | |||
| 324 | (void) mouse_pressed (b, &dummy_x, &dummy_y); | ||
| 325 | (void) mouse_released (b, &dummy_x, &dummy_y); | ||
| 326 | } | ||
| 327 | } | ||
| 328 | |||
| 312 | void | 329 | void |
| 313 | mouse_init () | 330 | mouse_init () |
| 314 | { | 331 | { |
| 315 | union REGS regs; | 332 | union REGS regs; |
| 316 | int b; | ||
| 317 | 333 | ||
| 318 | if (termscript) | 334 | if (termscript) |
| 319 | fprintf (termscript, "<M_INIT>"); | 335 | fprintf (termscript, "<M_INIT>"); |
| @@ -325,13 +341,7 @@ mouse_init () | |||
| 325 | doesn't do that automatically when function 21h is called, which | 341 | doesn't do that automatically when function 21h is called, which |
| 326 | causes Emacs to ``remember'' the click that switched focus to the | 342 | causes Emacs to ``remember'' the click that switched focus to the |
| 327 | window just before Emacs was started from that window. */ | 343 | window just before Emacs was started from that window. */ |
| 328 | for (b = 0; b < mouse_button_count; b++) | 344 | mouse_clear_clicks (); |
| 329 | { | ||
| 330 | int dummy_x, dummy_y; | ||
| 331 | |||
| 332 | (void) mouse_pressed (b, &dummy_x, &dummy_y); | ||
| 333 | (void) mouse_released (b, &dummy_x, &dummy_y); | ||
| 334 | } | ||
| 335 | 345 | ||
| 336 | regs.x.ax = 0x0007; | 346 | regs.x.ax = 0x0007; |
| 337 | regs.x.cx = 0; | 347 | regs.x.cx = 0; |
| @@ -3916,6 +3926,9 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx, | |||
| 3916 | (which invoked the menu) too quickly. If we don't remove these events, | 3926 | (which invoked the menu) too quickly. If we don't remove these events, |
| 3917 | Emacs will process them after we return and surprise the user. */ | 3927 | Emacs will process them after we return and surprise the user. */ |
| 3918 | discard_mouse_events (); | 3928 | discard_mouse_events (); |
| 3929 | mouse_clear_clicks (); | ||
| 3930 | if (!kbd_buffer_events_waiting (1)) | ||
| 3931 | clear_input_pending (); | ||
| 3919 | /* Allow mouse events generation by dos_rawgetc. */ | 3932 | /* Allow mouse events generation by dos_rawgetc. */ |
| 3920 | mouse_preempted--; | 3933 | mouse_preempted--; |
| 3921 | return result; | 3934 | return result; |