comparison src/console.h @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents de805c49cfc1
children da8ed4261e83
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
20 20
21 /* Synched up with: Not in FSF. */ 21 /* Synched up with: Not in FSF. */
22 22
23 /* Written by Ben Wing. */ 23 /* Written by Ben Wing. */
24 24
25 #ifndef INCLUDED_console_h_ 25 #ifndef _XEMACS_CONSOLE_H_
26 #define INCLUDED_console_h_ 26 #define _XEMACS_CONSOLE_H_
27 27
28 /* Devices and consoles are similar entities. The idea is that 28 /* Devices and consoles are similar entities. The idea is that
29 a console represents a physical keyboard/mouse/other-input-source 29 a console represents a physical keyboard/mouse/other-input-source
30 while a device represents a display where frames appear on. 30 while a device represents a display where frames appear on.
31 In the X world, a console is a "Display" while a device is a 31 In the X world, a console is a "Display" while a device is a
53 DM_color_menu_button, DM_color_menu_disabled, DM_color_toolbar, 53 DM_color_menu_button, DM_color_menu_disabled, DM_color_toolbar,
54 DM_color_scrollbar, DM_color_desktop, DM_color_workspace, DM_font_default, 54 DM_color_scrollbar, DM_color_desktop, DM_color_workspace, DM_font_default,
55 DM_font_menubar, DM_font_dialog, DM_size_cursor, DM_size_scrollbar, 55 DM_font_menubar, DM_font_dialog, DM_size_cursor, DM_size_scrollbar,
56 DM_size_menu, DM_size_toolbar, DM_size_toolbar_button, 56 DM_size_menu, DM_size_toolbar, DM_size_toolbar_button,
57 DM_size_toolbar_border, DM_size_icon, DM_size_icon_small, DM_size_device, 57 DM_size_toolbar_border, DM_size_icon, DM_size_icon_small, DM_size_device,
58 DM_size_workspace, DM_offset_workspace, DM_size_device_mm, DM_device_dpi, 58 DM_size_workspace, DM_size_device_mm, DM_device_dpi, DM_num_bit_planes,
59 DM_num_bit_planes, DM_num_color_cells, DM_mouse_buttons, DM_swap_buttons, 59 DM_num_color_cells, DM_mouse_buttons, DM_swap_buttons, DM_show_sounds,
60 DM_show_sounds, DM_slow_device, DM_security 60 DM_slow_device, DM_security
61 }; 61 };
62
63 extern const struct struct_description cted_description;
64 extern const struct struct_description console_methods_description;
65 62
66 struct console_methods 63 struct console_methods
67 { 64 {
68 const char *name; /* Used by print_console, print_device, print_frame */ 65 CONST char *name; /* Used by print_console, print_device, print_frame */
69 Lisp_Object symbol; 66 Lisp_Object symbol;
70 Lisp_Object predicate_symbol; 67 Lisp_Object predicate_symbol;
71 68
72 /* console methods */ 69 /* console methods */
73 void (*init_console_method) (struct console *, Lisp_Object props); 70 void (*init_console_method) (struct console *, Lisp_Object props);
74 void (*mark_console_method) (struct console *); 71 void (*mark_console_method) (struct console *, void (*)(Lisp_Object));
75 int (*initially_selected_for_input_method) (struct console *); 72 int (*initially_selected_for_input_method) (struct console *);
76 void (*delete_console_method) (struct console *); 73 void (*delete_console_method) (struct console *);
77 Lisp_Object (*semi_canonicalize_console_connection_method) 74 Lisp_Object (*semi_canonicalize_console_connection_method)
78 (Lisp_Object connection, Error_behavior errb); 75 (Lisp_Object connection, Error_behavior errb);
79 Lisp_Object (*semi_canonicalize_device_connection_method) 76 Lisp_Object (*semi_canonicalize_device_connection_method)
87 84
88 /* device methods */ 85 /* device methods */
89 void (*init_device_method) (struct device *, Lisp_Object props); 86 void (*init_device_method) (struct device *, Lisp_Object props);
90 void (*finish_init_device_method) (struct device *, Lisp_Object props); 87 void (*finish_init_device_method) (struct device *, Lisp_Object props);
91 void (*delete_device_method) (struct device *); 88 void (*delete_device_method) (struct device *);
92 void (*mark_device_method) (struct device *); 89 void (*mark_device_method) (struct device *, void (*)(Lisp_Object));
93 void (*asynch_device_change_method) (void); 90 void (*asynch_device_change_method) (void);
94 Lisp_Object (*device_system_metrics_method) (struct device *, 91 Lisp_Object (*device_system_metrics_method) (struct device *, enum device_metrics);
95 enum device_metrics);
96 unsigned int (*device_implementation_flags_method) (void); 92 unsigned int (*device_implementation_flags_method) (void);
97 Lisp_Object (*own_selection_method)(Lisp_Object selection_name,
98 Lisp_Object selection_value,
99 Lisp_Object how_to_add,
100 Lisp_Object selection_type);
101 void (*disown_selection_method)(Lisp_Object selection_name,
102 Lisp_Object timeval);
103 Lisp_Object (*get_foreign_selection_method) (Lisp_Object selection_symbol,
104 Lisp_Object target_type);
105 Lisp_Object (*selection_exists_p_method)(Lisp_Object selection_name,
106 Lisp_Object selection_type);
107 Lisp_Object (*available_selection_types_method)(Lisp_Object selection_name);
108 Lisp_Object (*register_selection_data_type_method)(Lisp_Object type_name);
109 Lisp_Object (*selection_data_type_name_method)(Lisp_Object type);
110 93
111 /* frame methods */ 94 /* frame methods */
112 Lisp_Object *device_specific_frame_props; 95 Lisp_Object *device_specific_frame_props;
113 void (*init_frame_1_method) (struct frame *, Lisp_Object properties); 96 void (*init_frame_1_method) (struct frame *, Lisp_Object properties);
114 void (*init_frame_2_method) (struct frame *, Lisp_Object properties); 97 void (*init_frame_2_method) (struct frame *, Lisp_Object properties);
115 void (*init_frame_3_method) (struct frame *); 98 void (*init_frame_3_method) (struct frame *);
116 void (*after_init_frame_method) (struct frame *, int first_on_device, 99 void (*after_init_frame_method) (struct frame *, int first_on_device,
117 int first_on_console); 100 int first_on_console);
118 void (*mark_frame_method) (struct frame *); 101 void (*mark_frame_method) (struct frame *, void (*)(Lisp_Object));
119 void (*delete_frame_method) (struct frame *); 102 void (*delete_frame_method) (struct frame *);
120 void (*focus_on_frame_method) (struct frame *); 103 void (*focus_on_frame_method) (struct frame *);
121 void (*raise_frame_method) (struct frame *); 104 void (*raise_frame_method) (struct frame *);
122 void (*lower_frame_method) (struct frame *); 105 void (*lower_frame_method) (struct frame *);
123 int (*get_mouse_position_method) (struct device *d, Lisp_Object *frame, 106 int (*get_mouse_position_method) (struct device *d, Lisp_Object *frame,
142 void (*set_frame_icon_method) (struct frame *f); 125 void (*set_frame_icon_method) (struct frame *f);
143 void (*popup_menu_method) (Lisp_Object menu, Lisp_Object event); 126 void (*popup_menu_method) (Lisp_Object menu, Lisp_Object event);
144 Lisp_Object (*get_frame_parent_method) (struct frame *f); 127 Lisp_Object (*get_frame_parent_method) (struct frame *f);
145 void (*update_frame_external_traits_method) (struct frame *f, Lisp_Object name); 128 void (*update_frame_external_traits_method) (struct frame *f, Lisp_Object name);
146 int (*frame_size_fixed_p_method) (struct frame *f); 129 int (*frame_size_fixed_p_method) (struct frame *f);
147 void (*eject_page_method) (struct frame *f);
148 130
149 /* redisplay methods */ 131 /* redisplay methods */
150 int (*left_margin_width_method) (struct window *); 132 int (*left_margin_width_method) (struct window *);
151 int (*right_margin_width_method) (struct window *); 133 int (*right_margin_width_method) (struct window *);
152 int (*text_width_method) (struct frame *f, struct face_cachel *cachel, 134 int (*text_width_method) (struct frame *f, struct face_cachel *cachel,
153 const Emchar *str, Charcount len); 135 CONST Emchar *str, Charcount len);
154 void (*output_display_block_method) (struct window *, struct display_line *, 136 void (*output_display_block_method) (struct window *, struct display_line *,
155 int, int, int, int, int, int, int); 137 int, int, int, int, int, int, int);
156 int (*divider_height_method) (void); 138 int (*divider_height_method) (void);
157 int (*eol_cursor_width_method) (void); 139 int (*eol_cursor_width_method) (void);
158 void (*output_vertical_divider_method) (struct window *, int); 140 void (*output_vertical_divider_method) (struct window *, int);
159 void (*clear_to_window_end_method) (struct window *, int, int); 141 void (*clear_to_window_end_method) (struct window *, int, int);
160 void (*clear_region_method) (Lisp_Object, struct device*, struct frame*, face_index, 142 void (*clear_region_method) (Lisp_Object, struct device*, struct frame*, face_index,
161 int, int, int, int, 143 int, int, int, int,
162 Lisp_Object, Lisp_Object, Lisp_Object); 144 Lisp_Object, Lisp_Object, Lisp_Object);
163 void (*clear_frame_method) (struct frame *); 145 void (*clear_frame_method) (struct frame *);
164 void (*window_output_begin_method) (struct window *); 146 void (*output_begin_method) (struct device *);
165 void (*frame_output_begin_method) (struct frame *); 147 void (*output_end_method) (struct device *);
166 void (*window_output_end_method) (struct window *);
167 void (*frame_output_end_method) (struct frame *);
168 int (*flash_method) (struct device *); 148 int (*flash_method) (struct device *);
169 void (*ring_bell_method) (struct device *, int volume, int pitch, 149 void (*ring_bell_method) (struct device *, int volume, int pitch,
170 int duration); 150 int duration);
171 void (*frame_redraw_cursor_method) (struct frame *f); 151 void (*frame_redraw_cursor_method) (struct frame *f);
172 void (*set_final_cursor_coords_method) (struct frame *, int, int); 152 void (*set_final_cursor_coords_method) (struct frame *, int, int);
173 void (*bevel_area_method) (struct window *, face_index, int, int, int, int, int, 153
174 int, enum edge_style);
175 void (*output_pixmap_method) (struct window *w, Lisp_Object image_instance,
176 struct display_box *db, struct display_glyph_area *dga,
177 face_index findex, int cursor_start, int cursor_width,
178 int cursor_height, int offset_bitmap);
179 void (*output_string_method) (struct window *w, struct display_line *dl,
180 Emchar_dynarr *buf, int xpos, int xoffset,
181 int start_pixpos, int width, face_index findex,
182 int cursor, int cursor_start, int cursor_width,
183 int cursor_height);
184 /* color methods */ 154 /* color methods */
185 int (*initialize_color_instance_method) (Lisp_Color_Instance *, 155 int (*initialize_color_instance_method) (struct Lisp_Color_Instance *,
186 Lisp_Object name, 156 Lisp_Object name,
187 Lisp_Object device, 157 Lisp_Object device,
188 Error_behavior errb); 158 Error_behavior errb);
189 void (*mark_color_instance_method) (Lisp_Color_Instance *); 159 void (*mark_color_instance_method) (struct Lisp_Color_Instance *,
190 void (*print_color_instance_method) (Lisp_Color_Instance *, 160 void (*)(Lisp_Object));
161 void (*print_color_instance_method) (struct Lisp_Color_Instance *,
191 Lisp_Object printcharfun, 162 Lisp_Object printcharfun,
192 int escapeflag); 163 int escapeflag);
193 void (*finalize_color_instance_method) (Lisp_Color_Instance *); 164 void (*finalize_color_instance_method) (struct Lisp_Color_Instance *);
194 int (*color_instance_equal_method) (Lisp_Color_Instance *, 165 int (*color_instance_equal_method) (struct Lisp_Color_Instance *,
195 Lisp_Color_Instance *, 166 struct Lisp_Color_Instance *,
196 int depth); 167 int depth);
197 unsigned long (*color_instance_hash_method) (Lisp_Color_Instance *, 168 unsigned long (*color_instance_hash_method) (struct Lisp_Color_Instance *,
198 int depth); 169 int depth);
199 Lisp_Object (*color_instance_rgb_components_method) (Lisp_Color_Instance *); 170 Lisp_Object (*color_instance_rgb_components_method)
171 (struct Lisp_Color_Instance *);
200 int (*valid_color_name_p_method) (struct device *, Lisp_Object color); 172 int (*valid_color_name_p_method) (struct device *, Lisp_Object color);
201 173
202 /* font methods */ 174 /* font methods */
203 int (*initialize_font_instance_method) (Lisp_Font_Instance *, 175 int (*initialize_font_instance_method) (struct Lisp_Font_Instance *,
204 Lisp_Object name, 176 Lisp_Object name,
205 Lisp_Object device, 177 Lisp_Object device,
206 Error_behavior errb); 178 Error_behavior errb);
207 void (*mark_font_instance_method) (Lisp_Font_Instance *); 179 void (*mark_font_instance_method) (struct Lisp_Font_Instance *,
208 void (*print_font_instance_method) (Lisp_Font_Instance *, 180 void (*)(Lisp_Object));
181 void (*print_font_instance_method) (struct Lisp_Font_Instance *,
209 Lisp_Object printcharfun, 182 Lisp_Object printcharfun,
210 int escapeflag); 183 int escapeflag);
211 void (*finalize_font_instance_method) (Lisp_Font_Instance *); 184 void (*finalize_font_instance_method) (struct Lisp_Font_Instance *);
212 Lisp_Object (*font_instance_truename_method) (Lisp_Font_Instance *, 185 Lisp_Object (*font_instance_truename_method) (struct Lisp_Font_Instance *,
213 Error_behavior errb); 186 Error_behavior errb);
214 Lisp_Object (*font_instance_properties_method) (Lisp_Font_Instance *); 187 Lisp_Object (*font_instance_properties_method) (struct Lisp_Font_Instance *);
215 Lisp_Object (*list_fonts_method) (Lisp_Object pattern, 188 Lisp_Object (*list_fonts_method) (Lisp_Object pattern,
216 Lisp_Object device); 189 Lisp_Object device);
217 Lisp_Object (*find_charset_font_method) (Lisp_Object device, 190 Lisp_Object (*find_charset_font_method) (Lisp_Object device,
218 Lisp_Object font, 191 Lisp_Object font,
219 Lisp_Object charset); 192 Lisp_Object charset);
220 int (*font_spec_matches_charset_method) (struct device *d, 193 int (*font_spec_matches_charset_method) (struct device *d,
221 Lisp_Object charset, 194 Lisp_Object charset,
222 const Bufbyte *nonreloc, 195 CONST Bufbyte *nonreloc,
223 Lisp_Object reloc, 196 Lisp_Object reloc,
224 Bytecount offset, 197 Bytecount offset,
225 Bytecount length); 198 Bytecount length);
226 199
227 /* image methods */ 200 /* image methods */
228 void (*mark_image_instance_method) (Lisp_Image_Instance *); 201 void (*mark_image_instance_method) (struct Lisp_Image_Instance *,
229 void (*print_image_instance_method) (Lisp_Image_Instance *, 202 void (*)(Lisp_Object));
203 void (*print_image_instance_method) (struct Lisp_Image_Instance *,
230 Lisp_Object printcharfun, 204 Lisp_Object printcharfun,
231 int escapeflag); 205 int escapeflag);
232 void (*finalize_image_instance_method) (Lisp_Image_Instance *); 206 void (*finalize_image_instance_method) (struct Lisp_Image_Instance *);
233 void (*unmap_subwindow_method) (Lisp_Image_Instance *); 207 void (*unmap_subwindow_method) (struct Lisp_Image_Instance *);
234 void (*map_subwindow_method) (Lisp_Image_Instance *, int x, int y, 208 void (*map_subwindow_method) (struct Lisp_Image_Instance *, int x, int y);
235 struct display_glyph_area* dga); 209 void (*resize_subwindow_method) (struct Lisp_Image_Instance *, int w, int h);
236 void (*resize_subwindow_method) (Lisp_Image_Instance *, int w, int h); 210 void (*update_subwindow_method) (struct Lisp_Image_Instance *);
237 void (*update_subwindow_method) (Lisp_Image_Instance *); 211 int (*image_instance_equal_method) (struct Lisp_Image_Instance *,
238 void (*update_widget_method) (Lisp_Image_Instance *); 212 struct Lisp_Image_Instance *,
239 int (*image_instance_equal_method) (Lisp_Image_Instance *,
240 Lisp_Image_Instance *,
241 int depth); 213 int depth);
242 unsigned long (*image_instance_hash_method) (Lisp_Image_Instance *, 214 unsigned long (*image_instance_hash_method) (struct Lisp_Image_Instance *,
243 int depth); 215 int depth);
244 void (*init_image_instance_from_eimage_method) (Lisp_Image_Instance *ii, 216 void (*init_image_instance_from_eimage_method) (struct Lisp_Image_Instance *ii,
245 int width, int height, 217 int width, int height,
246 int slices,
247 unsigned char *eimage, 218 unsigned char *eimage,
248 int dest_mask, 219 int dest_mask,
249 Lisp_Object instantiator, 220 Lisp_Object instantiator,
250 Lisp_Object domain); 221 Lisp_Object domain);
251 Lisp_Object (*locate_pixmap_file_method) (Lisp_Object file_method); 222 Lisp_Object (*locate_pixmap_file_method) (Lisp_Object file_method);
299 }; 270 };
300 271
301 /* 272 /*
302 * Constants returned by device_implementation_flags_method 273 * Constants returned by device_implementation_flags_method
303 */ 274 */
304
305 /* Set when device uses pixel-based geometry */ 275 /* Set when device uses pixel-based geometry */
306 #define XDEVIMPF_PIXEL_GEOMETRY 0x00000001L 276 #define XDEVIMPF_PIXEL_GEOMETRY 0x00000001L
307
308 /* Indicates that the device is a printer */
309 #define XDEVIMPF_IS_A_PRINTER 0x00000002L
310
311 /* Do not automatically redisplay this device */
312 #define XDEVIMPF_NO_AUTO_REDISPLAY 0x00000004L
313
314 /* Do not delete the device when last frame's gone */
315 #define XDEVIMPF_FRAMELESS_OK 0x00000008L
316 277
317 278
318 #define CONSOLE_TYPE_NAME(c) ((c)->conmeths->name) 279 #define CONSOLE_TYPE_NAME(c) ((c)->conmeths->name)
319 #define CONSOLE_TYPE(c) ((c)->conmeths->symbol) 280 #define CONSOLE_TYPE(c) ((c)->conmeths->symbol)
320 #define CONMETH_TYPE(meths) ((meths)->symbol) 281 #define CONMETH_TYPE(meths) ((meths)->symbol)
377 338
378 #define INITIALIZE_CONSOLE_TYPE(type, obj_name, pred_sym) do { \ 339 #define INITIALIZE_CONSOLE_TYPE(type, obj_name, pred_sym) do { \
379 type##_console_methods = xnew_and_zero (struct console_methods); \ 340 type##_console_methods = xnew_and_zero (struct console_methods); \
380 type##_console_methods->name = obj_name; \ 341 type##_console_methods->name = obj_name; \
381 type##_console_methods->symbol = Q##type; \ 342 type##_console_methods->symbol = Q##type; \
382 defsymbol_nodump (&type##_console_methods->predicate_symbol, pred_sym); \ 343 defsymbol (&type##_console_methods->predicate_symbol, pred_sym); \
383 add_entry_to_console_type_list (Q##type, type##_console_methods); \ 344 add_entry_to_console_type_list (Q##type, type##_console_methods); \
384 type##_console_methods->image_conversion_list = Qnil; \ 345 type##_console_methods->image_conversion_list = Qnil; \
385 staticpro_nodump (&type##_console_methods->image_conversion_list); \ 346 staticpro (&type##_console_methods->image_conversion_list); \
386 dumpstruct (&type##_console_methods, &console_methods_description); \
387 } while (0) 347 } while (0)
388
389 #define REINITIALIZE_CONSOLE_TYPE(type) do { \
390 staticpro_nodump (&type##_console_methods->predicate_symbol); \
391 staticpro_nodump (&type##_console_methods->image_conversion_list); \
392 } while (0)
393
394 348
395 /* Declare that console-type TYPE has method M; used in 349 /* Declare that console-type TYPE has method M; used in
396 initialization routines */ 350 initialization routines */
397 #define CONSOLE_HAS_METHOD(type, m) \ 351 #define CONSOLE_HAS_METHOD(type, m) \
398 (type##_console_methods->m##_method = type##_##m) 352 (type##_console_methods->m##_method = type##_##m)
399
400 /* Declare that console-type TYPE inherits method M
401 implementation from console-type FROMTYPE */
402 #define CONSOLE_INHERITS_METHOD(type, fromtype, m) \
403 (type##_console_methods->m##_method = fromtype##_##m)
404 353
405 struct console 354 struct console
406 { 355 {
407 struct lcrecord_header header; 356 struct lcrecord_header header;
408 357
445 394
446 DECLARE_LRECORD (console, struct console); 395 DECLARE_LRECORD (console, struct console);
447 #define XCONSOLE(x) XRECORD (x, console, struct console) 396 #define XCONSOLE(x) XRECORD (x, console, struct console)
448 #define XSETCONSOLE(x, p) XSETRECORD (x, p, console) 397 #define XSETCONSOLE(x, p) XSETRECORD (x, p, console)
449 #define CONSOLEP(x) RECORDP (x, console) 398 #define CONSOLEP(x) RECORDP (x, console)
399 #define GC_CONSOLEP(x) GC_RECORDP (x, console)
450 #define CHECK_CONSOLE(x) CHECK_RECORD (x, console) 400 #define CHECK_CONSOLE(x) CHECK_RECORD (x, console)
451 #define CONCHECK_CONSOLE(x) CONCHECK_RECORD (x, console) 401 #define CONCHECK_CONSOLE(x) CONCHECK_RECORD (x, console)
452 402
453 #define CHECK_LIVE_CONSOLE(x) do { \ 403 #define CHECK_LIVE_CONSOLE(x) do { \
454 CHECK_CONSOLE (x); \ 404 CHECK_CONSOLE (x); \
462 } while (0) 412 } while (0)
463 413
464 #define CONSOLE_TYPE_P(con, type) EQ (CONSOLE_TYPE (con), Q##type) 414 #define CONSOLE_TYPE_P(con, type) EQ (CONSOLE_TYPE (con), Q##type)
465 415
466 #ifdef ERROR_CHECK_TYPECHECK 416 #ifdef ERROR_CHECK_TYPECHECK
467 INLINE_HEADER struct console * 417 INLINE struct console *
468 error_check_console_type (struct console *con, Lisp_Object sym); 418 error_check_console_type (struct console *con, Lisp_Object sym);
469 INLINE_HEADER struct console * 419 INLINE struct console *
470 error_check_console_type (struct console *con, Lisp_Object sym) 420 error_check_console_type (struct console *con, Lisp_Object sym)
471 { 421 {
472 assert (EQ (CONSOLE_TYPE (con), sym)); 422 assert (EQ (CONSOLE_TYPE (con), sym));
473 return con; 423 return con;
474 } 424 }
601 int from_kill_emacs, int from_io_error); 551 int from_kill_emacs, int from_io_error);
602 void io_error_delete_console (Lisp_Object console); 552 void io_error_delete_console (Lisp_Object console);
603 void set_console_last_nonminibuf_frame (struct console *con, 553 void set_console_last_nonminibuf_frame (struct console *con,
604 Lisp_Object frame); 554 Lisp_Object frame);
605 555
606 #endif /* INCLUDED_console_h_ */ 556 #endif /* _XEMACS_CONSOLE_H_ */