annotate src/w32inevt.c @ 24820:788dc6ff04da

Add iswitchb-minibuffer-setup to minibuffer-setup-hook in iswitchb-default-keybindings.
author Stephen Eglen <stephen@gnu.org>
date Sat, 05 Jun 1999 11:48:02 +0000
parents 4582b492a651
children 42f29912dc46
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"
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
36 #include "w32heap.h"
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
37 #include "w32term.h"
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 /* stdin, from ntterm */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 extern HANDLE keyboard_handle;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 /* Info for last mouse motion */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 static COORD movement_pos;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 static DWORD movement_time;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 /* from keyboard.c */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 extern void reinvoke_input_signal (void);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 /* from dispnew.c */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 extern int change_frame_size (FRAME_PTR, int, int, int, int);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51
15460
be07c4433554 (Vwin32_alt_is_meta): Declared.
Richard M. Stallman <rms@gnu.org>
parents: 15144
diff changeset
52 /* from w32fns.c */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15784
diff changeset
53 extern Lisp_Object Vw32_alt_is_meta;
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
54 extern unsigned int map_keypad_keys (unsigned int, unsigned int);
15460
be07c4433554 (Vwin32_alt_is_meta): Declared.
Richard M. Stallman <rms@gnu.org>
parents: 15144
diff changeset
55
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
56 /* from w32term */
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
57 extern Lisp_Object Vw32_capslock_is_shiftlock;
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
58 extern Lisp_Object Vw32_enable_caps_lock;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
59 extern Lisp_Object Vw32_enable_num_lock;
21611
1a4fc4d9ca9a (Vw32_recognize_altgr): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19710
diff changeset
60 extern Lisp_Object Vw32_recognize_altgr;
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
61 extern Lisp_Object Vw32_pass_lwindow_to_system;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
62 extern Lisp_Object Vw32_pass_rwindow_to_system;
23804
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
63 extern Lisp_Object Vw32_phantom_key_code;
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
64 extern Lisp_Object Vw32_lwindow_modifier;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
65 extern Lisp_Object Vw32_rwindow_modifier;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
66 extern Lisp_Object Vw32_apps_modifier;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
67 extern Lisp_Object Vw32_scroll_lock_modifier;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
68 extern unsigned int w32_key_to_modifier (int key);
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
69
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 /* Event queue */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 #define EVENT_QUEUE_SIZE 50
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 static INPUT_RECORD event_queue[EVENT_QUEUE_SIZE];
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 static INPUT_RECORD *queue_ptr = event_queue, *queue_end = event_queue;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 static int
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 fill_queue (BOOL block)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 BOOL rc;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 DWORD events_waiting;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 if (queue_ptr < queue_end)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 return queue_end-queue_ptr;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 if (!block)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 /* 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
87 because we can't block. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 if (!GetNumberOfConsoleInputEvents (keyboard_handle, &events_waiting))
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 return -1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 if (events_waiting == 0)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 return 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 rc = ReadConsoleInput (keyboard_handle, event_queue, EVENT_QUEUE_SIZE,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 &events_waiting);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 if (!rc)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 return -1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 queue_ptr = event_queue;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 queue_end = event_queue + events_waiting;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 return (int) events_waiting;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 /* In a generic, multi-frame world this should take a console handle
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 and return the frame for it
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 Right now, there's only one frame so return it. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 static FRAME_PTR
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 get_frame (void)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 return selected_frame;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
113 /* Translate console modifiers to emacs modifiers.
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
114 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
115 int
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
116 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
117 {
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
118 int retval = 0;
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
119
21611
1a4fc4d9ca9a (Vw32_recognize_altgr): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19710
diff changeset
120 /* If we recognize right-alt and left-ctrl as AltGr, and it has been
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
121 pressed, first remove those modifiers. */
21611
1a4fc4d9ca9a (Vw32_recognize_altgr): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19710
diff changeset
122 if (!NILP (Vw32_recognize_altgr)
1a4fc4d9ca9a (Vw32_recognize_altgr): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19710
diff changeset
123 && (mods & (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED))
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
124 == (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED))
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
125 mods &= ~ (RIGHT_ALT_PRESSED | LEFT_CTRL_PRESSED);
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
126
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
127 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
128 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
129
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
130 if (mods & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED))
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
131 {
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
132 retval |= ctrl_modifier;
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
133 if ((mods & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED))
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
134 == (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED))
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
135 retval |= meta_modifier;
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
136 }
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
137
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
138 if (mods & LEFT_WIN_PRESSED)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
139 retval |= w32_key_to_modifier (VK_LWIN);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
140 if (mods & RIGHT_WIN_PRESSED)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
141 retval |= w32_key_to_modifier (VK_RWIN);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
142 if (mods & APPS_PRESSED)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
143 retval |= w32_key_to_modifier (VK_APPS);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
144 if (mods & SCROLLLOCK_ON)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
145 retval |= w32_key_to_modifier (VK_SCROLL);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
146
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
147 /* 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
148 optional by setting w32-capslock-is-shiftlock to t. */
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
149 if (NILP (Vw32_capslock_is_shiftlock)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
150 /* Keys that should _not_ be affected by CapsLock. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
151 && ( (key == VK_BACK)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
152 || (key == VK_TAB)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
153 || (key == VK_CLEAR)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
154 || (key == VK_RETURN)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
155 || (key == VK_ESCAPE)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
156 || ((key >= VK_SPACE) && (key <= VK_HELP))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
157 || ((key >= VK_NUMPAD0) && (key <= VK_F24))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
158 || ((key >= VK_NUMPAD_CLEAR) && (key <= VK_NUMPAD_DELETE))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
159 ))
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
160 {
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
161 /* Only consider shift state. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
162 if ((mods & SHIFT_PRESSED) != 0)
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
163 retval |= shift_modifier;
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
164 }
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
165 else
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
166 {
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
167 /* Ignore CapsLock state if not enabled. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
168 if (NILP (Vw32_enable_caps_lock))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
169 mods &= ~CAPSLOCK_ON;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
170 if ((mods & (SHIFT_PRESSED | CAPSLOCK_ON)) != 0)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
171 retval |= shift_modifier;
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
172 }
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
173
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
174 return retval;
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
175 }
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
176
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
177 #if 0
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
178 /* Return nonzero if the virtual key is a dead key. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
179 static int
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
180 is_dead_key (int wparam)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
181 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
182 unsigned int code = MapVirtualKey (wparam, 2);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
183
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
184 /* Windows 95 returns 0x8000, NT returns 0x80000000. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
185 return (code & 0x80008000) ? 1 : 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
186 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
187 #endif
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
188
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
189 /* 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
190 int
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15784
diff changeset
191 w32_kbd_patch_key (KEY_EVENT_RECORD *event)
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 {
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
193 unsigned int key_code = event->wVirtualKeyCode;
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
194 unsigned int mods = event->dwControlKeyState;
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
195 BYTE keystate[256];
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
196 static BYTE ansi_code[4];
15144
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
197 static int isdead = 0;
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
198
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
199 if (isdead == 2)
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
200 {
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
201 event->uChar.AsciiChar = ansi_code[2];
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
202 isdead = 0;
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
203 return 1;
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
204 }
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
205 if (event->uChar.AsciiChar != 0)
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
206 return 1;
14463
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
207
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
208 memset (keystate, 0, sizeof (keystate));
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
209 keystate[key_code] = 0x80;
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
210 if (mods & SHIFT_PRESSED)
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
211 keystate[VK_SHIFT] = 0x80;
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
212 if (mods & CAPSLOCK_ON)
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
213 keystate[VK_CAPITAL] = 1;
21611
1a4fc4d9ca9a (Vw32_recognize_altgr): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19710
diff changeset
214 /* If we recognize right-alt and left-ctrl as AltGr, set the key
1a4fc4d9ca9a (Vw32_recognize_altgr): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19710
diff changeset
215 states accordingly before invoking ToAscii. */
1a4fc4d9ca9a (Vw32_recognize_altgr): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19710
diff changeset
216 if (!NILP (Vw32_recognize_altgr)
1a4fc4d9ca9a (Vw32_recognize_altgr): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19710
diff changeset
217 && (mods & LEFT_CTRL_PRESSED) && (mods & RIGHT_ALT_PRESSED))
14463
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
218 {
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
219 keystate[VK_CONTROL] = 0x80;
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
220 keystate[VK_LCONTROL] = 0x80;
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
221 keystate[VK_MENU] = 0x80;
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
222 keystate[VK_RMENU] = 0x80;
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
223 }
24e5bd545f4d (win32_kbd_mods_to_emacs, win32_kbd_patch_key,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14245
diff changeset
224
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
225 #if 0
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
226 /* Because of an OS bug, ToAscii corrupts the stack when called to
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
227 convert a dead key in console mode on NT4. Unfortunately, trying
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
228 to check for dead keys using MapVirtualKey doesn't work either -
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
229 these functions apparently use internal information about keyboard
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
230 layout which doesn't get properly updated in console programs when
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
231 changing layout (though apparently it gets partly updated,
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
232 otherwise ToAscii wouldn't crash). */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
233 if (is_dead_key (event->wVirtualKeyCode))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
234 return 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
235 #endif
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
236
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
237 /* On NT, call ToUnicode instead and then convert to the current
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
238 locale's default codepage. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
239 if (os_subtype == OS_NT)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
240 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
241 WCHAR buf[128];
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
242
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
243 isdead = ToUnicode (event->wVirtualKeyCode, event->wVirtualScanCode,
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
244 keystate, buf, 128, 0);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
245 if (isdead > 0)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
246 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
247 char cp[20];
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
248 int cpId;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
249
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
250 GetLocaleInfo (GetThreadLocale (),
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
251 LOCALE_IDEFAULTANSICODEPAGE, cp, 20);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
252 cpId = atoi (cp);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
253 isdead = WideCharToMultiByte (cpId, 0, buf, isdead,
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
254 ansi_code, 4, NULL, NULL);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
255 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
256 else
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
257 isdead = 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
258 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
259 else
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
260 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
261 isdead = ToAscii (event->wVirtualKeyCode, event->wVirtualScanCode,
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
262 keystate, (LPWORD) ansi_code, 0);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
263 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
264
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
265 if (isdead == 0)
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
266 return 0;
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
267 event->uChar.AsciiChar = ansi_code[0];
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
268 return isdead;
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 }
15144
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
270
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
272 extern char *lispy_function_keys[];
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273
23804
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
274 static int faked_key = 0;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
275
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
276 /* 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
277 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
278 int
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
279 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
280 {
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
281 static int mod_key_state = 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
282 int wParam;
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
283
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
284 *isdead = 0;
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
285
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286 /* Skip key-up events. */
15144
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
287 if (!event->bKeyDown)
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 {
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
289 switch (event->wVirtualKeyCode)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
290 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
291 case VK_LWIN:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
292 mod_key_state &= ~LEFT_WIN_PRESSED;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
293 break;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
294 case VK_RWIN:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
295 mod_key_state &= ~RIGHT_WIN_PRESSED;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
296 break;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
297 case VK_APPS:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
298 mod_key_state &= ~APPS_PRESSED;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
299 break;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
300 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
301 return 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
302 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
303
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
304 /* Ignore keystrokes we fake ourself; see below. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
305 if (faked_key == event->wVirtualKeyCode)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
306 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
307 faked_key = 0;
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 return 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 }
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
310
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
311 /* To make it easier to debug this code, ignore modifier keys! */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
312 switch (event->wVirtualKeyCode)
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
313 {
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
314 case VK_LWIN:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
315 if (NILP (Vw32_pass_lwindow_to_system))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
316 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
317 /* Prevent system from acting on keyup (which opens the Start
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
318 menu if no other key was pressed) by simulating a press of
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
319 Space which we will ignore. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
320 if ((mod_key_state & LEFT_WIN_PRESSED) == 0)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
321 {
23804
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
322 if (NUMBERP (Vw32_phantom_key_code))
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
323 faked_key = XUINT (Vw32_phantom_key_code) & 255;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
324 else
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
325 faked_key = VK_SPACE;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
326 keybd_event (faked_key, (BYTE) MapVirtualKey (faked_key, 0), 0, 0);
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
327 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
328 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
329 mod_key_state |= LEFT_WIN_PRESSED;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
330 if (!NILP (Vw32_lwindow_modifier))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
331 return 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
332 break;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
333 case VK_RWIN:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
334 if (NILP (Vw32_pass_rwindow_to_system))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
335 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
336 if ((mod_key_state & RIGHT_WIN_PRESSED) == 0)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
337 {
23804
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
338 if (NUMBERP (Vw32_phantom_key_code))
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
339 faked_key = XUINT (Vw32_phantom_key_code) & 255;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
340 else
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
341 faked_key = VK_SPACE;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
342 keybd_event (faked_key, (BYTE) MapVirtualKey (faked_key, 0), 0, 0);
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
343 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
344 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
345 mod_key_state |= RIGHT_WIN_PRESSED;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
346 if (!NILP (Vw32_rwindow_modifier))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
347 return 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
348 break;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
349 case VK_APPS:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
350 mod_key_state |= APPS_PRESSED;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
351 if (!NILP (Vw32_apps_modifier))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
352 return 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
353 break;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
354 case VK_CAPITAL:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
355 /* Decide whether to treat as modifier or function key. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
356 if (NILP (Vw32_enable_caps_lock))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
357 goto disable_lock_key;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
358 return 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
359 case VK_NUMLOCK:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
360 /* Decide whether to treat as modifier or function key. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
361 if (NILP (Vw32_enable_num_lock))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
362 goto disable_lock_key;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
363 return 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
364 case VK_SCROLL:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
365 /* Decide whether to treat as modifier or function key. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
366 if (NILP (Vw32_scroll_lock_modifier))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
367 goto disable_lock_key;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
368 return 0;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
369 disable_lock_key:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
370 /* Ensure the appropriate lock key state is off (and the
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
371 indicator light as well). */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
372 wParam = event->wVirtualKeyCode;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
373 if (GetAsyncKeyState (wParam) & 0x8000)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
374 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
375 /* Fake another press of the relevant key. Apparently, this
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
376 really is the only way to turn off the indicator. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
377 faked_key = wParam;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
378 keybd_event ((BYTE) wParam, (BYTE) MapVirtualKey (wParam, 0),
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
379 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
380 keybd_event ((BYTE) wParam, (BYTE) MapVirtualKey (wParam, 0),
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
381 KEYEVENTF_EXTENDEDKEY | 0, 0);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
382 keybd_event ((BYTE) wParam, (BYTE) MapVirtualKey (wParam, 0),
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
383 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
384 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
385 break;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
386 case VK_MENU:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
387 case VK_CONTROL:
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
388 case VK_SHIFT:
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
389 return 0;
23804
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
390 case VK_CANCEL:
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
391 /* Windows maps Ctrl-Pause (aka Ctrl-Break) into VK_CANCEL,
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
392 which is confusing for purposes of key binding; convert
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
393 VK_CANCEL events into VK_PAUSE events. */
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
394 event->wVirtualKeyCode = VK_PAUSE;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
395 break;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
396 case VK_PAUSE:
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
397 /* Windows maps Ctrl-NumLock into VK_PAUSE, which is confusing
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
398 for purposes of key binding; convert these back into
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
399 VK_NUMLOCK events, at least when we want to see NumLock key
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
400 presses. (Note that there is never any possibility that
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
401 VK_PAUSE with Ctrl really is C-Pause as per above.) */
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
402 if (NILP (Vw32_enable_num_lock)
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
403 && (event->dwControlKeyState
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
404 & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) != 0)
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
405 event->wVirtualKeyCode = VK_NUMLOCK;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
406 break;
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 }
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
408
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
409 /* Recognize state of Windows and Apps keys. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
410 event->dwControlKeyState |= mod_key_state;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
411
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
412 /* Distinguish numeric keypad keys from extended keys. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
413 event->wVirtualKeyCode =
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
414 map_keypad_keys (event->wVirtualKeyCode,
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
415 (event->dwControlKeyState & ENHANCED_KEY));
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
416
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
417 if (lispy_function_keys[event->wVirtualKeyCode] == 0)
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419 emacs_ev->kind = ascii_keystroke;
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
420
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
421 if (!NILP (Vw32_recognize_altgr)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
422 && (event->dwControlKeyState & LEFT_CTRL_PRESSED)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
423 && (event->dwControlKeyState & RIGHT_ALT_PRESSED))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
424 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
425 /* Don't try to interpret AltGr key chords; ToAscii seems not
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
426 to process them correctly. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
427 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
428 /* Handle key chords including any modifiers other than shift
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
429 directly, in order to preserve as much modifier information as
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
430 possible. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
431 else if (event->dwControlKeyState
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
432 & ( RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
433 | RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
434 | (!NILP (Vw32_lwindow_modifier) ? LEFT_WIN_PRESSED : 0)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
435 | (!NILP (Vw32_rwindow_modifier) ? RIGHT_WIN_PRESSED : 0)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
436 | (!NILP (Vw32_apps_modifier) ? APPS_PRESSED : 0)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
437 | (!NILP (Vw32_scroll_lock_modifier) ? SCROLLLOCK_ON : 0)))
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
438 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
439 /* Don't translate modified alphabetic keystrokes, so the user
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
440 doesn't need to constantly switch layout to type control or
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
441 meta keystrokes when the normal layout translates
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
442 alphabetic characters to non-ascii characters. */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
443 if ('A' <= event->wVirtualKeyCode && event->wVirtualKeyCode <= 'Z')
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
444 {
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
445 event->uChar.AsciiChar = event->wVirtualKeyCode;
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
446 if ((event->dwControlKeyState & SHIFT_PRESSED) == 0)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
447 event->uChar.AsciiChar += ('a' - 'A');
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
448 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
449 /* Try to handle unrecognized keystrokes by determining the
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
450 base character (ie. translating the base key plus shift
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
451 modifier). */
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
452 else if (event->uChar.AsciiChar == 0)
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
453 w32_kbd_patch_key (event);
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
454 }
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
455 if (event->uChar.AsciiChar == 0)
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
456 return 0;
10007
10fc4417831d (SET_FRAME, key_event, do_mouse_event): Use accessor macros.
Karl Heuer <kwzh@gnu.org>
parents: 9907
diff changeset
457 XSETINT (emacs_ev->code, event->uChar.AsciiChar);
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459 else
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461 emacs_ev->kind = non_ascii_keystroke;
15144
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
462 XSETINT (emacs_ev->code, event->wVirtualKeyCode);
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
463 }
23679
3d02c8b4b525 Include w32term.h and w32heap.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21829
diff changeset
464
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
465 XSETFRAME (emacs_ev->frame_or_window, get_frame ());
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
466 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
467 event->wVirtualKeyCode);
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
468 emacs_ev->timestamp = GetTickCount ();
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469 return 1;
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
23804
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
472 int
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
473 w32_console_toggle_lock_key (int vk_code, Lisp_Object new_state)
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
474 {
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
475 int cur_state = (GetKeyState (vk_code) & 1);
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
476
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
477 if (NILP (new_state)
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
478 || (NUMBERP (new_state)
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
479 && (XUINT (new_state)) & 1 != cur_state))
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
480 {
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
481 faked_key = vk_code;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
482
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
483 keybd_event ((BYTE) vk_code,
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
484 (BYTE) MapVirtualKey (vk_code, 0),
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
485 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
486 keybd_event ((BYTE) vk_code,
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
487 (BYTE) MapVirtualKey (vk_code, 0),
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
488 KEYEVENTF_EXTENDEDKEY | 0, 0);
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
489 keybd_event ((BYTE) vk_code,
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
490 (BYTE) MapVirtualKey (vk_code, 0),
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
491 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
492 cur_state = !cur_state;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
493 }
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
494
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
495 return cur_state;
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
496 }
aa5a4d0b1591 (key_event): Use Vw32_phantom_key_code. Undo the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23679
diff changeset
497
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498 /* Mouse position hook. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
499 void
21829
674d44aeeda1 (w32_console_mouse_position): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 21611
diff changeset
500 w32_console_mouse_position (FRAME_PTR *f,
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
501 #ifndef MULE
21829
674d44aeeda1 (w32_console_mouse_position): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 21611
diff changeset
502 int insist,
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
503 #endif
21829
674d44aeeda1 (w32_console_mouse_position): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 21611
diff changeset
504 Lisp_Object *bar_window,
674d44aeeda1 (w32_console_mouse_position): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 21611
diff changeset
505 enum scroll_bar_part *part,
674d44aeeda1 (w32_console_mouse_position): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 21611
diff changeset
506 Lisp_Object *x,
674d44aeeda1 (w32_console_mouse_position): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 21611
diff changeset
507 Lisp_Object *y,
674d44aeeda1 (w32_console_mouse_position): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 21611
diff changeset
508 unsigned long *time)
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510 BLOCK_INPUT;
15144
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
511
9dd18e9e0362 (win32_kdb_patch_key): Initialize isdead.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14463
diff changeset
512 #ifndef MULE
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
513 insist = insist;
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
514 #endif
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
515
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
516 *f = get_frame ();
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 *bar_window = Qnil;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518 *part = 0;
12544
8f17bdb409cf (win32_mouse_position, mouse_moved_to):
Karl Heuer <kwzh@gnu.org>
parents: 12337
diff changeset
519 selected_frame->mouse_moved = 0;
9907
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 *x = movement_pos.X;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522 *y = movement_pos.Y;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523 *time = movement_time;
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 UNBLOCK_INPUT;
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
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
528 /* Remember mouse motion and notify emacs. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529 static void
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
530 mouse_moved_to (int x, int y)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
531 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
532 /* If we're in the same place, ignore it */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
533 if (x != movement_pos.X || y != movement_pos.Y)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
534 {
12544
8f17bdb409cf (win32_mouse_position, mouse_moved_to):
Karl Heuer <kwzh@gnu.org>
parents: 12337
diff changeset
535 selected_frame->mouse_moved = 1;
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
536 movement_pos.X = x;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
537 movement_pos.Y = y;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
538 movement_time = GetTickCount ();
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539 }
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
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
542 /* Consoles return button bits in a strange order:
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543 least significant - Leftmost button
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
544 next - Rightmost button
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
545 next - Leftmost+1
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
546 next - Leftmost+2...
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 Assume emacs likes three button mice, so
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549 Left == 0
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
550 Middle == 1
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 Right == 2
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552 Others increase from there. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
554 static int emacs_button_translation[NUM_MOUSE_BUTTONS] =
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
556 0, 2, 1, 3, 4,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557 };
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 static int
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
560 do_mouse_event (MOUSE_EVENT_RECORD *event,
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 struct input_event *emacs_ev)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
562 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
563 static DWORD button_state = 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564 DWORD but_change, mask;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
565 int i;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567 if (event->dwEventFlags == MOUSE_MOVED)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
568 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
569 /* For movement events we just note that the mouse has moved
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
570 so that emacs will generate drag events. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
571 mouse_moved_to (event->dwMousePosition.X, event->dwMousePosition.Y);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572 return 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
573 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
574
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575 /* It looks like the console code sends us a mouse event with
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 dwButtonState == 0 when a window is activated. Ignore this case. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 if (event->dwButtonState == button_state)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
578 return 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
579
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
580 emacs_ev->kind = mouse_click;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
581
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
582 /* Find out what button has changed state since the last button event. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
583 but_change = button_state ^ event->dwButtonState;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
584 mask = 1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585 for (i = 0; i < NUM_MOUSE_BUTTONS; i++, mask <<= 1)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586 if (but_change & mask)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
587 {
10007
10fc4417831d (SET_FRAME, key_event, do_mouse_event): Use accessor macros.
Karl Heuer <kwzh@gnu.org>
parents: 9907
diff changeset
588 XSETINT (emacs_ev->code, emacs_button_translation[i]);
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
589 break;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
590 }
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 /* If the changed button is out of emacs' range (highly unlikely)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
593 ignore this event. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
594 if (i == NUM_MOUSE_BUTTONS)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
595 return 0;
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 button_state = event->dwButtonState;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
598 emacs_ev->timestamp = GetTickCount ();
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
599 emacs_ev->modifiers = w32_kbd_mods_to_emacs (event->dwControlKeyState, 0) |
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
600 ((event->dwButtonState & mask) ? down_modifier : up_modifier);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
601
10007
10fc4417831d (SET_FRAME, key_event, do_mouse_event): Use accessor macros.
Karl Heuer <kwzh@gnu.org>
parents: 9907
diff changeset
602 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
603 XSETFASTINT (emacs_ev->y, event->dwMousePosition.Y);
14245
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
604 /* 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
605 #ifdef MULE
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
606 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
607 #else
11386
62e2ab942896 (do_mouse_event): Use XSETFASTINT.
Karl Heuer <kwzh@gnu.org>
parents: 11123
diff changeset
608 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
609 #endif
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
610
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
611 return 1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
612 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
613
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
614 static void
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
615 resize_event (WINDOW_BUFFER_SIZE_RECORD *event)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
616 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
617 FRAME_PTR f = get_frame ();
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
618
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
619 change_frame_size (f, event->dwSize.Y, event->dwSize.X, 0, 1);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
620 SET_FRAME_GARBAGED (f);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
621 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
622
24756
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
623 static void
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
624 maybe_generate_resize_event ()
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
625 {
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
626 CONSOLE_SCREEN_BUFFER_INFO info;
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
627 FRAME_PTR f = get_frame ();
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
628
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
629 GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &info);
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
630
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
631 /* It is okay to call this unconditionally, since it will do nothing
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
632 if the size hasn't actually changed. */
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
633 change_frame_size (f,
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
634 1 + info.srWindow.Bottom - info.srWindow.Top,
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
635 1 + info.srWindow.Right - info.srWindow.Left,
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
636 0, 0);
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
637 }
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
638
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
639 int
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15784
diff changeset
640 w32_console_read_socket (int sd, struct input_event *bufp, int numchars,
21829
674d44aeeda1 (w32_console_mouse_position): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 21611
diff changeset
641 int expected)
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
642 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 BOOL no_events = TRUE;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
644 int nev, ret = 0, add;
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
645 int isdead;
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
646
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
647 if (interrupt_input_blocked)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
649 interrupt_input_pending = 1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
650 return -1;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
651 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
652
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
653 interrupt_input_pending = 0;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
654 BLOCK_INPUT;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
655
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
656 for (;;)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
657 {
15784
75547616a6fe (win32_read_socket): Never block reading from input queue.
Richard M. Stallman <rms@gnu.org>
parents: 15460
diff changeset
658 nev = fill_queue (0);
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
659 if (nev <= 0)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
660 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
661 /* If nev == -1, there was some kind of error
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
662 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
663 so return. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
664 UNBLOCK_INPUT;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
665 return nev;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
666 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
667
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
668 while (nev > 0 && numchars > 0)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
669 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
670 switch (queue_ptr->EventType)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
671 {
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
672 case KEY_EVENT:
19710
4a6b8c86ad87 Declare externs from other files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
673 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
674 if (add == -1) /* 95.7.25 by himi */
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
675 {
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
676 queue_ptr--;
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
677 add = 1;
59d24d42958a (WIN32_KEY_SHIFTED): Macro undefined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
678 }
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
679 bufp += add;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
680 ret += add;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
681 numchars -= add;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
682 break;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
683
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
684 case MOUSE_EVENT:
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
685 add = do_mouse_event (&queue_ptr->Event.MouseEvent, bufp);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
686 bufp += add;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
687 ret += add;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
688 numchars -= add;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
689 break;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
690
24756
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
691 #if 0
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
692 case WINDOW_BUFFER_SIZE_EVENT:
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
693 resize_event (&queue_ptr->Event.WindowBufferSizeEvent);
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
694 break;
24756
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
695 #endif
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
696
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
697 case MENU_EVENT:
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
698 case FOCUS_EVENT:
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
699 /* Internal event types, ignored. */
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
700 break;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
701 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
702
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
703 queue_ptr++;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
704 nev--;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
705 }
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
706
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
707 if (ret > 0 || expected == 0)
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
708 break;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
709 }
24756
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
710
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
711 /* We don't get told about changes in the window size (only the buffer
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
712 size, which we no longer care about), so we have to check it
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
713 periodically. */
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
714 maybe_generate_resize_event ();
4582b492a651 (maybe_generate_resize_event): Detect changes in the
Andrew Innes <andrewi@gnu.org>
parents: 23804
diff changeset
715
9907
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
716 UNBLOCK_INPUT;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
717 return ret;
2e5a14f7c44e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
718 }