872
|
1 /* Define console object for XEmacs.
|
1318
|
2 Copyright (C) 1996, 2002, 2003 Ben Wing
|
872
|
3
|
|
4 This file is part of XEmacs.
|
|
5
|
|
6 XEmacs is free software; you can redistribute it and/or modify it
|
|
7 under the terms of the GNU General Public License as published by the
|
|
8 Free Software Foundation; either version 2, or (at your option) any
|
|
9 later version.
|
|
10
|
|
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with XEmacs; see the file COPYING. If not, write to
|
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
19 Boston, MA 02111-1307, USA. */
|
|
20
|
|
21 /* Synched up with: Not in FSF. */
|
|
22
|
|
23 /* Written by Ben Wing. */
|
|
24
|
|
25 #ifndef INCLUDED_console_impl_h_
|
|
26 #define INCLUDED_console_impl_h_
|
|
27
|
|
28 #include "console.h"
|
|
29
|
1204
|
30 extern const struct sized_memory_description cted_description;
|
|
31 extern const struct sized_memory_description console_methods_description;
|
872
|
32
|
|
33
|
|
34 /*
|
|
35 * Constants returned by device_implementation_flags_method
|
|
36 */
|
|
37
|
|
38 /* Set when device uses pixel-based geometry */
|
|
39 #define XDEVIMPF_PIXEL_GEOMETRY 0x00000001L
|
|
40
|
|
41 /* Indicates that the device is a printer */
|
|
42 #define XDEVIMPF_IS_A_PRINTER 0x00000002L
|
|
43
|
|
44 /* Do not automatically redisplay this device */
|
|
45 #define XDEVIMPF_NO_AUTO_REDISPLAY 0x00000004L
|
|
46
|
|
47 /* Do not delete the device when last frame's gone */
|
|
48 #define XDEVIMPF_FRAMELESS_OK 0x00000008L
|
|
49
|
|
50 /* Do not preempt resiaply of frame or device once it starts */
|
|
51 #define XDEVIMPF_DONT_PREEMPT_REDISPLAY 0x00000010L
|
|
52
|
|
53 struct console_methods
|
|
54 {
|
|
55 const char *name; /* Used by print_console, print_device, print_frame */
|
|
56 Lisp_Object symbol;
|
|
57 Lisp_Object predicate_symbol;
|
|
58 unsigned int flags; /* Read-only implementation flags, set once upon
|
|
59 console type creation. INITIALIZE_CONSOLE_TYPE sets
|
|
60 this member to 0. */
|
|
61
|
|
62 /* console methods */
|
|
63 void (*init_console_method) (struct console *, Lisp_Object props);
|
|
64 void (*mark_console_method) (struct console *);
|
|
65 int (*initially_selected_for_input_method) (struct console *);
|
|
66 void (*delete_console_method) (struct console *);
|
|
67 Lisp_Object (*semi_canonicalize_console_connection_method)
|
|
68 (Lisp_Object connection, Error_Behavior errb);
|
|
69 Lisp_Object (*semi_canonicalize_device_connection_method)
|
|
70 (Lisp_Object connection, Error_Behavior errb);
|
|
71 Lisp_Object (*canonicalize_console_connection_method)
|
|
72 (Lisp_Object connection, Error_Behavior errb);
|
|
73 Lisp_Object (*canonicalize_device_connection_method)
|
|
74 (Lisp_Object connection, Error_Behavior errb);
|
|
75 Lisp_Object (*device_to_console_connection_method)
|
|
76 (Lisp_Object connection, Error_Behavior errb);
|
2828
|
77 Lisp_Object (*perhaps_init_unseen_key_defaults_method)
|
|
78 (struct console *, Lisp_Object keysym);
|
872
|
79
|
|
80 /* device methods */
|
|
81 void (*init_device_method) (struct device *, Lisp_Object props);
|
|
82 void (*finish_init_device_method) (struct device *, Lisp_Object props);
|
|
83 void (*delete_device_method) (struct device *);
|
|
84 void (*mark_device_method) (struct device *);
|
|
85 void (*asynch_device_change_method) (void);
|
|
86 Lisp_Object (*device_system_metrics_method) (struct device *,
|
|
87 enum device_metrics);
|
|
88 Lisp_Object (*own_selection_method)(Lisp_Object selection_name,
|
|
89 Lisp_Object selection_value,
|
|
90 Lisp_Object how_to_add,
|
|
91 Lisp_Object selection_type,
|
|
92 int owned_p);
|
|
93 void (*disown_selection_method)(Lisp_Object selection_name,
|
|
94 Lisp_Object timeval);
|
|
95 Lisp_Object (*get_foreign_selection_method) (Lisp_Object selection_symbol,
|
|
96 Lisp_Object target_type);
|
|
97 Lisp_Object (*selection_exists_p_method)(Lisp_Object selection_name,
|
|
98 Lisp_Object selection_type);
|
|
99 Lisp_Object (*available_selection_types_method)(Lisp_Object selection_name);
|
|
100 Lisp_Object (*register_selection_data_type_method)(Lisp_Object type_name);
|
|
101 Lisp_Object (*selection_data_type_name_method)(Lisp_Object type);
|
|
102
|
|
103 /* frame methods */
|
|
104 Lisp_Object *device_specific_frame_props;
|
|
105 void (*init_frame_1_method) (struct frame *, Lisp_Object properties,
|
|
106 int frame_name_is_defaulted);
|
|
107 void (*init_frame_2_method) (struct frame *, Lisp_Object properties);
|
|
108 void (*init_frame_3_method) (struct frame *);
|
|
109 void (*after_init_frame_method) (struct frame *, int first_on_device,
|
|
110 int first_on_console);
|
|
111 void (*mark_frame_method) (struct frame *);
|
|
112 void (*delete_frame_method) (struct frame *);
|
|
113 void (*focus_on_frame_method) (struct frame *);
|
|
114 void (*raise_frame_method) (struct frame *);
|
|
115 void (*lower_frame_method) (struct frame *);
|
|
116 void (*enable_frame_method) (struct frame *);
|
|
117 void (*disable_frame_method) (struct frame *);
|
|
118 int (*get_mouse_position_method) (struct device *d, Lisp_Object *frame,
|
|
119 int *x, int *y);
|
|
120 void (*set_mouse_position_method) (struct window *w, int x, int y);
|
|
121 void (*make_frame_visible_method) (struct frame *f);
|
|
122 void (*make_frame_invisible_method) (struct frame *f);
|
|
123 void (*iconify_frame_method) (struct frame *f);
|
|
124 Lisp_Object (*frame_property_method) (struct frame *f, Lisp_Object prop);
|
|
125 int (*internal_frame_property_p_method) (struct frame *f,
|
|
126 Lisp_Object prop);
|
|
127 Lisp_Object (*frame_properties_method) (struct frame *f);
|
|
128 void (*set_frame_properties_method) (struct frame *f, Lisp_Object plist);
|
|
129 void (*set_frame_size_method) (struct frame *f, int width, int height);
|
|
130 void (*set_frame_position_method) (struct frame *f, int xoff, int yoff);
|
|
131 int (*frame_visible_p_method) (struct frame *f);
|
|
132 int (*frame_totally_visible_p_method) (struct frame *f);
|
|
133 int (*frame_iconified_p_method) (struct frame *f);
|
|
134 void (*set_title_from_ibyte_method) (struct frame *f, Ibyte *title);
|
|
135 void (*set_icon_name_from_ibyte_method) (struct frame *f, Ibyte *title);
|
|
136 void (*set_frame_pointer_method) (struct frame *f);
|
|
137 void (*set_frame_icon_method) (struct frame *f);
|
|
138 void (*popup_menu_method) (Lisp_Object menu, Lisp_Object event);
|
|
139 Lisp_Object (*get_frame_parent_method) (struct frame *f);
|
|
140 void (*update_frame_external_traits_method) (struct frame *f, Lisp_Object name);
|
|
141 int (*frame_size_fixed_p_method) (struct frame *f);
|
|
142 void (*eject_page_method) (struct frame *f);
|
|
143
|
|
144 /* redisplay methods */
|
|
145 int (*left_margin_width_method) (struct window *);
|
|
146 int (*right_margin_width_method) (struct window *);
|
|
147 int (*text_width_method) (struct frame *f, struct face_cachel *cachel,
|
|
148 const Ichar *str, Charcount len);
|
|
149 void (*output_display_block_method) (struct window *, struct display_line *,
|
|
150 int, int, int, int, int, int, int);
|
|
151 int (*divider_height_method) (void);
|
|
152 int (*eol_cursor_width_method) (void);
|
|
153 void (*output_vertical_divider_method) (struct window *, int);
|
|
154 void (*clear_to_window_end_method) (struct window *, int, int);
|
|
155 void (*clear_region_method) (Lisp_Object, struct device*, struct frame*, face_index,
|
|
156 int, int, int, int,
|
|
157 Lisp_Object, Lisp_Object, Lisp_Object);
|
|
158 void (*clear_frame_method) (struct frame *);
|
|
159 void (*window_output_begin_method) (struct window *);
|
|
160 void (*frame_output_begin_method) (struct frame *);
|
|
161 void (*window_output_end_method) (struct window *);
|
|
162 void (*frame_output_end_method) (struct frame *);
|
|
163 int (*flash_method) (struct device *);
|
|
164 void (*ring_bell_method) (struct device *, int volume, int pitch,
|
|
165 int duration);
|
|
166 void (*frame_redraw_cursor_method) (struct frame *f);
|
|
167 void (*set_final_cursor_coords_method) (struct frame *, int, int);
|
|
168 void (*bevel_area_method) (struct window *, face_index, int, int, int, int, int,
|
|
169 int, enum edge_style);
|
|
170 void (*output_pixmap_method) (struct window *w, Lisp_Object image_instance,
|
|
171 struct display_box *db, struct display_glyph_area *dga,
|
|
172 face_index findex, int cursor_start, int cursor_width,
|
|
173 int cursor_height, int offset_bitmap);
|
|
174 void (*output_string_method) (struct window *w, struct display_line *dl,
|
|
175 Ichar_dynarr *buf, int xpos, int xoffset,
|
|
176 int start_pixpos, int width, face_index findex,
|
|
177 int cursor, int cursor_start, int cursor_width,
|
|
178 int cursor_height);
|
|
179
|
|
180 /* color methods */
|
|
181 int (*initialize_color_instance_method) (Lisp_Color_Instance *,
|
|
182 Lisp_Object name,
|
|
183 Lisp_Object device,
|
|
184 Error_Behavior errb);
|
|
185 void (*mark_color_instance_method) (Lisp_Color_Instance *);
|
|
186 void (*print_color_instance_method) (Lisp_Color_Instance *,
|
|
187 Lisp_Object printcharfun,
|
|
188 int escapeflag);
|
|
189 void (*finalize_color_instance_method) (Lisp_Color_Instance *);
|
|
190 int (*color_instance_equal_method) (Lisp_Color_Instance *,
|
|
191 Lisp_Color_Instance *,
|
|
192 int depth);
|
|
193 Hashcode (*color_instance_hash_method) (Lisp_Color_Instance *,
|
|
194 int depth);
|
|
195 Lisp_Object (*color_instance_rgb_components_method) (Lisp_Color_Instance *);
|
|
196 int (*valid_color_name_p_method) (struct device *, Lisp_Object color);
|
2527
|
197 Lisp_Object (*color_list_method) (void);
|
872
|
198
|
|
199 /* font methods */
|
|
200 int (*initialize_font_instance_method) (Lisp_Font_Instance *,
|
|
201 Lisp_Object name,
|
|
202 Lisp_Object device,
|
|
203 Error_Behavior errb);
|
|
204 void (*mark_font_instance_method) (Lisp_Font_Instance *);
|
|
205 void (*print_font_instance_method) (Lisp_Font_Instance *,
|
|
206 Lisp_Object printcharfun,
|
|
207 int escapeflag);
|
|
208 void (*finalize_font_instance_method) (Lisp_Font_Instance *);
|
|
209 Lisp_Object (*font_instance_truename_method) (Lisp_Font_Instance *,
|
|
210 Error_Behavior errb);
|
|
211 Lisp_Object (*font_instance_properties_method) (Lisp_Font_Instance *);
|
2527
|
212 Lisp_Object (*font_list_method) (Lisp_Object pattern,
|
1701
|
213 Lisp_Object device,
|
|
214 Lisp_Object maxnumber);
|
872
|
215 Lisp_Object (*find_charset_font_method) (Lisp_Object device,
|
|
216 Lisp_Object font,
|
|
217 Lisp_Object charset,
|
|
218 int stage);
|
|
219 int (*font_spec_matches_charset_method) (struct device *d,
|
|
220 Lisp_Object charset,
|
|
221 const Ibyte *nonreloc,
|
|
222 Lisp_Object reloc,
|
|
223 Bytecount offset,
|
|
224 Bytecount length,
|
|
225 int stage);
|
|
226
|
|
227 /* image methods */
|
|
228 void (*mark_image_instance_method) (Lisp_Image_Instance *);
|
|
229 void (*print_image_instance_method) (Lisp_Image_Instance *,
|
|
230 Lisp_Object printcharfun,
|
|
231 int escapeflag);
|
|
232 void (*finalize_image_instance_method) (Lisp_Image_Instance *);
|
|
233 void (*unmap_subwindow_method) (Lisp_Image_Instance *);
|
|
234 void (*map_subwindow_method) (Lisp_Image_Instance *, int x, int y,
|
|
235 struct display_glyph_area* dga);
|
|
236 void (*resize_subwindow_method) (Lisp_Image_Instance *, int w, int h);
|
|
237 void (*redisplay_subwindow_method) (Lisp_Image_Instance *);
|
|
238 void (*redisplay_widget_method) (Lisp_Image_Instance *);
|
|
239 /* Maybe this should be a specifier. Unfortunately specifiers don't
|
|
240 allow us to represent things at the toolkit level, which is what
|
|
241 is required here. */
|
|
242 int (*widget_border_width_method) (void);
|
|
243 int (*widget_spacing_method) (Lisp_Image_Instance *);
|
|
244 int (*image_instance_equal_method) (Lisp_Image_Instance *,
|
|
245 Lisp_Image_Instance *,
|
|
246 int depth);
|
|
247 Hashcode (*image_instance_hash_method) (Lisp_Image_Instance *,
|
|
248 int depth);
|
|
249 void (*init_image_instance_from_eimage_method) (Lisp_Image_Instance *ii,
|
|
250 int width, int height,
|
|
251 int slices,
|
|
252 unsigned char *eimage,
|
|
253 int dest_mask,
|
|
254 Lisp_Object instantiator,
|
|
255 Lisp_Object domain);
|
|
256 Lisp_Object (*locate_pixmap_file_method) (Lisp_Object file_method);
|
|
257 int (*colorize_image_instance_method) (Lisp_Object image_instance,
|
|
258 Lisp_Object fg, Lisp_Object bg);
|
|
259 void (*widget_query_string_geometry_method) (Lisp_Object string,
|
|
260 Lisp_Object face,
|
|
261 int* width, int* height,
|
|
262 Lisp_Object domain);
|
|
263 Lisp_Object image_conversion_list;
|
|
264
|
|
265 #ifdef HAVE_TOOLBARS
|
|
266 /* toolbar methods */
|
|
267 void (*output_frame_toolbars_method) (struct frame *);
|
905
|
268 void (*clear_frame_toolbars_method) (struct frame *);
|
872
|
269 void (*initialize_frame_toolbars_method) (struct frame *);
|
|
270 void (*free_frame_toolbars_method) (struct frame *);
|
|
271 void (*output_toolbar_button_method) (struct frame *, Lisp_Object);
|
|
272 void (*redraw_frame_toolbars_method) (struct frame *);
|
|
273 void (*redraw_exposed_toolbars_method) (struct frame *f, int x, int y,
|
|
274 int width, int height);
|
|
275 #endif
|
|
276
|
|
277 #ifdef HAVE_SCROLLBARS
|
|
278 /* scrollbar methods */
|
|
279 int (*inhibit_scrollbar_slider_size_change_method) (void);
|
|
280 void (*free_scrollbar_instance_method) (struct scrollbar_instance *);
|
|
281 void (*release_scrollbar_instance_method) (struct scrollbar_instance *);
|
|
282 void (*create_scrollbar_instance_method) (struct frame *, int,
|
|
283 struct scrollbar_instance *);
|
|
284 void (*update_scrollbar_instance_values_method) (struct window *,
|
|
285 struct scrollbar_instance *,
|
|
286 int, int, int, int, int,
|
|
287 int, int, int, int, int);
|
|
288 void (*update_scrollbar_instance_status_method) (struct window *, int, int,
|
|
289 struct
|
|
290 scrollbar_instance *);
|
|
291 void (*scrollbar_pointer_changed_in_window_method) (struct window *w);
|
|
292 #ifdef MEMORY_USAGE_STATS
|
|
293 int (*compute_scrollbar_instance_usage_method) (struct device *,
|
|
294 struct scrollbar_instance *,
|
|
295 struct overhead_stats *);
|
|
296 #endif
|
1318
|
297 /* Paint the window's deadbox, a rectangle between window
|
|
298 borders and two short edges of both scrollbars. */
|
|
299 void (*redisplay_deadbox_method) (struct window *w, int x, int y, int width,
|
|
300 int height);
|
872
|
301 #endif /* HAVE_SCROLLBARS */
|
|
302
|
|
303 #ifdef HAVE_MENUBARS
|
|
304 /* menubar methods */
|
|
305 void (*update_frame_menubars_method) (struct frame *);
|
|
306 void (*free_frame_menubars_method) (struct frame *);
|
|
307 #endif
|
|
308
|
|
309 #ifdef HAVE_DIALOGS
|
|
310 /* dialog methods */
|
|
311 Lisp_Object (*make_dialog_box_internal_method) (struct frame *,
|
|
312 Lisp_Object type,
|
|
313 Lisp_Object keys);
|
|
314 #endif
|
|
315 };
|
|
316
|
|
317 #define CONMETH_TYPE(meths) ((meths)->symbol)
|
|
318 #define CONMETH_IMPL_FLAG(meths, f) ((meths)->flags & (f))
|
|
319
|
|
320 #define CONSOLE_TYPE_NAME(c) ((c)->conmeths->name)
|
|
321 #define CONSOLE_TYPE(c) ((c)->conmeths->symbol)
|
|
322 #define CONSOLE_IMPL_FLAG(c, f) CONMETH_IMPL_FLAG ((c)->conmeths, (f))
|
|
323
|
|
324 /******** Accessing / calling a console method *********/
|
|
325
|
|
326 #define HAS_CONTYPE_METH_P(meth, m) ((meth)->m##_method)
|
|
327 #define CONTYPE_METH(meth, m, args) (((meth)->m##_method) args)
|
|
328
|
|
329 /* Call a void-returning console method, if it exists */
|
|
330 #define MAYBE_CONTYPE_METH(meth, m, args) do { \
|
|
331 struct console_methods *maybe_contype_meth_meth = (meth); \
|
|
332 if (HAS_CONTYPE_METH_P (maybe_contype_meth_meth, m)) \
|
|
333 CONTYPE_METH (maybe_contype_meth_meth, m, args); \
|
|
334 } while (0)
|
|
335
|
|
336 /* Call a console method, if it exists; otherwise return
|
|
337 the specified value - meth is multiply evaluated. */
|
|
338 #define CONTYPE_METH_OR_GIVEN(meth, m, args, given) \
|
|
339 (HAS_CONTYPE_METH_P (meth, m) ? \
|
|
340 CONTYPE_METH (meth, m, args) : (given))
|
|
341
|
|
342 /* Call an int-returning console method, if it exists; otherwise
|
|
343 return 0 */
|
|
344 #define MAYBE_INT_CONTYPE_METH(meth, m, args) \
|
|
345 CONTYPE_METH_OR_GIVEN (meth, m, args, 0)
|
|
346
|
|
347 /* Call an Lisp-Object-returning console method, if it exists;
|
|
348 otherwise return Qnil */
|
|
349 #define MAYBE_LISP_CONTYPE_METH(meth, m, args) \
|
|
350 CONTYPE_METH_OR_GIVEN (meth, m, args, Qnil)
|
|
351
|
|
352 /******** Same functions, operating on a console instead of a
|
|
353 struct console_methods ********/
|
|
354
|
|
355 #define HAS_CONMETH_P(c, m) HAS_CONTYPE_METH_P ((c)->conmeths, m)
|
|
356 #define CONMETH(c, m, args) CONTYPE_METH ((c)->conmeths, m, args)
|
|
357 #define MAYBE_CONMETH(c, m, args) MAYBE_CONTYPE_METH ((c)->conmeths, m, args)
|
|
358 #define CONMETH_OR_GIVEN(c, m, args, given) \
|
|
359 CONTYPE_METH_OR_GIVEN((c)->conmeths, m, args, given)
|
|
360 #define MAYBE_INT_CONMETH(c, m, args) \
|
|
361 MAYBE_INT_CONTYPE_METH ((c)->conmeths, m, args)
|
|
362 #define MAYBE_LISP_CONMETH(c, m, args) \
|
|
363 MAYBE_LISP_CONTYPE_METH ((c)->conmeths, m, args)
|
|
364
|
|
365 /******** Defining new console types ********/
|
|
366
|
|
367 typedef struct console_type_entry console_type_entry;
|
|
368 struct console_type_entry
|
|
369 {
|
|
370 Lisp_Object symbol;
|
|
371 struct console_methods *meths;
|
|
372 };
|
|
373
|
|
374 #define DECLARE_CONSOLE_TYPE(type) \
|
|
375 extern struct console_methods * type##_console_methods
|
|
376
|
|
377 #define DEFINE_CONSOLE_TYPE(type) \
|
|
378 struct console_methods * type##_console_methods
|
|
379
|
|
380 #define INITIALIZE_CONSOLE_TYPE(type, obj_name, pred_sym) do { \
|
|
381 type##_console_methods = xnew_and_zero (struct console_methods); \
|
|
382 type##_console_methods->name = obj_name; \
|
|
383 type##_console_methods->symbol = Q##type; \
|
|
384 defsymbol_nodump (&type##_console_methods->predicate_symbol, pred_sym); \
|
|
385 add_entry_to_console_type_list (Q##type, type##_console_methods); \
|
|
386 type##_console_methods->image_conversion_list = Qnil; \
|
|
387 staticpro_nodump (&type##_console_methods->image_conversion_list); \
|
2367
|
388 dump_add_root_block_ptr (&type##_console_methods, &console_methods_description); \
|
872
|
389 } while (0)
|
|
390
|
|
391 #define REINITIALIZE_CONSOLE_TYPE(type) do { \
|
|
392 staticpro_nodump (&type##_console_methods->predicate_symbol); \
|
|
393 staticpro_nodump (&type##_console_methods->image_conversion_list); \
|
|
394 } while (0)
|
|
395
|
|
396
|
|
397 /* Declare that console-type TYPE has method M; used in
|
|
398 initialization routines */
|
|
399 #define CONSOLE_HAS_METHOD(type, m) \
|
|
400 (type##_console_methods->m##_method = type##_##m)
|
|
401
|
|
402 /* Declare that console-type TYPE inherits method M
|
|
403 implementation from console-type FROMTYPE */
|
|
404 #define CONSOLE_INHERITS_METHOD(type, fromtype, m) \
|
|
405 (type##_console_methods->m##_method = fromtype##_##m)
|
|
406
|
|
407 /* Define console type implementation flags */
|
|
408 #define CONSOLE_IMPLEMENTATION_FLAGS(type, flg) \
|
|
409 (type##_console_methods->flags = flg)
|
|
410
|
|
411 struct console
|
|
412 {
|
2720
|
413 #ifdef MC_ALLOC
|
|
414 struct lrecord_header header;
|
|
415 #else /* MC_ALLOC */
|
872
|
416 struct lcrecord_header header;
|
2720
|
417 #endif /* MC_ALLOC */
|
872
|
418
|
|
419 /* Description of this console's methods. */
|
|
420 struct console_methods *conmeths;
|
|
421
|
1204
|
422 /* Enumerated constant listing which type of console this is (TTY, X,
|
|
423 MS-Windows, etc.). This duplicates the symbol in conmeths->symbol,
|
|
424 which formerly was the only way to determine the console type.
|
|
425 We need this constant now for KKCC, so that it can be used in
|
|
426 an XD_UNION clause to determine the Lisp objects in console_data. */
|
934
|
427 enum console_variant contype;
|
|
428
|
872
|
429 /* A structure of auxiliary data specific to the console type.
|
|
430 struct x_console is used for X window frames; defined in console-x.h
|
|
431 struct tty_console is used to TTY's; defined in console-tty.h */
|
|
432 void *console_data;
|
|
433
|
|
434 /* ----- begin partially-completed console localization of
|
|
435 event loop ---- */
|
|
436
|
|
437 int local_var_flags;
|
|
438
|
1204
|
439 #define MARKED_SLOT(x) Lisp_Object x;
|
872
|
440 #include "conslots.h"
|
|
441
|
|
442 /* Where to store the next keystroke of the macro.
|
|
443 Index into con->kbd_macro_builder. */
|
|
444 int kbd_macro_ptr;
|
|
445
|
|
446 /* The finalized section of the macro starts at kbd_macro_buffer and
|
|
447 ends before this. This is not the same as kbd_macro_pointer, because
|
|
448 we advance this to kbd_macro_pointer when a key's command is complete.
|
|
449 This way, the keystrokes for "end-kbd-macro" are not included in the
|
|
450 macro. */
|
|
451 int kbd_macro_end;
|
|
452
|
|
453 /* ----- end partially-completed console localization of event loop ---- */
|
|
454
|
|
455 unsigned int input_enabled :1;
|
|
456 };
|
|
457
|
|
458 /* Redefine basic properties more efficiently */
|
|
459
|
|
460 #undef CONSOLE_LIVE_P
|
|
461 #define CONSOLE_LIVE_P(con) (!EQ (CONSOLE_TYPE (con), Qdead))
|
|
462 #undef CONSOLE_DEVICE_LIST
|
|
463 #define CONSOLE_DEVICE_LIST(con) ((con)->device_list)
|
|
464
|
|
465 #define CONSOLE_TYPE_P(con, type) EQ (CONSOLE_TYPE (con), Q##type)
|
|
466
|
|
467 #ifdef ERROR_CHECK_TYPES
|
|
468 DECLARE_INLINE_HEADER (
|
|
469 struct console *
|
|
470 error_check_console_type (struct console *con, Lisp_Object sym)
|
|
471 )
|
|
472 {
|
|
473 assert (EQ (CONSOLE_TYPE (con), sym));
|
|
474 return con;
|
|
475 }
|
|
476 # define CONSOLE_TYPE_DATA(con, type) \
|
|
477 (*(struct type##_console **) \
|
|
478 &(error_check_console_type (con, Q##type))->console_data)
|
|
479 #else
|
|
480 # define CONSOLE_TYPE_DATA(con, type) \
|
|
481 (*(struct type##_console **) &((con)->console_data))
|
|
482 #endif
|
|
483
|
|
484 #define CHECK_CONSOLE_TYPE(x, type) do { \
|
|
485 CHECK_CONSOLE (x); \
|
|
486 if (! CONSOLE_TYPE_P (XCONSOLE (x), type)) \
|
|
487 dead_wrong_type_argument \
|
|
488 (type##_console_methods->predicate_symbol, x); \
|
|
489 } while (0)
|
|
490 #define CONCHECK_CONSOLE_TYPE(x, type) do { \
|
|
491 CONCHECK_CONSOLE (x); \
|
|
492 if (!(CONSOLEP (x) && \
|
|
493 CONSOLE_TYPE_P (XCONSOLE (x), type))) \
|
|
494 x = wrong_type_argument \
|
|
495 (type##_console_methods->predicate_symbol, x); \
|
|
496 } while (0)
|
|
497
|
|
498 /* #### These should be in the console-*.h files but there are
|
|
499 too many places where the abstraction is broken. Need to
|
|
500 fix. */
|
|
501
|
|
502 #ifdef HAVE_GTK
|
|
503 #define CONSOLE_TYPESYM_GTK_P(typesym) EQ (typesym, Qgtk)
|
|
504 #else
|
|
505 #define CONSOLE_TYPESYM_GTK_P(typesym) 0
|
|
506 #endif
|
|
507
|
|
508 #ifdef HAVE_X_WINDOWS
|
|
509 #define CONSOLE_TYPESYM_X_P(typesym) EQ (typesym, Qx)
|
|
510 #else
|
|
511 #define CONSOLE_TYPESYM_X_P(typesym) 0
|
|
512 #endif
|
|
513 #ifdef HAVE_TTY
|
|
514 #define CONSOLE_TYPESYM_TTY_P(typesym) EQ (typesym, Qtty)
|
|
515 #else
|
|
516 #define CONSOLE_TYPESYM_TTY_P(typesym) 0
|
|
517 #endif
|
|
518 #ifdef HAVE_MS_WINDOWS
|
|
519 #define CONSOLE_TYPESYM_MSWINDOWS_P(typesym) EQ (typesym, Qmswindows)
|
|
520 #else
|
|
521 #define CONSOLE_TYPESYM_MSWINDOWS_P(typesym) 0
|
|
522 #endif
|
|
523 #define CONSOLE_TYPESYM_STREAM_P(typesym) EQ (typesym, Qstream)
|
|
524
|
|
525 #define CONSOLE_TYPESYM_WIN_P(typesym) \
|
|
526 (CONSOLE_TYPESYM_GTK_P (typesym) || CONSOLE_TYPESYM_X_P (typesym) || CONSOLE_TYPESYM_MSWINDOWS_P (typesym))
|
|
527
|
|
528 #define CONSOLE_X_P(con) CONSOLE_TYPESYM_X_P (CONSOLE_TYPE (con))
|
|
529 #define CHECK_X_CONSOLE(z) CHECK_CONSOLE_TYPE (z, x)
|
|
530 #define CONCHECK_X_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, x)
|
|
531
|
|
532 #define CONSOLE_GTK_P(con) CONSOLE_TYPESYM_GTK_P (CONSOLE_TYPE (con))
|
|
533 #define CHECK_GTK_CONSOLE(z) CHECK_CONSOLE_TYPE (z, gtk)
|
|
534 #define CONCHECK_GTK_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, gtk)
|
|
535
|
|
536 #define CONSOLE_TTY_P(con) CONSOLE_TYPESYM_TTY_P (CONSOLE_TYPE (con))
|
|
537 #define CHECK_TTY_CONSOLE(z) CHECK_CONSOLE_TYPE (z, tty)
|
|
538 #define CONCHECK_TTY_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, tty)
|
|
539
|
|
540 #define CONSOLE_MSWINDOWS_P(con) CONSOLE_TYPESYM_MSWINDOWS_P (CONSOLE_TYPE (con))
|
|
541 #define CHECK_MSWINDOWS_CONSOLE(z) CHECK_CONSOLE_TYPE (z, mswindows)
|
|
542 #define CONCHECK_MSWINDOWS_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, mswindows)
|
|
543
|
|
544 #define CONSOLE_STREAM_P(con) CONSOLE_TYPESYM_STREAM_P (CONSOLE_TYPE (con))
|
|
545 #define CHECK_STREAM_CONSOLE(z) CHECK_CONSOLE_TYPE (z, stream)
|
|
546 #define CONCHECK_STREAM_CONSOLE(z) CONCHECK_CONSOLE_TYPE (z, stream)
|
|
547
|
|
548 #define CONSOLE_WIN_P(con) CONSOLE_TYPESYM_WIN_P (CONSOLE_TYPE (con))
|
|
549
|
|
550 /* This structure marks which slots in a console have corresponding
|
|
551 default values in console_defaults.
|
|
552 Each such slot has a nonzero value in this structure.
|
|
553 The value has only one nonzero bit.
|
|
554
|
|
555 When a console has its own local value for a slot,
|
|
556 the bit for that slot (found in the same slot in this structure)
|
|
557 is turned on in the console's local_var_flags slot.
|
|
558
|
|
559 If a slot in this structure is zero, then even though there may
|
|
560 be a DEFVAR_CONSOLE_LOCAL for the slot, there is no default value for it;
|
|
561 and the corresponding slot in console_defaults is not used. */
|
|
562
|
|
563 extern struct console console_local_flags;
|
|
564
|
|
565 #define CONSOLE_NAME(con) ((con)->name)
|
|
566 #define CONSOLE_CONNECTION(con) ((con)->connection)
|
|
567 #define CONSOLE_CANON_CONNECTION(con) ((con)->canon_connection)
|
|
568 #define CONSOLE_FUNCTION_KEY_MAP(con) ((con)->function_key_map)
|
|
569 #define CONSOLE_SELECTED_DEVICE(con) ((con)->selected_device)
|
|
570 #define CONSOLE_SELECTED_FRAME(con) \
|
|
571 DEVICE_SELECTED_FRAME (XDEVICE ((con)->selected_device))
|
|
572 #define CONSOLE_LAST_NONMINIBUF_FRAME(con) NON_LVALUE ((con)->last_nonminibuf_frame)
|
|
573 #define CONSOLE_QUIT_CHAR(con) ((con)->quit_char)
|
1204
|
574 #define CONSOLE_QUIT_EVENT(con) ((con)->quit_event)
|
|
575 #define CONSOLE_CRITICAL_QUIT_EVENT(con) ((con)->critical_quit_event)
|
872
|
576
|
|
577 DECLARE_CONSOLE_TYPE (dead);
|
|
578
|
|
579 extern console_type_entry_dynarr *the_console_type_entry_dynarr;
|
|
580
|
|
581 #endif /* INCLUDED_console_impl_h_ */
|