annotate src/w32console.c @ 27830:99b1d31f039b

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