Mercurial > emacs
annotate src/w32console.c @ 28309:9c8f8c3fb131
(load-history): Fix doc string.
author | Dave Love <fx@gnu.org> |
---|---|
date | Sat, 25 Mar 2000 12:37:51 +0000 |
parents | 1857b9695885 |
children | 119787818dff |
rev | line source |
---|---|
16883
d1d4d81f9ece
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16593
diff
changeset
|
1 /* Terminal hooks for GNU Emacs on the Microsoft W32 API. |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
2 Copyright (C) 1992, 1999 Free Software Foundation, Inc. |
9907 | 3 |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13424
diff
changeset
|
4 This file is part of GNU Emacs. |
9907 | 5 |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13424
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:
13424
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:
13424
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:
13424
diff
changeset
|
9 any later version. |
9907 | 10 |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13424
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:
13424
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:
13424
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:
13424
diff
changeset
|
14 GNU General Public License for more details. |
9907 | 15 |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13424
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:
13424
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:
13424
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:
13424
diff
changeset
|
19 Boston, MA 02111-1307, USA. |
9907 | 20 |
21 Tim Fleehart (apollo@online.com) 1-17-92 | |
22 Geoff Voelker (voelker@cs.washington.edu) 9-12-93 | |
23 */ | |
24 | |
25 | |
12183
47685fb0fbd1
Include config.h before stdio.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
11942
diff
changeset
|
26 #include <config.h> |
47685fb0fbd1
Include config.h before stdio.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
11942
diff
changeset
|
27 |
9907 | 28 #include <stdlib.h> |
29 #include <stdio.h> | |
30 #include <windows.h> | |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
31 #include <string.h> |
9907 | 32 |
33 #include "lisp.h" | |
18507
be4c110cda51
Include charset.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16883
diff
changeset
|
34 #include "charset.h" |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
35 #include "coding.h" |
9907 | 36 #include "disptab.h" |
37 #include "termhooks.h" | |
27892
1857b9695885
Only disable window system features for dispextern.h
Jason Rumney <jasonr@gnu.org>
parents:
27518
diff
changeset
|
38 /* Disable features in dispextern.h that require a Window System. */ |
1857b9695885
Only disable window system features for dispextern.h
Jason Rumney <jasonr@gnu.org>
parents:
27518
diff
changeset
|
39 #undef HAVE_WINDOW_SYSTEM |
1857b9695885
Only disable window system features for dispextern.h
Jason Rumney <jasonr@gnu.org>
parents:
27518
diff
changeset
|
40 #include "frame.h" |
16593
4ed80eda6fac
Use new names for w32 files
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
41 #include "w32inevt.h" |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
42 #include "dispextern.h" |
9907 | 43 |
11389 | 44 /* from window.c */ |
9907 | 45 extern Lisp_Object Frecenter (); |
46 | |
47 /* from keyboard.c */ | |
48 extern int detect_input_pending (); | |
49 | |
50 /* from sysdep.c */ | |
51 extern int read_input_pending (); | |
52 | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
53 extern struct frame * updating_frame; |
9907 | 54 extern int meta_key; |
55 | |
56 static void move_cursor (int row, int col); | |
57 static void clear_to_end (void); | |
58 static void clear_frame (void); | |
59 static void clear_end_of_line (int); | |
60 static void ins_del_lines (int vpos, int n); | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
61 static void change_line_highlight (int, int, int, int); |
9907 | 62 static void reassert_line_highlight (int, int); |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
63 static void insert_glyphs (struct glyph *start, int len); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
64 static void write_glyphs (struct glyph *string, int len); |
9907 | 65 static void delete_glyphs (int n); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16262
diff
changeset
|
66 void w32_sys_ring_bell (void); |
9907 | 67 static void reset_terminal_modes (void); |
68 static void set_terminal_modes (void); | |
69 static void set_terminal_window (int size); | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
70 static void update_begin (struct frame * f); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
71 static void update_end (struct frame * f); |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
72 static WORD w32_face_attributes (struct frame *f, int face_id); |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
73 static int hl_mode (int new_highlight); |
9907 | 74 |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
75 static COORD cursor_coords; |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
76 static HANDLE prev_screen, cur_screen; |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
77 static WORD char_attr_normal; |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
78 static DWORD prev_console_mode; |
9907 | 79 |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
80 #ifndef USE_SEPARATE_SCREEN |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
81 static CONSOLE_CURSOR_INFO prev_console_cursor; |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
82 #endif |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
83 |
24938
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
84 /* Determine whether to make frame dimensions match the screen buffer, |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
85 or the current window size. The former is desirable when running |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
86 over telnet, while the latter is more useful when working directly at |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
87 the console with a large scroll-back buffer. */ |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
88 int w32_use_full_screen_buffer; |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
89 HANDLE keyboard_handle; |
24938
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
90 |
9907 | 91 |
92 /* Setting this as the ctrl handler prevents emacs from being killed when | |
12336
617f39b43557
(ctrl_c_handler): Ignore CTRL_BREAK_EVENT signals.
Richard M. Stallman <rms@gnu.org>
parents:
12183
diff
changeset
|
93 someone hits ^C in a 'suspended' session (child shell). |
617f39b43557
(ctrl_c_handler): Ignore CTRL_BREAK_EVENT signals.
Richard M. Stallman <rms@gnu.org>
parents:
12183
diff
changeset
|
94 Also ignore Ctrl-Break signals. */ |
617f39b43557
(ctrl_c_handler): Ignore CTRL_BREAK_EVENT signals.
Richard M. Stallman <rms@gnu.org>
parents:
12183
diff
changeset
|
95 |
9907 | 96 BOOL |
97 ctrl_c_handler (unsigned long type) | |
98 { | |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
99 /* Only ignore "interrupt" events when running interactively. */ |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
100 return (!noninteractive |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
101 && (type == CTRL_C_EVENT || type == CTRL_BREAK_EVENT)); |
9907 | 102 } |
103 | |
104 /* If we're updating a frame, use it as the current frame | |
105 Otherwise, use the selected frame. */ | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
106 #define PICK_FRAME() (updating_frame ? updating_frame : SELECTED_FRAME ()) |
9907 | 107 |
108 /* Move the cursor to (row, col). */ | |
109 void | |
110 move_cursor (int row, int col) | |
111 { | |
112 cursor_coords.X = col; | |
113 cursor_coords.Y = row; | |
114 | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
115 if (updating_frame == (struct frame *) NULL) |
9907 | 116 { |
117 SetConsoleCursorPosition (cur_screen, cursor_coords); | |
118 } | |
119 } | |
120 | |
121 /* Clear from cursor to end of screen. */ | |
122 void | |
123 clear_to_end (void) | |
124 { | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
125 struct frame * f = PICK_FRAME (); |
9907 | 126 |
127 clear_end_of_line (FRAME_WIDTH (f) - 1); | |
128 ins_del_lines (cursor_coords.Y, FRAME_HEIGHT (f) - cursor_coords.Y - 1); | |
129 } | |
130 | |
131 /* Clear the frame. */ | |
132 void | |
133 clear_frame (void) | |
134 { | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
135 struct frame * f = PICK_FRAME (); |
9907 | 136 COORD dest; |
14244
493cff4d5960
(clear_frame): Use FillConsoleOutput* calls instead of
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
137 int n, r; |
24755
3bb855a40bf6
(clear_frame): Remember that the window width might
Andrew Innes <andrewi@gnu.org>
parents:
23572
diff
changeset
|
138 CONSOLE_SCREEN_BUFFER_INFO info; |
3bb855a40bf6
(clear_frame): Remember that the window width might
Andrew Innes <andrewi@gnu.org>
parents:
23572
diff
changeset
|
139 |
3bb855a40bf6
(clear_frame): Remember that the window width might
Andrew Innes <andrewi@gnu.org>
parents:
23572
diff
changeset
|
140 GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &info); |
14244
493cff4d5960
(clear_frame): Use FillConsoleOutput* calls instead of
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
141 |
9907 | 142 hl_mode (0); |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
143 |
24755
3bb855a40bf6
(clear_frame): Remember that the window width might
Andrew Innes <andrewi@gnu.org>
parents:
23572
diff
changeset
|
144 /* Remember that the screen buffer might be wider than the window. */ |
3bb855a40bf6
(clear_frame): Remember that the window width might
Andrew Innes <andrewi@gnu.org>
parents:
23572
diff
changeset
|
145 n = FRAME_HEIGHT (f) * info.dwSize.X; |
14244
493cff4d5960
(clear_frame): Use FillConsoleOutput* calls instead of
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
146 dest.X = dest.Y = 0; |
493cff4d5960
(clear_frame): Use FillConsoleOutput* calls instead of
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
147 |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
148 FillConsoleOutputAttribute (cur_screen, char_attr_normal, n, dest, &r); |
14244
493cff4d5960
(clear_frame): Use FillConsoleOutput* calls instead of
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
149 FillConsoleOutputCharacter (cur_screen, ' ', n, dest, &r); |
493cff4d5960
(clear_frame): Use FillConsoleOutput* calls instead of
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
150 |
9907 | 151 move_cursor (0, 0); |
152 } | |
153 | |
154 | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
155 static struct glyph glyph_base[256]; |
9907 | 156 static BOOL ceol_initialized = FALSE; |
157 | |
158 /* Clear from Cursor to end (what's "standout marker"?). */ | |
159 void | |
160 clear_end_of_line (int end) | |
161 { | |
162 if (!ceol_initialized) | |
163 { | |
164 int i; | |
165 for (i = 0; i < 256; i++) | |
166 { | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
167 memcpy (&glyph_base[i], &space_glyph, sizeof (struct glyph)); |
9907 | 168 } |
169 ceol_initialized = TRUE; | |
170 } | |
171 write_glyphs (glyph_base, end - cursor_coords.X); /* fencepost ? */ | |
172 } | |
173 | |
174 /* Insert n lines at vpos. if n is negative delete -n lines. */ | |
175 void | |
176 ins_del_lines (int vpos, int n) | |
177 { | |
178 int i, nb, save_highlight; | |
179 SMALL_RECT scroll; | |
180 COORD dest; | |
181 CHAR_INFO fill; | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
182 struct frame * f = PICK_FRAME (); |
9907 | 183 |
184 if (n < 0) | |
185 { | |
186 scroll.Top = vpos - n; | |
187 scroll.Bottom = FRAME_HEIGHT (f); | |
188 dest.Y = vpos; | |
189 } | |
190 else | |
191 { | |
192 scroll.Top = vpos; | |
193 scroll.Bottom = FRAME_HEIGHT (f) - n; | |
194 dest.Y = vpos + n; | |
195 } | |
196 scroll.Left = 0; | |
197 scroll.Right = FRAME_WIDTH (f); | |
198 | |
199 dest.X = 0; | |
200 | |
201 save_highlight = hl_mode (0); | |
202 | |
203 fill.Char.AsciiChar = 0x20; | |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
204 fill.Attributes = char_attr_normal; |
9907 | 205 |
206 ScrollConsoleScreenBuffer (cur_screen, &scroll, NULL, dest, &fill); | |
207 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16262
diff
changeset
|
208 /* Here we have to deal with a w32 console flake: If the scroll |
9907 | 209 region looks like abc and we scroll c to a and fill with d we get |
210 cbd... if we scroll block c one line at a time to a, we get cdd... | |
211 Emacs expects cdd consistently... So we have to deal with that | |
212 here... (this also occurs scrolling the same way in the other | |
213 direction. */ | |
214 | |
215 if (n > 0) | |
216 { | |
217 if (scroll.Bottom < dest.Y) | |
218 { | |
219 for (i = scroll.Bottom; i < dest.Y; i++) | |
220 { | |
221 move_cursor (i, 0); | |
222 clear_end_of_line (FRAME_WIDTH (f)); | |
223 } | |
224 } | |
225 } | |
226 else | |
227 { | |
228 nb = dest.Y + (scroll.Bottom - scroll.Top) + 1; | |
229 | |
230 if (nb < scroll.Top) | |
231 { | |
232 for (i = nb; i < scroll.Top; i++) | |
233 { | |
234 move_cursor (i, 0); | |
235 clear_end_of_line (FRAME_WIDTH (f)); | |
236 } | |
237 } | |
238 } | |
239 | |
240 cursor_coords.X = 0; | |
241 cursor_coords.Y = vpos; | |
242 | |
243 hl_mode (save_highlight); | |
244 } | |
245 | |
246 /* Changes attribute to use when drawing characters to control. */ | |
247 static int | |
248 hl_mode (int new_highlight) | |
249 { | |
250 static int highlight = 0; | |
251 int old_highlight; | |
252 | |
253 old_highlight = highlight; | |
254 highlight = (new_highlight != 0); | |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
255 |
9907 | 256 return old_highlight; |
257 } | |
258 | |
259 /* Call this when about to modify line at position VPOS and change whether it | |
260 is highlighted. */ | |
261 void | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
262 change_line_highlight (int new_highlight, int vpos, int y, |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
263 int first_unused_hpos) |
9907 | 264 { |
265 hl_mode (new_highlight); | |
266 move_cursor (vpos, 0); | |
267 clear_end_of_line (first_unused_hpos); | |
268 } | |
269 | |
270 /* External interface to control of standout mode. Call this when about to | |
271 * modify line at position VPOS and not change whether it is highlighted. */ | |
272 void | |
273 reassert_line_highlight (int highlight, int vpos) | |
274 { | |
275 hl_mode (highlight); | |
276 vpos; /* pedantic compiler silencer */ | |
277 } | |
278 | |
279 #undef LEFT | |
280 #undef RIGHT | |
281 #define LEFT 1 | |
282 #define RIGHT 0 | |
283 | |
284 void | |
285 scroll_line (int dist, int direction) | |
286 { | |
287 /* The idea here is to implement a horizontal scroll in one line to | |
288 implement delete and half of insert. */ | |
289 SMALL_RECT scroll; | |
290 COORD dest; | |
291 CHAR_INFO fill; | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
292 struct frame * f = PICK_FRAME (); |
9907 | 293 |
294 scroll.Top = cursor_coords.Y; | |
295 scroll.Bottom = cursor_coords.Y; | |
296 | |
297 if (direction == LEFT) | |
298 { | |
299 scroll.Left = cursor_coords.X + dist; | |
300 scroll.Right = FRAME_WIDTH (f) - 1; | |
301 } | |
302 else | |
303 { | |
304 scroll.Left = cursor_coords.X; | |
305 scroll.Right = FRAME_WIDTH (f) - dist - 1; | |
306 } | |
307 | |
308 dest.X = cursor_coords.X; | |
309 dest.Y = cursor_coords.Y; | |
310 | |
311 fill.Char.AsciiChar = 0x20; | |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
312 fill.Attributes = char_attr_normal; |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
313 |
9907 | 314 ScrollConsoleScreenBuffer (cur_screen, &scroll, NULL, dest, &fill); |
315 } | |
316 | |
317 | |
318 /* If start is zero insert blanks instead of a string at start ?. */ | |
319 void | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
320 insert_glyphs (register struct glyph *start, register int len) |
9907 | 321 { |
322 scroll_line (len, RIGHT); | |
323 | |
324 /* Move len chars to the right starting at cursor_coords, fill with blanks */ | |
325 if (start) | |
326 { | |
327 /* Print the first len characters of start, cursor_coords.X adjusted | |
328 by write_glyphs. */ | |
329 | |
330 write_glyphs (start, len); | |
331 } | |
332 else | |
333 { | |
334 clear_end_of_line (cursor_coords.X + len); | |
335 } | |
336 } | |
337 | |
338 void | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
339 write_glyphs (register struct glyph *string, register int len) |
9907 | 340 { |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
341 int produced, consumed, i; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
342 struct frame * f = PICK_FRAME (); |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
343 WORD char_attr; |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
344 |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
345 if (len <= 0) |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
346 return; |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
347 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
348 /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
349 the tail. */ |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
350 terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK; |
14244
493cff4d5960
(clear_frame): Use FillConsoleOutput* calls instead of
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
351 |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
352 while (len > 0) |
9907 | 353 { |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
354 /* Identify a run of glyphs with the same face. */ |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
355 int face_id = string->face_id; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
356 int n; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
357 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
358 for (n = 1; n < len; ++n) |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
359 if (string[n].face_id != face_id) |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
360 break; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
361 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
362 /* Turn appearance modes of the face of the run on. */ |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
363 char_attr = w32_face_attributes (f, face_id); |
9907 | 364 |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
365 while (n > 0) |
9907 | 366 { |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
367 /* We use a shared conversion buffer of the current size |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
368 (1024 bytes at least). Usually it is sufficient, but if |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
369 not, we just repeat the loop. */ |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
370 produced = encode_terminal_code (string, conversion_buffer, |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
371 n, conversion_buffer_size, |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
372 &consumed); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
373 if (produced > 0) |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
374 { |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
375 /* Set the attribute for these characters. */ |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
376 if (!FillConsoleOutputAttribute (cur_screen, char_attr, |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
377 produced, cursor_coords, &i)) |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
378 { |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
379 printf ("Failed writing console attributes: %d\n", |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
380 GetLastError ()); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
381 fflush (stdout); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
382 } |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
383 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
384 /* Write the characters. */ |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
385 if (!WriteConsoleOutputCharacter (cur_screen, conversion_buffer, |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
386 produced, cursor_coords, &i)) |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
387 { |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
388 printf ("Failed writing console characters: %d\n", |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
389 GetLastError ()); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
390 fflush (stdout); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
391 } |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
392 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
393 cursor_coords.X += produced; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
394 move_cursor (cursor_coords.Y, cursor_coords.X); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
395 } |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
396 len -= consumed; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
397 n -= consumed; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
398 string += consumed; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
399 } |
9907 | 400 } |
401 | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
402 /* We may have to output some codes to terminate the writing. */ |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
403 if (CODING_REQUIRE_FLUSHING (&terminal_coding)) |
9907 | 404 { |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
405 terminal_coding.mode |= CODING_MODE_LAST_BLOCK; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
406 encode_coding (&terminal_coding, "", conversion_buffer, |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
407 0, conversion_buffer_size); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
408 if (terminal_coding.produced > 0) |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
409 { |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
410 if (!FillConsoleOutputAttribute (cur_screen, char_attr_normal, |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
411 terminal_coding.produced, |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
412 cursor_coords, &i)) |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
413 { |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
414 printf ("Failed writing console attributes: %d\n", |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
415 GetLastError ()); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
416 fflush (stdout); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
417 } |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
418 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
419 /* Write the characters. */ |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
420 if (!WriteConsoleOutputCharacter (cur_screen, conversion_buffer, |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
421 produced, cursor_coords, &i)) |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
422 { |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
423 printf ("Failed writing console characters: %d\n", |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
424 GetLastError ()); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
425 fflush (stdout); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
426 } |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
427 } |
9907 | 428 } |
429 } | |
430 | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
431 |
9907 | 432 void |
433 delete_glyphs (int n) | |
434 { | |
435 /* delete chars means scroll chars from cursor_coords.X + n to | |
436 cursor_coords.X, anything beyond the edge of the screen should | |
437 come out empty... */ | |
438 | |
439 scroll_line (n, LEFT); | |
440 } | |
441 | |
11389 | 442 static unsigned int sound_type = 0xFFFFFFFF; |
23563
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
443 #define MB_EMACS_SILENT (0xFFFFFFFF - 1) |
11389 | 444 |
9907 | 445 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16262
diff
changeset
|
446 w32_sys_ring_bell (void) |
9907 | 447 { |
11389 | 448 if (sound_type == 0xFFFFFFFF) |
23563
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
449 { |
11389 | 450 Beep (666, 100); |
23563
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
451 } |
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
452 else if (sound_type == MB_EMACS_SILENT) |
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
453 { |
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
454 /* Do nothing. */ |
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
455 } |
11389 | 456 else |
23563
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
457 MessageBeep (sound_type); |
9907 | 458 } |
459 | |
11389 | 460 DEFUN ("set-message-beep", Fset_message_beep, Sset_message_beep, 1, 1, 0, |
461 "Set the sound generated when the bell is rung.\n\ | |
23563
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
462 SOUND is 'asterisk, 'exclamation, 'hand, 'question, 'ok, or 'silent\n\ |
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
463 to use the corresponding system sound for the bell. The 'silent sound\n\ |
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
464 prevents Emacs from making any sound at all.\n\ |
11389 | 465 SOUND is nil to use the normal beep.") |
466 (sound) | |
467 Lisp_Object sound; | |
9907 | 468 { |
11389 | 469 CHECK_SYMBOL (sound, 0); |
470 | |
471 if (NILP (sound)) | |
472 sound_type = 0xFFFFFFFF; | |
473 else if (EQ (sound, intern ("asterisk"))) | |
474 sound_type = MB_ICONASTERISK; | |
475 else if (EQ (sound, intern ("exclamation"))) | |
476 sound_type = MB_ICONEXCLAMATION; | |
477 else if (EQ (sound, intern ("hand"))) | |
478 sound_type = MB_ICONHAND; | |
479 else if (EQ (sound, intern ("question"))) | |
480 sound_type = MB_ICONQUESTION; | |
481 else if (EQ (sound, intern ("ok"))) | |
482 sound_type = MB_OK; | |
23563
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
483 else if (EQ (sound, intern ("silent"))) |
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
484 sound_type = MB_EMACS_SILENT; |
11389 | 485 else |
486 sound_type = 0xFFFFFFFF; | |
487 | |
488 return sound; | |
9907 | 489 } |
490 | |
491 void | |
492 reset_terminal_modes (void) | |
493 { | |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
494 hl_mode (0); |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
495 |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
496 #ifdef USE_SEPARATE_SCREEN |
9907 | 497 SetConsoleActiveScreenBuffer (prev_screen); |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
498 #else |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
499 SetConsoleCursorInfo (prev_screen, &prev_console_cursor); |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
500 #endif |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
501 SetConsoleMode (keyboard_handle, prev_console_mode); |
9907 | 502 } |
503 | |
504 void | |
505 set_terminal_modes (void) | |
506 { | |
507 CONSOLE_CURSOR_INFO cci; | |
508 | |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
509 hl_mode (0); |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
510 |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
511 /* make cursor big and visible (100 on Win95 makes it disappear) */ |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
512 cci.dwSize = 99; |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
513 cci.bVisible = TRUE; |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
514 (void) SetConsoleCursorInfo (cur_screen, &cci); |
9907 | 515 |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
516 SetConsoleActiveScreenBuffer (cur_screen); |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
517 |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
518 SetConsoleMode (keyboard_handle, ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT); |
9907 | 519 |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
520 /* Initialize input mode: interrupt_input off, no flow control, allow |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
521 8 bit character input, standard quit char. */ |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
522 Fset_input_mode (Qnil, Qnil, make_number (2), Qnil); |
9907 | 523 } |
524 | |
525 /* hmmm... perhaps these let us bracket screen changes so that we can flush | |
526 clumps rather than one-character-at-a-time... | |
527 | |
528 we'll start with not moving the cursor while an update is in progress. */ | |
529 void | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
530 update_begin (struct frame * f) |
9907 | 531 { |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
532 hl_mode (0); |
9907 | 533 } |
534 | |
535 void | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
536 update_end (struct frame * f) |
9907 | 537 { |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
538 hl_mode (0); |
9907 | 539 SetConsoleCursorPosition (cur_screen, cursor_coords); |
540 } | |
541 | |
542 void | |
543 set_terminal_window (int size) | |
544 { | |
545 } | |
546 | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
547 /*********************************************************************** |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
548 Faces |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
549 ***********************************************************************/ |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
550 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
551 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
552 /* Turn appearances of face FACE_ID on tty frame F on. */ |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
553 |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
554 static WORD |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
555 w32_face_attributes (f, face_id) |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
556 struct frame *f; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
557 int face_id; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
558 { |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
559 WORD char_attr; |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
560 int highlight_on_p; |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
561 struct face *face = FACE_FROM_ID (f, face_id); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
562 |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
563 highlight_on_p = hl_mode (0); |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
564 hl_mode (highlight_on_p); |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
565 |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
566 xassert (face != NULL); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
567 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
568 char_attr = char_attr_normal; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
569 |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
570 if (face->foreground != FACE_TTY_DEFAULT_FG_COLOR |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
571 && face->foreground != FACE_TTY_DEFAULT_COLOR) |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
572 char_attr = (char_attr & 0xfff0) + (face->foreground % 16); |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
573 |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
574 if (face->background != FACE_TTY_DEFAULT_BG_COLOR |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
575 && face->background != FACE_TTY_DEFAULT_COLOR) |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
576 char_attr = (char_attr & 0xff0f) + ((face->background % 16) * 16); |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
577 |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
578 |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
579 /* Ensure readability (temporary measure until this all works) */ |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
580 if (((char_attr & 0x00f0) >> 4) == (char_attr & 0x000f)) |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
581 char_attr ^= 0x0007; |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
582 |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
583 if (face->tty_reverse_p || highlight_on_p) |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
584 char_attr = (char_attr & 0xff00) + ((char_attr & 0x000f) << 4) |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
585 + ((char_attr & 0x00f0) >> 4); |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
586 |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
587 return char_attr; |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
588 } |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
589 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
590 |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
591 /* Emulation of some X window features from xfns.c and xfaces.c. */ |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
592 |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
593 extern char unspecified_fg[], unspecified_bg[]; |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
594 |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
595 |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
596 /* Given a color index, return its standard name. */ |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
597 Lisp_Object |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
598 vga_stdcolor_name (int idx) |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
599 { |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
600 /* Standard VGA colors, in the order of their standard numbering |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
601 in the default VGA palette. */ |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
602 static char *vga_colors[16] = { |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
603 "black", "blue", "green", "cyan", "red", "magenta", "brown", |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
604 "lightgray", "darkgray", "lightblue", "lightgreen", "lightcyan", |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
605 "lightred", "lightmagenta", "yellow", "white" |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
606 }; |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
607 |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
608 extern Lisp_Object Qunspecified; |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
609 |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
610 if (idx >= 0 && idx < sizeof (vga_colors) / sizeof (vga_colors[0])) |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
611 return build_string (vga_colors[idx]); |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
612 else |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
613 return Qunspecified; /* meaning the default */ |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
614 } |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
615 |
9907 | 616 typedef int (*term_hook) (); |
617 | |
618 void | |
16883
d1d4d81f9ece
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16593
diff
changeset
|
619 initialize_w32_display (void) |
9907 | 620 { |
621 CONSOLE_SCREEN_BUFFER_INFO info; | |
622 | |
21828
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
623 cursor_to_hook = move_cursor; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
624 raw_cursor_to_hook = move_cursor; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
625 clear_to_end_hook = clear_to_end; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
626 clear_frame_hook = clear_frame; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
627 clear_end_of_line_hook = clear_end_of_line; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
628 ins_del_lines_hook = ins_del_lines; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
629 change_line_highlight_hook = change_line_highlight; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
630 reassert_line_highlight_hook = reassert_line_highlight; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
631 insert_glyphs_hook = insert_glyphs; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
632 write_glyphs_hook = write_glyphs; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
633 delete_glyphs_hook = delete_glyphs; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
634 ring_bell_hook = w32_sys_ring_bell; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
635 reset_terminal_modes_hook = reset_terminal_modes; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
636 set_terminal_modes_hook = set_terminal_modes; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
637 set_terminal_window_hook = set_terminal_window; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
638 update_begin_hook = update_begin; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
639 update_end_hook = update_end; |
9907 | 640 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16262
diff
changeset
|
641 read_socket_hook = w32_console_read_socket; |
21828
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
642 mouse_position_hook = w32_console_mouse_position; |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
643 estimate_mode_line_height_hook = 0; |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
644 |
22540
0e7c65caf1cb
(initialize_w32_display): Call init_crit to initialize
Andrew Innes <andrewi@gnu.org>
parents:
21828
diff
changeset
|
645 /* Initialize interrupt_handle. */ |
0e7c65caf1cb
(initialize_w32_display): Call init_crit to initialize
Andrew Innes <andrewi@gnu.org>
parents:
21828
diff
changeset
|
646 init_crit (); |
0e7c65caf1cb
(initialize_w32_display): Call init_crit to initialize
Andrew Innes <andrewi@gnu.org>
parents:
21828
diff
changeset
|
647 |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
648 /* Remember original console settings. */ |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
649 keyboard_handle = GetStdHandle (STD_INPUT_HANDLE); |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
650 GetConsoleMode (keyboard_handle, &prev_console_mode); |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
651 |
9907 | 652 prev_screen = GetStdHandle (STD_OUTPUT_HANDLE); |
653 | |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
654 #ifdef USE_SEPARATE_SCREEN |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
655 cur_screen = CreateConsoleScreenBuffer (GENERIC_READ | GENERIC_WRITE, |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
656 0, NULL, |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
657 CONSOLE_TEXTMODE_BUFFER, |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
658 NULL); |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
659 |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
660 if (cur_screen == INVALID_HANDLE_VALUE) |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
661 { |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
662 printf ("CreateConsoleScreenBuffer failed in ResetTerm\n"); |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
663 printf ("LastError = 0x%lx\n", GetLastError ()); |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
664 fflush (stdout); |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
665 exit (0); |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
666 } |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
667 #else |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
668 cur_screen = prev_screen; |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
669 GetConsoleCursorInfo (prev_screen, &prev_console_cursor); |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
670 #endif |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
671 |
24938
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
672 /* Respect setting of LINES and COLUMNS environment variables. */ |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
673 { |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
674 char * lines = getenv("LINES"); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
675 char * columns = getenv("COLUMNS"); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
676 |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
677 if (lines != NULL && columns != NULL) |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
678 { |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
679 SMALL_RECT new_win_dims; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
680 COORD new_size; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
681 |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
682 new_size.X = atoi (columns); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
683 new_size.Y = atoi (lines); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
684 |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
685 GetConsoleScreenBufferInfo (cur_screen, &info); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
686 |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
687 /* Shrink the window first, so the buffer dimensions can be |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
688 reduced if necessary. */ |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
689 new_win_dims.Top = 0; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
690 new_win_dims.Left = 0; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
691 new_win_dims.Bottom = min (new_size.Y, info.dwSize.Y) - 1; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
692 new_win_dims.Right = min (new_size.X, info.dwSize.X) - 1; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
693 SetConsoleWindowInfo (cur_screen, TRUE, &new_win_dims); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
694 |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
695 SetConsoleScreenBufferSize (cur_screen, new_size); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
696 |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
697 /* Set the window size to match the buffer dimension. */ |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
698 new_win_dims.Top = 0; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
699 new_win_dims.Left = 0; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
700 new_win_dims.Bottom = new_size.Y - 1; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
701 new_win_dims.Right = new_size.X - 1; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
702 SetConsoleWindowInfo (cur_screen, TRUE, &new_win_dims); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
703 } |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
704 } |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
705 |
9907 | 706 GetConsoleScreenBufferInfo (cur_screen, &info); |
707 | |
708 meta_key = 1; | |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
709 char_attr_normal = info.wAttributes; |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
710 hl_mode (0); |
23572
1fa5f9f5c92e
(initialize_w32_display): Use buffer coords
Geoff Voelker <voelker@cs.washington.edu>
parents:
23563
diff
changeset
|
711 |
24938
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
712 if (w32_use_full_screen_buffer) |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
713 { |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
714 FRAME_HEIGHT (SELECTED_FRAME ()) = info.dwSize.Y; /* lines per page */ |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
715 SET_FRAME_WIDTH (SELECTED_FRAME (), info.dwSize.X); /* characters per line */ |
24938
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
716 } |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
717 else |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
718 { |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
719 /* Lines per page. Use buffer coords instead of buffer size. */ |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
720 FRAME_HEIGHT (SELECTED_FRAME ()) = 1 + info.srWindow.Bottom - |
24938
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
721 info.srWindow.Top; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
722 /* Characters per line. Use buffer coords instead of buffer size. */ |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
723 SET_FRAME_WIDTH (SELECTED_FRAME (), 1 + info.srWindow.Right - |
24938
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
724 info.srWindow.Left); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
725 } |
27892
1857b9695885
Only disable window system features for dispextern.h
Jason Rumney <jasonr@gnu.org>
parents:
27518
diff
changeset
|
726 |
1857b9695885
Only disable window system features for dispextern.h
Jason Rumney <jasonr@gnu.org>
parents:
27518
diff
changeset
|
727 /* Setup w32_display_info structure for this frame. */ |
1857b9695885
Only disable window system features for dispextern.h
Jason Rumney <jasonr@gnu.org>
parents:
27518
diff
changeset
|
728 |
1857b9695885
Only disable window system features for dispextern.h
Jason Rumney <jasonr@gnu.org>
parents:
27518
diff
changeset
|
729 w32_initialize_display_info (build_string ("Console")); |
1857b9695885
Only disable window system features for dispextern.h
Jason Rumney <jasonr@gnu.org>
parents:
27518
diff
changeset
|
730 |
9907 | 731 } |
732 | |
733 DEFUN ("set-screen-color", Fset_screen_color, Sset_screen_color, 2, 2, 0, | |
734 "Set screen colors.") | |
735 (foreground, background) | |
736 Lisp_Object foreground; | |
737 Lisp_Object background; | |
738 { | |
739 char_attr_normal = XFASTINT (foreground) + (XFASTINT (background) << 4); | |
740 | |
741 Frecenter (Qnil); | |
742 return Qt; | |
743 } | |
744 | |
745 DEFUN ("set-cursor-size", Fset_cursor_size, Sset_cursor_size, 1, 1, 0, | |
746 "Set cursor size.") | |
747 (size) | |
748 Lisp_Object size; | |
749 { | |
750 CONSOLE_CURSOR_INFO cci; | |
751 cci.dwSize = XFASTINT (size); | |
752 cci.bVisible = TRUE; | |
753 (void) SetConsoleCursorInfo (cur_screen, &cci); | |
754 | |
755 return Qt; | |
756 } | |
757 | |
13424
efbbbfd268dd
(nt_ring_bell): Renamed from ring_bell, now global.
Geoff Voelker <voelker@cs.washington.edu>
parents:
12336
diff
changeset
|
758 #ifndef HAVE_NTGUI |
9907 | 759 void |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
760 pixel_to_glyph_coords (struct frame * f, int pix_x, int pix_y, int *x, int *y, |
9907 | 761 void *bounds, int noclip) |
762 { | |
763 *x = pix_x; | |
764 *y = pix_y; | |
765 } | |
766 | |
767 void | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
768 glyph_to_pixel_coords (struct frame * f, int x, int y, int *pix_x, int *pix_y) |
9907 | 769 { |
770 *pix_x = x; | |
771 *pix_y = y; | |
772 } | |
13424
efbbbfd268dd
(nt_ring_bell): Renamed from ring_bell, now global.
Geoff Voelker <voelker@cs.washington.edu>
parents:
12336
diff
changeset
|
773 #endif /* !HAVE_NTGUI */ |
9907 | 774 |
11389 | 775 void |
9907 | 776 syms_of_ntterm () |
777 { | |
24938
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
778 DEFVAR_BOOL ("w32-use-full-screen-buffer", |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
779 &w32_use_full_screen_buffer, |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
780 "Non-nil means make terminal frames use the full screen buffer dimensions.\n\ |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
781 This is desirable when running Emacs over telnet, and is the default.\n\ |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
782 A value of nil means use the current console window dimensions; this\n\ |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
783 may be preferrable when working directly at the console with a large\n\ |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
784 scroll-back buffer."); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
785 w32_use_full_screen_buffer = 1; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
786 |
9907 | 787 defsubr (&Sset_screen_color); |
788 defsubr (&Sset_cursor_size); | |
11389 | 789 defsubr (&Sset_message_beep); |
9907 | 790 } |