comparison src/console.h @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 7d59cb494b73
children 2f8bb876ab1d
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
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 _XEMACS_CONSOLE_H_ 25 #ifndef INCLUDED_console_h_
26 #define _XEMACS_CONSOLE_H_ 26 #define INCLUDED_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_size_device_mm, DM_device_dpi, DM_num_bit_planes, 58 DM_size_workspace, DM_offset_workspace, DM_size_device_mm, DM_device_dpi,
59 DM_num_color_cells, DM_mouse_buttons, DM_swap_buttons, DM_show_sounds, 59 DM_num_bit_planes, DM_num_color_cells, DM_mouse_buttons, DM_swap_buttons,
60 DM_slow_device, DM_security 60 DM_show_sounds, 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;
62 65
63 struct console_methods 66 struct console_methods
64 { 67 {
65 CONST char *name; /* Used by print_console, print_device, print_frame */ 68 const char *name; /* Used by print_console, print_device, print_frame */
66 Lisp_Object symbol; 69 Lisp_Object symbol;
67 Lisp_Object predicate_symbol; 70 Lisp_Object predicate_symbol;
68 71
69 /* console methods */ 72 /* console methods */
70 void (*init_console_method) (struct console *, Lisp_Object props); 73 void (*init_console_method) (struct console *, Lisp_Object props);
71 void (*mark_console_method) (struct console *, void (*)(Lisp_Object)); 74 void (*mark_console_method) (struct console *);
72 int (*initially_selected_for_input_method) (struct console *); 75 int (*initially_selected_for_input_method) (struct console *);
73 void (*delete_console_method) (struct console *); 76 void (*delete_console_method) (struct console *);
74 Lisp_Object (*semi_canonicalize_console_connection_method) 77 Lisp_Object (*semi_canonicalize_console_connection_method)
75 (Lisp_Object connection, Error_behavior errb); 78 (Lisp_Object connection, Error_behavior errb);
76 Lisp_Object (*semi_canonicalize_device_connection_method) 79 Lisp_Object (*semi_canonicalize_device_connection_method)
84 87
85 /* device methods */ 88 /* device methods */
86 void (*init_device_method) (struct device *, Lisp_Object props); 89 void (*init_device_method) (struct device *, Lisp_Object props);
87 void (*finish_init_device_method) (struct device *, Lisp_Object props); 90 void (*finish_init_device_method) (struct device *, Lisp_Object props);
88 void (*delete_device_method) (struct device *); 91 void (*delete_device_method) (struct device *);
89 void (*mark_device_method) (struct device *, void (*)(Lisp_Object)); 92 void (*mark_device_method) (struct device *);
90 void (*asynch_device_change_method) (void); 93 void (*asynch_device_change_method) (void);
91 Lisp_Object (*device_system_metrics_method) (struct device *, enum device_metrics); 94 Lisp_Object (*device_system_metrics_method) (struct device *, enum device_metrics);
92 unsigned int (*device_implementation_flags_method) (void); 95 unsigned int (*device_implementation_flags_method) (void);
96 Lisp_Object (*own_selection_method)(Lisp_Object selection_name, Lisp_Object selection_value);
97 void (*disown_selection_method)(Lisp_Object selection_name, Lisp_Object timeval);
98 Lisp_Object (*get_foreign_selection_method) (Lisp_Object selection_symbol,
99 Lisp_Object target_type);
100 Lisp_Object (*selection_exists_p_method)(Lisp_Object selection_name);
93 101
94 /* frame methods */ 102 /* frame methods */
95 Lisp_Object *device_specific_frame_props; 103 Lisp_Object *device_specific_frame_props;
96 void (*init_frame_1_method) (struct frame *, Lisp_Object properties); 104 void (*init_frame_1_method) (struct frame *, Lisp_Object properties);
97 void (*init_frame_2_method) (struct frame *, Lisp_Object properties); 105 void (*init_frame_2_method) (struct frame *, Lisp_Object properties);
98 void (*init_frame_3_method) (struct frame *); 106 void (*init_frame_3_method) (struct frame *);
99 void (*after_init_frame_method) (struct frame *, int first_on_device, 107 void (*after_init_frame_method) (struct frame *, int first_on_device,
100 int first_on_console); 108 int first_on_console);
101 void (*mark_frame_method) (struct frame *, void (*)(Lisp_Object)); 109 void (*mark_frame_method) (struct frame *);
102 void (*delete_frame_method) (struct frame *); 110 void (*delete_frame_method) (struct frame *);
103 void (*focus_on_frame_method) (struct frame *); 111 void (*focus_on_frame_method) (struct frame *);
104 void (*raise_frame_method) (struct frame *); 112 void (*raise_frame_method) (struct frame *);
105 void (*lower_frame_method) (struct frame *); 113 void (*lower_frame_method) (struct frame *);
106 int (*get_mouse_position_method) (struct device *d, Lisp_Object *frame, 114 int (*get_mouse_position_method) (struct device *d, Lisp_Object *frame,
125 void (*set_frame_icon_method) (struct frame *f); 133 void (*set_frame_icon_method) (struct frame *f);
126 void (*popup_menu_method) (Lisp_Object menu, Lisp_Object event); 134 void (*popup_menu_method) (Lisp_Object menu, Lisp_Object event);
127 Lisp_Object (*get_frame_parent_method) (struct frame *f); 135 Lisp_Object (*get_frame_parent_method) (struct frame *f);
128 void (*update_frame_external_traits_method) (struct frame *f, Lisp_Object name); 136 void (*update_frame_external_traits_method) (struct frame *f, Lisp_Object name);
129 int (*frame_size_fixed_p_method) (struct frame *f); 137 int (*frame_size_fixed_p_method) (struct frame *f);
138 void (*eject_page_method) (struct frame *f);
130 139
131 /* redisplay methods */ 140 /* redisplay methods */
132 int (*left_margin_width_method) (struct window *); 141 int (*left_margin_width_method) (struct window *);
133 int (*right_margin_width_method) (struct window *); 142 int (*right_margin_width_method) (struct window *);
134 int (*text_width_method) (struct frame *f, struct face_cachel *cachel, 143 int (*text_width_method) (struct frame *f, struct face_cachel *cachel,
135 CONST Emchar *str, Charcount len); 144 const Emchar *str, Charcount len);
136 void (*output_display_block_method) (struct window *, struct display_line *, 145 void (*output_display_block_method) (struct window *, struct display_line *,
137 int, int, int, int, int, int, int); 146 int, int, int, int, int, int, int);
138 int (*divider_height_method) (void); 147 int (*divider_height_method) (void);
139 int (*eol_cursor_width_method) (void); 148 int (*eol_cursor_width_method) (void);
140 void (*output_vertical_divider_method) (struct window *, int); 149 void (*output_vertical_divider_method) (struct window *, int);
148 int (*flash_method) (struct device *); 157 int (*flash_method) (struct device *);
149 void (*ring_bell_method) (struct device *, int volume, int pitch, 158 void (*ring_bell_method) (struct device *, int volume, int pitch,
150 int duration); 159 int duration);
151 void (*frame_redraw_cursor_method) (struct frame *f); 160 void (*frame_redraw_cursor_method) (struct frame *f);
152 void (*set_final_cursor_coords_method) (struct frame *, int, int); 161 void (*set_final_cursor_coords_method) (struct frame *, int, int);
153 162 void (*bevel_area_method) (struct window *, face_index, int, int, int, int, int,
163 int, enum edge_style);
164 void (*output_pixmap_method) (struct window *w, Lisp_Object image_instance,
165 struct display_box *db, struct display_glyph_area *dga,
166 face_index findex, int cursor_start, int cursor_width,
167 int cursor_height, int offset_bitmap);
168 void (*output_string_method) (struct window *w, struct display_line *dl,
169 Emchar_dynarr *buf, int xpos, int xoffset,
170 int start_pixpos, int width, face_index findex,
171 int cursor, int cursor_start, int cursor_width,
172 int cursor_height);
154 /* color methods */ 173 /* color methods */
155 int (*initialize_color_instance_method) (struct Lisp_Color_Instance *, 174 int (*initialize_color_instance_method) (Lisp_Color_Instance *,
156 Lisp_Object name, 175 Lisp_Object name,
157 Lisp_Object device, 176 Lisp_Object device,
158 Error_behavior errb); 177 Error_behavior errb);
159 void (*mark_color_instance_method) (struct Lisp_Color_Instance *, 178 void (*mark_color_instance_method) (Lisp_Color_Instance *);
160 void (*)(Lisp_Object)); 179 void (*print_color_instance_method) (Lisp_Color_Instance *,
161 void (*print_color_instance_method) (struct Lisp_Color_Instance *,
162 Lisp_Object printcharfun, 180 Lisp_Object printcharfun,
163 int escapeflag); 181 int escapeflag);
164 void (*finalize_color_instance_method) (struct Lisp_Color_Instance *); 182 void (*finalize_color_instance_method) (Lisp_Color_Instance *);
165 int (*color_instance_equal_method) (struct Lisp_Color_Instance *, 183 int (*color_instance_equal_method) (Lisp_Color_Instance *,
166 struct Lisp_Color_Instance *, 184 Lisp_Color_Instance *,
167 int depth); 185 int depth);
168 unsigned long (*color_instance_hash_method) (struct Lisp_Color_Instance *, 186 unsigned long (*color_instance_hash_method) (Lisp_Color_Instance *,
169 int depth); 187 int depth);
170 Lisp_Object (*color_instance_rgb_components_method) 188 Lisp_Object (*color_instance_rgb_components_method) (Lisp_Color_Instance *);
171 (struct Lisp_Color_Instance *);
172 int (*valid_color_name_p_method) (struct device *, Lisp_Object color); 189 int (*valid_color_name_p_method) (struct device *, Lisp_Object color);
173 190
174 /* font methods */ 191 /* font methods */
175 int (*initialize_font_instance_method) (struct Lisp_Font_Instance *, 192 int (*initialize_font_instance_method) (Lisp_Font_Instance *,
176 Lisp_Object name, 193 Lisp_Object name,
177 Lisp_Object device, 194 Lisp_Object device,
178 Error_behavior errb); 195 Error_behavior errb);
179 void (*mark_font_instance_method) (struct Lisp_Font_Instance *, 196 void (*mark_font_instance_method) (Lisp_Font_Instance *);
180 void (*)(Lisp_Object)); 197 void (*print_font_instance_method) (Lisp_Font_Instance *,
181 void (*print_font_instance_method) (struct Lisp_Font_Instance *,
182 Lisp_Object printcharfun, 198 Lisp_Object printcharfun,
183 int escapeflag); 199 int escapeflag);
184 void (*finalize_font_instance_method) (struct Lisp_Font_Instance *); 200 void (*finalize_font_instance_method) (Lisp_Font_Instance *);
185 Lisp_Object (*font_instance_truename_method) (struct Lisp_Font_Instance *, 201 Lisp_Object (*font_instance_truename_method) (Lisp_Font_Instance *,
186 Error_behavior errb); 202 Error_behavior errb);
187 Lisp_Object (*font_instance_properties_method) (struct Lisp_Font_Instance *); 203 Lisp_Object (*font_instance_properties_method) (Lisp_Font_Instance *);
188 Lisp_Object (*list_fonts_method) (Lisp_Object pattern, 204 Lisp_Object (*list_fonts_method) (Lisp_Object pattern,
189 Lisp_Object device); 205 Lisp_Object device);
190 Lisp_Object (*find_charset_font_method) (Lisp_Object device, 206 Lisp_Object (*find_charset_font_method) (Lisp_Object device,
191 Lisp_Object font, 207 Lisp_Object font,
192 Lisp_Object charset); 208 Lisp_Object charset);
193 int (*font_spec_matches_charset_method) (struct device *d, 209 int (*font_spec_matches_charset_method) (struct device *d,
194 Lisp_Object charset, 210 Lisp_Object charset,
195 CONST Bufbyte *nonreloc, 211 const Bufbyte *nonreloc,
196 Lisp_Object reloc, 212 Lisp_Object reloc,
197 Bytecount offset, 213 Bytecount offset,
198 Bytecount length); 214 Bytecount length);
199 215
200 /* image methods */ 216 /* image methods */
201 void (*mark_image_instance_method) (struct Lisp_Image_Instance *, 217 void (*mark_image_instance_method) (Lisp_Image_Instance *);
202 void (*)(Lisp_Object)); 218 void (*print_image_instance_method) (Lisp_Image_Instance *,
203 void (*print_image_instance_method) (struct Lisp_Image_Instance *,
204 Lisp_Object printcharfun, 219 Lisp_Object printcharfun,
205 int escapeflag); 220 int escapeflag);
206 void (*finalize_image_instance_method) (struct Lisp_Image_Instance *); 221 void (*finalize_image_instance_method) (Lisp_Image_Instance *);
207 void (*unmap_subwindow_method) (struct Lisp_Image_Instance *); 222 void (*unmap_subwindow_method) (Lisp_Image_Instance *);
208 void (*map_subwindow_method) (struct Lisp_Image_Instance *, int x, int y); 223 void (*map_subwindow_method) (Lisp_Image_Instance *, int x, int y,
209 void (*resize_subwindow_method) (struct Lisp_Image_Instance *, int w, int h); 224 struct display_glyph_area* dga);
210 void (*update_subwindow_method) (struct Lisp_Image_Instance *); 225 void (*resize_subwindow_method) (Lisp_Image_Instance *, int w, int h);
211 int (*image_instance_equal_method) (struct Lisp_Image_Instance *, 226 void (*update_subwindow_method) (Lisp_Image_Instance *);
212 struct Lisp_Image_Instance *, 227 void (*update_widget_method) (Lisp_Image_Instance *);
228 int (*image_instance_equal_method) (Lisp_Image_Instance *,
229 Lisp_Image_Instance *,
213 int depth); 230 int depth);
214 unsigned long (*image_instance_hash_method) (struct Lisp_Image_Instance *, 231 unsigned long (*image_instance_hash_method) (Lisp_Image_Instance *,
215 int depth); 232 int depth);
216 void (*init_image_instance_from_eimage_method) (struct Lisp_Image_Instance *ii, 233 void (*init_image_instance_from_eimage_method) (Lisp_Image_Instance *ii,
217 int width, int height, 234 int width, int height,
235 int slices,
218 unsigned char *eimage, 236 unsigned char *eimage,
219 int dest_mask, 237 int dest_mask,
220 Lisp_Object instantiator, 238 Lisp_Object instantiator,
221 Lisp_Object domain); 239 Lisp_Object domain);
222 Lisp_Object (*locate_pixmap_file_method) (Lisp_Object file_method); 240 Lisp_Object (*locate_pixmap_file_method) (Lisp_Object file_method);
270 }; 288 };
271 289
272 /* 290 /*
273 * Constants returned by device_implementation_flags_method 291 * Constants returned by device_implementation_flags_method
274 */ 292 */
293
275 /* Set when device uses pixel-based geometry */ 294 /* Set when device uses pixel-based geometry */
276 #define XDEVIMPF_PIXEL_GEOMETRY 0x00000001L 295 #define XDEVIMPF_PIXEL_GEOMETRY 0x00000001L
296
297 /* Indicates that the device is a printer */
298 #define XDEVIMPF_IS_A_PRINTER 0x00000002L
299
300 /* Do not automatically redisplay this device */
301 #define XDEVIMPF_NO_AUTO_REDISPLAY 0x00000004L
302
303 /* Do not delete the device when last frame's gone */
304 #define XDEVIMPF_FRAMELESS_OK 0x00000008L
277 305
278 306
279 #define CONSOLE_TYPE_NAME(c) ((c)->conmeths->name) 307 #define CONSOLE_TYPE_NAME(c) ((c)->conmeths->name)
280 #define CONSOLE_TYPE(c) ((c)->conmeths->symbol) 308 #define CONSOLE_TYPE(c) ((c)->conmeths->symbol)
281 #define CONMETH_TYPE(meths) ((meths)->symbol) 309 #define CONMETH_TYPE(meths) ((meths)->symbol)
338 366
339 #define INITIALIZE_CONSOLE_TYPE(type, obj_name, pred_sym) do { \ 367 #define INITIALIZE_CONSOLE_TYPE(type, obj_name, pred_sym) do { \
340 type##_console_methods = xnew_and_zero (struct console_methods); \ 368 type##_console_methods = xnew_and_zero (struct console_methods); \
341 type##_console_methods->name = obj_name; \ 369 type##_console_methods->name = obj_name; \
342 type##_console_methods->symbol = Q##type; \ 370 type##_console_methods->symbol = Q##type; \
343 defsymbol (&type##_console_methods->predicate_symbol, pred_sym); \ 371 defsymbol_nodump (&type##_console_methods->predicate_symbol, pred_sym); \
344 add_entry_to_console_type_list (Q##type, type##_console_methods); \ 372 add_entry_to_console_type_list (Q##type, type##_console_methods); \
345 type##_console_methods->image_conversion_list = Qnil; \ 373 type##_console_methods->image_conversion_list = Qnil; \
346 staticpro (&type##_console_methods->image_conversion_list); \ 374 staticpro_nodump (&type##_console_methods->image_conversion_list); \
347 } while (0) 375 dumpstruct (&type##_console_methods, &console_methods_description); \
376 } while (0)
377
378 #define REINITIALIZE_CONSOLE_TYPE(type) do { \
379 staticpro_nodump (&type##_console_methods->predicate_symbol); \
380 staticpro_nodump (&type##_console_methods->image_conversion_list); \
381 } while (0)
382
348 383
349 /* Declare that console-type TYPE has method M; used in 384 /* Declare that console-type TYPE has method M; used in
350 initialization routines */ 385 initialization routines */
351 #define CONSOLE_HAS_METHOD(type, m) \ 386 #define CONSOLE_HAS_METHOD(type, m) \
352 (type##_console_methods->m##_method = type##_##m) 387 (type##_console_methods->m##_method = type##_##m)
388
389 /* Declare that console-type TYPE inherits method M
390 implementation from console-type FROMTYPE */
391 #define CONSOLE_INHERITS_METHOD(type, fromtype, m) \
392 (type##_console_methods->m##_method = fromtype##_##m)
353 393
354 struct console 394 struct console
355 { 395 {
356 struct lcrecord_header header; 396 struct lcrecord_header header;
357 397
394 434
395 DECLARE_LRECORD (console, struct console); 435 DECLARE_LRECORD (console, struct console);
396 #define XCONSOLE(x) XRECORD (x, console, struct console) 436 #define XCONSOLE(x) XRECORD (x, console, struct console)
397 #define XSETCONSOLE(x, p) XSETRECORD (x, p, console) 437 #define XSETCONSOLE(x, p) XSETRECORD (x, p, console)
398 #define CONSOLEP(x) RECORDP (x, console) 438 #define CONSOLEP(x) RECORDP (x, console)
399 #define GC_CONSOLEP(x) GC_RECORDP (x, console)
400 #define CHECK_CONSOLE(x) CHECK_RECORD (x, console) 439 #define CHECK_CONSOLE(x) CHECK_RECORD (x, console)
401 #define CONCHECK_CONSOLE(x) CONCHECK_RECORD (x, console) 440 #define CONCHECK_CONSOLE(x) CONCHECK_RECORD (x, console)
402 441
403 #define CHECK_LIVE_CONSOLE(x) do { \ 442 #define CHECK_LIVE_CONSOLE(x) do { \
404 CHECK_CONSOLE (x); \ 443 CHECK_CONSOLE (x); \
551 int from_kill_emacs, int from_io_error); 590 int from_kill_emacs, int from_io_error);
552 void io_error_delete_console (Lisp_Object console); 591 void io_error_delete_console (Lisp_Object console);
553 void set_console_last_nonminibuf_frame (struct console *con, 592 void set_console_last_nonminibuf_frame (struct console *con,
554 Lisp_Object frame); 593 Lisp_Object frame);
555 594
556 #endif /* _XEMACS_CONSOLE_H_ */ 595 #endif /* INCLUDED_console_h_ */