1 /* Input event support for Emacs on the Microsoft Windows API.
2 Copyright (C) 1992-1993, 1995, 2001-2012 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
6 GNU Emacs is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 Adapted from ntkbd.c by Tim Fleehart
37 #include "dispextern.h"
39 #include "blockinput.h"
40 #include "termhooks.h"
46 /* stdin, from w32console.c */
47 extern HANDLE keyboard_handle
;
49 /* Info for last mouse motion */
50 static COORD movement_pos
;
51 static Time movement_time
;
54 extern unsigned int map_keypad_keys (unsigned int, unsigned int);
55 extern unsigned int w32_key_to_modifier (int key
);
58 #define EVENT_QUEUE_SIZE 50
59 static INPUT_RECORD event_queue
[EVENT_QUEUE_SIZE
];
60 static INPUT_RECORD
*queue_ptr
= event_queue
, *queue_end
= event_queue
;
62 /* Temporarily store lead byte of DBCS input sequences. */
63 static char dbcs_lead
= 0;
66 w32_read_console_input (HANDLE h
, INPUT_RECORD
*rec
, DWORD recsize
,
69 return (w32_console_unicode_input
70 ? ReadConsoleInputW (h
, rec
, recsize
, waiting
)
71 : ReadConsoleInputA (h
, rec
, recsize
, waiting
));
75 fill_queue (BOOL block
)
80 if (queue_ptr
< queue_end
)
81 return queue_end
-queue_ptr
;
85 /* Check to see if there are some events to read before we try
86 because we can't block. */
87 if (!GetNumberOfConsoleInputEvents (keyboard_handle
, &events_waiting
))
89 if (events_waiting
== 0)
93 rc
= w32_read_console_input (keyboard_handle
, event_queue
, EVENT_QUEUE_SIZE
,
97 queue_ptr
= event_queue
;
98 queue_end
= event_queue
+ events_waiting
;
99 return (int) events_waiting
;
102 /* In a generic, multi-frame world this should take a console handle
103 and return the frame for it
105 Right now, there's only one frame so return it. */
109 return SELECTED_FRAME ();
112 /* Translate console modifiers to emacs modifiers.
113 German keyboard support (Kai Morgan Zeise 2/18/95). */
115 w32_kbd_mods_to_emacs (DWORD mods
, WORD key
)
119 /* If we recognize right-alt and left-ctrl as AltGr, and it has been
120 pressed, first remove those modifiers. */
121 if (!NILP (Vw32_recognize_altgr
)
122 && (mods
& (RIGHT_ALT_PRESSED
| LEFT_CTRL_PRESSED
))
123 == (RIGHT_ALT_PRESSED
| LEFT_CTRL_PRESSED
))
124 mods
&= ~ (RIGHT_ALT_PRESSED
| LEFT_CTRL_PRESSED
);
126 if (mods
& (RIGHT_ALT_PRESSED
| LEFT_ALT_PRESSED
))
127 retval
= ((NILP (Vw32_alt_is_meta
)) ? alt_modifier
: meta_modifier
);
129 if (mods
& (RIGHT_CTRL_PRESSED
| LEFT_CTRL_PRESSED
))
131 retval
|= ctrl_modifier
;
132 if ((mods
& (RIGHT_CTRL_PRESSED
| LEFT_CTRL_PRESSED
))
133 == (RIGHT_CTRL_PRESSED
| LEFT_CTRL_PRESSED
))
134 retval
|= meta_modifier
;
137 if (mods
& LEFT_WIN_PRESSED
)
138 retval
|= w32_key_to_modifier (VK_LWIN
);
139 if (mods
& RIGHT_WIN_PRESSED
)
140 retval
|= w32_key_to_modifier (VK_RWIN
);
141 if (mods
& APPS_PRESSED
)
142 retval
|= w32_key_to_modifier (VK_APPS
);
143 if (mods
& SCROLLLOCK_ON
)
144 retval
|= w32_key_to_modifier (VK_SCROLL
);
146 /* Just in case someone wanted the original behavior, make it
147 optional by setting w32-capslock-is-shiftlock to t. */
148 if (NILP (Vw32_capslock_is_shiftlock
)
149 /* Keys that should _not_ be affected by CapsLock. */
150 && ( (key
== VK_BACK
)
153 || (key
== VK_RETURN
)
154 || (key
== VK_ESCAPE
)
155 || ((key
>= VK_SPACE
) && (key
<= VK_HELP
))
156 || ((key
>= VK_NUMPAD0
) && (key
<= VK_F24
))
157 || ((key
>= VK_NUMPAD_CLEAR
) && (key
<= VK_NUMPAD_DELETE
))
160 /* Only consider shift state. */
161 if ((mods
& SHIFT_PRESSED
) != 0)
162 retval
|= shift_modifier
;
166 /* Ignore CapsLock state if not enabled. */
167 if (NILP (Vw32_enable_caps_lock
))
168 mods
&= ~CAPSLOCK_ON
;
169 if ((mods
& (SHIFT_PRESSED
| CAPSLOCK_ON
)) != 0)
170 retval
|= shift_modifier
;
177 /* Return nonzero if the virtual key is a dead key. */
179 is_dead_key (int wparam
)
181 unsigned int code
= MapVirtualKey (wparam
, 2);
183 /* Windows 95 returns 0x8000, NT returns 0x80000000. */
184 return (code
& 0x80008000) ? 1 : 0;
188 /* The return code indicates key code size. cpID is the codepage to
189 use for translation to Unicode; -1 means use the current console
192 w32_kbd_patch_key (KEY_EVENT_RECORD
*event
, int cpId
)
194 unsigned int key_code
= event
->wVirtualKeyCode
;
195 unsigned int mods
= event
->dwControlKeyState
;
197 static BYTE ansi_code
[4];
198 static int isdead
= 0;
202 event
->uChar
.AsciiChar
= ansi_code
[2];
206 if (event
->uChar
.AsciiChar
!= 0)
209 memset (keystate
, 0, sizeof (keystate
));
210 keystate
[key_code
] = 0x80;
211 if (mods
& SHIFT_PRESSED
)
212 keystate
[VK_SHIFT
] = 0x80;
213 if (mods
& CAPSLOCK_ON
)
214 keystate
[VK_CAPITAL
] = 1;
215 /* If we recognize right-alt and left-ctrl as AltGr, set the key
216 states accordingly before invoking ToAscii. */
217 if (!NILP (Vw32_recognize_altgr
)
218 && (mods
& LEFT_CTRL_PRESSED
) && (mods
& RIGHT_ALT_PRESSED
))
220 keystate
[VK_CONTROL
] = 0x80;
221 keystate
[VK_LCONTROL
] = 0x80;
222 keystate
[VK_MENU
] = 0x80;
223 keystate
[VK_RMENU
] = 0x80;
227 /* Because of an OS bug, ToAscii corrupts the stack when called to
228 convert a dead key in console mode on NT4. Unfortunately, trying
229 to check for dead keys using MapVirtualKey doesn't work either -
230 these functions apparently use internal information about keyboard
231 layout which doesn't get properly updated in console programs when
232 changing layout (though apparently it gets partly updated,
233 otherwise ToAscii wouldn't crash). */
234 if (is_dead_key (event
->wVirtualKeyCode
))
238 /* On NT, call ToUnicode instead and then convert to the current
239 console input codepage. */
240 if (os_subtype
== OS_NT
)
244 isdead
= ToUnicode (event
->wVirtualKeyCode
, event
->wVirtualScanCode
,
245 keystate
, buf
, 128, 0);
248 /* When we are called from the GUI message processing code,
249 we are passed the current keyboard codepage, a positive
250 number, to use below. */
252 cpId
= GetConsoleCP ();
254 event
->uChar
.UnicodeChar
= buf
[isdead
- 1];
255 isdead
= WideCharToMultiByte (cpId
, 0, buf
, isdead
,
256 ansi_code
, 4, NULL
, NULL
);
263 isdead
= ToAscii (event
->wVirtualKeyCode
, event
->wVirtualScanCode
,
264 keystate
, (LPWORD
) ansi_code
, 0);
269 event
->uChar
.AsciiChar
= ansi_code
[0];
274 static int faked_key
= 0;
276 /* return code -1 means that event_queue_ptr won't be incremented.
277 In other word, this event makes two key codes. (by himi) */
279 key_event (KEY_EVENT_RECORD
*event
, struct input_event
*emacs_ev
, int *isdead
)
281 static int mod_key_state
= 0;
286 /* Skip key-up events. */
287 if (!event
->bKeyDown
)
289 switch (event
->wVirtualKeyCode
)
292 mod_key_state
&= ~LEFT_WIN_PRESSED
;
295 mod_key_state
&= ~RIGHT_WIN_PRESSED
;
298 mod_key_state
&= ~APPS_PRESSED
;
304 /* Ignore keystrokes we fake ourself; see below. */
305 if (faked_key
== event
->wVirtualKeyCode
)
311 /* To make it easier to debug this code, ignore modifier keys! */
312 switch (event
->wVirtualKeyCode
)
315 if (NILP (Vw32_pass_lwindow_to_system
))
317 /* Prevent system from acting on keyup (which opens the Start
318 menu if no other key was pressed) by simulating a press of
319 Space which we will ignore. */
320 if ((mod_key_state
& LEFT_WIN_PRESSED
) == 0)
322 if (NUMBERP (Vw32_phantom_key_code
))
323 faked_key
= XUINT (Vw32_phantom_key_code
) & 255;
325 faked_key
= VK_SPACE
;
326 keybd_event (faked_key
, (BYTE
) MapVirtualKey (faked_key
, 0), 0, 0);
329 mod_key_state
|= LEFT_WIN_PRESSED
;
330 if (!NILP (Vw32_lwindow_modifier
))
334 if (NILP (Vw32_pass_rwindow_to_system
))
336 if ((mod_key_state
& RIGHT_WIN_PRESSED
) == 0)
338 if (NUMBERP (Vw32_phantom_key_code
))
339 faked_key
= XUINT (Vw32_phantom_key_code
) & 255;
341 faked_key
= VK_SPACE
;
342 keybd_event (faked_key
, (BYTE
) MapVirtualKey (faked_key
, 0), 0, 0);
345 mod_key_state
|= RIGHT_WIN_PRESSED
;
346 if (!NILP (Vw32_rwindow_modifier
))
350 mod_key_state
|= APPS_PRESSED
;
351 if (!NILP (Vw32_apps_modifier
))
355 /* Decide whether to treat as modifier or function key. */
356 if (NILP (Vw32_enable_caps_lock
))
357 goto disable_lock_key
;
360 /* Decide whether to treat as modifier or function key. */
361 if (NILP (Vw32_enable_num_lock
))
362 goto disable_lock_key
;
365 /* Decide whether to treat as modifier or function key. */
366 if (NILP (Vw32_scroll_lock_modifier
))
367 goto disable_lock_key
;
370 /* Ensure the appropriate lock key state is off (and the
371 indicator light as well). */
372 wParam
= event
->wVirtualKeyCode
;
373 if (GetAsyncKeyState (wParam
) & 0x8000)
375 /* Fake another press of the relevant key. Apparently, this
376 really is the only way to turn off the indicator. */
378 keybd_event ((BYTE
) wParam
, (BYTE
) MapVirtualKey (wParam
, 0),
379 KEYEVENTF_EXTENDEDKEY
| KEYEVENTF_KEYUP
, 0);
380 keybd_event ((BYTE
) wParam
, (BYTE
) MapVirtualKey (wParam
, 0),
381 KEYEVENTF_EXTENDEDKEY
| 0, 0);
382 keybd_event ((BYTE
) wParam
, (BYTE
) MapVirtualKey (wParam
, 0),
383 KEYEVENTF_EXTENDEDKEY
| KEYEVENTF_KEYUP
, 0);
391 /* Windows maps Ctrl-Pause (aka Ctrl-Break) into VK_CANCEL,
392 which is confusing for purposes of key binding; convert
393 VK_CANCEL events into VK_PAUSE events. */
394 event
->wVirtualKeyCode
= VK_PAUSE
;
397 /* Windows maps Ctrl-NumLock into VK_PAUSE, which is confusing
398 for purposes of key binding; convert these back into
399 VK_NUMLOCK events, at least when we want to see NumLock key
400 presses. (Note that there is never any possibility that
401 VK_PAUSE with Ctrl really is C-Pause as per above.) */
402 if (NILP (Vw32_enable_num_lock
)
403 && (event
->dwControlKeyState
404 & (LEFT_CTRL_PRESSED
| RIGHT_CTRL_PRESSED
)) != 0)
405 event
->wVirtualKeyCode
= VK_NUMLOCK
;
409 /* Recognize state of Windows and Apps keys. */
410 event
->dwControlKeyState
|= mod_key_state
;
412 /* Distinguish numeric keypad keys from extended keys. */
413 event
->wVirtualKeyCode
=
414 map_keypad_keys (event
->wVirtualKeyCode
,
415 (event
->dwControlKeyState
& ENHANCED_KEY
));
417 if (lispy_function_keys
[event
->wVirtualKeyCode
] == 0)
419 if (!NILP (Vw32_recognize_altgr
)
420 && (event
->dwControlKeyState
& LEFT_CTRL_PRESSED
)
421 && (event
->dwControlKeyState
& RIGHT_ALT_PRESSED
))
423 /* Don't try to interpret AltGr key chords; ToAscii seems not
424 to process them correctly. */
426 /* Handle key chords including any modifiers other than shift
427 directly, in order to preserve as much modifier information as
429 else if (event
->dwControlKeyState
430 & ( RIGHT_CTRL_PRESSED
| LEFT_CTRL_PRESSED
431 | RIGHT_ALT_PRESSED
| LEFT_ALT_PRESSED
432 | (!NILP (Vw32_lwindow_modifier
) ? LEFT_WIN_PRESSED
: 0)
433 | (!NILP (Vw32_rwindow_modifier
) ? RIGHT_WIN_PRESSED
: 0)
434 | (!NILP (Vw32_apps_modifier
) ? APPS_PRESSED
: 0)
435 | (!NILP (Vw32_scroll_lock_modifier
) ? SCROLLLOCK_ON
: 0)))
437 /* Don't translate modified alphabetic keystrokes, so the user
438 doesn't need to constantly switch layout to type control or
439 meta keystrokes when the normal layout translates
440 alphabetic characters to non-ascii characters. */
441 if ('A' <= event
->wVirtualKeyCode
&& event
->wVirtualKeyCode
<= 'Z')
443 event
->uChar
.AsciiChar
= event
->wVirtualKeyCode
;
444 if ((event
->dwControlKeyState
& SHIFT_PRESSED
) == 0)
445 event
->uChar
.AsciiChar
+= ('a' - 'A');
447 /* Try to handle unrecognized keystrokes by determining the
448 base character (ie. translating the base key plus shift
450 else if (event
->uChar
.AsciiChar
== 0)
451 w32_kbd_patch_key (event
, -1);
454 if (event
->uChar
.AsciiChar
== 0)
456 emacs_ev
->kind
= NO_EVENT
;
459 else if (event
->uChar
.AsciiChar
> 0)
461 /* Pure ASCII characters < 128. */
462 emacs_ev
->kind
= ASCII_KEYSTROKE_EVENT
;
463 emacs_ev
->code
= event
->uChar
.AsciiChar
;
465 else if (event
->uChar
.UnicodeChar
> 0
466 && w32_console_unicode_input
)
468 /* Unicode codepoint; only valid if we are using Unicode
469 console input mode. */
470 emacs_ev
->kind
= MULTIBYTE_CHAR_KEYSTROKE_EVENT
;
471 emacs_ev
->code
= event
->uChar
.UnicodeChar
;
475 /* Fallback handling of non-ASCII characters for non-Unicode
476 versions of Windows, and for non-Unicode input on NT
477 family of Windows. Only characters in the current
478 console codepage are supported by this fallback. */
483 /* Get the current console input codepage to interpret this
484 key with. Note that the system defaults for the OEM
485 codepage could have been changed by calling SetConsoleCP
486 or w32-set-console-codepage, so using GetLocaleInfo to
487 get LOCALE_IDEFAULTCODEPAGE is not TRT here. */
488 cpId
= GetConsoleCP ();
491 dbcs
[1] = event
->uChar
.AsciiChar
;
495 if (!MultiByteToWideChar (cpId
, 0, dbcs
, 2, &code
, 1))
498 DebPrint (("Invalid DBCS sequence: %d %d\n",
500 emacs_ev
->kind
= NO_EVENT
;
503 else if (IsDBCSLeadByteEx (cpId
, dbcs
[1]))
506 emacs_ev
->kind
= NO_EVENT
;
510 if (!MultiByteToWideChar (cpId
, 0, &dbcs
[1], 1, &code
, 1))
513 DebPrint (("Invalid character: %d\n", dbcs
[1]));
514 emacs_ev
->kind
= NO_EVENT
;
517 emacs_ev
->kind
= MULTIBYTE_CHAR_KEYSTROKE_EVENT
;
518 emacs_ev
->code
= code
;
523 /* Function keys and other non-character keys. */
524 emacs_ev
->kind
= NON_ASCII_KEYSTROKE_EVENT
;
525 emacs_ev
->code
= event
->wVirtualKeyCode
;
528 XSETFRAME (emacs_ev
->frame_or_window
, get_frame ());
529 emacs_ev
->modifiers
= w32_kbd_mods_to_emacs (event
->dwControlKeyState
,
530 event
->wVirtualKeyCode
);
531 emacs_ev
->timestamp
= GetTickCount ();
536 w32_console_toggle_lock_key (int vk_code
, Lisp_Object new_state
)
538 int cur_state
= (GetKeyState (vk_code
) & 1);
541 || (NUMBERP (new_state
)
542 && ((XUINT (new_state
)) & 1) != cur_state
))
546 keybd_event ((BYTE
) vk_code
,
547 (BYTE
) MapVirtualKey (vk_code
, 0),
548 KEYEVENTF_EXTENDEDKEY
| KEYEVENTF_KEYUP
, 0);
549 keybd_event ((BYTE
) vk_code
,
550 (BYTE
) MapVirtualKey (vk_code
, 0),
551 KEYEVENTF_EXTENDEDKEY
| 0, 0);
552 keybd_event ((BYTE
) vk_code
,
553 (BYTE
) MapVirtualKey (vk_code
, 0),
554 KEYEVENTF_EXTENDEDKEY
| KEYEVENTF_KEYUP
, 0);
555 cur_state
= !cur_state
;
561 /* Mouse position hook. */
563 w32_console_mouse_position (FRAME_PTR
*f
,
565 Lisp_Object
*bar_window
,
566 enum scroll_bar_part
*part
,
578 SELECTED_FRAME ()->mouse_moved
= 0;
580 XSETINT (*x
, movement_pos
.X
);
581 XSETINT (*y
, movement_pos
.Y
);
582 *time
= movement_time
;
587 /* Remember mouse motion and notify emacs. */
589 mouse_moved_to (int x
, int y
)
591 /* If we're in the same place, ignore it. */
592 if (x
!= movement_pos
.X
|| y
!= movement_pos
.Y
)
594 SELECTED_FRAME ()->mouse_moved
= 1;
597 movement_time
= GetTickCount ();
601 /* Consoles return button bits in a strange order:
602 least significant - Leftmost button
603 next - Rightmost button
607 Assume emacs likes three button mice, so
611 Others increase from there. */
613 #define NUM_TRANSLATED_MOUSE_BUTTONS 3
614 static int emacs_button_translation
[NUM_TRANSLATED_MOUSE_BUTTONS
] =
620 do_mouse_event (MOUSE_EVENT_RECORD
*event
,
621 struct input_event
*emacs_ev
)
623 static DWORD button_state
= 0;
624 static Lisp_Object last_mouse_window
;
625 DWORD but_change
, mask
;
628 if (event
->dwEventFlags
== MOUSE_MOVED
)
630 FRAME_PTR f
= SELECTED_FRAME ();
631 Mouse_HLInfo
*hlinfo
= MOUSE_HL_INFO (f
);
632 int mx
= event
->dwMousePosition
.X
, my
= event
->dwMousePosition
.Y
;
634 mouse_moved_to (mx
, my
);
638 if (hlinfo
->mouse_face_hidden
)
640 hlinfo
->mouse_face_hidden
= 0;
641 clear_mouse_face (hlinfo
);
644 /* Generate SELECT_WINDOW_EVENTs when needed. */
645 if (!NILP (Vmouse_autoselect_window
))
647 Lisp_Object mouse_window
= window_from_coordinates (f
, mx
, my
,
649 /* A window will be selected only when it is not
650 selected now, and the last mouse movement event was
651 not in it. A minibuffer window will be selected iff
653 if (WINDOWP (mouse_window
)
654 && !EQ (mouse_window
, last_mouse_window
)
655 && !EQ (mouse_window
, selected_window
))
657 struct input_event event
;
660 event
.kind
= SELECT_WINDOW_EVENT
;
661 event
.frame_or_window
= mouse_window
;
663 event
.timestamp
= movement_time
;
664 kbd_buffer_store_event (&event
);
666 last_mouse_window
= mouse_window
;
669 last_mouse_window
= Qnil
;
671 previous_help_echo_string
= help_echo_string
;
672 help_echo_string
= help_echo_object
= help_echo_window
= Qnil
;
674 note_mouse_highlight (f
, mx
, my
);
675 /* If the contents of the global variable help_echo has
676 changed (inside note_mouse_highlight), generate a HELP_EVENT. */
677 if (!NILP (help_echo_string
) || !NILP (previous_help_echo_string
))
678 gen_help_event (help_echo_string
, selected_frame
, help_echo_window
,
679 help_echo_object
, help_echo_pos
);
684 /* It looks like the console code sends us a mouse event with
685 dwButtonState == 0 when a window is activated. Ignore this case. */
686 if (event
->dwButtonState
== button_state
)
689 emacs_ev
->kind
= MOUSE_CLICK_EVENT
;
691 /* Find out what button has changed state since the last button event. */
692 but_change
= button_state
^ event
->dwButtonState
;
694 for (i
= 0; mask
; i
++, mask
<<= 1)
695 if (but_change
& mask
)
697 if (i
< NUM_TRANSLATED_MOUSE_BUTTONS
)
698 emacs_ev
->code
= emacs_button_translation
[i
];
704 button_state
= event
->dwButtonState
;
705 emacs_ev
->timestamp
= GetTickCount ();
706 emacs_ev
->modifiers
= w32_kbd_mods_to_emacs (event
->dwControlKeyState
, 0) |
707 ((event
->dwButtonState
& mask
) ? down_modifier
: up_modifier
);
709 XSETFASTINT (emacs_ev
->x
, event
->dwMousePosition
.X
);
710 XSETFASTINT (emacs_ev
->y
, event
->dwMousePosition
.Y
);
711 /* for Mule 2.2 (Based on Emacs 19.28 */
713 XSET (emacs_ev
->frame_or_window
, Lisp_Frame
, get_frame ());
715 XSETFRAME (emacs_ev
->frame_or_window
, get_frame ());
722 resize_event (WINDOW_BUFFER_SIZE_RECORD
*event
)
724 FRAME_PTR f
= get_frame ();
726 change_frame_size (f
, event
->dwSize
.Y
, event
->dwSize
.X
, 0, 1, 0);
727 SET_FRAME_GARBAGED (f
);
731 maybe_generate_resize_event (void)
733 CONSOLE_SCREEN_BUFFER_INFO info
;
734 FRAME_PTR f
= get_frame ();
736 GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE
), &info
);
738 /* It is okay to call this unconditionally, since it will do nothing
739 if the size hasn't actually changed. */
740 change_frame_size (f
,
741 1 + info
.srWindow
.Bottom
- info
.srWindow
.Top
,
742 1 + info
.srWindow
.Right
- info
.srWindow
.Left
,
747 w32_console_read_socket (struct terminal
*terminal
,
749 struct input_event
*hold_quit
)
751 int nev
, ret
= 0, add
;
754 if (interrupt_input_blocked
)
756 interrupt_input_pending
= 1;
760 interrupt_input_pending
= 0;
765 nev
= fill_queue (0);
768 /* If nev == -1, there was some kind of error
769 If nev == 0 then waitp must be zero and no events were available
777 struct input_event inev
;
780 inev
.kind
= NO_EVENT
;
783 switch (queue_ptr
->EventType
)
786 add
= key_event (&queue_ptr
->Event
.KeyEvent
, &inev
, &isdead
);
787 if (add
== -1) /* 95.7.25 by himi */
793 kbd_buffer_store_event_hold (&inev
, hold_quit
);
797 add
= do_mouse_event (&queue_ptr
->Event
.MouseEvent
, &inev
);
799 kbd_buffer_store_event_hold (&inev
, hold_quit
);
802 case WINDOW_BUFFER_SIZE_EVENT
:
803 if (w32_use_full_screen_buffer
)
804 resize_event (&queue_ptr
->Event
.WindowBufferSizeEvent
);
809 /* Internal event types, ignored. */
817 if (ret
> 0 || expected
== 0)
821 /* We don't get told about changes in the window size (only the buffer
822 size, which we no longer care about), so we have to check it
824 if (!w32_use_full_screen_buffer
)
825 maybe_generate_resize_event ();