Remove the highlighting support for quoting 'like this' inside Lisp docstrings
[emacs.git] / src / termhooks.h
blobc183528ee84320a03cc74d4b647b7f5fe2726f10
1 /* Parameters and display hooks for terminal devices.
3 Copyright (C) 1985-1986, 1993-1994, 2001-2016 Free Software Foundation,
4 Inc.
6 This file is part of GNU Emacs.
8 GNU Emacs is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 GNU Emacs is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 #ifndef EMACS_TERMHOOKS_H
22 #define EMACS_TERMHOOKS_H
24 /* Miscellanea. */
26 #include "lisp.h"
27 #include "systime.h" /* for Time */
29 struct glyph;
31 INLINE_HEADER_BEGIN
33 enum scroll_bar_part {
34 scroll_bar_nowhere,
35 scroll_bar_above_handle,
36 scroll_bar_handle,
37 scroll_bar_below_handle,
38 scroll_bar_up_arrow,
39 scroll_bar_down_arrow,
40 scroll_bar_to_top,
41 scroll_bar_to_bottom,
42 scroll_bar_end_scroll,
43 scroll_bar_move_ratio,
44 scroll_bar_before_handle,
45 scroll_bar_horizontal_handle,
46 scroll_bar_after_handle,
47 scroll_bar_left_arrow,
48 scroll_bar_right_arrow,
49 scroll_bar_to_leftmost,
50 scroll_bar_to_rightmost
53 /* Output method of a terminal (and frames on this terminal, respectively). */
55 enum output_method
57 output_initial,
58 output_termcap,
59 output_x_window,
60 output_msdos_raw,
61 output_w32,
62 output_ns
65 /* Input queue declarations and hooks. */
67 enum event_kind
69 NO_EVENT, /* nothing happened. This should never
70 actually appear in the event queue. */
72 ASCII_KEYSTROKE_EVENT, /* The ASCII code is in .code, perhaps
73 with modifiers applied.
74 .modifiers holds the state of the
75 modifier keys.
76 .frame_or_window is the frame in
77 which the key was typed.
78 .timestamp gives a timestamp (in
79 milliseconds) for the keystroke. */
80 MULTIBYTE_CHAR_KEYSTROKE_EVENT, /* The multibyte char code is in .code,
81 perhaps with modifiers applied.
82 The others are the same as
83 ASCII_KEYSTROKE_EVENT. */
84 NON_ASCII_KEYSTROKE_EVENT, /* .code is a number identifying the
85 function key. A code N represents
86 a key whose name is
87 function_key_names[N]; function_key_names
88 is a table in keyboard.c to which you
89 should feel free to add missing keys.
90 .modifiers holds the state of the
91 modifier keys.
92 .frame_or_window is the frame in
93 which the key was typed.
94 .timestamp gives a timestamp (in
95 milliseconds) for the keystroke. */
96 TIMER_EVENT, /* A timer fired. */
97 MOUSE_CLICK_EVENT, /* The button number is in .code; it must
98 be >= 0 and < NUM_MOUSE_BUTTONS, defined
99 below.
100 .modifiers holds the state of the
101 modifier keys.
102 .x and .y give the mouse position,
103 in characters, within the window.
104 .frame_or_window gives the frame
105 the mouse click occurred in.
106 .timestamp gives a timestamp (in
107 milliseconds) for the click. */
108 WHEEL_EVENT, /* A wheel event is generated by a
109 wheel on a mouse (e.g., MS
110 Intellimouse).
111 .modifiers holds the rotate
112 direction (up or down), and the
113 state of the modifier keys.
114 .x and .y give the mouse position,
115 in characters, within the window.
116 .frame_or_window gives the frame
117 the wheel event occurred in.
118 .timestamp gives a timestamp (in
119 milliseconds) for the event. */
120 HORIZ_WHEEL_EVENT, /* A wheel event generated by a second
121 horizontal wheel that is present on some
122 mice. See WHEEL_EVENT. */
123 #ifdef HAVE_NTGUI
124 LANGUAGE_CHANGE_EVENT, /* A LANGUAGE_CHANGE_EVENT is
125 generated when HAVE_NTGUI or on Mac OS
126 when the keyboard layout or input
127 language is changed by the
128 user. */
129 #endif
130 SCROLL_BAR_CLICK_EVENT, /* .code gives the number of the mouse button
131 that was clicked.
132 .modifiers holds the state of the modifier
133 keys.
134 .part is a lisp symbol indicating which
135 part of the scroll bar got clicked.
136 .x gives the distance from the start of the
137 scroll bar of the click; .y gives the total
138 length of the scroll bar.
139 .frame_or_window gives the window
140 whose scroll bar was clicked in.
141 .timestamp gives a timestamp (in
142 milliseconds) for the click. */
143 HORIZONTAL_SCROLL_BAR_CLICK_EVENT, /* .code gives the number of the mouse button
144 that was clicked.
145 .modifiers holds the state of the modifier
146 keys.
147 .part is a lisp symbol indicating which
148 part of the scroll bar got clicked.
149 .x gives the distance from the start of the
150 scroll bar of the click; .y gives the total
151 length of the scroll bar.
152 .frame_or_window gives the window
153 whose scroll bar was clicked in.
154 .timestamp gives a timestamp (in
155 milliseconds) for the click. */
156 SELECTION_REQUEST_EVENT, /* Another X client wants a selection from us.
157 See `struct selection_input_event'. */
158 SELECTION_CLEAR_EVENT, /* Another X client cleared our selection. */
159 BUFFER_SWITCH_EVENT, /* A process filter has switched buffers. */
160 DELETE_WINDOW_EVENT, /* An X client said "delete this window". */
161 MENU_BAR_EVENT, /* An event generated by the menu bar.
162 The frame_or_window field's cdr holds the
163 Lisp-level event value.
164 (Only the toolkit version uses these.) */
165 ICONIFY_EVENT, /* An X client iconified this window. */
166 DEICONIFY_EVENT, /* An X client deiconified this window. */
167 MENU_BAR_ACTIVATE_EVENT, /* A button press in the menu bar
168 (toolkit version only). */
169 DRAG_N_DROP_EVENT, /* A drag-n-drop event is generated when
170 files selected outside of Emacs are dropped
171 onto an Emacs window.
172 .modifiers holds the state of the
173 modifier keys.
174 .x and .y give the mouse position,
175 in characters, within the window.
176 .frame_or_window is the frame in
177 which the drop was made.
178 .arg is a platform-dependent
179 representation of the dropped items.
180 .timestamp gives a timestamp (in
181 milliseconds) for the click. */
182 USER_SIGNAL_EVENT, /* A user signal.
183 code is a number identifying it,
184 index into lispy_user_signals. */
186 /* Help events. Member `frame_or_window' of the input_event is the
187 frame on which the event occurred, and member `arg' contains
188 the help to show. */
189 HELP_EVENT,
191 /* An event from a tool-bar. Member `arg' of the input event
192 contains the tool-bar item selected. If `frame_or_window'
193 and `arg' are equal, this is a prefix event. */
194 TOOL_BAR_EVENT,
196 /* Queued from XTread_socket on FocusIn events. Translated into
197 `switch-frame' events in kbd_buffer_get_event, if necessary. */
198 FOCUS_IN_EVENT,
200 FOCUS_OUT_EVENT,
202 /* Generated when mouse moves over window not currently selected. */
203 SELECT_WINDOW_EVENT,
205 /* Queued from XTread_socket when session manager sends
206 save yourself before shutdown. */
207 SAVE_SESSION_EVENT
209 #ifdef HAVE_GPM
210 , GPM_CLICK_EVENT
211 #endif
213 #ifdef HAVE_DBUS
214 , DBUS_EVENT
215 #endif
217 , CONFIG_CHANGED_EVENT
219 #ifdef HAVE_NTGUI
220 /* Generated when an APPCOMMAND event is received, in response to
221 Multimedia or Internet buttons on some keyboards.
222 Such keys are available as normal function keys on X through the
223 Xkeyboard extension.
224 On Windows, some of them get mapped to normal function key events,
225 but others need to be handled by APPCOMMAND. Handling them all as
226 APPCOMMAND events means they can be disabled
227 (w32-pass-multimedia-buttons-to-system), important on Windows since
228 the system never sees these keys if Emacs claims to handle them.
229 On X, the window manager seems to grab the keys it wants
230 first, so this is not a problem there. */
231 , MULTIMEDIA_KEY_EVENT
232 #endif
234 #ifdef HAVE_NS
235 /* Generated when native multi-keystroke input method is used to modify
236 tentative or indicative text display. */
237 , NS_TEXT_EVENT
238 /* Non-key system events (e.g. application menu events) */
239 , NS_NONKEY_EVENT
240 #endif
242 #ifdef HAVE_XWIDGETS
243 /* events generated by xwidgets*/
244 , XWIDGET_EVENT
245 #endif
247 #ifdef USE_FILE_NOTIFY
248 /* File or directory was changed. */
249 , FILE_NOTIFY_EVENT
250 #endif
254 /* Bit width of an enum event_kind tag at the start of structs and unions. */
255 enum { EVENT_KIND_WIDTH = 16 };
257 /* If a struct input_event has a kind which is SELECTION_REQUEST_EVENT
258 or SELECTION_CLEAR_EVENT, then its contents are really described
259 by `struct selection_input_event'; see xterm.h. */
261 /* The keyboard input buffer is an array of these structures. Each one
262 represents some sort of input event - a keystroke, a mouse click, or
263 a window system event. These get turned into their lispy forms when
264 they are removed from the event queue. */
266 struct input_event
268 /* What kind of event was this? */
269 ENUM_BF (event_kind) kind : EVENT_KIND_WIDTH;
271 /* Used in scroll back click events. */
272 ENUM_BF (scroll_bar_part) part : 16;
274 /* For an ASCII_KEYSTROKE_EVENT and MULTIBYTE_CHAR_KEYSTROKE_EVENT,
275 this is the character.
276 For a NON_ASCII_KEYSTROKE_EVENT, this is the keysym code.
277 For a mouse event, this is the button number. */
278 unsigned code;
280 /* See enum below for interpretation. */
281 unsigned modifiers;
283 /* One would prefer C integers, but HELP_EVENT uses these to
284 record frame or window object and a help form, respectively. */
285 Lisp_Object x, y;
287 /* Usually a time as reported by window system-specific event loop.
288 For a HELP_EVENT, this is the position within the object (stored
289 in ARG below) where the help was found. */
290 Time timestamp;
292 /* This field is copied into a vector while the event is in
293 the queue, so that garbage collections won't kill it. */
294 Lisp_Object frame_or_window;
296 /* This additional argument is used in attempt to avoid extra consing
297 when building events. Unfortunately some events have to pass much
298 more data than it's reasonable to pack directly into this structure. */
299 Lisp_Object arg;
302 #define EVENT_INIT(event) memset (&(event), 0, sizeof (struct input_event))
304 /* Bits in the modifiers member of the input_event structure.
305 Note that reorder_modifiers assumes that the bits are in canonical
306 order.
308 The modifiers applied to mouse clicks are rather ornate. The
309 window-system-specific code should store mouse clicks with
310 up_modifier or down_modifier set. Having an explicit down modifier
311 simplifies some of window-system-independent code; without it, the
312 code would have to recognize down events by checking if the event
313 is a mouse click lacking the click and drag modifiers.
315 The window-system independent code turns all up_modifier events
316 bits into drag_modifier, click_modifier, double_modifier, or
317 triple_modifier events. The click_modifier has no written
318 representation in the names of the symbols used as event heads,
319 but it does appear in the Qevent_symbol_components property of the
320 event heads. */
321 enum {
322 up_modifier = 1, /* Only used on mouse buttons - always
323 turned into a click or a drag modifier
324 before lisp code sees the event. */
325 down_modifier = 2, /* Only used on mouse buttons. */
326 drag_modifier = 4, /* This is never used in the event
327 queue; it's only used internally by
328 the window-system-independent code. */
329 click_modifier= 8, /* See drag_modifier. */
330 double_modifier= 16, /* See drag_modifier. */
331 triple_modifier= 32, /* See drag_modifier. */
333 /* The next four modifier bits are used also in keyboard events at
334 the Lisp level.
336 It's probably not the greatest idea to use the 2^28 bit for any
337 modifier. It may or may not be the sign bit, depending on
338 FIXNUM_BITS, so using it to represent a modifier key means that
339 characters thus modified have different integer equivalents
340 depending on the architecture they're running on. Oh, and
341 applying XINT to a character whose 2^28 bit is set might sign-extend
342 it, so you get a bunch of bits in the mask you didn't want.
344 The CHAR_ macros are defined in lisp.h. */
345 alt_modifier = CHAR_ALT, /* Under X, the XK_Alt_[LR] keysyms. */
346 super_modifier= CHAR_SUPER, /* Under X, the XK_Super_[LR] keysyms. */
347 hyper_modifier= CHAR_HYPER, /* Under X, the XK_Hyper_[LR] keysyms. */
348 shift_modifier= CHAR_SHIFT,
349 ctrl_modifier = CHAR_CTL,
350 meta_modifier = CHAR_META /* Under X, the XK_Meta_[LR] keysyms. */
353 #ifdef HAVE_GPM
354 #include <gpm.h>
355 extern int handle_one_term_event (struct tty_display_info *, Gpm_Event *, struct input_event *);
356 #ifndef HAVE_WINDOW_SYSTEM
357 extern void term_mouse_moveto (int, int);
358 #endif
360 /* The device for which we have enabled gpm support. */
361 extern struct tty_display_info *gpm_tty;
362 #endif
364 /* Terminal-local parameters. */
365 struct terminal
367 /* This is for Lisp; the terminal code does not refer to it. */
368 struct vectorlike_header header;
370 /* Parameter alist of this terminal. */
371 Lisp_Object param_alist;
373 /* List of charsets supported by the terminal. It is set by
374 Fset_terminal_coding_system_internal along with
375 the member terminal_coding. */
376 Lisp_Object charset_list;
378 /* This is an association list containing the X selections that
379 Emacs might own on this terminal. Each element has the form
380 (SELECTION-NAME SELECTION-VALUE SELECTION-TIMESTAMP FRAME)
381 SELECTION-NAME is a lisp symbol, whose name is the name of an X Atom.
382 SELECTION-VALUE is the value that emacs owns for that selection.
383 It may be any kind of Lisp object.
384 SELECTION-TIMESTAMP is the time at which emacs began owning this
385 selection, as a cons of two 16-bit numbers (making a 32 bit
386 time.)
387 FRAME is the frame for which we made the selection. If there is
388 an entry in this alist, then it can be assumed that Emacs owns
389 that selection.
390 The only (eq) parts of this list that are visible from Lisp are
391 the selection-values. */
392 Lisp_Object Vselection_alist;
394 /* If a char-table, this maps characters to terminal glyph codes.
395 If t, the mapping is not available. If nil, it is not known
396 whether the mapping is available. */
397 Lisp_Object glyph_code_table;
399 /* All fields before `next_terminal' should be Lisp_Object and are traced
400 by the GC. All fields afterwards are ignored by the GC. */
402 /* Chain of all terminal devices. */
403 struct terminal *next_terminal;
405 /* Unique id for this terminal device. */
406 int id;
408 /* The number of frames that are on this terminal. */
409 int reference_count;
411 /* The type of the terminal device. */
412 enum output_method type;
414 /* The name of the terminal device. Do not use this to uniquely
415 identify a terminal; the same device may be opened multiple
416 times. */
417 char *name;
419 /* The terminal's keyboard object. */
420 struct kboard *kboard;
422 #ifdef HAVE_WINDOW_SYSTEM
423 /* Cache of images. */
424 struct image_cache *image_cache;
425 #endif /* HAVE_WINDOW_SYSTEM */
427 /* Device-type dependent data shared amongst all frames on this terminal. */
428 union display_info
430 struct tty_display_info *tty; /* termchar.h */
431 struct x_display_info *x; /* xterm.h */
432 struct w32_display_info *w32; /* w32term.h */
433 struct ns_display_info *ns; /* nsterm.h */
434 } display_info;
437 /* Coding-system to be used for encoding terminal output. This
438 structure contains information of a coding-system specified by
439 the function `set-terminal-coding-system'. Also see
440 `safe_terminal_coding' in coding.h. */
441 struct coding_system *terminal_coding;
443 /* Coding-system of what is sent from terminal keyboard. This
444 structure contains information of a coding-system specified by
445 the function `set-keyboard-coding-system'. */
446 struct coding_system *keyboard_coding;
448 /* Window-based redisplay interface for this device (0 for tty
449 devices). */
450 struct redisplay_interface *rif;
452 /* Frame-based redisplay interface. */
454 /* Text display hooks. */
456 void (*cursor_to_hook) (struct frame *f, int vpos, int hpos);
457 void (*raw_cursor_to_hook) (struct frame *, int, int);
459 void (*clear_to_end_hook) (struct frame *);
460 void (*clear_frame_hook) (struct frame *);
461 void (*clear_end_of_line_hook) (struct frame *, int);
463 void (*ins_del_lines_hook) (struct frame *f, int, int);
465 void (*insert_glyphs_hook) (struct frame *f, struct glyph *s, int n);
466 void (*write_glyphs_hook) (struct frame *f, struct glyph *s, int n);
467 void (*delete_glyphs_hook) (struct frame *, int);
469 void (*ring_bell_hook) (struct frame *f);
470 void (*toggle_invisible_pointer_hook) (struct frame *f, bool invisible);
472 void (*reset_terminal_modes_hook) (struct terminal *);
473 void (*set_terminal_modes_hook) (struct terminal *);
475 void (*update_begin_hook) (struct frame *);
476 void (*update_end_hook) (struct frame *);
477 void (*set_terminal_window_hook) (struct frame *, int);
479 /* Multi-frame and mouse support hooks. */
481 /* Return the current position of the mouse.
483 Set *f to the frame the mouse is in, or zero if the mouse is in no
484 Emacs frame. If it is set to zero, all the other arguments are
485 garbage.
487 If the motion started in a scroll bar, set *bar_window to the
488 scroll bar's window, *part to the part the mouse is currently over,
489 *x to the position of the mouse along the scroll bar, and *y to the
490 overall length of the scroll bar.
492 Otherwise, set *bar_window to Qnil, and *x and *y to the column and
493 row of the character cell the mouse is over.
495 Set *time to the time the mouse was at the returned position. */
496 void (*mouse_position_hook) (struct frame **f, int,
497 Lisp_Object *bar_window,
498 enum scroll_bar_part *part,
499 Lisp_Object *x,
500 Lisp_Object *y,
501 Time *);
503 /* When a frame's focus redirection is changed, this hook tells the
504 window system code to re-decide where to put the highlight. Under
505 X, this means that Emacs lies about where the focus is. */
506 void (*frame_rehighlight_hook) (struct frame *);
508 /* If we're displaying frames using a window system that can stack
509 frames on top of each other, this hook allows you to bring a frame
510 to the front, or bury it behind all the other windows. If this
511 hook is zero, that means the terminal we're displaying on doesn't
512 support overlapping frames, so there's no need to raise or lower
513 anything.
515 If RAISE_FLAG, F is brought to the front, before all other
516 windows. If !RAISE_FLAG, F is sent to the back, behind all other
517 windows. */
518 void (*frame_raise_lower_hook) (struct frame *f, bool raise_flag);
520 /* If the value of the frame parameter changed, this hook is called.
521 For example, if going from fullscreen to not fullscreen this hook
522 may do something OS dependent, like extended window manager hints on X11. */
523 void (*fullscreen_hook) (struct frame *f);
525 /* This hook is called to display menus. */
526 Lisp_Object (*menu_show_hook) (struct frame *f, int x, int y, int menuflags,
527 Lisp_Object title, const char **error_name);
529 /* This hook is called to display popup dialog. */
530 Lisp_Object (*popup_dialog_hook) (struct frame *f, Lisp_Object header,
531 Lisp_Object contents);
533 /* Scroll bar hooks. */
535 /* The representation of scroll bars is determined by the code which
536 implements them, except for one thing: they must be represented by
537 lisp objects. This allows us to place references to them in
538 Lisp_Windows without worrying about those references becoming
539 dangling references when the scroll bar is destroyed.
541 The window-system-independent portion of Emacs just refers to
542 scroll bars via their windows, and never looks inside the scroll bar
543 representation; it always uses hook functions to do all the
544 scroll bar manipulation it needs.
546 The `vertical_scroll_bar' field of a Lisp_Window refers to that
547 window's scroll bar, or is nil if the window doesn't have a
548 scroll bar.
550 The `scroll_bars' and `condemned_scroll_bars' fields of a Lisp_Frame
551 are free for use by the scroll bar implementation in any way it sees
552 fit. They are marked by the garbage collector. */
555 /* Set the vertical scroll bar for WINDOW to have its upper left corner
556 at (TOP, LEFT), and be LENGTH rows high. Set its handle to
557 indicate that we are displaying PORTION characters out of a total
558 of WHOLE characters, starting at POSITION. If WINDOW doesn't yet
559 have a scroll bar, create one for it. */
560 void (*set_vertical_scroll_bar_hook) (struct window *window,
561 int portion, int whole,
562 int position);
565 /* Set the horizontal scroll bar for WINDOW to have its upper left
566 corner at (TOP, LEFT), and be LENGTH rows high. Set its handle to
567 indicate that we are displaying PORTION characters out of a total
568 of WHOLE characters, starting at POSITION. If WINDOW doesn't yet
569 have a scroll bar, create one for it. */
570 void (*set_horizontal_scroll_bar_hook) (struct window *window,
571 int portion, int whole,
572 int position);
575 /* The following three hooks are used when we're doing a thorough
576 redisplay of the frame. We don't explicitly know which scroll bars
577 are going to be deleted, because keeping track of when windows go
578 away is a real pain - can you say set-window-configuration?
579 Instead, we just assert at the beginning of redisplay that *all*
580 scroll bars are to be removed, and then save scroll bars from the
581 fiery pit when we actually redisplay their window. */
583 /* Arrange for all scroll bars on FRAME to be removed at the next call
584 to `*judge_scroll_bars_hook'. A scroll bar may be spared if
585 `*redeem_scroll_bar_hook' is applied to its window before the judgment.
587 This should be applied to each frame each time its window tree is
588 redisplayed, even if it is not displaying scroll bars at the moment;
589 if the HAS_SCROLL_BARS flag has just been turned off, only calling
590 this and the judge_scroll_bars_hook will get rid of them.
592 If non-zero, this hook should be safe to apply to any frame,
593 whether or not it can support scroll bars, and whether or not it is
594 currently displaying them. */
595 void (*condemn_scroll_bars_hook) (struct frame *frame);
597 /* Unmark WINDOW's scroll bar for deletion in this judgment cycle.
598 Note that it's okay to redeem a scroll bar that is not condemned. */
599 void (*redeem_scroll_bar_hook) (struct window *window);
601 /* Remove all scroll bars on FRAME that haven't been saved since the
602 last call to `*condemn_scroll_bars_hook'.
604 This should be applied to each frame after each time its window
605 tree is redisplayed, even if it is not displaying scroll bars at the
606 moment; if the HAS_SCROLL_BARS flag has just been turned off, only
607 calling this and condemn_scroll_bars_hook will get rid of them.
609 If non-zero, this hook should be safe to apply to any frame,
610 whether or not it can support scroll bars, and whether or not it is
611 currently displaying them. */
612 void (*judge_scroll_bars_hook) (struct frame *FRAME);
615 /* Called to read input events.
617 TERMINAL indicates which terminal device to read from. Input
618 events should be read into HOLD_QUIT.
620 A positive return value indicates that that many input events
621 were read into BUF.
622 Zero means no events were immediately available.
623 A value of -1 means a transient read error, while -2 indicates
624 that the device was closed (hangup), and it should be deleted. */
625 int (*read_socket_hook) (struct terminal *terminal,
626 struct input_event *hold_quit);
628 /* Called when a frame's display becomes entirely up to date. */
629 void (*frame_up_to_date_hook) (struct frame *);
632 /* Called to delete the device-specific portions of a frame that is
633 on this terminal device. */
634 void (*delete_frame_hook) (struct frame *);
636 /* Called after the last frame on this terminal is deleted, or when
637 the display device was closed (hangup).
639 If this is NULL, then the generic delete_terminal is called
640 instead. Otherwise the hook must call delete_terminal itself.
642 The hook must check for and close any live frames that are still
643 on the terminal. delete_frame ensures that there are no live
644 frames on the terminal when it calls this hook, so infinite
645 recursion is prevented. */
646 void (*delete_terminal_hook) (struct terminal *);
649 /* Most code should use these functions to set Lisp fields in struct
650 terminal. */
651 INLINE void
652 tset_charset_list (struct terminal *t, Lisp_Object val)
654 t->charset_list = val;
656 INLINE void
657 tset_selection_alist (struct terminal *t, Lisp_Object val)
659 t->Vselection_alist = val;
662 /* Chain of all terminal devices currently in use. */
663 extern struct terminal *terminal_list;
665 #define FRAME_MUST_WRITE_SPACES(f) (FRAME_TTY (f)->must_write_spaces)
666 #define FRAME_LINE_INS_DEL_OK(f) (FRAME_TTY (f)->line_ins_del_ok)
667 #define FRAME_CHAR_INS_DEL_OK(f) (FRAME_TTY (f)->char_ins_del_ok)
668 #define FRAME_SCROLL_REGION_OK(f) (FRAME_TTY (f)->scroll_region_ok)
669 #define FRAME_SCROLL_REGION_COST(f) (FRAME_TTY (f)->scroll_region_cost)
670 #define FRAME_MEMORY_BELOW_FRAME(f) (FRAME_TTY (f)->memory_below_frame)
672 #define FRAME_TERMINAL_CODING(f) ((f)->terminal->terminal_coding)
673 #define FRAME_KEYBOARD_CODING(f) ((f)->terminal->keyboard_coding)
675 #define TERMINAL_TERMINAL_CODING(d) ((d)->terminal_coding)
676 #define TERMINAL_KEYBOARD_CODING(d) ((d)->keyboard_coding)
678 #define FRAME_RIF(f) ((f)->terminal->rif)
680 #define FRAME_TERMINAL(f) ((f)->terminal)
682 /* Return true if the terminal device is not suspended. */
683 #define TERMINAL_ACTIVE_P(d) \
684 (((d)->type != output_termcap && (d)->type != output_msdos_raw) \
685 || (d)->display_info.tty->input)
687 /* Return font cache data for the specified terminal. The historical
688 name is grossly misleading, actually it is (NAME . FONT-LIST-CACHE). */
689 #if defined (HAVE_X_WINDOWS)
690 #define TERMINAL_FONT_CACHE(t) \
691 (t->type == output_x_window ? t->display_info.x->name_list_element : Qnil)
692 #elif defined (HAVE_NTGUI)
693 #define TERMINAL_FONT_CACHE(t) \
694 (t->type == output_w32 ? t->display_info.w32->name_list_element : Qnil)
695 #elif defined (HAVE_NS)
696 #define TERMINAL_FONT_CACHE(t) \
697 (t->type == output_ns ? t->display_info.ns->name_list_element : Qnil)
698 #endif
700 extern struct terminal *decode_live_terminal (Lisp_Object);
701 extern struct terminal *decode_tty_terminal (Lisp_Object);
702 extern struct terminal *get_named_terminal (const char *);
703 extern struct terminal *create_terminal (enum output_method,
704 struct redisplay_interface *);
705 extern void delete_terminal (struct terminal *);
706 extern Lisp_Object terminal_glyph_code (struct terminal *, int);
708 /* The initial terminal device, created by initial_term_init. */
709 extern struct terminal *initial_terminal;
711 extern unsigned char *encode_terminal_code (struct glyph *, int,
712 struct coding_system *);
714 #ifdef HAVE_GPM
715 extern void close_gpm (int gpm_fd);
716 #endif
718 #ifdef WINDOWSNT
719 extern int cursorX (struct tty_display_info *);
720 extern int cursorY (struct tty_display_info *);
721 #else
722 #define cursorX(t) curX(t)
723 #define cursorY(t) curY(t)
724 #endif
726 INLINE_HEADER_END
728 #endif /* EMACS_TERMHOOKS_H */