annotate src/w32inevt.c @ 21103:8e12f5209e37

(fill-region): If JUSTIFY is non-nil and not a known value, treat it as `full'. (fill-region-as-paragraph): Likewise.
author Richard M. Stallman <rms@gnu.org>
date Sun, 08 Mar 1998 00:27:23 +0000
parents 4a6b8c86ad87
children 1a4fc4d9ca9a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
1 /* Input event support for Emacs on the Microsoft W32 API.
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
2 Copyright (C) 1992, 1993, 1995 Free Software Foundation, Inc.
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
4 This file is part of GNU Emacs.
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
7 it under the terms of the GNU General Public License as published by
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
9 any later version.
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
14 GNU General Public License for more details.
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
16 You should have received a copy of the GNU General Public License
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 12544
diff changeset
19 Boston, MA 02111-1307, USA.
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 Drew Bliss 01-Oct-93
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 Adapted from ntkbd.c by Tim Fleehart
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 #include "config.h"
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 #include <stdlib.h>
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 #include <stdio.h>
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 #include <windows.h>
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 #include "lisp.h"
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 #include "frame.h"
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 #include "blockinput.h"
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 #include "termhooks.h"
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 /* stdin, from ntterm */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 extern HANDLE keyboard_handle;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 /* Info for last mouse motion */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 static COORD movement_pos;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 static DWORD movement_time;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 /* from keyboard.c */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 extern void reinvoke_input_signal (void);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 /* from dispnew.c */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 extern int change_frame_size (FRAME_PTR, int, int, int, int);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49
15460
be07c4433554 (Vwin32_alt_is_meta): Declared.
Richard M. Stallman <rms@gnu.org>
parents: 15144
diff changeset
50 /* from w32fns.c */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15784
diff changeset
51 extern Lisp_Object Vw32_alt_is_meta;
15460
be07c4433554 (Vwin32_alt_is_meta): Declared.
Richard M. Stallman <rms@gnu.org>
parents: 15144
diff changeset
52
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
53 /* from w32term */
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
54 extern Lisp_Object Vw32_capslock_is_shiftlock;
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
55
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 /* Event queue */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 #define EVENT_QUEUE_SIZE 50
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 static INPUT_RECORD event_queue[EVENT_QUEUE_SIZE];
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 static INPUT_RECORD *queue_ptr = event_queue, *queue_end = event_queue;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 static int
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 fill_queue (BOOL block)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 BOOL rc;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 DWORD events_waiting;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 if (queue_ptr < queue_end)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 return queue_end-queue_ptr;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 if (!block)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 /* Check to see if there are some events to read before we try
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 because we can't block. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 if (!GetNumberOfConsoleInputEvents (keyboard_handle, &events_waiting))
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 return -1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 if (events_waiting == 0)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 return 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 rc = ReadConsoleInput (keyboard_handle, event_queue, EVENT_QUEUE_SIZE,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 &events_waiting);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 if (!rc)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 return -1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 queue_ptr = event_queue;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 queue_end = event_queue + events_waiting;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 return (int) events_waiting;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 /* In a generic, multi-frame world this should take a console handle
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 and return the frame for it
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 Right now, there's only one frame so return it. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 static FRAME_PTR
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 get_frame (void)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 return selected_frame;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
99 /* Translate console modifiers to emacs modifiers.
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
100 German keyboard support (Kai Morgan Zeise 2/18/95). */
15144
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
101 int
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
102 w32_kbd_mods_to_emacs (DWORD mods, WORD key)
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
103 {
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
104 int retval = 0;
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
105
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
106 /* If AltGr has been pressed, remove it. */
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
107 if ((mods & (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED))
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
108 == (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED))
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
109 mods &= ~ (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED);
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
110
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
111 if (mods & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15784
diff changeset
112 retval = ((NILP (Vw32_alt_is_meta)) ? alt_modifier : meta_modifier);
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
113
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
114 if (mods & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED))
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
115 {
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
116 retval |= ctrl_modifier;
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
117 if ((mods & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED))
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
118 == (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED))
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
119 retval |= meta_modifier;
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
120 }
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
121
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
122 /* Just in case someone wanted the original behaviour, make it
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
123 optional by setting w32-capslock-is-shiftlock to t. */
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
124 if (NILP (Vw32_capslock_is_shiftlock)
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
125 && ((key == VK_INSERT)
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
126 || (key == VK_DELETE)
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
127 || ((key >= VK_F1) && (key <= VK_F24))
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
128 || ((key >= VK_PRIOR) && (key <= VK_DOWN))))
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
129 {
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
130 if ( (mods & SHIFT_PRESSED) == SHIFT_PRESSED)
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
131 retval |= shift_modifier;
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
132 }
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
133 else
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
134 {
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
135 if (((mods & (SHIFT_PRESSED | CAPSLOCK_ON)) == SHIFT_PRESSED)
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
136 || ((mods & (SHIFT_PRESSED | CAPSLOCK_ON)) == CAPSLOCK_ON))
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
137 retval |= shift_modifier;
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
138 }
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
139
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
140 return retval;
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
141 }
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
142
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
143 /* The return code indicates key code size. */
14463
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
144 int
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15784
diff changeset
145 w32_kbd_patch_key (KEY_EVENT_RECORD *event)
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 {
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
147 unsigned int key_code = event->wVirtualKeyCode;
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
148 unsigned int mods = event->dwControlKeyState;
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
149 BYTE keystate[256];
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
150 static BYTE ansi_code[4];
15144
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
151 static int isdead = 0;
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
152
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
153 if (isdead == 2)
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
154 {
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
155 event->uChar.AsciiChar = ansi_code[2];
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
156 isdead = 0;
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
157 return 1;
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
158 }
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
159 if (event->uChar.AsciiChar != 0)
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
160 return 1;
14463
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
161
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
162 memset (keystate, 0, sizeof (keystate));
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
163 if (mods & SHIFT_PRESSED)
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
164 keystate[VK_SHIFT] = 0x80;
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
165 if (mods & CAPSLOCK_ON)
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
166 keystate[VK_CAPITAL] = 1;
14463
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
167 if ((mods & LEFT_CTRL_PRESSED) && (mods & RIGHT_ALT_PRESSED))
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
168 {
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
169 keystate[VK_CONTROL] = 0x80;
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
170 keystate[VK_LCONTROL] = 0x80;
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
171 keystate[VK_MENU] = 0x80;
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
172 keystate[VK_RMENU] = 0x80;
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
173 }
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
174
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
175 isdead = ToAscii (event->wVirtualKeyCode, event->wVirtualScanCode,
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
176 keystate, (LPWORD) ansi_code, 0);
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
177 if (isdead == 0)
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
178 return 0;
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
179 event->uChar.AsciiChar = ansi_code[0];
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
180 return isdead;
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 }
15144
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
182
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 /* Map virtual key codes into:
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 -1 - Ignore this key
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 -2 - ASCII char
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 Other - Map non-ASCII keys into X keysyms so that they are looked up
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 correctly in keyboard.c
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 Return, escape and tab are mapped to ASCII rather than coming back
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 as non-ASCII to be more compatible with old-style keyboard support. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 static int map_virt_key[256] =
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 {
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
194 #ifdef MULE
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
195 -3,
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
196 #else
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 -1,
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
198 #endif
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 -1, /* VK_LBUTTON */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 -1, /* VK_RBUTTON */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 0x69, /* VK_CANCEL */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 -1, /* VK_MBUTTON */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 -1, -1, -1,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 8, /* VK_BACK */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 -2, /* VK_TAB */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 -1, -1,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 11, /* VK_CLEAR */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 -2, /* VK_RETURN */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 -1, -1,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 -1, /* VK_SHIFT */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 -1, /* VK_CONTROL */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 -1, /* VK_MENU */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 0x13, /* VK_PAUSE */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 -1, /* VK_CAPITAL */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 -1, -1, -1, -1, -1, -1,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 -2, /* VK_ESCAPE */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217 -1, -1, -1, -1,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 -2, /* VK_SPACE */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 0x55, /* VK_PRIOR */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 0x56, /* VK_NEXT */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 0x57, /* VK_END */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 0x50, /* VK_HOME */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 0x51, /* VK_LEFT */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 0x52, /* VK_UP */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 0x53, /* VK_RIGHT */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 0x54, /* VK_DOWN */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227 0x60, /* VK_SELECT */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228 0x61, /* VK_PRINT */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229 0x62, /* VK_EXECUTE */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 -1, /* VK_SNAPSHOT */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 0x63, /* VK_INSERT */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 0xff, /* VK_DELETE */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 0x6a, /* VK_HELP */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, /* 0 - 9 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 -1, -1, -1, -1, -1, -1, -1,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 -2, -2, -2, -2, -2, -2, -2, -2, /* A - Z */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 -2, -2, -2, -2, -2, -2, -2, -2,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238 -2, -2, -2, -2, -2, -2, -2, -2,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 -2, -2,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 -1, -1, -1, -1, -1,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 0xb0, /* VK_NUMPAD0 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 0xb1, /* VK_NUMPAD1 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 0xb2, /* VK_NUMPAD2 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 0xb3, /* VK_NUMPAD3 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245 0xb4, /* VK_NUMPAD4 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 0xb5, /* VK_NUMPAD5 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 0xb6, /* VK_NUMPAD6 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 0xb7, /* VK_NUMPAD7 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 0xb8, /* VK_NUMPAD8 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 0xb9, /* VK_NUMPAD9 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 0xaa, /* VK_MULTIPLY */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 0xab, /* VK_ADD */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 0xac, /* VK_SEPARATOR */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 0xad, /* VK_SUBTRACT */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 0xae, /* VK_DECIMAL */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256 0xaf, /* VK_DIVIDE */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 0xbe, /* VK_F1 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 0xbf, /* VK_F2 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 0xc0, /* VK_F3 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260 0xc1, /* VK_F4 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 0xc2, /* VK_F5 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262 0xc3, /* VK_F6 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263 0xc4, /* VK_F7 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 0xc5, /* VK_F8 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 0xc6, /* VK_F9 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 0xc7, /* VK_F10 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 0xc8, /* VK_F11 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 0xc9, /* VK_F12 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 0xca, /* VK_F13 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 0xcb, /* VK_F14 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 0xcc, /* VK_F15 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 0xcd, /* VK_F16 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 0xce, /* VK_F17 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 0xcf, /* VK_F18 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 0xd0, /* VK_F19 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 0xd1, /* VK_F20 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 0xd2, /* VK_F21 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 0xd3, /* VK_F22 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 0xd4, /* VK_F23 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280 0xd5, /* VK_F24 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 -1, -1, -1, -1, -1, -1, -1, -1,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 0x7f, /* VK_NUMLOCK */
12337
85bdcc694c7a (map_virt_key): Mark some additional chars as valid ASCII.
Richard M. Stallman <rms@gnu.org>
parents: 11386
diff changeset
283 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x9f */
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xaf */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xb9 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286 -2, /* ; */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 -2, /* = */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 -2, /* , */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 -2, /* \ */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 -2, /* . */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 -2, /* / */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 -2, /* ` */
12337
85bdcc694c7a (map_virt_key): Mark some additional chars as valid ASCII.
Richard M. Stallman <rms@gnu.org>
parents: 11386
diff changeset
293 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xcf */
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0xda */
12337
85bdcc694c7a (map_virt_key): Mark some additional chars as valid ASCII.
Richard M. Stallman <rms@gnu.org>
parents: 11386
diff changeset
295 -2, -2, -2, -2, -2, /* 0xdf */
85bdcc694c7a (map_virt_key): Mark some additional chars as valid ASCII.
Richard M. Stallman <rms@gnu.org>
parents: 11386
diff changeset
296 -2, -2, -2, -2, -2,
85bdcc694c7a (map_virt_key): Mark some additional chars as valid ASCII.
Richard M. Stallman <rms@gnu.org>
parents: 11386
diff changeset
297 -1, /* 0xe5 */
85bdcc694c7a (map_virt_key): Mark some additional chars as valid ASCII.
Richard M. Stallman <rms@gnu.org>
parents: 11386
diff changeset
298 -2, /* oxe6 */
85bdcc694c7a (map_virt_key): Mark some additional chars as valid ASCII.
Richard M. Stallman <rms@gnu.org>
parents: 11386
diff changeset
299 -1, -1, /* 0xe8 */
85bdcc694c7a (map_virt_key): Mark some additional chars as valid ASCII.
Richard M. Stallman <rms@gnu.org>
parents: 11386
diff changeset
300 -2, -2, -2, -2, -2, -2, -2, /* 0xef */
85bdcc694c7a (map_virt_key): Mark some additional chars as valid ASCII.
Richard M. Stallman <rms@gnu.org>
parents: 11386
diff changeset
301 -2, -2, -2, -2, -2, -2,
85bdcc694c7a (map_virt_key): Mark some additional chars as valid ASCII.
Richard M. Stallman <rms@gnu.org>
parents: 11386
diff changeset
302 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 /* 0xff */
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 };
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
305 /* return code -1 means that event_queue_ptr won't be incremented.
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
306 In other word, this event makes two key codes. (by himi) */
14463
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
307 int
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
308 key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead)
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 int map;
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
311 int key_flag = 0;
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
312 static BOOL map_virt_key_init_done;
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
313
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
314 *isdead = 0;
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 /* Skip key-up events. */
15144
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
317 if (!event->bKeyDown)
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318 return 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320 if (event->wVirtualKeyCode > 0xff)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322 printf ("Unknown key code %d\n", event->wVirtualKeyCode);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 return 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
324 }
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
325
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
326 /* Patch needed for German keyboard. Ulrich Leodolter (1/11/95). */
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
327 if (! map_virt_key_init_done)
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
328 {
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
329 short vk;
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
330
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
331 if ((vk = VkKeyScan (0x3c)) >= 0 && vk < 256) map_virt_key[vk] = -2; /* less */
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
332 if ((vk = VkKeyScan (0x3e)) >= 0 && vk < 256) map_virt_key[vk] = -2; /* greater */
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
333
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
334 map_virt_key_init_done = TRUE;
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
335 }
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
336
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337 /* BUGBUG - Ignores the repeat count
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338 It's questionable whether we want to obey the repeat count anyway
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
339 since keys usually aren't repeated unless key events back up in
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 the queue. If they're backing up then we don't generally want
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 to honor them later since that leads to significant slop in
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 cursor motion when the system is under heavy load. */
15144
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
343
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 map = map_virt_key[event->wVirtualKeyCode];
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
345 if (map == -1)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347 return 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349 else if (map == -2)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351 /* ASCII */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352 emacs_ev->kind = ascii_keystroke;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15784
diff changeset
353 key_flag = w32_kbd_patch_key (event); /* 95.7.25 by himi */
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
354 if (key_flag == 0)
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
355 return 0;
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
356 if (key_flag < 0)
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
357 *isdead = 1;
10007
10fc4417831d (SET_FRAME, key_event, do_mouse_event): Use accessor macros.
Karl Heuer <kwzh@gnu.org>
parents: 9907
diff changeset
358 XSETINT (emacs_ev->code, event->uChar.AsciiChar);
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 }
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
360 #ifdef MULE
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
361 /* for IME */
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
362 else if (map == -3)
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
363 {
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
364 if ((event->dwControlKeyState & NLS_IME_CONVERSION)
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
365 && !(event->dwControlKeyState & RIGHT_ALT_PRESSED)
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
366 && !(event->dwControlKeyState & LEFT_ALT_PRESSED)
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
367 && !(event->dwControlKeyState & RIGHT_CTRL_PRESSED)
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
368 && !(event->dwControlKeyState & LEFT_CTRL_PRESSED))
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
369 {
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
370 emacs_ev->kind = ascii_keystroke;
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
371 XSETINT (emacs_ev->code, event->uChar.AsciiChar);
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
372 }
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
373 else
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
374 return 0;
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
375 }
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
376 #endif
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
377 else
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379 /* non-ASCII */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
380 emacs_ev->kind = non_ascii_keystroke;
15144
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
381 #ifdef HAVE_NTGUI
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
382 /* use Windows keysym map */
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
383 XSETINT (emacs_ev->code, event->wVirtualKeyCode);
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
384 #else
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
385 /*
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
386 * make_lispy_event () now requires non-ascii codes to have
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387 * the full X keysym values (2nd byte is 0xff). add it on.
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388 */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
389 map |= 0xff00;
10007
10fc4417831d (SET_FRAME, key_event, do_mouse_event): Use accessor macros.
Karl Heuer <kwzh@gnu.org>
parents: 9907
diff changeset
390 XSETINT (emacs_ev->code, map);
15144
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
391 #endif /* HAVE_NTGUI */
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392 }
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
393 /* for Mule 2.2 (Based on Emacs 19.28) */
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
394 #ifdef MULE
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
395 XSET (emacs_ev->frame_or_window, Lisp_Frame, get_frame ());
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
396 #else
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
397 XSETFRAME (emacs_ev->frame_or_window, get_frame ());
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
398 #endif
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
399 emacs_ev->modifiers = w32_kbd_mods_to_emacs (event->dwControlKeyState,
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
400 event->wVirtualKeyCode);
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
401 emacs_ev->timestamp = GetTickCount ();
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
402 if (key_flag == 2) return -1; /* 95.7.25 by himi */
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 return 1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
406 /* Mouse position hook. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15784
diff changeset
408 w32_mouse_position (FRAME_PTR *f,
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
409 #ifndef MULE
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
410 int insist,
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
411 #endif
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
412 Lisp_Object *bar_window,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
413 enum scroll_bar_part *part,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
414 Lisp_Object *x,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
415 Lisp_Object *y,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
416 unsigned long *time)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418 BLOCK_INPUT;
15144
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
419
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
420 #ifndef MULE
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
421 insist = insist;
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
422 #endif
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
423
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
424 *f = get_frame ();
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425 *bar_window = Qnil;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
426 *part = 0;
12544
8f17bdb409cf (win32_mouse_position, mouse_moved_to):
Karl Heuer <kwzh@gnu.org>
parents: 12337
diff changeset
427 selected_frame->mouse_moved = 0;
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
428
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
429 *x = movement_pos.X;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
430 *y = movement_pos.Y;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
431 *time = movement_time;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
432
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
433 UNBLOCK_INPUT;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
434 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
435
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
436 /* Remember mouse motion and notify emacs. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
437 static void
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
438 mouse_moved_to (int x, int y)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
439 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
440 /* If we're in the same place, ignore it */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441 if (x != movement_pos.X || y != movement_pos.Y)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
442 {
12544
8f17bdb409cf (win32_mouse_position, mouse_moved_to):
Karl Heuer <kwzh@gnu.org>
parents: 12337
diff changeset
443 selected_frame->mouse_moved = 1;
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
444 movement_pos.X = x;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445 movement_pos.Y = y;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446 movement_time = GetTickCount ();
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
447 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
448 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
449
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
450 /* Consoles return button bits in a strange order:
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
451 least significant - Leftmost button
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
452 next - Rightmost button
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453 next - Leftmost+1
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454 next - Leftmost+2...
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456 Assume emacs likes three button mice, so
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
457 Left == 0
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458 Middle == 1
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459 Right == 2
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 Others increase from there. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
462 static int emacs_button_translation[NUM_MOUSE_BUTTONS] =
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
463 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
464 0, 2, 1, 3, 4,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 };
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
466
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467 static int
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
468 do_mouse_event (MOUSE_EVENT_RECORD *event,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469 struct input_event *emacs_ev)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 static DWORD button_state = 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
472 DWORD but_change, mask;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
473 int i;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
474
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
475 if (event->dwEventFlags == MOUSE_MOVED)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
476 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
477 /* For movement events we just note that the mouse has moved
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
478 so that emacs will generate drag events. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
479 mouse_moved_to (event->dwMousePosition.X, event->dwMousePosition.Y);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
480 return 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
483 /* It looks like the console code sends us a mouse event with
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484 dwButtonState == 0 when a window is activated. Ignore this case. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
485 if (event->dwButtonState == button_state)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
486 return 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
487
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
488 emacs_ev->kind = mouse_click;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
489
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
490 /* Find out what button has changed state since the last button event. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
491 but_change = button_state ^ event->dwButtonState;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
492 mask = 1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
493 for (i = 0; i < NUM_MOUSE_BUTTONS; i++, mask <<= 1)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
494 if (but_change & mask)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
495 {
10007
10fc4417831d (SET_FRAME, key_event, do_mouse_event): Use accessor macros.
Karl Heuer <kwzh@gnu.org>
parents: 9907
diff changeset
496 XSETINT (emacs_ev->code, emacs_button_translation[i]);
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
497 break;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
499
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500 /* If the changed button is out of emacs' range (highly unlikely)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501 ignore this event. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502 if (i == NUM_MOUSE_BUTTONS)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
503 return 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
504
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
505 button_state = event->dwButtonState;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
506 emacs_ev->timestamp = GetTickCount ();
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
507 emacs_ev->modifiers = w32_kbd_mods_to_emacs (event->dwControlKeyState, 0) |
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508 ((event->dwButtonState & mask) ? down_modifier : up_modifier);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509
10007
10fc4417831d (SET_FRAME, key_event, do_mouse_event): Use accessor macros.
Karl Heuer <kwzh@gnu.org>
parents: 9907
diff changeset
510 XSETFASTINT (emacs_ev->x, event->dwMousePosition.X);
10fc4417831d (SET_FRAME, key_event, do_mouse_event): Use accessor macros.
Karl Heuer <kwzh@gnu.org>
parents: 9907
diff changeset
511 XSETFASTINT (emacs_ev->y, event->dwMousePosition.Y);
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
512 /* for Mule 2.2 (Based on Emacs 19.28 */
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
513 #ifdef MULE
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
514 XSET (emacs_ev->frame_or_window, Lisp_Frame, get_frame ());
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
515 #else
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
516 XSETFRAME (emacs_ev->frame_or_window, get_frame ());
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
517 #endif
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
519 return 1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
520 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
521
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522 static void
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523 resize_event (WINDOW_BUFFER_SIZE_RECORD *event)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
525 FRAME_PTR f = get_frame ();
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
526
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
527 change_frame_size (f, event->dwSize.Y, event->dwSize.X, 0, 1);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
528 SET_FRAME_GARBAGED (f);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
530
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
531 int
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15784
diff changeset
532 w32_console_read_socket (int sd, struct input_event *bufp, int numchars,
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15784
diff changeset
533 int waitp, int expected)
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
534 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
535 BOOL no_events = TRUE;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
536 int nev, ret = 0, add;
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
537 int isdead;
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
538
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539 if (interrupt_input_blocked)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
540 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
541 interrupt_input_pending = 1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
542 return -1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
544
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
545 interrupt_input_pending = 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
546 BLOCK_INPUT;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
548 for (;;)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549 {
15784
75547616a6fe (win32_read_socket): Never block reading from input queue.
Richard M. Stallman <rms@gnu.org>
parents: 15460
diff changeset
550 nev = fill_queue (0);
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 if (nev <= 0)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553 /* If nev == -1, there was some kind of error
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
554 If nev == 0 then waitp must be zero and no events were available
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 so return. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
556 UNBLOCK_INPUT;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557 return nev;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
558 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
559
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
560 while (nev > 0 && numchars > 0)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
562 switch (queue_ptr->EventType)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
563 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564 case KEY_EVENT:
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
565 add = key_event (&queue_ptr->Event.KeyEvent, bufp, &isdead);
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
566 if (add == -1) /* 95.7.25 by himi */
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
567 {
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
568 queue_ptr--;
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
569 add = 1;
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
570 }
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
571 bufp += add;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572 ret += add;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
573 numchars -= add;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
574 break;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 case MOUSE_EVENT:
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 add = do_mouse_event (&queue_ptr->Event.MouseEvent, bufp);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
578 bufp += add;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
579 ret += add;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
580 numchars -= add;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
581 break;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
582
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
583 case WINDOW_BUFFER_SIZE_EVENT:
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
584 resize_event (&queue_ptr->Event.WindowBufferSizeEvent);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585 break;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
587 case MENU_EVENT:
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
588 case FOCUS_EVENT:
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
589 /* Internal event types, ignored. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
590 break;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
591 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
592
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
593 queue_ptr++;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
594 nev--;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
595 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
596
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
597 if (ret > 0 || expected == 0)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
598 break;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
599 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
600
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
601 UNBLOCK_INPUT;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
602 return ret;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
603 }