Mercurial > emacs
annotate src/w32console.c @ 54851:99eea8becc4f
(cua-read-only-cursor-color)
(cua-overwrite-cursor-color, cua-global-mark-cursor-color): Doc fix.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Tue, 13 Apr 2004 21:46:30 +0000 |
parents | 695cf19ef79e |
children | fa1998970a4d 375f2633d815 |
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" | |
32668
3bdd8b545352
Do not undef HAVE_WINDOW_SYSTEM before
Jason Rumney <jasonr@gnu.org>
parents:
31109
diff
changeset
|
38 #include "dispextern.h" |
3bdd8b545352
Do not undef HAVE_WINDOW_SYSTEM before
Jason Rumney <jasonr@gnu.org>
parents:
31109
diff
changeset
|
39 /* Disable features in frame.h that require a Window System. */ |
27892
1857b9695885
Only disable window system features for dispextern.h
Jason Rumney <jasonr@gnu.org>
parents:
27518
diff
changeset
|
40 #undef HAVE_WINDOW_SYSTEM |
1857b9695885
Only disable window system features for dispextern.h
Jason Rumney <jasonr@gnu.org>
parents:
27518
diff
changeset
|
41 #include "frame.h" |
16593
4ed80eda6fac
Use new names for w32 files
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
42 #include "w32inevt.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 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
|
62 static void write_glyphs (struct glyph *string, int len); |
9907 | 63 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
|
64 void w32_sys_ring_bell (void); |
9907 | 65 static void reset_terminal_modes (void); |
66 static void set_terminal_modes (void); | |
67 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
|
68 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
|
69 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
|
70 static WORD w32_face_attributes (struct frame *f, int face_id); |
9907 | 71 |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
72 static COORD cursor_coords; |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
73 static HANDLE prev_screen, cur_screen; |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
74 static WORD char_attr_normal; |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
75 static DWORD prev_console_mode; |
9907 | 76 |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
77 #ifndef USE_SEPARATE_SCREEN |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
78 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
|
79 #endif |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
80 |
24938
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
81 /* 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
|
82 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
|
83 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
|
84 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
|
85 int w32_use_full_screen_buffer; |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
86 HANDLE keyboard_handle; |
24938
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
87 |
9907 | 88 |
89 /* 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
|
90 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
|
91 Also ignore Ctrl-Break signals. */ |
617f39b43557
(ctrl_c_handler): Ignore CTRL_BREAK_EVENT signals.
Richard M. Stallman <rms@gnu.org>
parents:
12183
diff
changeset
|
92 |
9907 | 93 BOOL |
94 ctrl_c_handler (unsigned long type) | |
95 { | |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
96 /* 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
|
97 return (!noninteractive |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
98 && (type == CTRL_C_EVENT || type == CTRL_BREAK_EVENT)); |
9907 | 99 } |
100 | |
101 /* If we're updating a frame, use it as the current frame | |
102 Otherwise, use the selected frame. */ | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
103 #define PICK_FRAME() (updating_frame ? updating_frame : SELECTED_FRAME ()) |
9907 | 104 |
105 /* Move the cursor to (row, col). */ | |
106 void | |
107 move_cursor (int row, int col) | |
108 { | |
109 cursor_coords.X = col; | |
110 cursor_coords.Y = row; | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
111 |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
112 if (updating_frame == (struct frame *) NULL) |
9907 | 113 { |
114 SetConsoleCursorPosition (cur_screen, cursor_coords); | |
115 } | |
116 } | |
117 | |
118 /* Clear from cursor to end of screen. */ | |
119 void | |
120 clear_to_end (void) | |
121 { | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
122 struct frame * f = PICK_FRAME (); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
123 |
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50247
diff
changeset
|
124 clear_end_of_line (FRAME_COLS (f) - 1); |
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50247
diff
changeset
|
125 ins_del_lines (cursor_coords.Y, FRAME_LINES (f) - cursor_coords.Y - 1); |
9907 | 126 } |
127 | |
128 /* Clear the frame. */ | |
129 void | |
130 clear_frame (void) | |
131 { | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
132 struct frame * f = PICK_FRAME (); |
9907 | 133 COORD dest; |
31109 | 134 int n; |
135 DWORD r; | |
24755
3bb855a40bf6
(clear_frame): Remember that the window width might
Andrew Innes <andrewi@gnu.org>
parents:
23572
diff
changeset
|
136 CONSOLE_SCREEN_BUFFER_INFO info; |
3bb855a40bf6
(clear_frame): Remember that the window width might
Andrew Innes <andrewi@gnu.org>
parents:
23572
diff
changeset
|
137 |
3bb855a40bf6
(clear_frame): Remember that the window width might
Andrew Innes <andrewi@gnu.org>
parents:
23572
diff
changeset
|
138 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
|
139 |
24755
3bb855a40bf6
(clear_frame): Remember that the window width might
Andrew Innes <andrewi@gnu.org>
parents:
23572
diff
changeset
|
140 /* Remember that the screen buffer might be wider than the window. */ |
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50247
diff
changeset
|
141 n = FRAME_LINES (f) * info.dwSize.X; |
14244
493cff4d5960
(clear_frame): Use FillConsoleOutput* calls instead of
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
142 dest.X = dest.Y = 0; |
493cff4d5960
(clear_frame): Use FillConsoleOutput* calls instead of
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
143 |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
144 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
|
145 FillConsoleOutputCharacter (cur_screen, ' ', n, dest, &r); |
493cff4d5960
(clear_frame): Use FillConsoleOutput* calls instead of
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
146 |
9907 | 147 move_cursor (0, 0); |
148 } | |
149 | |
150 | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
151 static struct glyph glyph_base[256]; |
9907 | 152 static BOOL ceol_initialized = FALSE; |
153 | |
154 /* Clear from Cursor to end (what's "standout marker"?). */ | |
155 void | |
156 clear_end_of_line (int end) | |
157 { | |
158 if (!ceol_initialized) | |
159 { | |
160 int i; | |
161 for (i = 0; i < 256; i++) | |
162 { | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
163 memcpy (&glyph_base[i], &space_glyph, sizeof (struct glyph)); |
9907 | 164 } |
165 ceol_initialized = TRUE; | |
166 } | |
167 write_glyphs (glyph_base, end - cursor_coords.X); /* fencepost ? */ | |
168 } | |
169 | |
170 /* Insert n lines at vpos. if n is negative delete -n lines. */ | |
171 void | |
172 ins_del_lines (int vpos, int n) | |
173 { | |
40079
e62d3694acdc
(reassert_line_highlight, change_line_highlight): Functions removed.
Miles Bader <miles@gnu.org>
parents:
39682
diff
changeset
|
174 int i, nb; |
9907 | 175 SMALL_RECT scroll; |
176 COORD dest; | |
177 CHAR_INFO fill; | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
178 struct frame * f = PICK_FRAME (); |
9907 | 179 |
180 if (n < 0) | |
181 { | |
182 scroll.Top = vpos - n; | |
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50247
diff
changeset
|
183 scroll.Bottom = FRAME_LINES (f); |
9907 | 184 dest.Y = vpos; |
185 } | |
186 else | |
187 { | |
188 scroll.Top = vpos; | |
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50247
diff
changeset
|
189 scroll.Bottom = FRAME_LINES (f) - n; |
9907 | 190 dest.Y = vpos + n; |
191 } | |
192 scroll.Left = 0; | |
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50247
diff
changeset
|
193 scroll.Right = FRAME_COLS (f); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
194 |
9907 | 195 dest.X = 0; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
196 |
9907 | 197 fill.Char.AsciiChar = 0x20; |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
198 fill.Attributes = char_attr_normal; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
199 |
9907 | 200 ScrollConsoleScreenBuffer (cur_screen, &scroll, NULL, dest, &fill); |
201 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16262
diff
changeset
|
202 /* Here we have to deal with a w32 console flake: If the scroll |
9907 | 203 region looks like abc and we scroll c to a and fill with d we get |
204 cbd... if we scroll block c one line at a time to a, we get cdd... | |
205 Emacs expects cdd consistently... So we have to deal with that | |
206 here... (this also occurs scrolling the same way in the other | |
207 direction. */ | |
208 | |
209 if (n > 0) | |
210 { | |
211 if (scroll.Bottom < dest.Y) | |
212 { | |
213 for (i = scroll.Bottom; i < dest.Y; i++) | |
214 { | |
215 move_cursor (i, 0); | |
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50247
diff
changeset
|
216 clear_end_of_line (FRAME_COLS (f)); |
9907 | 217 } |
218 } | |
219 } | |
220 else | |
221 { | |
222 nb = dest.Y + (scroll.Bottom - scroll.Top) + 1; | |
223 | |
224 if (nb < scroll.Top) | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
225 { |
9907 | 226 for (i = nb; i < scroll.Top; i++) |
227 { | |
228 move_cursor (i, 0); | |
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50247
diff
changeset
|
229 clear_end_of_line (FRAME_COLS (f)); |
9907 | 230 } |
231 } | |
232 } | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
233 |
9907 | 234 cursor_coords.X = 0; |
235 cursor_coords.Y = vpos; | |
236 } | |
237 | |
238 #undef LEFT | |
239 #undef RIGHT | |
240 #define LEFT 1 | |
241 #define RIGHT 0 | |
242 | |
243 void | |
244 scroll_line (int dist, int direction) | |
245 { | |
246 /* The idea here is to implement a horizontal scroll in one line to | |
247 implement delete and half of insert. */ | |
248 SMALL_RECT scroll; | |
249 COORD dest; | |
250 CHAR_INFO fill; | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
251 struct frame * f = PICK_FRAME (); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
252 |
9907 | 253 scroll.Top = cursor_coords.Y; |
254 scroll.Bottom = cursor_coords.Y; | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
255 |
9907 | 256 if (direction == LEFT) |
257 { | |
258 scroll.Left = cursor_coords.X + dist; | |
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50247
diff
changeset
|
259 scroll.Right = FRAME_COLS (f) - 1; |
9907 | 260 } |
261 else | |
262 { | |
263 scroll.Left = cursor_coords.X; | |
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50247
diff
changeset
|
264 scroll.Right = FRAME_COLS (f) - dist - 1; |
9907 | 265 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
266 |
9907 | 267 dest.X = cursor_coords.X; |
268 dest.Y = cursor_coords.Y; | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
269 |
9907 | 270 fill.Char.AsciiChar = 0x20; |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
271 fill.Attributes = char_attr_normal; |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
272 |
9907 | 273 ScrollConsoleScreenBuffer (cur_screen, &scroll, NULL, dest, &fill); |
274 } | |
275 | |
276 | |
277 /* If start is zero insert blanks instead of a string at start ?. */ | |
278 void | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
279 insert_glyphs (register struct glyph *start, register int len) |
9907 | 280 { |
281 scroll_line (len, RIGHT); | |
282 | |
283 /* Move len chars to the right starting at cursor_coords, fill with blanks */ | |
284 if (start) | |
285 { | |
286 /* Print the first len characters of start, cursor_coords.X adjusted | |
287 by write_glyphs. */ | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
288 |
9907 | 289 write_glyphs (start, len); |
290 } | |
291 else | |
292 { | |
293 clear_end_of_line (cursor_coords.X + len); | |
294 } | |
295 } | |
296 | |
297 void | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
298 write_glyphs (register struct glyph *string, register int len) |
9907 | 299 { |
31109 | 300 int produced, consumed; |
301 DWORD r; | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
302 struct frame * f = PICK_FRAME (); |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
303 WORD char_attr; |
30837
b6b7264277b5
(write_glyphs): Use a locally declared conversion_buffer.
Kenichi Handa <handa@m17n.org>
parents:
29316
diff
changeset
|
304 unsigned char conversion_buffer[1024]; |
b6b7264277b5
(write_glyphs): Use a locally declared conversion_buffer.
Kenichi Handa <handa@m17n.org>
parents:
29316
diff
changeset
|
305 int conversion_buffer_size = sizeof conversion_buffer; |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
306 |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
307 if (len <= 0) |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
308 return; |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
309 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
310 /* 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
|
311 the tail. */ |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
312 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
|
313 |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
314 while (len > 0) |
9907 | 315 { |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
316 /* 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
|
317 int face_id = string->face_id; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
318 int n; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
319 |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
320 for (n = 1; n < len; ++n) |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
321 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
|
322 break; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
323 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
324 /* 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
|
325 char_attr = w32_face_attributes (f, face_id); |
9907 | 326 |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
327 while (n > 0) |
9907 | 328 { |
30837
b6b7264277b5
(write_glyphs): Use a locally declared conversion_buffer.
Kenichi Handa <handa@m17n.org>
parents:
29316
diff
changeset
|
329 /* We use a fixed size (1024 bytes) of conversion buffer. |
b6b7264277b5
(write_glyphs): Use a locally declared conversion_buffer.
Kenichi Handa <handa@m17n.org>
parents:
29316
diff
changeset
|
330 Usually it is sufficient, but if not, we just repeat the |
b6b7264277b5
(write_glyphs): Use a locally declared conversion_buffer.
Kenichi Handa <handa@m17n.org>
parents:
29316
diff
changeset
|
331 loop. */ |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
332 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
|
333 n, conversion_buffer_size, |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
334 &consumed); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
335 if (produced > 0) |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
336 { |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
337 /* Set the attribute for these characters. */ |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
338 if (!FillConsoleOutputAttribute (cur_screen, char_attr, |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
339 produced, cursor_coords, &r)) |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
340 { |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
341 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
|
342 GetLastError ()); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
343 fflush (stdout); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
344 } |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
345 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
346 /* Write the characters. */ |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
347 if (!WriteConsoleOutputCharacter (cur_screen, conversion_buffer, |
31109 | 348 produced, cursor_coords, &r)) |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
349 { |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
350 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
|
351 GetLastError ()); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
352 fflush (stdout); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
353 } |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
354 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
355 cursor_coords.X += produced; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
356 move_cursor (cursor_coords.Y, cursor_coords.X); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
357 } |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
358 len -= consumed; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
359 n -= consumed; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
360 string += consumed; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
361 } |
9907 | 362 } |
363 | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
364 /* 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
|
365 if (CODING_REQUIRE_FLUSHING (&terminal_coding)) |
9907 | 366 { |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
367 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
|
368 encode_coding (&terminal_coding, "", conversion_buffer, |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
369 0, conversion_buffer_size); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
370 if (terminal_coding.produced > 0) |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
371 { |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
372 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
|
373 terminal_coding.produced, |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
374 cursor_coords, &r)) |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
375 { |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
376 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
|
377 GetLastError ()); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
378 fflush (stdout); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
379 } |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
380 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
381 /* Write the characters. */ |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
382 if (!WriteConsoleOutputCharacter (cur_screen, conversion_buffer, |
31109 | 383 produced, cursor_coords, &r)) |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
384 { |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
385 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
|
386 GetLastError ()); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
387 fflush (stdout); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
388 } |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
389 } |
9907 | 390 } |
391 } | |
392 | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
393 |
9907 | 394 void |
395 delete_glyphs (int n) | |
396 { | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
397 /* delete chars means scroll chars from cursor_coords.X + n to |
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
398 cursor_coords.X, anything beyond the edge of the screen should |
9907 | 399 come out empty... */ |
400 | |
401 scroll_line (n, LEFT); | |
402 } | |
403 | |
11389 | 404 static unsigned int sound_type = 0xFFFFFFFF; |
23563
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
405 #define MB_EMACS_SILENT (0xFFFFFFFF - 1) |
11389 | 406 |
9907 | 407 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16262
diff
changeset
|
408 w32_sys_ring_bell (void) |
9907 | 409 { |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
410 if (sound_type == 0xFFFFFFFF) |
23563
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
411 { |
11389 | 412 Beep (666, 100); |
23563
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
413 } |
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
414 else if (sound_type == MB_EMACS_SILENT) |
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
415 { |
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
416 /* Do nothing. */ |
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
417 } |
11389 | 418 else |
23563
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
419 MessageBeep (sound_type); |
9907 | 420 } |
421 | |
11389 | 422 DEFUN ("set-message-beep", Fset_message_beep, Sset_message_beep, 1, 1, 0, |
40962
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
423 doc: /* Set the sound generated when the bell is rung. |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
424 SOUND is 'asterisk, 'exclamation, 'hand, 'question, 'ok, or 'silent |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
425 to use the corresponding system sound for the bell. The 'silent sound |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
426 prevents Emacs from making any sound at all. |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
427 SOUND is nil to use the normal beep. */) |
11389 | 428 (sound) |
429 Lisp_Object sound; | |
9907 | 430 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40079
diff
changeset
|
431 CHECK_SYMBOL (sound); |
11389 | 432 |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
433 if (NILP (sound)) |
11389 | 434 sound_type = 0xFFFFFFFF; |
435 else if (EQ (sound, intern ("asterisk"))) | |
436 sound_type = MB_ICONASTERISK; | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
437 else if (EQ (sound, intern ("exclamation"))) |
11389 | 438 sound_type = MB_ICONEXCLAMATION; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
439 else if (EQ (sound, intern ("hand"))) |
11389 | 440 sound_type = MB_ICONHAND; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
441 else if (EQ (sound, intern ("question"))) |
11389 | 442 sound_type = MB_ICONQUESTION; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
443 else if (EQ (sound, intern ("ok"))) |
11389 | 444 sound_type = MB_OK; |
23563
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
445 else if (EQ (sound, intern ("silent"))) |
18c5f58b70b5
(Fset_message_beep): Recognize 'silent.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22540
diff
changeset
|
446 sound_type = MB_EMACS_SILENT; |
11389 | 447 else |
448 sound_type = 0xFFFFFFFF; | |
449 | |
450 return sound; | |
9907 | 451 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
452 |
9907 | 453 void |
454 reset_terminal_modes (void) | |
455 { | |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
456 #ifdef USE_SEPARATE_SCREEN |
9907 | 457 SetConsoleActiveScreenBuffer (prev_screen); |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
458 #else |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
459 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
|
460 #endif |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
461 SetConsoleMode (keyboard_handle, prev_console_mode); |
9907 | 462 } |
463 | |
464 void | |
465 set_terminal_modes (void) | |
466 { | |
467 CONSOLE_CURSOR_INFO cci; | |
468 | |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
469 /* 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
|
470 cci.dwSize = 99; |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
471 cci.bVisible = TRUE; |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
472 (void) SetConsoleCursorInfo (cur_screen, &cci); |
9907 | 473 |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
474 SetConsoleActiveScreenBuffer (cur_screen); |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
475 |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
476 SetConsoleMode (keyboard_handle, ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT); |
9907 | 477 |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
478 /* 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
|
479 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
|
480 Fset_input_mode (Qnil, Qnil, make_number (2), Qnil); |
9907 | 481 } |
482 | |
483 /* hmmm... perhaps these let us bracket screen changes so that we can flush | |
484 clumps rather than one-character-at-a-time... | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
485 |
9907 | 486 we'll start with not moving the cursor while an update is in progress. */ |
487 void | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
488 update_begin (struct frame * f) |
9907 | 489 { |
490 } | |
491 | |
492 void | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
493 update_end (struct frame * f) |
9907 | 494 { |
495 SetConsoleCursorPosition (cur_screen, cursor_coords); | |
496 } | |
497 | |
498 void | |
499 set_terminal_window (int size) | |
500 { | |
501 } | |
502 | |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
503 /*********************************************************************** |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
504 Faces |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
505 ***********************************************************************/ |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
506 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
507 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
508 /* 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
|
509 |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
510 static WORD |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
511 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
|
512 struct frame *f; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
513 int face_id; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
514 { |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
515 WORD char_attr; |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
516 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
|
517 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
518 xassert (face != NULL); |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
519 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
520 char_attr = char_attr_normal; |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
521 |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
522 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
|
523 && face->foreground != FACE_TTY_DEFAULT_COLOR) |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
524 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
|
525 |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
526 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
|
527 && face->background != FACE_TTY_DEFAULT_COLOR) |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
528 char_attr = (char_attr & 0xff0f) + ((face->background % 16) << 4); |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
529 |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
530 |
32668
3bdd8b545352
Do not undef HAVE_WINDOW_SYSTEM before
Jason Rumney <jasonr@gnu.org>
parents:
31109
diff
changeset
|
531 /* NTEMACS_TODO: Faces defined during startup get both foreground |
3bdd8b545352
Do not undef HAVE_WINDOW_SYSTEM before
Jason Rumney <jasonr@gnu.org>
parents:
31109
diff
changeset
|
532 and background of 0. Need a better way around this - for now detect |
3bdd8b545352
Do not undef HAVE_WINDOW_SYSTEM before
Jason Rumney <jasonr@gnu.org>
parents:
31109
diff
changeset
|
533 the problem and invert one of the faces to make the text readable. */ |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
534 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
|
535 char_attr ^= 0x0007; |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
536 |
40079
e62d3694acdc
(reassert_line_highlight, change_line_highlight): Functions removed.
Miles Bader <miles@gnu.org>
parents:
39682
diff
changeset
|
537 if (face->tty_reverse_p) |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
538 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
|
539 + ((char_attr & 0x00f0) >> 4); |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
540 |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
541 return char_attr; |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
542 } |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
543 |
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
544 |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
545 /* 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
|
546 |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
547 extern char unspecified_fg[], unspecified_bg[]; |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
548 |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
549 |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
550 /* 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
|
551 Lisp_Object |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
552 vga_stdcolor_name (int idx) |
27395
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 /* 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
|
555 in the default VGA palette. */ |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
556 static char *vga_colors[16] = { |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
557 "black", "blue", "green", "cyan", "red", "magenta", "brown", |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
558 "lightgray", "darkgray", "lightblue", "lightgreen", "lightcyan", |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
559 "lightred", "lightmagenta", "yellow", "white" |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
560 }; |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
561 |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
562 extern Lisp_Object Qunspecified; |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
563 |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
564 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
|
565 return build_string (vga_colors[idx]); |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
566 else |
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
567 return Qunspecified; /* meaning the default */ |
27395
fe54558f20d8
(turn_on_face, turn_off_face): New functions.
Jason Rumney <jasonr@gnu.org>
parents:
24938
diff
changeset
|
568 } |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
569 |
9907 | 570 typedef int (*term_hook) (); |
571 | |
572 void | |
16883
d1d4d81f9ece
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16593
diff
changeset
|
573 initialize_w32_display (void) |
9907 | 574 { |
575 CONSOLE_SCREEN_BUFFER_INFO info; | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
576 |
21828
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
577 cursor_to_hook = move_cursor; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
578 raw_cursor_to_hook = move_cursor; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
579 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
|
580 clear_frame_hook = clear_frame; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
581 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
|
582 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
|
583 insert_glyphs_hook = insert_glyphs; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
584 write_glyphs_hook = write_glyphs; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
585 delete_glyphs_hook = delete_glyphs; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
586 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
|
587 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
|
588 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
|
589 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
|
590 update_begin_hook = update_begin; |
7e3f21132df4
(initialize_w32_displayed): Use new function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19706
diff
changeset
|
591 update_end_hook = update_end; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
592 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16262
diff
changeset
|
593 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
|
594 mouse_position_hook = w32_console_mouse_position; |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
595 |
22540
0e7c65caf1cb
(initialize_w32_display): Call init_crit to initialize
Andrew Innes <andrewi@gnu.org>
parents:
21828
diff
changeset
|
596 /* Initialize interrupt_handle. */ |
0e7c65caf1cb
(initialize_w32_display): Call init_crit to initialize
Andrew Innes <andrewi@gnu.org>
parents:
21828
diff
changeset
|
597 init_crit (); |
0e7c65caf1cb
(initialize_w32_display): Call init_crit to initialize
Andrew Innes <andrewi@gnu.org>
parents:
21828
diff
changeset
|
598 |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
599 /* Remember original console settings. */ |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
600 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
|
601 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
|
602 |
9907 | 603 prev_screen = GetStdHandle (STD_OUTPUT_HANDLE); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
604 |
19706
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
605 #ifdef USE_SEPARATE_SCREEN |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
606 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
|
607 0, NULL, |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
608 CONSOLE_TEXTMODE_BUFFER, |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
609 NULL); |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
610 |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
611 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
|
612 { |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
613 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
|
614 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
|
615 fflush (stdout); |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
616 exit (0); |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
617 } |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
618 #else |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
619 cur_screen = prev_screen; |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
620 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
|
621 #endif |
e21b63afe61f
(DebPrint, reset_kbd, unset_kbd, take_console): Delete functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
622 |
24938
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
623 /* 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
|
624 { |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
625 char * lines = getenv("LINES"); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
626 char * columns = getenv("COLUMNS"); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
627 |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
628 if (lines != NULL && columns != NULL) |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
629 { |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
630 SMALL_RECT new_win_dims; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
631 COORD new_size; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
632 |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
633 new_size.X = atoi (columns); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
634 new_size.Y = atoi (lines); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
635 |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
636 GetConsoleScreenBufferInfo (cur_screen, &info); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
637 |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
638 /* 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
|
639 reduced if necessary. */ |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
640 new_win_dims.Top = 0; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
641 new_win_dims.Left = 0; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
642 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
|
643 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
|
644 SetConsoleWindowInfo (cur_screen, TRUE, &new_win_dims); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
645 |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
646 SetConsoleScreenBufferSize (cur_screen, new_size); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
647 |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
648 /* 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
|
649 new_win_dims.Top = 0; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
650 new_win_dims.Left = 0; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
651 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
|
652 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
|
653 SetConsoleWindowInfo (cur_screen, TRUE, &new_win_dims); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
654 } |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
655 } |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
656 |
9907 | 657 GetConsoleScreenBufferInfo (cur_screen, &info); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
658 |
9907 | 659 meta_key = 1; |
27518
ff2e0205b5a0
(turn_on_face, turn_off_face): Removed.
Jason Rumney <jasonr@gnu.org>
parents:
27395
diff
changeset
|
660 char_attr_normal = info.wAttributes; |
23572
1fa5f9f5c92e
(initialize_w32_display): Use buffer coords
Geoff Voelker <voelker@cs.washington.edu>
parents:
23563
diff
changeset
|
661 |
24938
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
662 if (w32_use_full_screen_buffer) |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
663 { |
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50247
diff
changeset
|
664 FRAME_LINES (SELECTED_FRAME ()) = info.dwSize.Y; /* lines per page */ |
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50247
diff
changeset
|
665 SET_FRAME_COLS (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
|
666 } |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
667 else |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
668 { |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
669 /* Lines per page. Use buffer coords instead of buffer size. */ |
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50247
diff
changeset
|
670 FRAME_LINES (SELECTED_FRAME ()) = 1 + info.srWindow.Bottom - |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
671 info.srWindow.Top; |
24938
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
672 /* Characters per line. Use buffer coords instead of buffer size. */ |
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50247
diff
changeset
|
673 SET_FRAME_COLS (SELECTED_FRAME (), 1 + info.srWindow.Right - |
24938
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
674 info.srWindow.Left); |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
675 } |
27892
1857b9695885
Only disable window system features for dispextern.h
Jason Rumney <jasonr@gnu.org>
parents:
27518
diff
changeset
|
676 |
1857b9695885
Only disable window system features for dispextern.h
Jason Rumney <jasonr@gnu.org>
parents:
27518
diff
changeset
|
677 /* 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
|
678 |
1857b9695885
Only disable window system features for dispextern.h
Jason Rumney <jasonr@gnu.org>
parents:
27518
diff
changeset
|
679 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
|
680 |
9907 | 681 } |
682 | |
683 DEFUN ("set-screen-color", Fset_screen_color, Sset_screen_color, 2, 2, 0, | |
40962
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
684 doc: /* Set screen colors. */) |
9907 | 685 (foreground, background) |
686 Lisp_Object foreground; | |
687 Lisp_Object background; | |
688 { | |
689 char_attr_normal = XFASTINT (foreground) + (XFASTINT (background) << 4); | |
690 | |
691 Frecenter (Qnil); | |
692 return Qt; | |
693 } | |
694 | |
695 DEFUN ("set-cursor-size", Fset_cursor_size, Sset_cursor_size, 1, 1, 0, | |
40962
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
696 doc: /* Set cursor size. */) |
9907 | 697 (size) |
698 Lisp_Object size; | |
699 { | |
700 CONSOLE_CURSOR_INFO cci; | |
701 cci.dwSize = XFASTINT (size); | |
702 cci.bVisible = TRUE; | |
703 (void) SetConsoleCursorInfo (cur_screen, &cci); | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
40962
diff
changeset
|
704 |
9907 | 705 return Qt; |
706 } | |
707 | |
11389 | 708 void |
9907 | 709 syms_of_ntterm () |
710 { | |
24938
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
711 DEFVAR_BOOL ("w32-use-full-screen-buffer", |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
712 &w32_use_full_screen_buffer, |
40962
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
713 doc: /* Non-nil means make terminal frames use the full screen buffer dimensions. |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
714 This is desirable when running Emacs over telnet, and is the default. |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
715 A value of nil means use the current console window dimensions; this |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
716 may be preferrable when working directly at the console with a large |
f66d09d1bb2f
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
717 scroll-back buffer. */); |
24938
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
718 w32_use_full_screen_buffer = 1; |
a4c871b96d4b
(w32_use_full_screen_buffer): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24755
diff
changeset
|
719 |
9907 | 720 defsubr (&Sset_screen_color); |
721 defsubr (&Sset_cursor_size); | |
11389 | 722 defsubr (&Sset_message_beep); |
9907 | 723 } |
52401 | 724 |
725 /* arch-tag: a390a07f-f661-42bc-aeb4-e6d8bf860337 | |
726 (do not change this comment) */ |